Commit 4bd73ec6d87ee2468959cc7d0125c3783d7ee6b3

Authored by Evandro Junior
1 parent a7066af5

Changed settings_items type to boolean

plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
... ... @@ -12,18 +12,18 @@ class RelevantContentPlugin::RelevantContentBlock < Block
12 12 end
13 13  
14 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 21 include ActionController::UrlWriter
22 22 def content(args={})
23 23  
24 24 content = block_title(title)
25 25  
26   - if self.show_most_read != 0
  26 + if self.show_most_read
27 27 docs = Article.most_accessed(owner, self.limit)
28 28 if !docs.blank?
29 29 subcontent = ""
... ... @@ -33,7 +33,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block
33 33 end
34 34 end
35 35  
36   - if self.show_most_commented != 0
  36 + if self.show_most_commented
37 37 docs = Article.most_commented_relevant_content(owner, self.limit)
38 38 if !docs.blank?
39 39 subcontent = ""
... ... @@ -50,7 +50,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block
50 50 end
51 51  
52 52 if env.plugin_enabled?(VotePlugin)
53   - if self.show_most_liked != 0
  53 + if self.show_most_liked
54 54 docs = Article.more_positive_votes(owner, self.limit)
55 55 if !docs.blank?
56 56 subcontent = ""
... ... @@ -59,7 +59,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block
59 59 content += content_tag(:div, subcontent, :class=>"block mliked") + "\n"
60 60 end
61 61 end
62   - if self.show_most_disliked != 0
  62 + if self.show_most_disliked
63 63 docs = Article.more_negative_votes(owner, self.limit)
64 64 if !docs.blank?
65 65 subcontent = ""
... ... @@ -69,7 +69,7 @@ class RelevantContentPlugin::RelevantContentBlock < Block
69 69 end
70 70 end
71 71  
72   - if self.show_most_voted != 0
  72 + if self.show_most_voted
73 73 docs = Article.most_voted(owner, self.limit)
74 74 if !docs.blank?
75 75 subcontent = ""
... ...
plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml
1 1 <div id='edit-relevant-content-block'>
2 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 8 </div>
9 9 \ No newline at end of file
... ...