Skip to content

Commit

Permalink
Site redesign, mostly happy with it so far.
Browse files Browse the repository at this point in the history
  • Loading branch information
zk committed Oct 13, 2010
1 parent 0087a95 commit 06f1862
Show file tree
Hide file tree
Showing 21 changed files with 275 additions and 81 deletions.
7 changes: 4 additions & 3 deletions app/controllers/main_controller.rb
Expand Up @@ -6,12 +6,13 @@ class MainController < ApplicationController

def index

num_recent = 7
num_recent = 6
num_tc = 24
@recently_updated = find_recently_updated(7, nil)
@top_contributors = []

tc_example_versions = Example.find_by_sql("select count(*), example_versions.user_id from example_versions group by user_id order by count(*) desc")[0, 10]
tc_examples = Example.find_by_sql("select count(*), examples.user_id from examples group by user_id order by count(*) desc;")[0, 10]
tc_example_versions = Example.find_by_sql("select count(*), example_versions.user_id from example_versions group by user_id order by count(*) desc")[0, num_tc]
tc_examples = Example.find_by_sql("select count(*), examples.user_id from examples group by user_id order by count(*) desc;")[0, num_tc]

tc_examples.each do |e|
count = e["count(*)"]
Expand Down
28 changes: 20 additions & 8 deletions app/views/_recently_updated.html.erb
Expand Up @@ -4,24 +4,36 @@ recently_updated.each do |u|
<% func = Function.find(u.commentable_id) %>
<div class="recent_comment">
<span class="user">
<%= link_to u.user.login, :controller => 'user', :action => 'profile', :login => u.user.login %>
</span>
<%= (u.created_at == u.updated_at) ? "commented on" : "updated a comment on" %>


<!-- <%= (u.created_at == u.updated_at) ? "commented on" : "updated a comment on" %> -->
on
<a href="<%= func.href %>"><span class="ns"><%= func.namespace.name %>/</span><span class="name"><%= func.name %></span></a>
<div class="timestamp">
by
<span class="user">
<%= link_to u.user.login, :controller => 'user', :action => 'profile', :login => u.user.login %>
</span>
<%= time_ago_or_time_stamp(u.updated_at) %>
</div>
</div>

<% elsif u.instance_of? Example and u.function_id %>
<% func = Function.find(u.function_id) %>
<div class="recent_example">
<span class="user">
<%= link_to u.user.login, :controller => 'user', :action => 'profile', :login => u.user.login %>
</span>
<%= (u.created_at == u.updated_at) ? "added an example to" : "updated an example on" %>

<!-- <%= (u.created_at == u.updated_at) ? "added an example to" : "updated an example on" %> -->
on
<a href="<%= func.href %>"><span class="ns"><%= func.namespace.name %>/</span><span class="name"><%= func.name %></span></a>
<br />
<div class="timestamp">
by
<span class="user">
<%= link_to u.user.login, :controller => 'user', :action => 'profile', :login => u.user.login %>
</span>
<%= time_ago_or_time_stamp(u.updated_at)%>
</div>
</div>

<% elsif u.instance_of? SeeAlso %>
Expand Down
32 changes: 18 additions & 14 deletions app/views/examples/view_changes.html.erb
@@ -1,18 +1,22 @@
<script type="text/javascript" charset="utf-8">
SyntaxHighlighter.all()
SyntaxHighlighter.all()
</script>
<h1>Changes for <span class="ns"><%= @example.function.namespace.name %>/</span><%= @example.function.name %></h1>
<div class="container_16">
<div class="grid_16">
<h1>Changes for <span class="ns"><%= @example.function.namespace.name %>/</span><%= @example.function.name %></h1>

