From 8eeb74c2b925e0791f11a6ca8580541098bc9eeb Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Sat, 1 Dec 2007 21:24:14 +0000 Subject: [PATCH] ActionItem31: moving tag stuff to SearchController and making minor enhancements to the interface --- app/controllers/public/search_controller.rb | 9 +++++++++ app/controllers/public/tag_controller.rb | 4 +--- app/views/search/tag.rhtml | 13 +++++++++++++ app/views/search/tags.rhtml | 5 +++++ public/designs/icons/default/README | 1 + public/designs/icons/default/gtk-go-back-ltr.png | Bin 0 -> 953 bytes public/designs/icons/default/style.css | 1 + public/stylesheets/search.css | 3 +++ 8 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 app/views/search/tag.rhtml create mode 100644 app/views/search/tags.rhtml create mode 100644 public/designs/icons/default/gtk-go-back-ltr.png diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index e8d0a41..829d697 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -46,4 +46,13 @@ class SearchController < ApplicationController @results = search(@query) end + def tags + @tags = Tag.find(:all) + end + + def tag + @tag = Tag.find_by_name(params[:tag]) + @tagged = @tag.taggings.map(&:taggable) + end + end diff --git a/app/controllers/public/tag_controller.rb b/app/controllers/public/tag_controller.rb index ad1da14..282211a 100644 --- a/app/controllers/public/tag_controller.rb +++ b/app/controllers/public/tag_controller.rb @@ -1,5 +1,3 @@ class TagController < ApplicationController - def index - raise 'pending' - end + end diff --git a/app/views/search/tag.rhtml b/app/views/search/tag.rhtml new file mode 100644 index 0000000..3f2fcf8 --- /dev/null +++ b/app/views/search/tag.rhtml @@ -0,0 +1,13 @@ +

+ <%= _('Tagged with "%s"') % content_tag('code', @tag) %> +

+ +<% button_bar do %> + <%= button('back', _('Back to tag cloud'), :action => 'tags') %> +<% end %> + +
+<% @tagged.each do |hit| %> + <%= render :partial => partial_for_hit(hit.class), :locals => { :hit => hit } %> +<% end %> +
diff --git a/app/views/search/tags.rhtml b/app/views/search/tags.rhtml new file mode 100644 index 0000000..7915fc0 --- /dev/null +++ b/app/views/search/tags.rhtml @@ -0,0 +1,5 @@ +

<%= _('Tag cloud') %>

+ +<% @tags.each do |t| %> + <%= link_to("#{t.name} (#{t.taggings.count})", { :action => 'tag', :tag => t.name }, :style => "font-size: #{14 + 2 * t.taggings.count}px;") %> +<% end %> diff --git a/public/designs/icons/default/README b/public/designs/icons/default/README index 5dfda81..9362ba0 100644 --- a/public/designs/icons/default/README +++ b/public/designs/icons/default/README @@ -31,6 +31,7 @@ user_icon.png Nuovo apps/ gnome-other.png Nuovo apps/ gtk-delete.png Nuovo stock/ gtk-find.png Nuovo stock/ +gtk-go-back-ltr.png Nuovo stock/ ### END OF ICONS LISTING ### Licensing of GNOME themes diff --git a/public/designs/icons/default/gtk-go-back-ltr.png b/public/designs/icons/default/gtk-go-back-ltr.png new file mode 100644 index 0000000..d157d5f Binary files /dev/null and b/public/designs/icons/default/gtk-go-back-ltr.png differ diff --git a/public/designs/icons/default/style.css b/public/designs/icons/default/style.css index 96b0615..6623dd2 100644 --- a/public/designs/icons/default/style.css +++ b/public/designs/icons/default/style.css @@ -11,3 +11,4 @@ .button.product { background-image: url(gnome-other.png); } .button.delete { background-image: url(gtk-delete.png); } .button.find { background-image: url(gtk-find.png); } +.button.back { background-image: url(gtk-go-back-ltr.png); } diff --git a/public/stylesheets/search.css b/public/stylesheets/search.css index dff2084..56650a3 100644 --- a/public/stylesheets/search.css +++ b/public/stylesheets/search.css @@ -8,3 +8,6 @@ margin-left: 40px; } +.search-tagged-items { + margin-top: 1em; +} -- libgit2 0.21.2