Commit 2fa3897980c7fdfd7c3743c3e52f29ab0bcf3b2f

Authored by Fabio Teixeira
Committed by Thiago Ribeiro
1 parent e0ca6a86
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

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 +
... ...