Commit 8625b2c8c476eb68e94642e86625ed7fc5fed2c3
1 parent
99c4da00
Exists in
master
and in
28 other branches
fix: catalog configuration only for enterprises
(ActionItem896)
Showing
2 changed files
with
43 additions
and
3 deletions
Show diff stats
app/views/profile_editor/_organization.rhtml
| ... | ... | @@ -66,6 +66,7 @@ |
| 66 | 66 | |
| 67 | 67 | <%= render :partial => 'moderation', :locals => { :profile => @profile } %> |
| 68 | 68 | |
| 69 | -<h2><%=_('Product/Service catalog')%></h2> | |
| 70 | - | |
| 71 | -<%= f.text_field(:products_per_catalog_page, :size=>3) %> | |
| 69 | +<% if profile.enterprise? && profile.environment.enabled?('products_for_enterprises') %> | |
| 70 | + <h2><%=_('Products/Services catalog')%></h2> | |
| 71 | + <%= labelled_form_field(_('Number of products/services displayed per page on catalog'), text_field(:profile_data, :products_per_catalog_page, :size => 3)) %> | |
| 72 | +<% end %> | ... | ... |
test/functional/profile_editor_controller_test.rb
| ... | ... | @@ -988,5 +988,44 @@ class ProfileEditorControllerTest < ActionController::TestCase |
| 988 | 988 | assert_response :success |
| 989 | 989 | end |
| 990 | 990 | |
| 991 | + should 'display field to choose number of products if enterprise and enabled on environment' do | |
| 992 | + enterprise = fast_create(Enterprise) | |
| 993 | + enterprise.environment.enable('products_for_enterprises') | |
| 994 | + get :edit, :profile => enterprise.identifier | |
| 995 | + assert_tag :tag => 'div', :descendant => { :tag => 'h2', :content => 'Products/Services catalog' } | |
| 996 | + assert_tag :tag => 'div', | |
| 997 | + :attributes => { :class => 'formfield type-text' }, | |
| 998 | + :descendant => {:tag => 'input', :attributes => {:id => 'profile_data_products_per_catalog_page'} } | |
| 999 | + end | |
| 1000 | + | |
| 1001 | + should 'not display field to choose number of products if enterprise but disabled on environment' do | |
| 1002 | + enterprise = fast_create(Enterprise) | |
| 1003 | + enterprise.environment.disable('products_for_enterprises') | |
| 1004 | + get :edit, :profile => enterprise.identifier | |
| 1005 | + assert_no_tag :tag => 'div', :descendant => { :tag => 'h2', :content => 'Products/Services catalog' } | |
| 1006 | + assert_no_tag :tag => 'div', | |
| 1007 | + :attributes => { :class => 'formfield type-text' }, | |
| 1008 | + :descendant => {:tag => 'input', :attributes => {:id => 'profile_data_products_per_catalog_page'} } | |
| 1009 | + end | |
| 1010 | + | |
| 1011 | + should 'not display field to choose number of products if enabled on environment but not enterprise' do | |
| 1012 | + community = fast_create(Community) | |
| 1013 | + community.environment.enable('products_for_enterprises') | |
| 1014 | + get :edit, :profile => community.identifier | |
| 1015 | + assert_no_tag :tag => 'div', :descendant => { :tag => 'h2', :content => 'Products/Services catalog' } | |
| 1016 | + assert_no_tag :tag => 'div', | |
| 1017 | + :attributes => { :class => 'formfield type-text' }, | |
| 1018 | + :descendant => {:tag => 'input', :attributes => {:id => 'profile_data_products_per_catalog_page'} } | |
| 1019 | + end | |
| 1020 | + | |
| 1021 | + should 'not display field to choose number of products if disabled on environment and not enterprise' do | |
| 1022 | + community = fast_create(Community) | |
| 1023 | + community.environment.disable('products_for_enterprises') | |
| 1024 | + get :edit, :profile => community.identifier | |
| 1025 | + assert_no_tag :tag => 'div', :descendant => { :tag => 'h2', :content => 'Products/Services catalog' } | |
| 1026 | + assert_no_tag :tag => 'div', | |
| 1027 | + :attributes => { :class => 'formfield type-text' }, | |
| 1028 | + :descendant => {:tag => 'input', :attributes => {:id => 'profile_data_products_per_catalog_page'} } | |
| 1029 | + end | |
| 991 | 1030 | |
| 992 | 1031 | end | ... | ... |