diff --git a/lib/software_communities_plugin.rb b/lib/software_communities_plugin.rb index 07ad801..1f2c36c 100644 --- a/lib/software_communities_plugin.rb +++ b/lib/software_communities_plugin.rb @@ -41,7 +41,8 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin CategoriesSoftwareBlock => { :type => [Environment] }, SearchCatalogBlock => { :type => [Environment] }, SoftwareHighlightsBlock => { :type => [Environment] }, - SoftwareTabDataBlock => {:type => [Community], :position => 1} + SoftwareTabDataBlock => {:type => [Community], :position => 1}, + WikiBlock => {:type => [Community]} } end diff --git a/lib/wiki_block.rb b/lib/wiki_block.rb new file mode 100644 index 0000000..3d7da90 --- /dev/null +++ b/lib/wiki_block.rb @@ -0,0 +1,30 @@ +class WikiBlock < Block + + attr_accessible :show_name, :wiki_link + settings_items :show_name, :type => :boolean, :default => false + settings_items :wiki_link, :type => :string, :default => "" + + def self.description + _('Wiki Link') + end + + def help + _('This block displays a link to the software wiki.') + end + + def content(args={}) + block = self + s = show_name + + lambda do |object| + render( + :file => 'blocks/wiki', + :locals => { :block => block, :show_name => s } + ) + end + end + + def cacheable? + true + end +end diff --git a/views/blocks/software_tab_data.html.erb b/views/blocks/software_tab_data.html.erb index 3438b0d..3b0a1ce 100644 --- a/views/blocks/software_tab_data.html.erb +++ b/views/blocks/software_tab_data.html.erb @@ -1,10 +1,13 @@ -
- <% tabs = [] %> - <% tabs << {:title => _("Activity"), :id => 'activity-tab', :content => ""} %> - <% tabs << {:title => _("Discussions"), :id => 'discussions-tab', :content => ""} %> - <% tabs << {:title => _("Blog"), :id => 'blog-tab', :content => (render partial: "blocks/software_tab_blog", :locals => {block: block})} %> - <% tabs << {:title => _("Wiki"), :id => 'wiki-tab', :content => ""} %> - <% tabs << {:title => _("Repository Feed"), :id => 'repository-feed-tab', :content => ""} %> +<% if block.owner.software_info.nil? %> + <%= _("This community needs a software to use this block") %> +<% else %> +
+ <% tabs = [] %> + <% tabs << {:title => _("Discussions"), :id => 'discussions-tab', :content => ""} %> + <% tabs << {:title => _("Blog"), :id => 'blog-tab', :content => (render partial: "blocks/software_tab_blog", :locals => {block: block})} %> + <% tabs << {:title => _("Repository Feed"), :id => 'repository-feed-tab', :content => ""} %> + + <%= render_tabs(tabs) %> +
+<% end %> - <%= render_tabs(tabs) %> -
diff --git a/views/blocks/wiki.html.erb b/views/blocks/wiki.html.erb new file mode 100644 index 0000000..3d2757b --- /dev/null +++ b/views/blocks/wiki.html.erb @@ -0,0 +1,6 @@ +<% if block.owner.software_info.nil? %> + <%= _("This community needs a software to use this block") %> +<% else %> + <%= link_to _("Wiki") , block.wiki_link, :id => "bt_repositorio", :target => "_blank" %> +<% end %> + diff --git a/views/box_organizer/_wiki_block.html.erb b/views/box_organizer/_wiki_block.html.erb new file mode 100644 index 0000000..489b85d --- /dev/null +++ b/views/box_organizer/_wiki_block.html.erb @@ -0,0 +1,10 @@ +
+ + +
+ <%= text_field_tag "block[wiki_link]", value=@block.wiki_link %> +
+
+ -- libgit2 0.21.2