Commit 8eeb74c2b925e0791f11a6ca8580541098bc9eeb

Authored by AntonioTerceiro
1 parent 17985317

ActionItem31: moving tag stuff to SearchController and making minor enhancements to the interface



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1024 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/search_controller.rb
@@ -46,4 +46,13 @@ class SearchController < ApplicationController @@ -46,4 +46,13 @@ class SearchController < ApplicationController
46 @results = search(@query) 46 @results = search(@query)
47 end 47 end
48 48
  49 + def tags
  50 + @tags = Tag.find(:all)
  51 + end
  52 +
  53 + def tag
  54 + @tag = Tag.find_by_name(params[:tag])
  55 + @tagged = @tag.taggings.map(&:taggable)
  56 + end
  57 +
49 end 58 end
app/controllers/public/tag_controller.rb
1 class TagController < ApplicationController 1 class TagController < ApplicationController
2 - def index  
3 - raise 'pending'  
4 - end 2 +
5 end 3 end
app/views/search/tag.rhtml 0 → 100644
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +<h2>
  2 + <%= _('Tagged with "%s"') % content_tag('code', @tag) %>
  3 +</h2>
  4 +
  5 +<% button_bar do %>
  6 + <%= button('back', _('Back to tag cloud'), :action => 'tags') %>
  7 +<% end %>
  8 +
  9 +<div class='search-tagged-items'>
  10 +<% @tagged.each do |hit| %>
  11 + <%= render :partial => partial_for_hit(hit.class), :locals => { :hit => hit } %>
  12 +<% end %>
  13 +</div>
app/views/search/tags.rhtml 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +<h2><%= _('Tag cloud') %></h2>
  2 +
  3 +<% @tags.each do |t| %>
  4 + <%= link_to("#{t.name} (#{t.taggings.count})", { :action => 'tag', :tag => t.name }, :style => "font-size: #{14 + 2 * t.taggings.count}px;") %>
  5 +<% end %>
public/designs/icons/default/README
@@ -31,6 +31,7 @@ user_icon.png Nuovo apps/ @@ -31,6 +31,7 @@ user_icon.png Nuovo apps/
31 gnome-other.png Nuovo apps/ 31 gnome-other.png Nuovo apps/
32 gtk-delete.png Nuovo stock/ 32 gtk-delete.png Nuovo stock/
33 gtk-find.png Nuovo stock/ 33 gtk-find.png Nuovo stock/
  34 +gtk-go-back-ltr.png Nuovo stock/
34 ### END OF ICONS LISTING ### 35 ### END OF ICONS LISTING ###
35 36
36 Licensing of GNOME themes 37 Licensing of GNOME themes
public/designs/icons/default/gtk-go-back-ltr.png 0 → 100644

953 Bytes

public/designs/icons/default/style.css
@@ -11,3 +11,4 @@ @@ -11,3 +11,4 @@
11 .button.product { background-image: url(gnome-other.png); } 11 .button.product { background-image: url(gnome-other.png); }
12 .button.delete { background-image: url(gtk-delete.png); } 12 .button.delete { background-image: url(gtk-delete.png); }
13 .button.find { background-image: url(gtk-find.png); } 13 .button.find { background-image: url(gtk-find.png); }
  14 +.button.back { background-image: url(gtk-go-back-ltr.png); }
public/stylesheets/search.css
@@ -8,3 +8,6 @@ @@ -8,3 +8,6 @@
8 margin-left: 40px; 8 margin-left: 40px;
9 } 9 }
10 10
  11 +.search-tagged-items {
  12 + margin-top: 1em;
  13 +}