diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index d7d6916..08ca1a4 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -10,6 +10,7 @@ class ProfileEditorController < MyProfileController def block_types %w[ FavoriteLinksProfile + ListBlock ] end diff --git a/app/models/product.rb b/app/models/product.rb index 02a4e51..fba6b57 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -4,4 +4,5 @@ class Product < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name, :scope => :enterprise_id + validates_numericality_of :price, :allow_nil => true end diff --git a/app/views/manage_products/show.rhtml b/app/views/manage_products/show.rhtml index 2734ee7..4509b35 100644 --- a/app/views/manage_products/show.rhtml +++ b/app/views/manage_products/show.rhtml @@ -2,7 +2,7 @@
<%= _('Price: ') %> <%= @product.price %>
<%= _('Description: ') %> <%= @product.description %>
- +<%= _('Category: ') %> <%= @product.product_category ? @product.product_category.name : _('Uncategorized product') %>
<%= link_to _('edit'), :action => 'edit', :id => @product %> <%= link_to _('destroy'), :action => 'destroy', :id => @product %> diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index eb6e888..a8b28fe 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -12,6 +12,8 @@ <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') %> <%= file_manager_button(_('Change Password'), 'icons-app/change-password.png', :controller => 'account', :action => 'change_password') %> + + <%= file_manager_button(_('Manage Products'), 'icons-app/products.png', :controller => 'manage_products') if @profile.kind_of?(Enterprise) %> <% end %> diff --git a/test/functional/role_controller_test.rb b/test/functional/role_controller_test.rb index 826dcce..78cf8a2 100644 --- a/test/functional/role_controller_test.rb +++ b/test/functional/role_controller_test.rb @@ -6,7 +6,6 @@ class RoleController; def rescue_action(e) raise e end; end class RoleControllerTest < Test::Unit::TestCase all_fixtures - under_profile :ze def setup @controller = RoleController.new diff --git a/test/unit/product_test.rb b/test/unit/product_test.rb index 3185a41..9056124 100644 --- a/test/unit/product_test.rb +++ b/test/unit/product_test.rb @@ -4,22 +4,22 @@ class ProductTest < Test::Unit::TestCase should 'create product' do assert_difference Product, :count do - p = Product.new(:name => 'test product') + p = Product.new(:name => 'test product1') assert p.save end end should 'destroy product' do - p = Product.create(:name => 'test product') + p = Product.create(:name => 'test product2') assert_difference Product, :count, -1 do p.destroy end end should 'name be unique' do - Product.create(:name => 'test product') + Product.create(:name => 'test product3') assert_no_difference Product, :count do - p = Product.new(:name => 'test product') + p = Product.new(:name => 'test product3') assert !p.save end end -- libgit2 0.21.2