<% @versions.each do |v| %>
<% if v.user_id
vuser = User.find(v.user_id)%>
<div class="version">
<div class="info">
<img src="<%= grav_url_for(vuser.email, 25) %>" />
<%= link_to vuser.login, :controller => 'user', :action => 'profile', :login => vuser.login %>
<%= time_ago_or_time_stamp((v.updated_at || v.created_at)) %>
<% @versions.each do |v| %>
<% if v.user_id
vuser = User.find(v.user_id)%>
<div class="version">
<div class="info">
<img src="<%= grav_url_for(vuser.email, 25) %>" />
<%= link_to vuser.login, :controller => 'user', :action => 'profile', :login => vuser.login %>
<%= time_ago_or_time_stamp((v.updated_at || v.created_at)) %>
</div>
<%= render :partial => "/examples/example", :locals => {:e => v, :hide_controls => true}%>
</div>
<% end %>
<% end %>
</div>
<%= render :partial => "/examples/example", :locals => {:e => v, :hide_controls => true}%>
</div>
<% end %>
<% end %>
</div>
13 changes: 7 additions & 6 deletions app/views/layouts/_header.html.erb
Expand Up @@ -34,23 +34,24 @@
<div class="header_content">
<div class="user_area">
<div class="grid_16">
<span class="user_area_content">
<% if current_user_session %>
<%= image_tag(grav_url_for(current_user.email, 16), :class => 'user_area_gravatar') %>
Logged in as <%= link_to current_user.login, :controller => 'user', :action => 'profile', :login => current_user.login %>
|
<a href="/logout">logout</a>
<% else %>
<a href="/login" id="login">login / sign up</a>
<% end%>
</span>
</div>
<div class="clear"></div>
</div>

<div class="grid_8">
<% if @library %>
<h1><a href="/">ClojureDocs</a><span class="version">(alpha)</span> :: <a class="lib_name" href="/<%= @library.url_friendly_name %>"><%= @library.name %></a></h1>
<% else %>
<div class="grid_1">
<%= image_tag "cd_logo.png", :class => 'cd_logo' %>
</div>
<div class="grid_7">
<h1><a href="/">ClojureDocs</a><span class="version">(alpha)</span></h1>
<% end %>
</div>
<div class="grid_8">
<div class="search">
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/main.html.erb
Expand Up @@ -125,9 +125,9 @@
<body>
<%= render :partial => '/layouts/header' %>
<div class="container_16">
<%= yield %>
</div>


<div class="clear"></div>
<div class="footer">
Expand Down
5 changes: 3 additions & 2 deletions app/views/main/clojure_core_shortdesc.html.erb
Expand Up @@ -13,7 +13,7 @@
})
})
</script>

<div class="container_16">
<div class="quick_ref">
<div class="grid_3">
<%= render :partial => 'lib_nav', :locals => {:lib => @library} %>
Expand Down Expand Up @@ -89,4 +89,5 @@
<!-- <div class="grid_3">
<%= render :partial => '/lib_namespaces' %>
</div> -->
</div>
</div>
<div class="container_16">
5 changes: 3 additions & 2 deletions app/views/main/clojure_core_vars_only.html.erb
Expand Up @@ -3,7 +3,7 @@
$('.toc').makeTOCSideBar()
})
</script>

