From 72889f54a5b19a54df1637ea468239c4dff3bddc Mon Sep 17 00:00:00 2001 From: Aurélio A. Heckert Date: Mon, 17 Jun 2013 18:34:51 -0300 Subject: [PATCH] Adds configuration for products per page on catalog --- app/controllers/public/catalog_controller.rb | 6 +++++- app/models/enterprise.rb | 1 + app/views/profile_editor/_organization.rhtml | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/public/catalog_controller.rb b/app/controllers/public/catalog_controller.rb index 9998e84..3704925 100644 --- a/app/controllers/public/catalog_controller.rb +++ b/app/controllers/public/catalog_controller.rb @@ -5,7 +5,11 @@ class CatalogController < PublicController def index @category = params[:level] ? ProductCategory.find(params[:level]) : nil - @products = @profile.products.from_category(@category).paginate(:order => 'available desc, highlighted desc, name asc', :per_page => 9, :page => params[:page]) + @products = @profile.products.from_category(@category).paginate( + :order => 'available desc, highlighted desc, name asc', + :per_page => @profile.products_per_catalog_page, + :page => params[:page] + ) @categories = ProductCategory.on_level(params[:level]).order(:name) end diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 1035d09..a8cea65 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -23,6 +23,7 @@ class Enterprise < Organization N_('Organization website'); N_('Historic and current context'); N_('Activities short description'); N_('City'); N_('State'); N_('Country'); N_('ZIP code') settings_items :organization_website, :historic_and_current_context, :activities_short_description, :zip_code, :city, :state, :country + settings_items :products_per_catalog_page, :type => :integer, :default => 6 extend SetProfileRegionFromCityState::ClassMethods set_profile_region_from_city_state diff --git a/app/views/profile_editor/_organization.rhtml b/app/views/profile_editor/_organization.rhtml index 9fedbd1..6c0caa4 100644 --- a/app/views/profile_editor/_organization.rhtml +++ b/app/views/profile_editor/_organization.rhtml @@ -65,3 +65,7 @@ <%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %> <%= render :partial => 'moderation', :locals => { :profile => @profile } %> + +

<%=_('Product/Service catalog')%>

+ +<%= f.text_field(:products_per_catalog_page, :size=>3) %> -- libgit2 0.21.2