Commit a90b7543de84dcd67872fc5b1858437ee08a4294

Authored by JoenioCosta
1 parent 6e71c9a4

ActionItem328: s/Products/Products and Services/

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1837 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/consumed_products/index.rhtml
1 -<h2> <%=_('Listing products') %> </h2> 1 +<h2> <%=_('Listing consumed products') %> </h2>
2 2
3 <p> <%= link_to _('Add product'), :action => 'new' %> </p> 3 <p> <%= link_to _('Add product'), :action => 'new' %> </p>
4 4
5 <% @consumptions.each do |consumption| %> 5 <% @consumptions.each do |consumption| %>
6 - <p> <b> <%= link_to_category(consumption.product_category) %> </b> </p> 6 + <p> <b> <%= link_to_category(consumption.product_category) %> </b>
7 <%= link_to _('remove'), { :action => 'destroy', :id => consumption }, 7 <%= link_to _('remove'), { :action => 'destroy', :id => consumption },
8 :confirm => _('Are you sure, you want to remove this product from your list') %> 8 :confirm => _('Are you sure, you want to remove this product from your list') %>
9 - <pre><%= consumption.aditional_specifications %></pre> 9 + <pre><%= consumption.aditional_specifications %></pre> </p>
10 <% end %> 10 <% end %>
11 11
12 <%= link_to_myprofile(_('Back'), {}, @profile.identifier)%> 12 <%= link_to_myprofile(_('Back'), {}, @profile.identifier)%>
app/views/manage_products/_subcategories.rhtml
1 -<p><%= _('Current category:') %></p>  
2 -<%= hidden_field_tag 'product[product_category_id]', @current_category ? @current_category.id : nil %>  
3 -<%  
4 - categories = [@current_category]  
5 - categories.push(@current_category) while @current_category and @current_category = @current_category.parent  
6 -%>  
7 -<%= categories.compact.reverse.map{|i|  
8 - link_to_remote(i.name,  
9 - :update => "subcategories",  
10 - :url => { :action => 'update_subcategories', :id => i, :loaded => visual_effect(:highlight, "subcategories") },  
11 - :class => 'select-current-category-link')}.join(' &rarr; ')  
12 -%> 1 +<% if !@current_category.nil? and !@current_category.top_level? %>
  2 +
  3 + <p><%= _('Current category:') %></p>
  4 + <%= hidden_field_tag 'product[product_category_id]', @current_category.id %>
  5 + <%
  6 + categories = [@current_category]
  7 + categories.push(@current_category) while @current_category = @current_category.parent
  8 + categories.last.name = _('Back')
  9 + %>
  10 + <% if categories.size > 1 %>
  11 + <%= categories.compact.reverse.map{|i|
  12 + link_to_remote(i.name,
  13 + :update => "subcategories",
  14 + :url => { :action => 'update_subcategories', :id => i, :loaded => visual_effect(:highlight, "subcategories") },
  15 + :class => 'select-current-category-link')}.join(' &rarr; ')
  16 + %>
  17 + <% end %>
13 18
14 -<% unless @categories.empty? %> 19 +<% end %>
  20 +
  21 +<% if @current_category %>
  22 + <p><%= _('Select a category:') %></p>
  23 +<% elsif !@categories.empty? %>
15 <p><%= _('Select a subcategory:') %></p> 24 <p><%= _('Select a subcategory:') %></p>
16 <% end %> 25 <% end %>
  26 +