<div class="container_16">
<div class="quick_ref">
<div class="grid_3">
<%= render :partial => 'lib_nav', :locals => {:lib => @library} %>
Expand Down Expand Up @@ -69,4 +69,5 @@
<div class="grid_3">
<%= render :partial => '/lib_namespaces' %>
</div>
</div>
</div>
<div class="container_16">
2 changes: 2 additions & 0 deletions app/views/main/function.html.erb
Expand Up @@ -14,6 +14,7 @@ $(document).ready(function() {
})
})
</script>
<div class="container_16">
<div class="grid_3">
<%= render :partial => 'lib_nav', :locals => {:lib => @function.namespace.library} %>
<%= render :partial => '/lib_namespaces' %>
Expand Down Expand Up @@ -299,5 +300,6 @@ $(document).ready(function() {

&nbsp;
</div>
<div class="container_16">


102 changes: 83 additions & 19 deletions app/views/main/index.html.erb
@@ -1,17 +1,23 @@
<% content_for :title, " - Community powered Clojure Documentation and Examples" %>

<div class="featured">
<div class="grid_8">
<div class="grid_8 alpha omega">
<div class="container_16">
<div class="grid_15 prefix_1 suffix_1">
<div class="overview">
<h2 style="text-align: left">ClojureDocs is a community powered documentation and examples repository for the <a href="http://clojure.org">Clojure programming language</a>.</h2>
</div>
</div>
<div class="grid_16">
<div class="grid_7 prefix_1 alpha">
<div class="core_libraries">
<h2>Core Language</h2>
<div class="library">
<h3><a href="/clojure_core">Clojure Core</a></h3>
<a href="/quickref/Clojure%20Core">Quick Reference</a><br />
<a href="http://clojure.org">http://clojure.org</a><br />
<p>Clojure is a dynamic programming language that targets the Java Virtual Machine (and the CLR).</p>
</div>
<br />
</div>
</div>
<div class="grid_7 suffix_1 omega">
<div class="core_libraries">
<div class="library">
<h3><a href="/clojure_contrib">Clojure Contrib</a></h3>
<a href="http://richhickey.github.com/clojure-contrib/">http://richhickey.github.com/clojure-contrib/</a>
Expand All @@ -20,20 +26,84 @@
</div>
</div>
<div class="clear"></div>
<br />
<h2>Top Contributors <span class="find_functions_without_examples"><a href="/management/Clojure%20Core">Find vars that need examples.</a></span></h2>
</div>
<div class="clear"></div>
<br />
<br />
</div>
<div class="other_content">
<div class="container_16">

<br />
<br />
<div class="grid_9">
<div class="welcome_message">
<h2>Getting started with ClojureDocs</h2>
<p>Finding the right tool for the job can be tough, so we&apos;ve outlined a few ways to go about your search below.</p>
<ul>
<li>Take a look at the <a href="/quickref/Clojure%20Core">Clojure Core quickref</a>, which displays Clojure vars grouped by category.</li>
<li>Browse an alphabetical list of vars defined in <a href="/clojure_core">Clojure Core</a> or <a href="/clojure_contrib">Contrib</a>.</li>
<li><a href="/search?q=reduce">Search</a> for something.</li>
</ul>
</div>

<div class="contribute">
<h2>Contribute to ClojureDocs</h2>
<p>We need your help to make ClojureDocs a great community resource. Here are a couple of ways you can contribute.</p>
<ul>
<li>
<h3>Give Feedback</h3>
<p>Our <a href="http://clojuredocs.uservoice.com">UserVoice Forum</a> allows you to give feedback publicly ('Go to our Feedback Forum') or privately ('Need help? Contact ClojureDocs').</p>
<p>We also have a <a href="http://groups.google.com/group/clojuredocsorg">Google Group</a> for announcements and discussions.</p>
</li>
<li>
<h3>Add an Example</h3>
<p></p>
</li>
</ul>
<p>The site is currently in alpha and we need your help to make it a great community resource, so please let us know if you've got any feedback on how to make this site better.</p>
</div>

</div>
<div class="grid_6 prefix_1">
<div class="top_contributors">
<h2>Top Contributors</h2>
<ul class="top_contributors">
<% @top_contributors.each do |tc| %>
<li>
<%= link_to image_tag(grav_url_for(tc[:email]), :alt => tc[:author]), :controller => 'user', :action => 'profile', :login => tc[:author] %>
</li>
<% end %>
</ul>

<div class="clear"></div>
<br />
<span class="find_functions_without_examples"><a href="/management/Clojure%20Core">Find vars that need examples.</a></span>
</div>
<%= image_tag "curly_bracket.png", :class => "curly" %>
<div class="recently_updated_panel">
<h2>Recently Updated <a href="/feed/recent_updates" alt="All recent updates RSS feed"><%= image_tag 'browser-rss.png'%></a></h2>
<%= render :partial => '/recently_updated', :locals => {:recently_updated => @recently_updated}%>
</div>
</div>
<div class="grid_8 suffix_1">

</div>
<div class="grid_1 suffix_1">
<h2 style="font-size: 160px; line-height: 180px">}</h2>
</div>

<div class="grid_7">
<div class="feedback_callout">
<h2>Have Feedback?</h2>
<ul>
<li>Use the feedback tab at the right side of the page.</li>
<li>Google Group</li>
</ul>
<p>There are a couple ways to contact us: The quickest and easiest is to use the 'Feedback' tab on the right side of any ClojureDocs page. It's linked to our <a href="http://clojuredocs.uservoice.com">UserVoice Forum</a>, and allows you to give feedback publicly ('Go to our Feedback Forum') or privately ('Need help? Contact ClojureDocs').
<p>We also have a <a href="http://groups.google.com/group/clojuredocsorg">Google Group</a> for announcements and discussions.</p>
</div>
</div>

<div class="grid_8">
<div class="news">
<h2>News</h2>
Expand All @@ -42,13 +112,7 @@
<p>Also, we&#39;ve put together an <a href="/examples_style_guide">examples style guide</a>. Please take a look before adding new examples, as following these conventions will help to keep formatting uniform across examples.</p>
</div>
</div>
<div class="welcome_message">
<h2>New to ClojureDocs?</h2>
<p>ClojureDocs is a community powered documentation and examples repository for the <a href="http://clojure.org">Clojure programming language</a>.</p>
<p>The site is currently in alpha and we need your help to make it a great community resource, so please let us know if you've got any feedback on how to make this site better.</p>
<p>There are a couple ways to contact us: The quickest and easiest is to use the 'Feedback' tab on the right side of any ClojureDocs page. It's linked to our <a href="http://clojuredocs.uservoice.com">UserVoice Forum</a>, and allows you to give feedback publicly ('Go to our Feedback Forum') or privately ('Need help? Contact ClojureDocs').
<p>We also have a <a href="http://groups.google.com/group/clojuredocsorg">Google Group</a> for announcements and discussions.</p>
</div>

<br />
<h2>Other Libs</h2>
<div class="grid_4 alpha">
Expand Down Expand Up @@ -122,7 +186,7 @@
</div>

</div>
<div class="clear"></div>
</div>

<div class="clear"></div>
<div class="clear"></div>
</div>
</div>
3 changes: 3 additions & 0 deletions app/views/main/lib.html.erb
Expand Up @@ -9,6 +9,8 @@
})
</script>

