Commit ad2520f9902b6df850167b377a431b64199af32d

Authored by JoenioCosta
1 parent 0baf2a29

ActionItem348: display the image in category index

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1823 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/search/category_index.rhtml
1 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 4 <h1 id="category-name"><%= _('Category: %s') % @category.name %></h1>
4 5  
5 6 <%= render :partial => 'display_results' %>
... ...
public/stylesheets/common.css
... ... @@ -173,6 +173,10 @@ div#notice {
173 173  
174 174 #view-category { /* none */ }
175 175  
  176 +#category-image {
  177 + text-align: center;
  178 +}
  179 +
176 180 #categiry-name {
177 181 margin: 0px;
178 182 position: relative;
... ...
test/functional/search_controller_test.rb
... ... @@ -842,4 +842,13 @@ class SearchControllerTest &lt; Test::Unit::TestCase
842 842 assert_no_match /Category:/, @response.body
843 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 854 end
... ...