parent
4fb0e7deb5
commit
09fd14dd93
|
@ -1,5 +1,10 @@
|
||||||
class TagsController < ApplicationController
|
class TagsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
return render :json => Tag.active.all
|
@tags = Tag.all_with_story_counts_for(nil)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { render :action => "index" }
|
||||||
|
format.json { render :json => @tags }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
13
app/views/tags/index.html.erb
Normal file
13
app/views/tags/index.html.erb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<div class="box wide">
|
||||||
|
<div class="legend">
|
||||||
|
Tags
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% max_size = @tags.map{|t| t.stories_count }.max %>
|
||||||
|
<% @tags.each do |tag| %>
|
||||||
|
<% mod = (max_size.to_f / tag.stories_count.to_f) %>
|
||||||
|
<%= link_to tag.tag, tag_path(tag), :class => tag.css_class,
|
||||||
|
:style => "text-decoration: none; vertical-align: middle; " <<
|
||||||
|
"font-size: #{((52 / (mod + 1)) + 8).ceil}pt; line-height: 1.5em;" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -106,6 +106,7 @@ Lobsters::Application.routes.draw do
|
||||||
get "/filters" => "filters#index"
|
get "/filters" => "filters#index"
|
||||||
post "/filters" => "filters#update"
|
post "/filters" => "filters#update"
|
||||||
|
|
||||||
|
get "/tags" => "tags#index"
|
||||||
get "/tags.json" => "tags#index", :format => "json"
|
get "/tags.json" => "tags#index", :format => "json"
|
||||||
|
|
||||||
post "/invitations" => "invitations#create"
|
post "/invitations" => "invitations#create"
|
||||||
|
|
Loading…
Reference in a new issue