<div class="container_16">

<div class="grid_3">
<%= render :partial => 'lib_nav', :locals => {:lib => @library} %>
<%= render :partial => '/lib_namespaces' %>
Expand Down Expand Up @@ -73,4 +75,5 @@
</div>
<div class="grid_3">
&nbsp;
</div>
</div>
22 changes: 13 additions & 9 deletions app/views/main/libs.html.erb
@@ -1,11 +1,15 @@
<div class="libraries">
<% @libs.each do |l| %>
<h2>
<%= link_to l.name, :controller => 'main', :action => 'lib', :lib => l.url_friendly_name %>
</h2>
<div class="lib_link">
<a href="<%= l.site_url %>"><%= l.site_url %></a>
<p class="description"><%= l.description %></a>
<div class="container_16">
<div class="grid_16">
<div class="libraries">
<% @libs.each do |l| %>
<h2>
<%= link_to l.name, :controller => 'main', :action => 'lib', :lib => l.url_friendly_name %>
</h2>
<div class="lib_link">
<a href="<%= l.site_url %>"><%= l.site_url %></a>
<p class="description"><%= l.description %></a>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
3 changes: 2 additions & 1 deletion app/views/main/search.html.erb
Expand Up @@ -33,7 +33,7 @@ $(document).ready(function() {
$('.linktext').quickCopy()
})
</script>

<div class="container_16">
<div class="search_results">
<div class="grid_11 suffix_1">

Expand Down Expand Up @@ -141,4 +141,5 @@ $(document).ready(function() {
Please see <a href="http://www.sphinxsearch.com/docs/current.html#extended-syntax">this page</a> for a full listing of search options.
</div>
</div>
</div>
</div>

0 comments on commit 06f1862

Please sign in to comment.