diff --git a/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb b/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb index ffa5055..1c31c9a 100644 --- a/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb +++ b/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb @@ -12,18 +12,18 @@ class RelevantContentPlugin::RelevantContentBlock < Block end settings_items :limit, :type => :integer, :default => 5 - settings_items :show_most_read, :type => :integer, :default => 1 - settings_items :show_most_commented, :type => :integer, :default => 1 - settings_items :show_most_liked, :type => :integer, :default => 1 - settings_items :show_most_disliked, :type => :integer, :default => 0 - settings_items :show_most_voted, :type => :integer, :default => 1 + settings_items :show_most_read, :type => :boolean, :default => 1 + settings_items :show_most_commented, :type => :boolean, :default => 1 + settings_items :show_most_liked, :type => :boolean, :default => 1 + settings_items :show_most_disliked, :type => :boolean, :default => 0 + settings_items :show_most_voted, :type => :boolean, :default => 1 include ActionController::UrlWriter def content(args={}) content = block_title(title) - if self.show_most_read != 0 + if self.show_most_read docs = Article.most_accessed(owner, self.limit) if !docs.blank? subcontent = "" @@ -33,7 +33,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block end end - if self.show_most_commented != 0 + if self.show_most_commented docs = Article.most_commented_relevant_content(owner, self.limit) if !docs.blank? subcontent = "" @@ -50,7 +50,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block end if env.plugin_enabled?(VotePlugin) - if self.show_most_liked != 0 + if self.show_most_liked docs = Article.more_positive_votes(owner, self.limit) if !docs.blank? subcontent = "" @@ -59,7 +59,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block content += content_tag(:div, subcontent, :class=>"block mliked") + "\n" end end - if self.show_most_disliked != 0 + if self.show_most_disliked docs = Article.more_negative_votes(owner, self.limit) if !docs.blank? subcontent = "" @@ -69,7 +69,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block end end - if self.show_most_voted != 0 + if self.show_most_voted docs = Article.most_voted(owner, self.limit) if !docs.blank? subcontent = "" diff --git a/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml b/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml index b36f659..04b03eb 100644 --- a/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml +++ b/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml @@ -1,8 +1,8 @@
<%= labelled_form_field _('Limit of items per category'), text_field(:block, :limit, :size => 3) %> - <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read != 0 %>
- <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented != 0 %>
- <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked != 0 %>
- <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted != 0 %>
- <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked != 0 %>
+ <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read %>
+ <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented %>
+ <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked %>
+ <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted %>
+ <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked %>
\ No newline at end of file -- libgit2 0.21.2