Commit 4bd73ec6d87ee2468959cc7d0125c3783d7ee6b3
1 parent
a7066af5
Exists in
master
and in
29 other branches
Changed settings_items type to boolean
Showing
2 changed files
with
15 additions
and
15 deletions
Show diff stats
plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
@@ -12,18 +12,18 @@ class RelevantContentPlugin::RelevantContentBlock < Block | @@ -12,18 +12,18 @@ class RelevantContentPlugin::RelevantContentBlock < Block | ||
12 | end | 12 | end |
13 | 13 | ||
14 | settings_items :limit, :type => :integer, :default => 5 | 14 | settings_items :limit, :type => :integer, :default => 5 |
15 | - settings_items :show_most_read, :type => :integer, :default => 1 | ||
16 | - settings_items :show_most_commented, :type => :integer, :default => 1 | ||
17 | - settings_items :show_most_liked, :type => :integer, :default => 1 | ||
18 | - settings_items :show_most_disliked, :type => :integer, :default => 0 | ||
19 | - settings_items :show_most_voted, :type => :integer, :default => 1 | 15 | + settings_items :show_most_read, :type => :boolean, :default => 1 |
16 | + settings_items :show_most_commented, :type => :boolean, :default => 1 | ||
17 | + settings_items :show_most_liked, :type => :boolean, :default => 1 | ||
18 | + settings_items :show_most_disliked, :type => :boolean, :default => 0 | ||
19 | + settings_items :show_most_voted, :type => :boolean, :default => 1 | ||
20 | 20 | ||
21 | include ActionController::UrlWriter | 21 | include ActionController::UrlWriter |
22 | def content(args={}) | 22 | def content(args={}) |
23 | 23 | ||
24 | content = block_title(title) | 24 | content = block_title(title) |
25 | 25 | ||
26 | - if self.show_most_read != 0 | 26 | + if self.show_most_read |
27 | docs = Article.most_accessed(owner, self.limit) | 27 | docs = Article.most_accessed(owner, self.limit) |
28 | if !docs.blank? | 28 | if !docs.blank? |
29 | subcontent = "" | 29 | subcontent = "" |
@@ -33,7 +33,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | @@ -33,7 +33,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | ||
33 | end | 33 | end |
34 | end | 34 | end |
35 | 35 | ||
36 | - if self.show_most_commented != 0 | 36 | + if self.show_most_commented |
37 | docs = Article.most_commented_relevant_content(owner, self.limit) | 37 | docs = Article.most_commented_relevant_content(owner, self.limit) |
38 | if !docs.blank? | 38 | if !docs.blank? |
39 | subcontent = "" | 39 | subcontent = "" |
@@ -50,7 +50,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | @@ -50,7 +50,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | ||
50 | end | 50 | end |
51 | 51 | ||
52 | if env.plugin_enabled?(VotePlugin) | 52 | if env.plugin_enabled?(VotePlugin) |
53 | - if self.show_most_liked != 0 | 53 | + if self.show_most_liked |
54 | docs = Article.more_positive_votes(owner, self.limit) | 54 | docs = Article.more_positive_votes(owner, self.limit) |
55 | if !docs.blank? | 55 | if !docs.blank? |
56 | subcontent = "" | 56 | subcontent = "" |
@@ -59,7 +59,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | @@ -59,7 +59,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | ||
59 | content += content_tag(:div, subcontent, :class=>"block mliked") + "\n" | 59 | content += content_tag(:div, subcontent, :class=>"block mliked") + "\n" |
60 | end | 60 | end |
61 | end | 61 | end |
62 | - if self.show_most_disliked != 0 | 62 | + if self.show_most_disliked |
63 | docs = Article.more_negative_votes(owner, self.limit) | 63 | docs = Article.more_negative_votes(owner, self.limit) |
64 | if !docs.blank? | 64 | if !docs.blank? |
65 | subcontent = "" | 65 | subcontent = "" |
@@ -69,7 +69,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | @@ -69,7 +69,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block | ||
69 | end | 69 | end |
70 | end | 70 | end |
71 | 71 | ||
72 | - if self.show_most_voted != 0 | 72 | + if self.show_most_voted |
73 | docs = Article.most_voted(owner, self.limit) | 73 | docs = Article.most_voted(owner, self.limit) |
74 | if !docs.blank? | 74 | if !docs.blank? |
75 | subcontent = "" | 75 | subcontent = "" |
plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml
1 | <div id='edit-relevant-content-block'> | 1 | <div id='edit-relevant-content-block'> |
2 | <%= labelled_form_field _('Limit of items per category'), text_field(:block, :limit, :size => 3) %> | 2 | <%= labelled_form_field _('Limit of items per category'), text_field(:block, :limit, :size => 3) %> |
3 | - <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read != 0 %><BR> | ||
4 | - <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented != 0 %><BR> | ||
5 | - <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked != 0 %><BR> | ||
6 | - <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted != 0 %><BR> | ||
7 | - <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked != 0 %><BR> | 3 | + <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read %><BR> |
4 | + <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented %><BR> | ||
5 | + <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked %><BR> | ||
6 | + <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted %><BR> | ||
7 | + <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked %><BR> | ||
8 | </div> | 8 | </div> |
9 | \ No newline at end of file | 9 | \ No newline at end of file |