Commit 05fc8a5c58579bfb4f27939c5a24b95bc08c3ff2

Authored by Fabio Teixeira
Committed by Gabriela Navarro
1 parent ecbff9f5
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

Create an initializer and load ControlPanel

lib/software_communities_plugin.rb
... ... @@ -122,8 +122,11 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin
122 122 %w(
123 123 vendor/jquery.maskedinput.min.js
124 124 vendor/modulejs-1.5.0.min.js
125   - spb-utils.js
126   - mpog-software.js
  125 + vendor/jquery.js
  126 + lib/noosfero-root.js
  127 + lib/select-element.js
  128 + views/control-panel.js
  129 + initializer.js
127 130 mpog-software-validations.js
128 131 mpog-user-validations.js
129 132 mpog-institution-validations.js
... ...
public/initializer.js 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +var dependencies = [
  2 + 'ControlPanel'
  3 +];
  4 +
  5 +
  6 +modulejs.define('Initializer', dependencies, function(cp) {
  7 + if( cp.isControlPanel() ) {
  8 + cp.init();
  9 + }
  10 +});
  11 +
  12 +
  13 +(function() {
  14 + 'use strict';
  15 +
  16 + var $ = modulejs.require('jquery');
  17 + Initializer = modulejs.require('Initializer');
  18 +
  19 +
  20 + $(document).ready(function() {
  21 + Initializer();
  22 + });
  23 +})();
0 24 \ No newline at end of file
... ...
public/lib/noosfero-root.js 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +modulejs.define('NoosferoRoot', function() {
  2 + function url_with_subdirectory(url) {
  3 + return noosfero_root() + url;
  4 + }
  5 +
  6 + return {
  7 + urlWithSubDirectory: url_with_subdirectory
  8 + }
  9 +});
... ...
public/lib/select-element.js 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +modulejs.define('SelectElement', function() {
  2 + function SelectElement(name, id) {
  3 + this.select = document.createElement("select");
  4 + }
  5 +
  6 +
  7 + SelectElement.prototype.setAttr = function(attr, value) {
  8 + return this.select.setAttribute(attr, value);
  9 + };
  10 +
  11 +
  12 + SelectElement.prototype.addOption = function(option) {
  13 + return this.select.add(option);
  14 + };
  15 +
  16 +
  17 + SelectElement.prototype.getSelect = function() {
  18 + return this.select;
  19 + };
  20 +
  21 +
  22 + SelectElement.generateOption = function(value, text) {
  23 + var option;
  24 + option = document.createElement("option");
  25 + option.setAttribute("value", value);
  26 + option.text = text;
  27 + return option;
  28 + };
  29 +
  30 +
  31 + return SelectElement;
  32 +});
... ...
public/mpog-software.js
... ... @@ -1,42 +0,0 @@
1   -(function(){
2   - function hide_infos(){
3   - jQuery(".language-info").hide();
4   - jQuery(".database-info").hide();
5   - jQuery(".libraries-info").hide();
6   - jQuery(".operating-system-info").hide();
7   - jQuery(".language-button-hide").hide();
8   - jQuery(".database-button-hide").hide();
9   - jQuery(".libraries-button-hide").hide();
10   - jQuery(".operating-system-button-hide").hide();
11   - }
12   -
13   - function add_software_on_control_panel(control_panel) {
14   - var software_link = jQuery(".control-panel-software-link").remove();
15   -
16   - if( software_link.size() > 0 ) {
17   - control_panel.prepend(software_link);
18   - }
19   - }
20   -
21   - function add_institution_on_control_panel(control_panel) {
22   - var institution_link = jQuery(".control-panel-instituton-link").remove();
23   -
24   - if( institution_link.size() > 0 ) {
25   - control_panel.prepend(institution_link);
26   - }
27   - }
28   -
29   - function add_itens_on_controla_panel() {
30   - var control_panel = jQuery(".control-panel");
31   -
32   - if( control_panel.size() > 0 ) {
33   - add_software_on_control_panel(control_panel);
34   - add_institution_on_control_panel(control_panel);
35   - }
36   - }
37   -
38   - jQuery(document).ready(function(){
39   - add_itens_on_controla_panel();
40   - hide_infos();
41   - });
42   -})();
43 0 \ No newline at end of file
public/software-catalog.js
... ... @@ -8,7 +8,7 @@
8 8  
9 9  
10 10 function show_head_message() {
11   - if ($("#filter-categories-select-catalog").text().blank()){
  11 + if ($("#filter-categories-select-catalog").text()){
12 12 $("#filter-categories-select-catalog").hide();
13 13 $("#filter-option-catalog-software").show();
14 14 }else{
... ...
public/spb-utils.js
... ... @@ -1,37 +0,0 @@
1   -/*
2   -* "Class" for select and option html generation
3   -*/
4   -var SelectElement = (function() {
5   - function SelectElement(name, id) {
6   - this.select = document.createElement("select");
7   - }
8   -
9   - SelectElement.prototype.setAttr = function(attr, value) {
10   - return this.select.setAttribute(attr, value);
11   - };
12   -
13   - SelectElement.prototype.addOption = function(option) {
14   - return this.select.add(option);
15   - };
16   -
17   - SelectElement.prototype.getSelect = function() {
18   - return this.select;
19   - };
20   -
21   - SelectElement.generateOption = function(value, text) {
22   - var option;
23   - option = document.createElement("option");
24   - option.setAttribute("value", value);
25   - option.text = text;
26   - return option;
27   - };
28   -
29   - return SelectElement;
30   -})();
31   -
32   -
33   -function url_with_subdirectory(url) {
34   - var subdirectory = jQuery("meta[property='noosfero:root']").attr("content");
35   -
36   - return subdirectory+url;
37   -}
38 0 \ No newline at end of file
public/vendor/jquery.js 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +modulejs.define('jquery', function() {
  2 + return jQuery;
  3 +});
... ...
public/views/control-panel.js 0 → 100644
... ... @@ -0,0 +1,53 @@
  1 +modulejs.define('ControlPanel', ['jquery'], function($) {
  2 + function hide_infos(){
  3 + $(".language-info").hide();
  4 + $(".database-info").hide();
  5 + $(".libraries-info").hide();
  6 + $(".operating-system-info").hide();
  7 + $(".language-button-hide").hide();
  8 + $(".database-button-hide").hide();
  9 + $(".libraries-button-hide").hide();
  10 + $(".operating-system-button-hide").hide();
  11 + }
  12 +
  13 +
  14 + function add_software_on_control_panel(control_panel) {
  15 + var software_link = $(".control-panel-software-link").remove();
  16 +
  17 + if( software_link.size() > 0 ) {
  18 + control_panel.prepend(software_link);
  19 + }
  20 + }
  21 +
  22 +
  23 + function add_institution_on_control_panel(control_panel) {
  24 + var institution_link = $(".control-panel-instituton-link").remove();
  25 +
  26 + if( institution_link.size() > 0 ) {
  27 + control_panel.prepend(institution_link);
  28 + }
  29 + }
  30 +
  31 +
  32 + function add_itens_on_controla_panel() {
  33 + var control_panel = $(".control-panel");
  34 +
  35 + if( control_panel.size() > 0 ) {
  36 + add_software_on_control_panel(control_panel);
  37 + add_institution_on_control_panel(control_panel);
  38 + }
  39 + }
  40 +
  41 +
  42 + return {
  43 + isControlPanel: function() {
  44 + return $("#profile-editor-index").length == 1;
  45 + },
  46 +
  47 +
  48 + init: function() {
  49 + add_itens_on_controla_panel();
  50 + hide_infos();
  51 + }
  52 + }
  53 +});
... ...