diff --git a/app/controllers/public/home_controller.rb b/app/controllers/public/home_controller.rb index 746eb14..615bb8d 100644 --- a/app/controllers/public/home_controller.rb +++ b/app/controllers/public/home_controller.rb @@ -2,13 +2,13 @@ class HomeController < PublicController def index @has_news = false - if environment.enabled?('use_portal_community') && environment.portal_community + if environment.portal_enabled @has_news = true @news_cache_key = environment.portal_news_cache_key(FastGettext.locale) if !read_fragment(@news_cache_key) portal_community = environment.portal_community - @highlighted_news = portal_community.news(2, true) - @portal_news = portal_community.news(7, true) - @highlighted_news + @highlighted_news = portal_community.news(environment.highlighted_news_amount, true) + @portal_news = portal_community.news(environment.portal_news_amount, true).offset(environment.highlighted_news_amount) @area_news = environment.portal_folders end end diff --git a/app/models/environment.rb b/app/models/environment.rb index 573e249..e49fb4e 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -3,7 +3,7 @@ # domains. class Environment < ActiveRecord::Base - attr_accessible :name, :is_default, :signup_welcome_text_subject, :signup_welcome_text_body, :terms_of_use, :message_for_disabled_enterprise, :news_amount_by_folder, :default_language, :languages, :description, :organization_approval_method, :enabled_plugins, :enabled_features, :redirection_after_login, :redirection_after_signup, :contact_email, :theme, :reports_lower_bound, :noreply_email, :signup_welcome_screen_body, :members_whitelist_enabled, :members_whitelist + attr_accessible :name, :is_default, :signup_welcome_text_subject, :signup_welcome_text_body, :terms_of_use, :message_for_disabled_enterprise, :news_amount_by_folder, :default_language, :languages, :description, :organization_approval_method, :enabled_plugins, :enabled_features, :redirection_after_login, :redirection_after_signup, :contact_email, :theme, :reports_lower_bound, :noreply_email, :signup_welcome_screen_body, :members_whitelist_enabled, :members_whitelist, :highlighted_news_amount, :portal_news_amount has_many :users @@ -268,6 +268,8 @@ class Environment < ActiveRecord::Base settings_items :description, :type => String, :default => '
' settings_items :local_docs, :type => Array, :default => [] settings_items :news_amount_by_folder, :type => Integer, :default => 4 + settings_items :highlighted_news_amount, :type => Integer, :default => 2 + settings_items :portal_news_amount, :type => Integer, :default => 5 settings_items :help_message_to_add_enterprise, :type => String, :default => '' settings_items :tip_message_enterprise_activation_question, :type => String, :default => '' diff --git a/app/views/admin_panel/set_portal_community.html.erb b/app/views/admin_panel/set_portal_community.html.erb index 03dd6f2..df1cc17 100644 --- a/app/views/admin_panel/set_portal_community.html.erb +++ b/app/views/admin_panel/set_portal_community.html.erb @@ -18,7 +18,7 @@ <%= button 'ok', _('Enable'), {:action => 'manage_portal_community', :activate => 1} %> <% end %> <%= button 'folder', _('Select Portal Folders'), {:action => 'set_portal_folders'} %> - <%= button 'edit', _('Define Amount by Folder'), {:action => 'set_portal_news_amount'} %> + <%= button 'edit', _('Define news amount on portal'), {:action => 'set_portal_news_amount'} %> <%= button 'delete', _('Remove'), { :action => 'unset_portal_community'} %> <% end %> <% end %> diff --git a/app/views/admin_panel/set_portal_news_amount.html.erb b/app/views/admin_panel/set_portal_news_amount.html.erb index a6c5957..9358fce 100644 --- a/app/views/admin_panel/set_portal_news_amount.html.erb +++ b/app/views/admin_panel/set_portal_news_amount.html.erb @@ -1,8 +1,10 @@ -