Commit 6f434dd372e84c78c801bca5ac40317d84745fd2

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

Fix some institution problems:

-Add the create institution option on admin panel
-Fix some accentuation issues. Still needs to make the seed.rb file to
populate the DB with the initial options
-Add cancel button on the create institution form
lib/gov_user_plugin.rb
... ... @@ -137,6 +137,18 @@ class GovUserPlugin < Noosfero::Plugin
137 137 )
138 138 end
139 139  
  140 + def admin_panel_links
  141 + [
  142 + {
  143 + :title => _('Create Institution'),
  144 + :url => {
  145 + :controller => 'gov_user_plugin',
  146 + :action => 'create_institution_admin'
  147 + }
  148 + }
  149 + ]
  150 + end
  151 +
140 152 protected
141 153  
142 154 def profile_required_list
... ...
public/static/governmental_powers.txt
1 1 Executivo
2 2 Legislativo
3   -Judiciario
4   -Nao se aplica
  3 +Judiciário
  4 +Não se aplica
... ...
public/static/governmental_sphere.txt
1 1 Federal
2 2 Estadual
3 3 Distrital
4   -Municipal
5 4 \ No newline at end of file
  5 +Municipal
... ...
public/static/juridical_nature.txt
1   -Administracao Direta
  1 +Administração Direta
2 2 Autarquia
3   -Empresa Publica
4   -Fundacao
5   -Orgao Autonomo
  3 +Empresa Pública
  4 +Fundação
  5 +Orgão Autônomo
6 6 Sociedade
7 7 Sociedade Civil
8 8 Sociedade de Economia Mista
... ...
public/views/create-institution.js
... ... @@ -125,6 +125,11 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement']
125 125 });
126 126 }
127 127  
  128 + function cancel_institution(evt){
  129 + evt.preventDefault();
  130 + $('#institution_dialog').dialog('close');
  131 + }
  132 +
128 133  
129 134 function institution_already_exists(){
130 135 if( this.value.length >= 3 ) {
... ... @@ -187,8 +192,6 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement']
187 192  
188 193  
189 194 function add_new_institution(evt) {
190   - (" JAJAjAjAJAJaJ ADD NEW INST")
191   -
192 195 evt.preventDefault();
193 196 var selected = $("#institution_selected");
194 197 var institution_already_added = $(".institutions_added li[data-institution='"+selected.val()+"']").length;
... ... @@ -227,6 +230,8 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement']
227 230 var cnpj = $("#institutions_cnpj").parent().parent();
228 231 var city = $("#community_city").parent().parent();
229 232 var state = $("#community_state").parent().parent();
  233 + var inst_type = $("input[name='institutions[type]']:checked").val();
  234 + institution_type_actions(inst_type)
230 235  
231 236 if( country === "-1" ) $("#community_country").val("BR");
232 237  
... ... @@ -243,7 +248,8 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement']
243 248  
244 249  
245 250 function institution_type_actions(type) {
246   - if( type === "PublicInstitution" ) {
  251 + var country = $("#community_country").val();
  252 + if( type === "PublicInstitution" && country == "BR") {
247 253 show_public_institutions_fields();
248 254 } else {
249 255 show_private_institutions_fields();
... ... @@ -255,6 +261,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement']
255 261 var divisor_option = SelectElement.generateOption("-1", "--------------------------------");
256 262 var default_option = SelectElement.generateOption("BR", "Brazil");
257 263  
  264 +
258 265 var inst_type = $("input[name='institutions[type]']:checked").val();
259 266 var country = $("#community_country").val();
260 267  
... ... @@ -282,6 +289,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement']
282 289 });
283 290  
284 291 $('#save_institution_button').click(save_institution);
  292 + $('#cancel_institution_button').click(cancel_institution);
285 293  
286 294 $("#community_name").keyup(institution_already_exists);
287 295  
... ...
views/gov_user_plugin/_institution.html.erb
... ... @@ -64,7 +64,7 @@
64 64 <span class='required-field'>
65 65 <div class="formfield">
66 66 <label for="community_state" class="formlabel"><%= _("State") %></label>
67   - <%= f.select(:state, @state_list.collect {|state| [state.name, state.name]}) %>
  67 + <%= f.select(:state, [[_('Select a state'), '-1']] | @state_list.collect {|state| [state.name, state.name]}) %>
68 68 </div>
69 69 </span>
70 70  
... ... @@ -115,9 +115,11 @@
115 115  
116 116 <% if @url_token == "create_institution_admin" %>
117 117 <%= submit_button :save, _('Save') %>
  118 + <%= button(:cancel, _("Cancel"), {:controller => "admin_panel", :action => 'index'}) %>
118 119 <%else%>
119 120 <div>
120 121 <%= link_to(_('Save'), '#', :id=>'save_institution_button', :class=>'button with-text icon-add') %>
  122 + <%= link_to(_('Cancel'), '#', :id=>"cancel_institution_button", :class=>'button with-text icon-cancel') %>
121 123 </div>
122 124 <%= hidden_field_tag :institution_error_message, _("Could not send the form data to the server") %>
123 125 <%end%>
... ...