17 <% for category in @categories do %> 27 <% for category in @categories do %>
18 <%= link_to_remote category.name, { 28 <%= link_to_remote category.name, {
19 :update => "subcategories", 29 :update => "subcategories",
app/views/manage_products/index.rhtml
1 -<h2> <%=_('Listing products') %> </h2> 1 +<h2> <%=_('Listing products and services') %> </h2>
2 2
3 -<p> <%= link_to _('New product'), :action => 'new' %> </p> 3 +<p> <%= link_to _('New product or service'), :action => 'new' %> </p>
4 4
5 <% @products.each do |product| %> 5 <% @products.each do |product| %>
6 <p> <b> <%= link_to product.name, :action => 'show', :id => product %> </b> 6 <p> <b> <%= link_to product.name, :action => 'show', :id => product %> </b>
app/views/profile_editor/index.rhtml
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 22
23 <%= file_manager_button(_('Consumed Products'), 'icons-app/consumed_product.png', :controller => 'consumed_products') if profile.enterprise? %> 23 <%= file_manager_button(_('Consumed Products'), 'icons-app/consumed_product.png', :controller => 'consumed_products') if profile.enterprise? %>
24 24
25 - <%= file_manager_button(_('Manage Products'), 'icons-app/products.png', :controller => 'manage_products') if profile.enterprise? %> 25 + <%= file_manager_button(_('Manage Products and Services'), 'icons-app/products.png', :controller => 'manage_products') if profile.enterprise? %>
26 26
27 <%= file_manager_button(_('Enterprise Validation'), 'icons-app/validation.png', :controller => 'enterprise_validation') if profile.is_validation_entity? %> 27 <%= file_manager_button(_('Enterprise Validation'), 'icons-app/validation.png', :controller => 'enterprise_validation') if profile.is_validation_entity? %>
28 28
test/functional/manage_products_controller_test.rb
@@ -112,21 +112,30 @@ class ManageProductsControllerTest &lt; Test::Unit::TestCase @@ -112,21 +112,30 @@ class ManageProductsControllerTest &lt; Test::Unit::TestCase
112 end 112 end
113 end 113 end
114 114
115 - should 'show current category' do 115 + should 'show categories list' do
116 environment = Environment.default 116 environment = Environment.default
117 category1 = ProductCategory.create!(:name => 'Category 1', :environment => environment) 117 category1 = ProductCategory.create!(:name => 'Category 1', :environment => environment)
118 category2 = ProductCategory.create!(:name => 'Category 2', :environment => environment, :parent => category1) 118 category2 = ProductCategory.create!(:name => 'Category 2', :environment => environment, :parent => category1)
119 category3 = ProductCategory.create!(:name => 'Category 3', :environment => environment, :parent => category2) 119 category3 = ProductCategory.create!(:name => 'Category 3', :environment => environment, :parent => category2)
120 - category4 = ProductCategory.create!(:name => 'Category 4', :environment => environment, :parent => category3)  
121 get :new, :profile => @enterprise.identifier 120 get :new, :profile => @enterprise.identifier
122 - assert_tag :tag => 'p', :content => /Current category:/, :sibling => { :tag => 'a', :content => /#{category1.name}/ } 121 + assert_tag :tag => 'p', :content => /Select a category:/, :sibling => { :tag => 'a', :content => /#{category2.name}/ }
  122 + end
  123 +
  124 + should 'show current category' do
  125 + environment = Environment.default
  126 + category1 = ProductCategory.create!(:name => 'Category 1', :environment => environment)
  127 + category2 = ProductCategory.create!(:name => 'Category 2', :environment => environment, :parent => category1)
  128 + category3 = ProductCategory.create!(:name => 'Category 3', :environment => environment, :parent => category2)
  129 + get 'update_subcategories', :profile => @enterprise.identifier, :id => category2.id
  130 + assert_tag :tag => 'p', :content => /Current category:/, :sibling => { :tag => 'a', :content => /#{category3.name}/ }
123 end 131 end
124 132
125 should 'show subcategories list' do 133 should 'show subcategories list' do
126 environment = Environment.default 134 environment = Environment.default
127 category1 = ProductCategory.create!(:name => 'Category 1', :environment => environment) 135 category1 = ProductCategory.create!(:name => 'Category 1', :environment => environment)
128 category2 = ProductCategory.create!(:name => 'Category 2', :environment => environment, :parent => category1) 136 category2 = ProductCategory.create!(:name => 'Category 2', :environment => environment, :parent => category1)
129 - get 'new', :profile => @enterprise.identifier 137 + category3 = ProductCategory.create!(:name => 'Category 3', :environment => environment, :parent => category2)
  138 + get 'update_subcategories', :profile => @enterprise.identifier, :id => category2.id
130 assert !assigns(:categories).empty? 139 assert !assigns(:categories).empty?
131 assert_tag :tag => 'p', :content => /Select a subcategory:/, :sibling => { :tag => 'a', :attributes => { :href => '#' }, :content => /#{category2.name}/ } 140 assert_tag :tag => 'p', :content => /Select a subcategory:/, :sibling => { :tag => 'a', :attributes => { :href => '#' }, :content => /#{category2.name}/ }
132 end 141 end