Commit 66bdeedfb78c9417cc1bf723652c9588d4ce22ff

Authored by Caio Almeida
1 parent 99a71058

Ticket #85: Put the interests block under the plugin scope

plugins/person_tags/lib/person_tags_block.rb
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -class PersonTagsBlock < Block  
2 - def view_title  
3 - self.default_title  
4 - end  
5 -  
6 - def tags  
7 - owner.tag_list  
8 - end  
9 -  
10 - def extra_option  
11 - {}  
12 - end  
13 -  
14 - def self.description  
15 - _('Fields of Interest')  
16 - end  
17 -  
18 - def help  
19 - _('Things that this person is interested in')  
20 - end  
21 -  
22 - def default_title  
23 - _('Fields of Interest')  
24 - end  
25 -  
26 - def self.expire_on  
27 - { profile: [:profile] }  
28 - end  
29 -end  
plugins/person_tags/lib/person_tags_plugin.rb
@@ -22,7 +22,7 @@ class PersonTagsPlugin &lt; Noosfero::Plugin @@ -22,7 +22,7 @@ class PersonTagsPlugin &lt; Noosfero::Plugin
22 22
23 def self.extra_blocks 23 def self.extra_blocks
24 { 24 {
25 - PersonTagsBlock => { type: Person } 25 + PersonTagsPlugin::InterestsBlock => { type: Person }
26 } 26 }
27 end 27 end
28 28
plugins/person_tags/lib/person_tags_plugin/interests_block.rb 0 → 100644
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
  1 +class PersonTagsPlugin::InterestsBlock < Block
  2 + def view_title
  3 + self.default_title
  4 + end
  5 +
  6 + def tags
  7 + owner.tag_list
  8 + end
  9 +
  10 + def extra_option
  11 + {}
  12 + end
  13 +
  14 + def self.description
  15 + _('Fields of Interest')
  16 + end
  17 +
  18 + def help
  19 + _('Things that this person is interested in')
  20 + end
  21 +
  22 + def default_title
  23 + _('Fields of Interest')
  24 + end
  25 +
  26 + def self.expire_on
  27 + { profile: [:profile] }
  28 + end
  29 +end
plugins/person_tags/views/blocks/interests.html.erb 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +<%= block_title(block.view_title, block.subtitle) %>
  2 +
  3 +<div class="person-tags-block">
  4 + <% unless block.tags.size == 0 %>
  5 + <ul>
  6 + <% block.tags.each do |tag| %>
  7 + <li><%= tag %></li>
  8 + <% end %>
  9 + </ul>
  10 + <% else %>
  11 + <div class="person-tags-block-none"><%= c_('None') %></div>
  12 + <% end %>
  13 + <br style="clear:both" />
  14 +</div>
plugins/person_tags/views/blocks/person_tags.html.erb
@@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
1 -<%= block_title(block.view_title, block.subtitle) %>  
2 -  
3 -<div class="person-tags-block">  
4 - <% unless block.tags.size == 0 %>  
5 - <ul>  
6 - <% block.tags.each do |tag| %>  
7 - <li><%= tag %></li>  
8 - <% end %>  
9 - </ul>  
10 - <% else %>  
11 - <div class="person-tags-block-none"><%= c_('None') %></div>  
12 - <% end %>  
13 - <br style="clear:both" />  
14 -</div>