Commit ad2520f9902b6df850167b377a431b64199af32d
1 parent
0baf2a29
Exists in
master
and in
22 other branches
ActionItem348: display the image in category index
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1823 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
14 additions
and
0 deletions
Show diff stats
app/views/search/category_index.rhtml
| 1 | <div id="view-category"> | 1 | <div id="view-category"> |
| 2 | 2 | ||
| 3 | + <div id="category-image"><%= image_tag(@category.image.public_filename(:thumb), :id => 'category-image') if @category.image %></div> | ||
| 3 | <h1 id="category-name"><%= _('Category: %s') % @category.name %></h1> | 4 | <h1 id="category-name"><%= _('Category: %s') % @category.name %></h1> |
| 4 | 5 | ||
| 5 | <%= render :partial => 'display_results' %> | 6 | <%= render :partial => 'display_results' %> |
public/stylesheets/common.css
| @@ -173,6 +173,10 @@ div#notice { | @@ -173,6 +173,10 @@ div#notice { | ||
| 173 | 173 | ||
| 174 | #view-category { /* none */ } | 174 | #view-category { /* none */ } |
| 175 | 175 | ||
| 176 | +#category-image { | ||
| 177 | + text-align: center; | ||
| 178 | +} | ||
| 179 | + | ||
| 176 | #categiry-name { | 180 | #categiry-name { |
| 177 | margin: 0px; | 181 | margin: 0px; |
| 178 | position: relative; | 182 | position: relative; |
test/functional/search_controller_test.rb
| @@ -842,4 +842,13 @@ class SearchControllerTest < Test::Unit::TestCase | @@ -842,4 +842,13 @@ class SearchControllerTest < Test::Unit::TestCase | ||
| 842 | assert_no_match /Category:/, @response.body | 842 | assert_no_match /Category:/, @response.body |
| 843 | end | 843 | end |
| 844 | 844 | ||
| 845 | + should 'display category image while in directory' do | ||
| 846 | + parent = Category.create!(:name => 'category1', :environment => Environment.default) | ||
| 847 | + cat = Category.create!(:name => 'category2', :environment => Environment.default, :parent => parent, | ||
| 848 | + :image_builder => {:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')} | ||
| 849 | + ) | ||
| 850 | + get :category_index, :category_path => [ 'category1', 'category2' ], :query => 'teste' | ||
| 851 | + assert_tag :tag => 'img', :attributes => { :src => /rails_thumb\.png/ } | ||
| 852 | + end | ||
| 853 | + | ||
| 845 | end | 854 | end |