Commit 72889f54a5b19a54df1637ea468239c4dff3bddc
1 parent
082a5c33
Exists in
master
and in
22 other branches
Adds configuration for products per page on catalog
related to ActionItem896
Showing
3 changed files
with
10 additions
and
1 deletions
Show diff stats
app/controllers/public/catalog_controller.rb
... | ... | @@ -5,7 +5,11 @@ class CatalogController < PublicController |
5 | 5 | |
6 | 6 | def index |
7 | 7 | @category = params[:level] ? ProductCategory.find(params[:level]) : nil |
8 | - @products = @profile.products.from_category(@category).paginate(:order => 'available desc, highlighted desc, name asc', :per_page => 9, :page => params[:page]) | |
8 | + @products = @profile.products.from_category(@category).paginate( | |
9 | + :order => 'available desc, highlighted desc, name asc', | |
10 | + :per_page => @profile.products_per_catalog_page, | |
11 | + :page => params[:page] | |
12 | + ) | |
9 | 13 | @categories = ProductCategory.on_level(params[:level]).order(:name) |
10 | 14 | end |
11 | 15 | ... | ... |
app/models/enterprise.rb
... | ... | @@ -23,6 +23,7 @@ class Enterprise < Organization |
23 | 23 | N_('Organization website'); N_('Historic and current context'); N_('Activities short description'); N_('City'); N_('State'); N_('Country'); N_('ZIP code') |
24 | 24 | |
25 | 25 | settings_items :organization_website, :historic_and_current_context, :activities_short_description, :zip_code, :city, :state, :country |
26 | + settings_items :products_per_catalog_page, :type => :integer, :default => 6 | |
26 | 27 | |
27 | 28 | extend SetProfileRegionFromCityState::ClassMethods |
28 | 29 | set_profile_region_from_city_state | ... | ... |
app/views/profile_editor/_organization.rhtml
... | ... | @@ -65,3 +65,7 @@ |
65 | 65 | <%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %> |
66 | 66 | |
67 | 67 | <%= render :partial => 'moderation', :locals => { :profile => @profile } %> |
68 | + | |
69 | +<h2><%=_('Product/Service catalog')%></h2> | |
70 | + | |
71 | +<%= f.text_field(:products_per_catalog_page, :size=>3) %> | ... | ... |