Commit 2fa3897980c7fdfd7c3743c3e52f29ab0bcf3b2f
Committed by
Thiago Ribeiro
1 parent
e0ca6a86
Exists in
master
and in
79 other branches
add wiki block instead of wiki tab
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com> Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com> Conflicts: lib/software_communities_plugin.rb
Showing
5 changed files
with
60 additions
and
10 deletions
Show diff stats
lib/software_communities_plugin.rb
@@ -41,7 +41,8 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | @@ -41,7 +41,8 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | ||
41 | CategoriesSoftwareBlock => { :type => [Environment] }, | 41 | CategoriesSoftwareBlock => { :type => [Environment] }, |
42 | SearchCatalogBlock => { :type => [Environment] }, | 42 | SearchCatalogBlock => { :type => [Environment] }, |
43 | SoftwareHighlightsBlock => { :type => [Environment] }, | 43 | SoftwareHighlightsBlock => { :type => [Environment] }, |
44 | - SoftwareTabDataBlock => {:type => [Community], :position => 1} | 44 | + SoftwareTabDataBlock => {:type => [Community], :position => 1}, |
45 | + WikiBlock => {:type => [Community]} | ||
45 | } | 46 | } |
46 | end | 47 | end |
47 | 48 |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +class WikiBlock < Block | ||
2 | + | ||
3 | + attr_accessible :show_name, :wiki_link | ||
4 | + settings_items :show_name, :type => :boolean, :default => false | ||
5 | + settings_items :wiki_link, :type => :string, :default => "" | ||
6 | + | ||
7 | + def self.description | ||
8 | + _('Wiki Link') | ||
9 | + end | ||
10 | + | ||
11 | + def help | ||
12 | + _('This block displays a link to the software wiki.') | ||
13 | + end | ||
14 | + | ||
15 | + def content(args={}) | ||
16 | + block = self | ||
17 | + s = show_name | ||
18 | + | ||
19 | + lambda do |object| | ||
20 | + render( | ||
21 | + :file => 'blocks/wiki', | ||
22 | + :locals => { :block => block, :show_name => s } | ||
23 | + ) | ||
24 | + end | ||
25 | + end | ||
26 | + | ||
27 | + def cacheable? | ||
28 | + true | ||
29 | + end | ||
30 | +end |
views/blocks/software_tab_data.html.erb
1 | -<div id="block-community-tabs"> | ||
2 | - <% tabs = [] %> | ||
3 | - <% tabs << {:title => _("Activity"), :id => 'activity-tab', :content => ""} %> | ||
4 | - <% tabs << {:title => _("Discussions"), :id => 'discussions-tab', :content => ""} %> | ||
5 | - <% tabs << {:title => _("Blog"), :id => 'blog-tab', :content => (render partial: "blocks/software_tab_blog", :locals => {block: block})} %> | ||
6 | - <% tabs << {:title => _("Wiki"), :id => 'wiki-tab', :content => ""} %> | ||
7 | - <% tabs << {:title => _("Repository Feed"), :id => 'repository-feed-tab', :content => ""} %> | 1 | +<% if block.owner.software_info.nil? %> |
2 | + <%= _("This community needs a software to use this block") %> | ||
3 | +<% else %> | ||
4 | + <div id="block-community-tabs"> | ||
5 | + <% tabs = [] %> | ||
6 | + <% tabs << {:title => _("Discussions"), :id => 'discussions-tab', :content => ""} %> | ||
7 | + <% tabs << {:title => _("Blog"), :id => 'blog-tab', :content => (render partial: "blocks/software_tab_blog", :locals => {block: block})} %> | ||
8 | + <% tabs << {:title => _("Repository Feed"), :id => 'repository-feed-tab', :content => ""} %> | ||
9 | + | ||
10 | + <%= render_tabs(tabs) %> | ||
11 | + </div> | ||
12 | +<% end %> | ||
8 | 13 | ||
9 | - <%= render_tabs(tabs) %> | ||
10 | -</div> |