Commit 2fa3897980c7fdfd7c3743c3e52f29ab0bcf3b2f

Authored by Fabio Teixeira
Committed by Thiago Ribeiro
1 parent e0ca6a86

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
lib/software_communities_plugin.rb
... ... @@ -41,7 +41,8 @@ class SoftwareCommunitiesPlugin &lt; Noosfero::Plugin
41 41 CategoriesSoftwareBlock => { :type => [Environment] },
42 42 SearchCatalogBlock => { :type => [Environment] },
43 43 SoftwareHighlightsBlock => { :type => [Environment] },
44   - SoftwareTabDataBlock => {:type => [Community], :position => 1}
  44 + SoftwareTabDataBlock => {:type => [Community], :position => 1},
  45 + WikiBlock => {:type => [Community]}
45 46 }
46 47 end
47 48  
... ...
lib/wiki_block.rb 0 → 100644
... ... @@ -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>
... ...
views/blocks/wiki.html.erb 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<% if block.owner.software_info.nil? %>
  2 + <%= _("This community needs a software to use this block") %>
  3 +<% else %>
  4 + <%= link_to _("Wiki") , block.wiki_link, :id => "bt_repositorio", :target => "_blank" %>
  5 +<% end %>
  6 +
... ...
views/box_organizer/_wiki_block.html.erb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<div class="formfieldline">
  2 + <label class="formlabel" for="block_title">
  3 + <%= _("Wiki link") %>
  4 + </label>
  5 +
  6 + <div class="formfield type-text">
  7 + <%= text_field_tag "block[wiki_link]", value=@block.wiki_link %>
  8 + </div>
  9 +</div>
  10 +
... ...