Commit 517180c6e35e28d7e7563b38ebc675dba778bf77

Authored by Thiago Ribeiro
2 parents dbdf7b11 b7d62204

Merge branch 'create_institution_bootstrap_modal' into 'master'

Create institution bootstrap modal

Add modal to create institution in use report.

See merge request !87
Showing 25 changed files with 1176 additions and 399 deletions   Show diff stats
src/noosfero-spb/gov_user/controllers/gov_user_plugin_controller.rb
@@ -117,7 +117,7 @@ class GovUserPluginController < ApplicationController @@ -117,7 +117,7 @@ class GovUserPluginController < ApplicationController
117 @juridical_nature = get_juridical_natures() 117 @juridical_nature = get_juridical_natures()
118 118
119 state_list = get_state_list() 119 state_list = get_state_list()
120 - @state_options = state_list.zip(state_list).prepend([_('Select a state'), '-1']) 120 + @state_options = state_list.zip(state_list)
121 end 121 end
122 122
123 def get_model_by_params_field 123 def get_model_by_params_field
src/noosfero-spb/gov_user/features/rating_institution_registration.feature 0 → 100644
@@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
  1 +Feature: Create institution on user report
  2 + As a user
  3 + I want to create a institution in use report of a software
  4 + to add institution in report.
  5 +
  6 + Background:
  7 + Given "GovUserPlugin" plugin is enabled
  8 + And "SoftwareCommunitiesPlugin" plugin is enabled
  9 + And "OrganizationRatings" plugin is enabled
  10 + And I am logged in as mpog_admin
  11 + And I go to /admin/plugins
  12 + And I check "GovUserPlugin"
  13 + And I check "SoftwareCommunitiesPlugin"
  14 + And I check "Organization Ratings"
  15 + And I press "Save changes"
  16 + And the following softwares
  17 + | name | public_software | finality |
  18 + | Noosfero | true | some finality |
  19 +
  20 + @selenium
  21 + Scenario: Test Additional JavaScript Fields
  22 + Given I go to /profile/noosfero/plugin/organization_ratings/new_rating
  23 + And I should not see "Number of Beneficiaries"
  24 + And I should not see "Saved resources"
  25 + And I should not see "Organization name or Enterprise name"
  26 + When I click on anything with selector "#comments-additional-information"
  27 + Then I should see "Number of Beneficiaries"
  28 + And I should see "Organization name or Enterprise name"
  29 + And I should see "Saved resources"
  30 +
  31 + @selenium
  32 + Scenario: Show new institution fields when clicked in add new institution
  33 + Given I go to /profile/noosfero/plugin/organization_ratings/new_rating
  34 + And I click on anything with selector "#comments-additional-information"
  35 + And I fill in "input_institution" with "None institution"
  36 + And I sleep for 2 seconds
  37 + When I follow "Add"
  38 + Then I should see "New Institution"
  39 + And I should see "Public Institution"
  40 + And I should see "Private Institution"
  41 + And I should see "Corporate Name"
  42 + And I should see "Name"
  43 + And I should see "State"
  44 + And I should see "City"
  45 + And I should see "Country"
  46 + And I should see "CNPJ"
  47 + And I should see "Acronym"
  48 + And I choose "Public Institution"
  49 + And I should see "Governmental Sphere:"
  50 + And I should see "Governmental Power:"
  51 + And I should see "Juridical Nature:"
  52 +
  53 + @selenium
  54 + Scenario: Create new institution with name changed in the modal
  55 + Given I go to /profile/noosfero/plugin/organization_ratings/new_rating
  56 + And I click on anything with selector "#comments-additional-information"
  57 + And I fill in "input_institution" with "None institution"
  58 + And I sleep for 2 seconds
  59 + When I click on anything with selector "#create_institution_link"
  60 + And I fill in "community_name" with "Noosfero Institution"
  61 + And I select "United States" from "#community_country"
  62 + And I follow "#save_institution_button"
  63 + Then I should see "Noosfero Institution"
  64 +
  65 + @selenium
  66 + Scenario: Check new institution name in the modal
  67 + Given I go to /profile/noosfero/plugin/organization_ratings/new_rating
  68 + And I click on anything with selector "#comments-additional-information"
  69 + And I fill in "input_institution" with "None institution"
  70 + And I sleep for 2 seconds
  71 + When I click on anything with selector "#create_institution_link"
  72 + Then I should see "None Institution" within "community_name"
  73 +
  74 +
  75 +
  76 +
  77 +
  78 +
src/noosfero-spb/gov_user/features/steps_definitions/gov_user_steps.rb
@@ -1,90 +0,0 @@ @@ -1,90 +0,0 @@
1 -Given /^Institutions has initial default values on database$/ do  
2 - GovernmentalPower.create(:name => "Executivo")  
3 - GovernmentalPower.create(:name => "Legislativo")  
4 - GovernmentalPower.create(:name => "Judiciario")  
5 -  
6 - GovernmentalSphere.create(:name => "Federal")  
7 -  
8 - JuridicalNature.create(:name => "Autarquia")  
9 - JuridicalNature.create(:name => "Administracao Direta")  
10 - JuridicalNature.create(:name => "Empresa Publica")  
11 - JuridicalNature.create(:name => "Fundacao")  
12 - JuridicalNature.create(:name => "Orgao Autonomo")  
13 - JuridicalNature.create(:name => "Sociedade")  
14 - JuridicalNature.create(:name => "Sociedade Civil")  
15 - JuridicalNature.create(:name => "Sociedade de Economia Mista")  
16 -  
17 - national_region = NationalRegion.new  
18 - national_region.name = "Distrito Federal"  
19 - national_region.national_region_code = '35'  
20 - national_region.national_region_type_id = NationalRegionType::STATE  
21 - national_region.save  
22 -end  
23 -  
24 -Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select|  
25 -# Wait the page javascript load  
26 -sleep 1  
27 -# Basicaly it, search for the input field, type something, wait for ajax end select an item  
28 -page.driver.browser.execute_script %Q{  
29 - var search_query = "#{input_field_selector}.ui-autocomplete-input";  
30 - var input = jQuery(search_query).first();  
31 -  
32 - input.trigger('click');  
33 - input.val('#{typed}');  
34 - input.trigger('keydown');  
35 -  
36 - window.setTimeout(function(){  
37 - search_query = ".ui-menu-item a:contains('#{should_select}')";  
38 - var typed = jQuery(search_query).first();  
39 -  
40 - typed.trigger('mouseenter').trigger('click');  
41 - console.log(jQuery('#license_info_id'));  
42 - }, 1000);  
43 - }  
44 - sleep 1  
45 -end  
46 -  
47 -Given /^the following public institutions?$/ do |table|  
48 - # table is a Cucumber::Ast::Table  
49 - table.hashes.each do |item|  
50 - community = Community.new  
51 - community.name = item[:name]  
52 - community.country = item[:country]  
53 - community.state = item[:state]  
54 - community.city = item[:city]  
55 - community.save!  
56 -  
57 - governmental_power = GovernmentalPower.where(:name => item[:governmental_power]).first  
58 - governmental_sphere = GovernmentalSphere.where(:name => item[:governmental_sphere]).first  
59 -  
60 - juridical_nature = JuridicalNature.create(:name => item[:juridical_nature])  
61 -  
62 - institution = PublicInstitution.new(:name => item[:name], :type => "PublicInstitution", :acronym => item[:acronym], :cnpj => item[:cnpj], :juridical_nature => juridical_nature, :governmental_power => governmental_power, :governmental_sphere => governmental_sphere)  
63 - institution.community = community  
64 - institution.corporate_name = item[:corporate_name]  
65 - institution.save!  
66 - end  
67 -end  
68 -  
69 -Given /^I sleep for (\d+) seconds$/ do |time|  
70 - sleep time.to_i  
71 -end  
72 -  
73 -Given /^I am logged in as mpog_admin$/ do  
74 - visit('/account/logout')  
75 -  
76 - user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com')  
77 - person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin"  
78 - user.person = person  
79 - user.save!  
80 -  
81 - user.activate  
82 - e = Environment.default  
83 - e.add_admin(user.person)  
84 -  
85 - visit('/account/login')  
86 - fill_in("Username", :with => user.login)  
87 - fill_in("Password", :with => '123456')  
88 - click_button("Log in")  
89 -end  
90 -  
src/noosfero-spb/gov_user/features/steps_definitions/gov_user_steps_backup.rb 0 → 100644
@@ -0,0 +1,93 @@ @@ -0,0 +1,93 @@
  1 +Given /^Institutions has initial default values on database$/ do
  2 + GovernmentalPower.create(:name => "Executivo")
  3 + GovernmentalPower.create(:name => "Legislativo")
  4 + GovernmentalPower.create(:name => "Judiciario")
  5 +
  6 + GovernmentalSphere.create(:name => "Federal")
  7 +
  8 + JuridicalNature.create(:name => "Autarquia")
  9 + JuridicalNature.create(:name => "Administracao Direta")
  10 + JuridicalNature.create(:name => "Empresa Publica")
  11 + JuridicalNature.create(:name => "Fundacao")
  12 + JuridicalNature.create(:name => "Orgao Autonomo")
  13 + JuridicalNature.create(:name => "Sociedade")
  14 + JuridicalNature.create(:name => "Sociedade Civil")
  15 + JuridicalNature.create(:name => "Sociedade de Economia Mista")
  16 +
  17 + national_region = NationalRegion.new
  18 + national_region.name = "Distrito Federal"
  19 + national_region.national_region_code = '35'
  20 + national_region.national_region_type_id = NationalRegionType::STATE
  21 + national_region.save
  22 +end
  23 +
  24 +Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select|
  25 +# Wait the page javascript load
  26 +sleep 1
  27 +# Basicaly it, search for the input field, type something, wait for ajax end select an item
  28 +page.driver.browser.execute_script %Q{
  29 + var search_query = "#{input_field_selector}.ui-autocomplete-input";
  30 + var input = jQuery(search_query).first();
  31 +
  32 + input.trigger('click');
  33 + input.val('#{typed}');
  34 + input.trigger('keydown');
  35 +
  36 + window.setTimeout(function(){
  37 + search_query = ".ui-menu-item a:contains('#{should_select}')";
  38 + var typed = jQuery(search_query).first();
  39 +
  40 + typed.trigger('mouseenter').trigger('click');
  41 + console.log(jQuery('#license_info_id'));
  42 + }, 1000);
  43 + }
  44 + sleep 1
  45 +end
  46 +
  47 +Given /^the following public institutions?$/ do |table|
  48 + # table is a Cucumber::Ast::Table
  49 + table.hashes.each do |item|
  50 + community = Community.new
  51 + community.name = item[:name]
  52 + community.country = item[:country]
  53 + community.state = item[:state]
  54 + community.city = item[:city]
  55 + community.save!
  56 +
  57 + governmental_power = GovernmentalPower.where(:name => item[:governmental_power]).first
  58 + governmental_sphere = GovernmentalSphere.where(:name => item[:governmental_sphere]).first
  59 +
  60 + juridical_nature = JuridicalNature.create(:name => item[:juridical_nature])
  61 +
  62 + institution = PublicInstitution.new(:name => item[:name], :type => "PublicInstitution", :acronym => item[:acronym], :cnpj => item[:cnpj], :juridical_nature => juridical_nature, :governmental_power => governmental_power, :governmental_sphere => governmental_sphere)
  63 + institution.community = community
  64 + institution.corporate_name = item[:corporate_name]
  65 + institution.save!
  66 + end
  67 +end
  68 +
  69 +Given /^I sleep for (\d+) seconds$/ do |time|
  70 + sleep time.to_i
  71 +end
  72 +
  73 +Given /^I am logged in as mpog_admin$/ do
  74 + visit('/account/logout')
  75 +
  76 + user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com')
  77 + person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin"
  78 + user.person = person
  79 + user.save!
  80 +
  81 + user.activate
  82 + e = Environment.default
  83 + e.add_admin(user.person)
  84 +
  85 + visit('/account/login')
  86 + fill_in("Username", :with => user.login)
  87 + fill_in("Password", :with => '123456')
  88 + click_button("Log in")
  89 +end
  90 +
  91 +Given /^I click on anything with selector "([^"]*)"$/ do |selector|
  92 + evaluate_script "jQuery('#{selector}').trigger('click') && true"
  93 +end
src/noosfero-spb/gov_user/features/steps_definitions/software_communities_steps.rb 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +../../../software_communities/features/step_definitions/software_communities_steps.rb
0 \ No newline at end of file 2 \ No newline at end of file
src/noosfero-spb/gov_user/lib/ext/organization_rating.rb
@@ -13,7 +13,8 @@ OrganizationRating.class_eval do @@ -13,7 +13,8 @@ OrganizationRating.class_eval do
13 def verify_institution 13 def verify_institution
14 if self.institution != nil 14 if self.institution != nil
15 institution = Institution.find_by_id self.institution.id 15 institution = Institution.find_by_id self.institution.id
16 - self.errors.add :institution, _("not found") unless institution 16 + self.errors.add :institution, _("institution not found") unless institution
  17 + return !!institution
17 end 18 end
18 end 19 end
19 20
src/noosfero-spb/gov_user/lib/gov_user_plugin.rb
@@ -150,12 +150,14 @@ class GovUserPlugin < Noosfero::Plugin @@ -150,12 +150,14 @@ class GovUserPlugin < Noosfero::Plugin
150 lib/noosfero-root.js 150 lib/noosfero-root.js
151 lib/select-element.js 151 lib/select-element.js
152 lib/select-field-choices.js 152 lib/select-field-choices.js
  153 + lib/modal-observer.js
153 views/complete-registration.js 154 views/complete-registration.js
154 views/control-panel.js 155 views/control-panel.js
155 views/create-institution.js 156 views/create-institution.js
156 views/new-community.js 157 views/new-community.js
157 views/user-edit-profile.js 158 views/user-edit-profile.js
158 views/gov-user-comments-extra-fields.js 159 views/gov-user-comments-extra-fields.js
  160 + views/institution-modal.js
159 initializer.js 161 initializer.js
160 app.js 162 app.js
161 ) 163 )
src/noosfero-spb/gov_user/lib/institution_modal_helper.rb 0 → 100644
@@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
  1 +class InstitutionModalHelper
  2 + extend(
  3 + ActionView::Helpers::FormOptionsHelper, # content_tag
  4 + ActionView::Helpers::FormTagHelper, # button_tag
  5 + ActionView::Helpers::UrlHelper, # link_to
  6 + ActionView::Context # content_tag do end
  7 + )
  8 +
  9 + def self.modal_button link_text=_("Create new institution"), display="block"
  10 + # HTML Sample in: http://getbootstrap.com/javascript/#modals-examples
  11 + content_tag :div, :id=>"institution_modal_container", :style=>"display: #{display}" do
  12 + link = link_to(
  13 + link_text,
  14 + "javascript: void(0)",
  15 + {:class=>"button with-text", :data=>{:toggle=>"modal", :target=>"#institution_modal"}, :id=>"create_institution_link"}
  16 + )
  17 +
  18 + link.concat modal
  19 + end
  20 + end
  21 +
  22 + private
  23 +
  24 + def self.modal
  25 + options = {
  26 + :id=>"institution_modal",
  27 + :role=>"dialog",
  28 + :class=>"modal fade"
  29 + }
  30 +
  31 + content_tag :div, options do
  32 + modal_dialog
  33 + end
  34 + end
  35 +
  36 + def self.modal_dialog
  37 + content_tag :div, :class=>"modal-dialog", :role=>"document" do
  38 + modal_content
  39 + end
  40 + end
  41 +
  42 + def self.modal_content
  43 + content_tag :div, :class=>"modal-content" do
  44 + #modal_header.concat(modal_body.concat(modal_footer))
  45 + modal_header.concat(modal_body)
  46 + end
  47 + end
  48 +
  49 + def self.modal_header
  50 + content_tag :div, :class=>"modal-header" do
  51 + button = button_tag :type=>"button", :data=>{:dismiss=>"modal"}, :class=>"close" do
  52 + content_tag :span, "×"
  53 + end
  54 +
  55 + h4 = content_tag :h4, _("New Institution"), :class=>"modal-title"
  56 +
  57 + button.concat h4
  58 + end
  59 + end
  60 +
  61 + def self.modal_body
  62 + content_tag :div, "", :id=>"institution_modal_body", :class=>"modal-body"
  63 + end
  64 +
  65 + #def self.modal_footer
  66 + # content_tag :div, {:class=>"modal-footer"} do
  67 + # close = button_tag _("Close"), :type=>"button", :class=>"button with-text"
  68 + # save = button_tag _("Save changes"), :type=>"button", :class=>"button with-text"
  69 + #
  70 + # close.concat save
  71 + # end
  72 + #end
  73 +end
  74 +
src/noosfero-spb/gov_user/po/gov_user.pot
@@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
6 #, fuzzy 6 #, fuzzy
7 msgid "" 7 msgid ""
8 msgstr "" 8 msgstr ""
9 -"Project-Id-Version: 1.3.1+spb2\n"  
10 -"POT-Creation-Date: 2015-10-16 19:14-0000\n" 9 +"Project-Id-Version: 1.3.1-42-ga3cd3c2\n"
  10 +"POT-Creation-Date: 2015-12-03 19:28-0000\n"
11 "PO-Revision-Date: 2015-09-01 20:59-0000\n" 11 "PO-Revision-Date: 2015-09-01 20:59-0000\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n" 13 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -23,55 +23,48 @@ msgid &quot;Name Should begin with a capital letter and no special characters&quot; @@ -23,55 +23,48 @@ msgid &quot;Name Should begin with a capital letter and no special characters&quot;
23 msgstr "" 23 msgstr ""
24 24
25 #: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:28 25 #: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:28
26 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:168 26 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:181
27 msgid "Could not find Governmental Power or Governmental Sphere" 27 msgid "Could not find Governmental Power or Governmental Sphere"
28 msgstr "" 28 msgstr ""
29 29
30 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:18  
31 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:43 30 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:137
32 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:80 31 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:80
33 msgid "Select a Governmental Sphere" 32 msgid "Select a Governmental Sphere"
34 msgstr "" 33 msgstr ""
35 34
36 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:19  
37 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:44 35 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:142
38 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:87 36 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:87
39 msgid "Select a Governmental Power" 37 msgid "Select a Governmental Power"
40 msgstr "" 38 msgstr ""
41 39
42 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:20  
43 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:45 40 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:147
44 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:93 41 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:93
45 msgid "Select a Juridical Nature" 42 msgid "Select a Juridical Nature"
46 msgstr "" 43 msgstr ""
47 44
48 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:21  
49 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:46  
50 -msgid "Select a state"  
51 -msgstr ""  
52 -  
53 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:214 45 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:227
54 msgid "Institution successful created!" 46 msgid "Institution successful created!"
55 msgstr "" 47 msgstr ""
56 48
57 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:219 49 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:232
58 msgid "Institution could not be created!" 50 msgid "Institution could not be created!"
59 msgstr "" 51 msgstr ""
60 52
61 -#: plugins/gov_user/lib/gov_user_plugin.rb:17 53 +#: plugins/gov_user/lib/gov_user_plugin.rb:21
62 msgid "Add features related to Brazilian government." 54 msgid "Add features related to Brazilian government."
63 msgstr "" 55 msgstr ""
64 56
65 -#: plugins/gov_user/lib/gov_user_plugin.rb:132  
66 -#: plugins/gov_user/lib/gov_user_plugin.rb:163 57 +#: plugins/gov_user/lib/gov_user_plugin.rb:136
  58 +#: plugins/gov_user/lib/gov_user_plugin.rb:169
67 msgid "Create Institution" 59 msgid "Create Institution"
68 msgstr "" 60 msgstr ""
69 61
70 -#: plugins/gov_user/lib/gov_user_plugin.rb:289 62 +#: plugins/gov_user/lib/gov_user_plugin.rb:295
71 msgid "Institution Info" 63 msgid "Institution Info"
72 msgstr "" 64 msgstr ""
73 65
74 -#: plugins/gov_user/lib/gov_user_plugin.rb:314 66 +#: plugins/gov_user/lib/gov_user_plugin.rb:320
  67 +#: plugins/gov_user/views/organization_ratings_extra_fields_show_institution.html.erb:4
75 msgid "Institution" 68 msgid "Institution"
76 msgstr "" 69 msgstr ""
77 70
@@ -106,7 +99,15 @@ msgid &quot;Institution Catalog&quot; @@ -106,7 +99,15 @@ msgid &quot;Institution Catalog&quot;
106 msgstr "" 99 msgstr ""
107 100
108 #: plugins/gov_user/lib/ext/organization_rating.rb:16 101 #: plugins/gov_user/lib/ext/organization_rating.rb:16
109 -msgid "not found" 102 +msgid "institution not found"
  103 +msgstr ""
  104 +
  105 +#: plugins/gov_user/lib/institution_modal_helper.rb:9
  106 +msgid "Create new institution"
  107 +msgstr ""
  108 +
  109 +#: plugins/gov_user/lib/institution_modal_helper.rb:55
  110 +msgid "New Institution"
110 msgstr "" 111 msgstr ""
111 112
112 #: plugins/gov_user/lib/institutions_block.rb:4 113 #: plugins/gov_user/lib/institutions_block.rb:4
@@ -143,97 +144,94 @@ msgid &quot;&quot; @@ -143,97 +144,94 @@ msgid &quot;&quot;
143 msgstr "" 144 msgstr ""
144 145
145 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:11 146 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:11
146 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11 147 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:18
147 msgid "\"Can`t create new Institution: #{flash[:errors].length} errors\"" 148 msgid "\"Can`t create new Institution: #{flash[:errors].length} errors\""
148 msgstr "" 149 msgstr ""
149 150
150 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:28 151 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:28
151 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:37 152 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:51
152 msgid "Public Institution" 153 msgid "Public Institution"
153 msgstr "" 154 msgstr ""
154 155
155 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:33 156 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:33
156 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:33 157 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:44
157 msgid "Private Institution" 158 msgid "Private Institution"
158 msgstr "" 159 msgstr ""
159 160
160 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:40 161 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:40
161 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:44 162 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:67
162 msgid "Institution name already exists" 163 msgid "Institution name already exists"
163 msgstr "" 164 msgstr ""
164 165
165 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:44 166 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:44
166 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:48 167 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:62
167 msgid "Corporate Name" 168 msgid "Corporate Name"
168 msgstr "" 169 msgstr ""
169 170
170 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:49 171 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:49
171 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:53 172 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:79
172 msgid "Country" 173 msgid "Country"
173 msgstr "" 174 msgstr ""
174 175
175 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:53 176 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:53
176 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:57 177 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:88
177 msgid "State" 178 msgid "State"
178 msgstr "" 179 msgstr ""
179 180
180 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:63 181 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:63
181 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:66 182 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:108
182 msgid "CNPJ" 183 msgid "CNPJ"
183 msgstr "" 184 msgstr ""
184 185
185 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:70 186 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:70
186 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:72 187 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:72
187 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:72  
188 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:74 188 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:115
  189 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:117
189 msgid "Acronym" 190 msgid "Acronym"
190 msgstr "" 191 msgstr ""
191 192
192 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:71 193 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:71
193 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:73 194 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:71
  195 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:116
194 msgid "Fantasy name" 196 msgid "Fantasy name"
195 msgstr "" 197 msgstr ""
196 198
197 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:79 199 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:79
198 #: plugins/gov_user/views/profile/_institution_tab.html.erb:17 200 #: plugins/gov_user/views/profile/_institution_tab.html.erb:17
199 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:81  
200 msgid "Governmental Sphere:" 201 msgid "Governmental Sphere:"
201 msgstr "" 202 msgstr ""
202 203
203 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:86 204 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:86
204 #: plugins/gov_user/views/profile/_institution_tab.html.erb:16 205 #: plugins/gov_user/views/profile/_institution_tab.html.erb:16
205 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:88  
206 msgid "Governmental Power:" 206 msgid "Governmental Power:"
207 msgstr "" 207 msgstr ""
208 208
209 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:92 209 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:92
210 #: plugins/gov_user/views/profile/_institution_tab.html.erb:18 210 #: plugins/gov_user/views/profile/_institution_tab.html.erb:18
211 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:94  
212 msgid "Juridical Nature:" 211 msgid "Juridical Nature:"
213 msgstr "" 212 msgstr ""
214 213
215 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99 214 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99
216 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:101  
217 msgid "SISP?" 215 msgid "SISP?"
218 msgstr "" 216 msgstr ""
219 217
220 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101 218 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101
221 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19 219 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19
222 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:104 220 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:165
223 msgid "Yes" 221 msgid "Yes"
224 msgstr "" 222 msgstr ""
225 223
226 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:103 224 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:103
227 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:106 225 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:106
228 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19 226 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19
229 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:106  
230 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:108 227 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:170
  228 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:174
231 msgid "No" 229 msgid "No"
232 msgstr "" 230 msgstr ""
233 231
234 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:111 232 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:111
235 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:114  
236 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:118 233 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:184
  234 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:187
237 msgid "Save" 235 msgid "Save"
238 msgstr "" 236 msgstr ""
239 237
@@ -281,57 +279,80 @@ msgstr &quot;&quot; @@ -281,57 +279,80 @@ msgstr &quot;&quot;
281 msgid "Organization name or Enterprise name" 279 msgid "Organization name or Enterprise name"
282 msgstr "" 280 msgstr ""
283 281
284 -#: plugins/gov_user/views/ratings_extra_field.html.erb:6  
285 -#: plugins/gov_user/views/person_editor_extras.html.erb:21  
286 -msgid "No institution found" 282 +#: plugins/gov_user/views/ratings_extra_field.html.erb:7
  283 +msgid "No organization or company found"
287 msgstr "" 284 msgstr ""
288 285
289 -#: plugins/gov_user/views/person_editor_extras.html.erb:2  
290 -msgid "Secondary e-mail" 286 +#: plugins/gov_user/views/ratings_extra_field.html.erb:8
  287 +msgid "Add"
291 msgstr "" 288 msgstr ""
292 289
293 -#: plugins/gov_user/views/person_editor_extras.html.erb:22  
294 -msgid "Add new institution" 290 +#: plugins/gov_user/views/person_editor_extras.html.erb:2
  291 +msgid "Secondary e-mail"
295 msgstr "" 292 msgstr ""
296 293
297 -#: plugins/gov_user/views/person_editor_extras.html.erb:23  
298 -msgid "Create new institution" 294 +#: plugins/gov_user/views/person_editor_extras.html.erb:21
  295 +msgid "No institution found"
299 msgstr "" 296 msgstr ""
300 297
301 -#: plugins/gov_user/views/person_editor_extras.html.erb:39 298 +#: plugins/gov_user/views/person_editor_extras.html.erb:38
302 msgid "Should begin with a capital letter and no special characters" 299 msgid "Should begin with a capital letter and no special characters"
303 msgstr "" 300 msgstr ""
304 301
305 -#: plugins/gov_user/views/person_editor_extras.html.erb:40 302 +#: plugins/gov_user/views/person_editor_extras.html.erb:39
306 msgid "Email should have the following format: name@host.br" 303 msgid "Email should have the following format: name@host.br"
307 msgstr "" 304 msgstr ""
308 305
309 -#: plugins/gov_user/views/person_editor_extras.html.erb:41 306 +#: plugins/gov_user/views/person_editor_extras.html.erb:40
310 msgid "Site should have a valid format: http://name.hosts" 307 msgid "Site should have a valid format: http://name.hosts"
311 msgstr "" 308 msgstr ""
312 309
313 -#: plugins/gov_user/views/person_editor_extras.html.erb:42 310 +#: plugins/gov_user/views/person_editor_extras.html.erb:41
314 msgid "If you work in a public agency use your government e-Mail" 311 msgid "If you work in a public agency use your government e-Mail"
315 msgstr "" 312 msgstr ""
316 313
317 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:1  
318 -msgid "New Institution" 314 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11
  315 +msgid "The highlighted fields are mandatory"
319 msgstr "" 316 msgstr ""
320 317
321 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:16 318 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:23
322 msgid "\"<b>#{key_name.capitalize}</b> #{value.join()}\"" 319 msgid "\"<b>#{key_name.capitalize}</b> #{value.join()}\""
323 msgstr "" 320 msgstr ""
324 321
325 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:115  
326 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:119 322 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:83
  323 +msgid "Select a country"
  324 +msgstr ""
  325 +
  326 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:97
  327 +msgid "City"
  328 +msgstr ""
  329 +
  330 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:125
  331 +msgid "Governmental Sphere"
  332 +msgstr ""
  333 +
  334 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:136
  335 +msgid "Governmental Power"
  336 +msgstr ""
  337 +
  338 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:147
  339 +msgid "Juridical Nature"
  340 +msgstr ""
  341 +
  342 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:157
  343 +msgid "SISP ?"
  344 +msgstr ""
  345 +
  346 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:185
  347 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:188
327 msgid "Cancel" 348 msgid "Cancel"
328 msgstr "" 349 msgstr ""
329 350
330 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:121 351 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:189
331 msgid "Could not send the form data to the server" 352 msgid "Could not send the form data to the server"
332 msgstr "" 353 msgstr ""
333 354
334 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:128 355 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:197
335 msgid "Creating institution" 356 msgid "Creating institution"
336 msgstr "" 357 msgstr ""
337 358
src/noosfero-spb/gov_user/po/pt/gov_user.po
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 # 5 #
6 msgid "" 6 msgid ""
7 msgstr "" 7 msgstr ""
8 -"Project-Id-Version: 1.3.1+spb2\n"  
9 -"POT-Creation-Date: 2015-10-16 19:14-0000\n" 8 +"Project-Id-Version: 1.3.1-42-ga3cd3c2\n"
  9 +"POT-Creation-Date: 2015-12-03 19:28-0000\n"
10 "PO-Revision-Date: 2015-09-01 19:55-0000\n" 10 "PO-Revision-Date: 2015-09-01 19:55-0000\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n" 12 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -23,55 +23,48 @@ msgstr &quot;&quot; @@ -23,55 +23,48 @@ msgstr &quot;&quot;
23 "Nome deve iniciar com letrar maiúscula e não deve conter carateres especiais" 23 "Nome deve iniciar com letrar maiúscula e não deve conter carateres especiais"
24 24
25 #: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:28 25 #: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:28
26 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:168 26 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:181
27 msgid "Could not find Governmental Power or Governmental Sphere" 27 msgid "Could not find Governmental Power or Governmental Sphere"
28 msgstr "Não foi possível encontrar o Poder ou Esfera Governamental" 28 msgstr "Não foi possível encontrar o Poder ou Esfera Governamental"
29 29
30 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:18  
31 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:43 30 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:137
32 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:80 31 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:80
33 msgid "Select a Governmental Sphere" 32 msgid "Select a Governmental Sphere"
34 msgstr "Selecione uma Esfera Governamental" 33 msgstr "Selecione uma Esfera Governamental"
35 34
36 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:19  
37 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:44 35 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:142
38 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:87 36 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:87
39 msgid "Select a Governmental Power" 37 msgid "Select a Governmental Power"
40 msgstr "Selecione um Poder Governamental" 38 msgstr "Selecione um Poder Governamental"
41 39
42 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:20  
43 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:45 40 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:147
44 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:93 41 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:93
45 msgid "Select a Juridical Nature" 42 msgid "Select a Juridical Nature"
46 msgstr "Seleciona uma Natureza Jurídica" 43 msgstr "Seleciona uma Natureza Jurídica"
47 44
48 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:21  
49 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:46  
50 -msgid "Select a state"  
51 -msgstr "Selecione um Estado"  
52 -  
53 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:214 45 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:227
54 msgid "Institution successful created!" 46 msgid "Institution successful created!"
55 msgstr "Instituição criada com sucesso!" 47 msgstr "Instituição criada com sucesso!"
56 48
57 -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:219 49 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:232
58 msgid "Institution could not be created!" 50 msgid "Institution could not be created!"
59 msgstr "Instituição não pode ser criada!" 51 msgstr "Instituição não pode ser criada!"
60 52
61 -#: plugins/gov_user/lib/gov_user_plugin.rb:17 53 +#: plugins/gov_user/lib/gov_user_plugin.rb:21
62 msgid "Add features related to Brazilian government." 54 msgid "Add features related to Brazilian government."
63 msgstr "Adicionar funcionlidade relacionada com o governo brasileiro." 55 msgstr "Adicionar funcionlidade relacionada com o governo brasileiro."
64 56
65 -#: plugins/gov_user/lib/gov_user_plugin.rb:132  
66 -#: plugins/gov_user/lib/gov_user_plugin.rb:163 57 +#: plugins/gov_user/lib/gov_user_plugin.rb:136
  58 +#: plugins/gov_user/lib/gov_user_plugin.rb:169
67 msgid "Create Institution" 59 msgid "Create Institution"
68 msgstr "Criar Instituição" 60 msgstr "Criar Instituição"
69 61
70 -#: plugins/gov_user/lib/gov_user_plugin.rb:289 62 +#: plugins/gov_user/lib/gov_user_plugin.rb:295
71 msgid "Institution Info" 63 msgid "Institution Info"
72 msgstr "Informações da Instituição" 64 msgstr "Informações da Instituição"
73 65
74 -#: plugins/gov_user/lib/gov_user_plugin.rb:314 66 +#: plugins/gov_user/lib/gov_user_plugin.rb:320
  67 +#: plugins/gov_user/views/organization_ratings_extra_fields_show_institution.html.erb:4
75 msgid "Institution" 68 msgid "Institution"
76 msgstr "Instituição" 69 msgstr "Instituição"
77 70
@@ -106,8 +99,16 @@ msgid &quot;Institution Catalog&quot; @@ -106,8 +99,16 @@ msgid &quot;Institution Catalog&quot;
106 msgstr "Catálogo de Instituições" 99 msgstr "Catálogo de Instituições"
107 100
108 #: plugins/gov_user/lib/ext/organization_rating.rb:16 101 #: plugins/gov_user/lib/ext/organization_rating.rb:16
109 -msgid "not found"  
110 -msgstr "não encontrada" 102 +msgid "institution not found"
  103 +msgstr "Nenhuma instituição encontrada"
  104 +
  105 +#: plugins/gov_user/lib/institution_modal_helper.rb:9
  106 +msgid "Create new institution"
  107 +msgstr "Criar nova instituição"
  108 +
  109 +#: plugins/gov_user/lib/institution_modal_helper.rb:55
  110 +msgid "New Institution"
  111 +msgstr "Nova Instituição"
111 112
112 #: plugins/gov_user/lib/institutions_block.rb:4 113 #: plugins/gov_user/lib/institutions_block.rb:4
113 #: plugins/gov_user/views/person_editor_extras.html.erb:11 114 #: plugins/gov_user/views/person_editor_extras.html.erb:11
@@ -147,98 +148,95 @@ msgstr &quot;&quot; @@ -147,98 +148,95 @@ msgstr &quot;&quot;
147 "critérios." 148 "critérios."
148 149
149 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:11 150 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:11
150 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11 151 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:18
151 msgid "\"Can`t create new Institution: #{flash[:errors].length} errors\"" 152 msgid "\"Can`t create new Institution: #{flash[:errors].length} errors\""
152 msgstr "" 153 msgstr ""
153 "\"Não foi possível criar nova Instituição: #{flash[:errors].length} erros\"" 154 "\"Não foi possível criar nova Instituição: #{flash[:errors].length} erros\""
154 155
155 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:28 156 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:28
156 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:37 157 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:51
157 msgid "Public Institution" 158 msgid "Public Institution"
158 msgstr "Instituição Pública" 159 msgstr "Instituição Pública"
159 160
160 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:33 161 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:33
161 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:33 162 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:44
162 msgid "Private Institution" 163 msgid "Private Institution"
163 msgstr "Instituição Privada" 164 msgstr "Instituição Privada"
164 165
165 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:40 166 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:40
166 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:44 167 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:67
167 msgid "Institution name already exists" 168 msgid "Institution name already exists"
168 msgstr "Nome de Instituição já existe" 169 msgstr "Nome de Instituição já existe"
169 170
170 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:44 171 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:44
171 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:48 172 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:62
172 msgid "Corporate Name" 173 msgid "Corporate Name"
173 -msgstr "Nome da Coorporação" 174 +msgstr "Razão social"
174 175
175 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:49 176 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:49
176 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:53 177 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:79
177 msgid "Country" 178 msgid "Country"
178 msgstr "País" 179 msgstr "País"
179 180
180 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:53 181 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:53
181 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:57 182 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:88
182 msgid "State" 183 msgid "State"
183 msgstr "Estado" 184 msgstr "Estado"
184 185
185 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:63 186 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:63
186 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:66 187 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:108
187 msgid "CNPJ" 188 msgid "CNPJ"
188 msgstr "CNPJ" 189 msgstr "CNPJ"
189 190
190 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:70 191 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:70
191 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:72 192 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:72
192 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:72  
193 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:74 193 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:115
  194 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:117
194 msgid "Acronym" 195 msgid "Acronym"
195 msgstr "Sigla" 196 msgstr "Sigla"
196 197
197 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:71 198 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:71
198 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:73 199 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:71
  200 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:116
199 msgid "Fantasy name" 201 msgid "Fantasy name"
200 msgstr "Nome Fantasia" 202 msgstr "Nome Fantasia"
201 203
202 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:79 204 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:79
203 #: plugins/gov_user/views/profile/_institution_tab.html.erb:17 205 #: plugins/gov_user/views/profile/_institution_tab.html.erb:17
204 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:81  
205 msgid "Governmental Sphere:" 206 msgid "Governmental Sphere:"
206 msgstr "Esfera Governamental:" 207 msgstr "Esfera Governamental:"
207 208
208 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:86 209 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:86
209 #: plugins/gov_user/views/profile/_institution_tab.html.erb:16 210 #: plugins/gov_user/views/profile/_institution_tab.html.erb:16
210 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:88  
211 msgid "Governmental Power:" 211 msgid "Governmental Power:"
212 msgstr "Poder Governamental:" 212 msgstr "Poder Governamental:"
213 213
214 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:92 214 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:92
215 #: plugins/gov_user/views/profile/_institution_tab.html.erb:18 215 #: plugins/gov_user/views/profile/_institution_tab.html.erb:18
216 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:94  
217 msgid "Juridical Nature:" 216 msgid "Juridical Nature:"
218 msgstr "Natureza Jurídica:" 217 msgstr "Natureza Jurídica:"
219 218
220 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99 219 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99
221 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:101  
222 msgid "SISP?" 220 msgid "SISP?"
223 msgstr "SISP?" 221 msgstr "SISP?"
224 222
225 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101 223 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101
226 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19 224 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19
227 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:104 225 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:165
228 msgid "Yes" 226 msgid "Yes"
229 msgstr "Sim" 227 msgstr "Sim"
230 228
231 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:103 229 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:103
232 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:106 230 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:106
233 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19 231 #: plugins/gov_user/views/profile/_institution_tab.html.erb:19
234 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:106  
235 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:108 232 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:170
  233 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:174
236 msgid "No" 234 msgid "No"
237 msgstr "Não" 235 msgstr "Não"
238 236
239 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:111 237 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:111
240 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:114  
241 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:118 238 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:184
  239 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:187
242 msgid "Save" 240 msgid "Save"
243 msgstr "Salvar" 241 msgstr "Salvar"
244 242
@@ -286,57 +284,84 @@ msgstr &quot;SISP:&quot; @@ -286,57 +284,84 @@ msgstr &quot;SISP:&quot;
286 msgid "Organization name or Enterprise name" 284 msgid "Organization name or Enterprise name"
287 msgstr "Nome da organização ou empresa" 285 msgstr "Nome da organização ou empresa"
288 286
289 -#: plugins/gov_user/views/ratings_extra_field.html.erb:6  
290 -#: plugins/gov_user/views/person_editor_extras.html.erb:21  
291 -msgid "No institution found"  
292 -msgstr "Nenhuma instituição encontrada" 287 +#: plugins/gov_user/views/ratings_extra_field.html.erb:7
  288 +msgid "No organization or company found"
  289 +msgstr "Nenhuma organização ou companhia encontrados"
  290 +
  291 +#: plugins/gov_user/views/ratings_extra_field.html.erb:8
  292 +msgid "Add"
  293 +msgstr "Adicionar"
293 294
294 #: plugins/gov_user/views/person_editor_extras.html.erb:2 295 #: plugins/gov_user/views/person_editor_extras.html.erb:2
295 msgid "Secondary e-mail" 296 msgid "Secondary e-mail"
296 msgstr "Email secundário" 297 msgstr "Email secundário"
297 298
298 -#: plugins/gov_user/views/person_editor_extras.html.erb:22  
299 -msgid "Add new institution"  
300 -msgstr "Adicionar nova instituição"  
301 -  
302 -#: plugins/gov_user/views/person_editor_extras.html.erb:23  
303 -msgid "Create new institution"  
304 -msgstr "Criar nova instituição" 299 +#: plugins/gov_user/views/person_editor_extras.html.erb:21
  300 +msgid "No institution found"
  301 +msgstr "Nenhuma instituição encontrada"
305 302
306 -#: plugins/gov_user/views/person_editor_extras.html.erb:39 303 +#: plugins/gov_user/views/person_editor_extras.html.erb:38
307 msgid "Should begin with a capital letter and no special characters" 304 msgid "Should begin with a capital letter and no special characters"
308 msgstr "Deve começar com letra maíscula e não conter caracteres especiais" 305 msgstr "Deve começar com letra maíscula e não conter caracteres especiais"
309 306
310 -#: plugins/gov_user/views/person_editor_extras.html.erb:40 307 +#: plugins/gov_user/views/person_editor_extras.html.erb:39
311 msgid "Email should have the following format: name@host.br" 308 msgid "Email should have the following format: name@host.br"
312 msgstr "Email deve ter o seguinte formato: name@host.br" 309 msgstr "Email deve ter o seguinte formato: name@host.br"
313 310
314 -#: plugins/gov_user/views/person_editor_extras.html.erb:41 311 +#: plugins/gov_user/views/person_editor_extras.html.erb:40
315 msgid "Site should have a valid format: http://name.hosts" 312 msgid "Site should have a valid format: http://name.hosts"
316 msgstr "Site deve ter um formato válido: http://name.hosts" 313 msgstr "Site deve ter um formato válido: http://name.hosts"
317 314
318 -#: plugins/gov_user/views/person_editor_extras.html.erb:42 315 +#: plugins/gov_user/views/person_editor_extras.html.erb:41
319 msgid "If you work in a public agency use your government e-Mail" 316 msgid "If you work in a public agency use your government e-Mail"
320 msgstr "Se você trabalha em uma agência pública use seu email governamental" 317 msgstr "Se você trabalha em uma agência pública use seu email governamental"
321 318
322 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:1  
323 -msgid "New Institution"  
324 -msgstr "Nova Instituição" 319 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11
  320 +msgid "The highlighted fields are mandatory"
  321 +msgstr "Todos os campos com (*) são obrigatórios"
325 322
326 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:16 323 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:23
327 msgid "\"<b>#{key_name.capitalize}</b> #{value.join()}\"" 324 msgid "\"<b>#{key_name.capitalize}</b> #{value.join()}\""
328 msgstr "\"<b>#{key_name.capitalize}</b> #{value.join()}\"" 325 msgstr "\"<b>#{key_name.capitalize}</b> #{value.join()}\""
329 326
330 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:115  
331 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:119 327 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:83
  328 +#, fuzzy
  329 +msgid "Select a country"
  330 +msgstr "Selecione um Estado"
  331 +
  332 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:97
  333 +msgid "City"
  334 +msgstr "Cidade"
  335 +
  336 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:125
  337 +#, fuzzy
  338 +msgid "Governmental Sphere"
  339 +msgstr "Esfera Governamental:"
  340 +
  341 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:136
  342 +#, fuzzy
  343 +msgid "Governmental Power"
  344 +msgstr "Poder Governamental:"
  345 +
  346 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:147
  347 +#, fuzzy
  348 +msgid "Juridical Nature"
  349 +msgstr "Natureza Jurídica:"
  350 +
  351 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:157
  352 +msgid "SISP ?"
  353 +msgstr "SISP ?"
  354 +
  355 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:185
  356 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:188
332 msgid "Cancel" 357 msgid "Cancel"
333 msgstr "Cancelar" 358 msgstr "Cancelar"
334 359
335 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:121 360 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:189
336 msgid "Could not send the form data to the server" 361 msgid "Could not send the form data to the server"
337 msgstr "Não foi possível enviar os dados do formulário para o servidor" 362 msgstr "Não foi possível enviar os dados do formulário para o servidor"
338 363
339 -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:128 364 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:197
340 msgid "Creating institution" 365 msgid "Creating institution"
341 msgstr "Criar instituição" 366 msgstr "Criar instituição"
342 367
@@ -356,8 +381,14 @@ msgstr &quot;Complete seu perfil&quot; @@ -356,8 +381,14 @@ msgstr &quot;Complete seu perfil&quot;
356 msgid "Hide" 381 msgid "Hide"
357 msgstr "Ocultar" 382 msgstr "Ocultar"
358 383
359 -#~ msgid "All fields with (*) are mandatory"  
360 -#~ msgstr "Todos os campos com (*) são obrigatórios" 384 +#~ msgid "Name"
  385 +#~ msgstr "Nome"
  386 +
  387 +#~ msgid "not found"
  388 +#~ msgstr "não encontrada"
  389 +
  390 +#~ msgid "Add new institution"
  391 +#~ msgstr "Adicionar nova instituição"
361 392
362 #~ msgid "A plugin that does this and that." 393 #~ msgid "A plugin that does this and that."
363 #~ msgstr "Um plugin que faz isso e aquilo" 394 #~ msgstr "Um plugin que faz isso e aquilo"
src/noosfero-spb/gov_user/public/initializer.js
@@ -9,7 +9,8 @@ @@ -9,7 +9,8 @@
9 'CompleteRegistration', 9 'CompleteRegistration',
10 'UserEditProfile', 10 'UserEditProfile',
11 'NewCommunity', 11 'NewCommunity',
12 - 'GovUserCommentsExtraFields' 12 + 'GovUserCommentsExtraFields',
  13 + 'InstitutionModal'
13 ]; 14 ];
14 15
15 16
src/noosfero-spb/gov_user/public/lib/modal-observer.js 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +/* globals modulejs */
  2 +
  3 +// Works on: IE 11, Edge 12+, Firefox 40+, Chrome 43+, Opera 32+, Safari 32+
  4 +modulejs.define("ModalObserver", function() {
  5 + "use strict";
  6 +
  7 + function ModalObserver(target, callback) {
  8 + this.action_callback = callback;
  9 + this.observer = new MutationObserver(this.mutationVerifier.bind(this));
  10 +
  11 + this.observer.observe(target, {attributes: true});
  12 + }
  13 +
  14 +
  15 + ModalObserver.prototype.mutationVerifier = function(mutations) {
  16 + var callback = this.action_callback;
  17 + var observer = this.observer;
  18 +
  19 + mutations.forEach(function(mutation) {
  20 + if (mutation.attributeName === "style" &&
  21 + mutation.target.style.display === "none")
  22 + {
  23 + callback();
  24 + // stop the observer, once its action is done
  25 + observer.disconnect();
  26 + }
  27 + });
  28 + };
  29 +
  30 +
  31 + return {
  32 + init: function(target, callback) {
  33 + new ModalObserver(target, callback);
  34 + }
  35 + };
  36 +});
src/noosfero-spb/gov_user/public/style.css
@@ -24,3 +24,12 @@ @@ -24,3 +24,12 @@
24 border-color: #FF0000; 24 border-color: #FF0000;
25 box-shadow: 0 0 10px #FF0000; 25 box-shadow: 0 0 10px #FF0000;
26 } 26 }
  27 +
  28 +#institution_empty_ajax_message {
  29 + margin-top: 10px;
  30 + margin-left: 0px !important;
  31 +}
  32 +
  33 +#create_institution_link {
  34 + margin-left: 8px;
  35 +}
src/noosfero-spb/gov_user/public/views/create-institution.js
@@ -4,8 +4,6 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -4,8 +4,6 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
4 'use strict'; 4 'use strict';
5 5
6 var AJAX_URL = { 6 var AJAX_URL = {
7 - create_institution_modal:  
8 - NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/create_institution"),  
9 new_institution: 7 new_institution:
10 NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/new_institution"), 8 NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/new_institution"),
11 institution_already_exists: 9 institution_already_exists:
@@ -16,30 +14,11 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -16,30 +14,11 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
16 NoosferoRoot.urlWithSubDirectory("/account/search_cities") 14 NoosferoRoot.urlWithSubDirectory("/account/search_cities")
17 }; 15 };
18 16
19 -  
20 - function open_create_institution_modal(evt) {  
21 - evt.preventDefault();  
22 -  
23 - $.get(AJAX_URL.create_institution_modal, function(response){  
24 - $("#institution_dialog").html(response);  
25 -  
26 - set_form_count_custom_data();  
27 - set_events();  
28 -  
29 - $("#institution_dialog").dialog({  
30 - modal: true,  
31 - width: 500,  
32 - height: 530,  
33 - position: 'center',  
34 - close: function() {  
35 - $("#institution_dialog").html("");  
36 - $('#institution_empty_ajax_message').switchClass("show-field", "hide-field");  
37 - }  
38 - });  
39 - }); 17 + function set_institution_field_name(name) {
  18 + $("#input_institution").attr("value", name);
  19 + $("#input_institution").autocomplete("search");
40 } 20 }
41 21
42 -  
43 function show_public_institutions_fields() { 22 function show_public_institutions_fields() {
44 $(".public-institutions-fields").show(); 23 $(".public-institutions-fields").show();
45 } 24 }
@@ -92,13 +71,28 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -92,13 +71,28 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
92 var institution_name = response.institution_data.name; 71 var institution_name = response.institution_data.name;
93 var institution_id = response.institution_data.id; 72 var institution_id = response.institution_data.id;
94 73
95 - $("#institution_dialog").html("<div class='errorExplanation'><h2>"+response.message+"</h2></div>");  
96 - $("#create_institution_errors").switchClass("show-field", "hide-field"); 74 + // Tell the user it was created
  75 + window.display_notice(response.message);
  76 +
  77 + set_institution_field_name($("#community_name").val());
  78 + //settup_created_institution();
  79 +
  80 + // Close modal
  81 + //$(".modal-header .close").trigger("click");
97 82
  83 + // Clear modal fields
  84 + $("#institution_modal_body").html(window.sessionStorage.getItem("InstitutionModalBody"));
  85 +
  86 + // Reset modal events
  87 + init_module();
  88 +
  89 +
  90 + // If the page has a user institution list, update it without repeating the institution
98 $(".institution_container").append(get_clone_institution_data(institution_id)); 91 $(".institution_container").append(get_clone_institution_data(institution_id));
99 add_selected_institution_to_list(institution_id, institution_name); 92 add_selected_institution_to_list(institution_id, institution_name);
100 -  
101 $(".remove-institution").click(remove_institution); 93 $(".remove-institution").click(remove_institution);
  94 + //$('#institution_dialog').dialog('close');
  95 + $('#institution_modal').modal('toggle');
102 } else { 96 } else {
103 var errors = create_error_list(response); 97 var errors = create_error_list(response);
104 $("#create_institution_errors").switchClass("hide-field", "show-field").html("<h2>"+response.message+"</h2>"+errors); 98 $("#create_institution_errors").switchClass("hide-field", "show-field").html("<h2>"+response.message+"</h2>"+errors);
@@ -172,7 +166,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -172,7 +166,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
172 166
173 function cancel_institution(evt){ 167 function cancel_institution(evt){
174 evt.preventDefault(); 168 evt.preventDefault();
175 - $('#institution_dialog').dialog('close'); 169 + $('#institution_modal').modal('toggle');
176 } 170 }
177 171
178 172
@@ -196,6 +190,16 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -196,6 +190,16 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
196 return user_institutions; 190 return user_institutions;
197 } 191 }
198 192
  193 + function toggle_extra_fields_style_status(status) {
  194 + if(status) {
  195 + $('.extra-fields-container').css({ marginTop: "55px" });
  196 + $('.button-bar').css({ marginTop: "55px" });
  197 + } else {
  198 + $('.extra-fields-container').css({ marginTop: "0px" });
  199 + $('.button-bar').css({ marginTop: "20px" });
  200 + }
  201 + }
  202 +
199 203
200 function institution_autocomplete() { 204 function institution_autocomplete() {
201 $("#input_institution").autocomplete({ 205 $("#input_institution").autocomplete({
@@ -209,8 +213,8 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -209,8 +213,8 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
209 213
210 if( result.length === 0 ) { 214 if( result.length === 0 ) {
211 $('#institution_empty_ajax_message').switchClass("hide-field", "show-field"); 215 $('#institution_empty_ajax_message').switchClass("hide-field", "show-field");
212 - } else {  
213 - $('#institution_empty_ajax_message').switchClass("show-field", "hide-field"); 216 + toggle_extra_fields_style_status(true);
  217 + $("#institution_modal").css({display: "none"});
214 } 218 }
215 }, 219 },
216 error: function(ajax, stat, errorThrown) { 220 error: function(ajax, stat, errorThrown) {
@@ -222,17 +226,13 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -222,17 +226,13 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
222 minLength: 2, 226 minLength: 2,
223 227
224 select : function (event, selected) { 228 select : function (event, selected) {
  229 + $('#institution_empty_ajax_message').switchClass("show-field", "hide-field");
  230 + //$("#create_institution_link").remove();
  231 + toggle_extra_fields_style_status(false);
225 $("#institution_selected").val(selected.item.id).attr("data-name", selected.item.label); 232 $("#institution_selected").val(selected.item.id).attr("data-name", selected.item.label);
226 -  
227 - // +("") -> 0; +("1") -> 1...  
228 - if (+($("#institution_selected").val()) !== 0) {  
229 - add_new_institution();  
230 - }  
231 } 233 }
232 }); 234 });
233 } 235 }
234 -  
235 -  
236 function add_selected_institution_to_list(id, name) { 236 function add_selected_institution_to_list(id, name) {
237 var selected_institution = "<li data-institution='"+id+"'>"+name; 237 var selected_institution = "<li data-institution='"+id+"'>"+name;
238 selected_institution += "<a href='#' class='button without-text icon-remove remove-institution'></a></li>"; 238 selected_institution += "<a href='#' class='button without-text icon-remove remove-institution'></a></li>";
@@ -240,28 +240,27 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -240,28 +240,27 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
240 $(".institutions_added").append(selected_institution); 240 $(".institutions_added").append(selected_institution);
241 } 241 }
242 242
243 -  
244 - function add_new_institution() { 243 + function add_new_institution(evt) {
  244 + evt.preventDefault();
245 var selected = $("#institution_selected"); 245 var selected = $("#institution_selected");
246 - var already_added_to_list = is_institution_already_added_to_list(selected.val()); 246 + var institution_already_added = $(".institutions_added li[data-institution='"+selected.val()+"']").length;
247 247
248 - if(selected.val().length > 0 && !already_added_to_list) { 248 + if(selected.val().length > 0 && institution_already_added === 0) {
249 //field that send the institutions to the server 249 //field that send the institutions to the server
250 $(".institution_container").append(get_clone_institution_data(selected.val())); 250 $(".institution_container").append(get_clone_institution_data(selected.val()));
251 251
252 // Visualy add the selected institution to the list 252 // Visualy add the selected institution to the list
253 add_selected_institution_to_list(selected.val(), selected.attr("data-name")); 253 add_selected_institution_to_list(selected.val(), selected.attr("data-name"));
254 254
  255 + // clean the institution flag
  256 + selected.val("").attr("data-name", "");
  257 + $("#input_institution").val("");
  258 +
255 $(".remove-institution").click(remove_institution); 259 $(".remove-institution").click(remove_institution);
256 } 260 }
257 } 261 }
258 262
259 263
260 - function is_institution_already_added_to_list(institution_id) {  
261 - return $(".institutions_added li[data-institution='"+institution_id+"']").length !== 0;  
262 - }  
263 -  
264 -  
265 function remove_institution(evt) { 264 function remove_institution(evt) {
266 evt.preventDefault(); 265 evt.preventDefault();
267 var code = $(this).parent().attr("data-institution"); 266 var code = $(this).parent().attr("data-institution");
@@ -279,15 +278,19 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -279,15 +278,19 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
279 278
280 279
281 function show_hide_cnpj_city(country) { 280 function show_hide_cnpj_city(country) {
282 - var cnpj = $("#institutions_cnpj").parent().parent();  
283 - var city = $("#community_city").parent().parent();  
284 - var state = $("#community_state").parent().parent(); 281 + var cnpj = $("#institutions_cnpj").parent();
  282 + var city = $("#community_city").parent();
  283 + var state = $("#community_state").parent();
285 var inst_type = $("input[name='institutions[type]']:checked").val(); 284 var inst_type = $("input[name='institutions[type]']:checked").val();
  285 +
286 institution_type_actions(inst_type); 286 institution_type_actions(inst_type);
287 287
288 - if( country === "-1" ) $("#community_country").val("BR"); 288 + if ( country === "-1" ) {
  289 + $("#community_country").val("BR");
  290 + country = "BR";
  291 + }
289 292
290 - if( country !== "BR" ) { 293 + if ( country !== "BR" ) {
291 cnpj.hide(); 294 cnpj.hide();
292 city.hide(); 295 city.hide();
293 state.hide(); 296 state.hide();
@@ -364,18 +367,24 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -364,18 +367,24 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
364 } 367 }
365 } 368 }
366 369
367 - function set_events() {  
368 - $("#create_institution_link").click(open_create_institution_modal);  
369 370
  371 + function set_institution_name_into_modal() {
  372 + $("#community_name").val($("#input_institution").val());
  373 + }
  374 +
  375 +
  376 + function set_events() {
370 $("input[name='institutions[type]']").click(function(){ 377 $("input[name='institutions[type]']").click(function(){
371 institution_type_actions(this.value); 378 institution_type_actions(this.value);
372 - }); 379 + }).trigger("click");
373 380
374 $('#save_institution_button').click(save_institution); 381 $('#save_institution_button').click(save_institution);
375 $('#cancel_institution_button').click(cancel_institution); 382 $('#cancel_institution_button').click(cancel_institution);
376 383
377 $("#community_name").keyup(institution_already_exists); 384 $("#community_name").keyup(institution_already_exists);
378 385
  386 + $("#add_new_institution").click(add_new_institution);
  387 +
379 $(".remove-institution").click(remove_institution); 388 $(".remove-institution").click(remove_institution);
380 389
381 $("#community_country").change(function(){ 390 $("#community_country").change(function(){
@@ -390,19 +399,22 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -390,19 +399,22 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
390 $('#community_country').change(function(){ 399 $('#community_country').change(function(){
391 autoCompleteCity(); 400 autoCompleteCity();
392 }); 401 });
  402 +
  403 + $("#create_institution_link").click(set_institution_name_into_modal);
393 } 404 }
394 405
395 406
  407 + function init_module() {
  408 + set_form_count_custom_data();
  409 + set_events();
  410 + }
  411 +
396 return { 412 return {
397 isCurrentPage: function() { 413 isCurrentPage: function() {
398 return $("#institution_form").length === 1; 414 return $("#institution_form").length === 1;
399 }, 415 },
400 416
401 -  
402 - init: function() {  
403 - set_form_count_custom_data();  
404 - set_events();  
405 - }, 417 + init: init_module,
406 418
407 institution_autocomplete: function(){ 419 institution_autocomplete: function(){
408 institution_autocomplete(); 420 institution_autocomplete();
src/noosfero-spb/gov_user/public/views/institution-modal.js 0 → 100644
@@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
  1 +/* globals modulejs */
  2 +
  3 +modulejs.define('InstitutionModal',
  4 + ['jquery', 'NoosferoRoot', 'CreateInstitution', 'ModalObserver'],
  5 + function($, NoosferoRoot, CreateInstitution, ModalObserver)
  6 +{
  7 + 'use strict';
  8 +
  9 + var AJAX_URL = {
  10 + create_institution_modal:
  11 + NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/create_institution"),
  12 + };
  13 +
  14 + // When the modal is closed, put the community name into the autocomplete
  15 + function observer_action() {
  16 + var community_name = $("#community_name").val();
  17 + $("#input_institution").attr("value", community_name).autocomplete("search");
  18 +
  19 + // Clear error messages
  20 + $("#create_institution_errors").html("");
  21 + }
  22 +
  23 + // Observe when modal is closed
  24 + function observe_modal() {
  25 + var institution_modal = document.querySelector("#institution_modal");
  26 + ModalObserver.init(institution_modal, observer_action);
  27 + }
  28 +
  29 +
  30 + function prepare_institution_modal() {
  31 + $.get(AJAX_URL.create_institution_modal, function(response){
  32 + window.sessionStorage.setItem("InstitutionModalBody", response);
  33 + $("#institution_modal_body").html(response);
  34 +
  35 + // Set all events on modal
  36 + CreateInstitution.init();
  37 + });
  38 +
  39 + $("#create_institution_link").click(observe_modal);
  40 + }
  41 +
  42 +
  43 + return {
  44 + isCurrentPage: function() {
  45 + return $("#institution_modal_container").length === 1;
  46 + },
  47 +
  48 +
  49 + init: function() {
  50 + prepare_institution_modal();
  51 + },
  52 + };
  53 +});
  54 +
src/noosfero-spb/gov_user/views/gov_user_plugin/_institution.html.erb
1 -<h1><%= _('New Institution') %></h1> 1 +<div class="form-description">
  2 + <div class="spb-row no-margin-top">
  3 + <% if environment.enabled?('admin_must_approve_new_communities') %>
  4 + <div class='spb-col spb-col-12 explanation'>
  5 + <%= _("Note that the creation of communities in this environment is restricted. Your request to create this new community will be sent to %{environment} administrators and will be approved or rejected according to their methods and criteria.") % { :environment => environment.name }%>
  6 + </div>
  7 + <% end %>
  8 + </div>
2 9
3 -<% if environment.enabled?('admin_must_approve_new_communities') %>  
4 - <div class='explanation'>  
5 - <%= _("Note that the creation of communities in this environment is restricted. Your request to create this new community will be sent to %{environment} administrators and will be approved or rejected according to their methods and criteria.") % { :environment => environment.name }%> 10 + <div class="spb-row spb-col spb-col-12 required-field">
  11 + <%= _("The highlighted fields are mandatory") %>
6 </div> 12 </div>
7 -<%end %>  
8 -  
9 -<% unless flash[:errors].nil? %>  
10 -<div class="errorExplanation" id="errorExplanation">  
11 - <h2> <%= _("Can`t create new Institution: #{flash[:errors].length} errors") %> </h2>  
12 - <ul>  
13 - <% flash[:errors].each do |key, value| %>  
14 - <% key_name = key.to_s.gsub("_", " ") %>  
15 - <% if value.length > 0 %>  
16 - <li> <%= _("<b>#{key_name.capitalize}</b> #{value.join()}") %> </li> 13 +</div>
  14 +
  15 +<div class="spb-row spb-col spb-col-12">
  16 + <% unless flash[:errors].nil? %>
  17 + <div class="errorExplanation" id="errorExplanation">
  18 + <h2> <%= _("Can`t create new Institution: #{flash[:errors].length} errors") %> </h2>
  19 + <ul>
  20 + <% flash[:errors].each do |key, value| %>
  21 + <% key_name = key.to_s.gsub("_", " ") %>
  22 + <% if value.length > 0 %>
  23 + <li> <%= _("<b>#{key_name.capitalize}</b> #{value.join()}") %> </li>
  24 + <% end %>
17 <% end %> 25 <% end %>
  26 + </ul>
  27 + </div>
18 <% end %> 28 <% end %>
19 - </ul>  
20 </div> 29 </div>
21 -<% end %>  
22 30
23 -<div id = 'create_institution_errors' class='errorExplanation hide-field'></div>  
24 -  
25 -<div>  
26 - <%= labelled_form_for :community, :url => {:action=>"new_institution"}, :html => { :multipart => true, :id=>"institution_form" } do |f| %>  
27 - <%= required_fields_message %>  
28 - <%= hidden_field_tag "edit_institution_page", false %>  
29 - <%= fields_for :institutions do |inst| %>  
30 - <span class=''>  
31 - <div class='formfield type-radio'>  
32 - <label>  
33 - <%= _("Private Institution") %>  
34 - <%= radio_button_tag("institutions[type]" ,"PrivateInstitution", true)%>  
35 - </label>  
36 -  
37 - <label> <%= _("Public Institution") %>  
38 - <%= radio_button_tag("institutions[type]", "PublicInstitution") %>  
39 - </label>  
40 - </div>  
41 - </span> 31 +<div class="spb-row">
  32 + <div id='create_institution_errors' class='spb-col spb-col-12 errorExplanation hide-field'></div>
  33 +</div>
42 34
43 - <%= required f.text_field(:name, :class => flash[:error_community_name], :value => params[:community][:name]) %>  
44 - <%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %>  
45 35
46 - <span class='optional-field'>  
47 - <div class="formfield type-text">  
48 - <%= inst.label "corporate_name", _("Corporate Name"), :class=>"formlabel" %>  
49 - <%= inst.text_field(:corporate_name, :value => params[:institutions][:corporate_name], :size => 55) %>  
50 - </div>  
51 - </span> 36 +<%= form_for :community, :url => {:action=>"new_institution"}, :html => { :multipart => true, :id=>"institution_form" } do |f| %>
52 37
53 - <%= required select_country(_('Country'), 'community', 'country', {:class => "type-select #{flash[:error_community_country]}", :id => "community_country"}) %> 38 + <%= hidden_field_tag "edit_institution_page", false %>
  39 + <%= fields_for :institutions do |inst| %>
  40 + <div class="spb-row no-margin-top">
  41 + <div class='spb-col spb-col-3'>
  42 + <label class="formlabel">
  43 + <%= radio_button_tag("institutions[type]" ,"PrivateInstitution", true)%>
  44 + <%= _("Private Institution") %>
  45 + </label>
  46 + </div>
54 47
55 - <span class='required-field'>  
56 - <div class="formfield">  
57 - <label for="community_state" class="formlabel"><%= _("State") %></label>  
58 - <%= f.select(:state, @state_options, {:selected => params[:community][:state]}, {:class => flash[:error_community_state]}) %>  
59 - </div>  
60 - </span> 48 + <div class="spb-col spb-col-3">
  49 + <label class="formlabel">
  50 + <%= radio_button_tag("institutions[type]", "PublicInstitution") %>
  51 + <%= _("Public Institution") %>
  52 + </label>
  53 + </div>
61 54
62 - <%= required f.text_field(:city, :class => flash[:error_community_city], :value => params[:community][:city]) %> 55 + <div class="spb-col spb-col-3"></div>
  56 + <div class="spb-col spb-col-3"></div>
  57 + </div>
63 58
  59 + <div class="spb-row">
  60 + <div class="spb-col spb-col-5">
  61 + <label for="community_name" class="formlabel">
  62 + <%= _("Corporate Name") %><!-- razão social -->
  63 + <span class="required-field">(*)</span>
  64 + </label>
64 65
65 - <div class="formfield type-text"> 66 + <%= f.text_field(:name, :class => flash[:error_community_name], :value => params[:community][:name]) %>
  67 + <%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %>
  68 + </div>
  69 +
  70 + <div class="spb-col spb-col-6">
  71 + <%= inst.label "corporate_name", _("Fantasy name"), :class=>"formlabel" %><!-- Nome fantasia -->
  72 + <%= inst.text_field(:corporate_name, :value => params[:institutions][:corporate_name], :size => 55) %>
  73 + </div>
  74 + </div>
  75 +
  76 + <div class="spb-row">
  77 + <div class="spb-col spb-col-5">
  78 + <label for="community_country" class="formlabel">
  79 + <%= _("Country") %>
  80 + <span class="required-field">(*)</span>
  81 + </label>
  82 +
  83 + <%= select("community", "country", [[_('Select a country'), nil]] + country_helper.countries, {:class => "type-select #{flash[:error_community_country]}"}) %>
  84 + </div>
  85 +
  86 + <div class="spb-col spb-col-2">
  87 + <label for="community_state" class="formlabel">
  88 + <%= _("State") %>
  89 + <span class="required-field">(*)</span>
  90 + </label>
  91 +
  92 + <%= f.select(:state, @state_options, {:selected => params[:community][:state]}, {:class => flash[:error_community_state]}) %>
  93 + </div>
  94 +
  95 + <div class="spb-col spb-col-5">
  96 + <label class="formlabel" for="community_city">
  97 + <%= _("City") %>
  98 + <span class="required-field">(*)</span>
  99 + </label>
  100 +
  101 + <%= f.text_field(:city, :class => flash[:error_community_city], :value => params[:community][:city]) %>
  102 + </div>
  103 + </div>
  104 +
  105 +
  106 + <div class="spb-row">
  107 + <div class="spb-col spb-col-12">
66 <%= inst.label("cnpj" ,_("CNPJ"), :class=>"formlabel") %> 108 <%= inst.label("cnpj" ,_("CNPJ"), :class=>"formlabel") %>
67 - <%= required inst.text_field(:cnpj, :placeholder=>"99.999.999/9999-99", :class=>"intitution_cnpj_field", :value => params[:institutions][:cnpj]) %> 109 + <%= inst.text_field(:cnpj, :placeholder=>"99.999.999/9999-99", :class=>"intitution_cnpj_field", :value => params[:institutions][:cnpj]) %>
  110 + </div>
  111 + </div>
  112 +
  113 + <div class="spb-row">
  114 + <div class="spb-col spb-col-12">
  115 + <%= hidden_field_tag "acronym_translate", _("Acronym") %>
  116 + <%= hidden_field_tag "fantasy_name_translate", _("Fantasy name") %>
  117 + <%= inst.label("acronym" ,_("Acronym"), :class=>"formlabel") %>
  118 + <%= inst.text_field(:acronym, :value => params[:institutions][:acronym]) %>
68 </div> 119 </div>
  120 + </div>
69 121
70 - <span class='optional-field'>  
71 - <div class="formfield type-text">  
72 - <%= hidden_field_tag "acronym_translate", _("Acronym") %>  
73 - <%= hidden_field_tag "fantasy_name_translate", _("Fantasy name") %>  
74 - <%= inst.label("acronym" ,_("Acronym"), :class=>"formlabel") %>  
75 - <%= inst.text_field(:acronym, :value => params[:institutions][:acronym]) %>  
76 - </div>  
77 - </span> 122 + <div class="spb-row public-institutions-fields">
  123 + <div class="spb-col spb-col-6">
  124 + <label class="formlabel" for="institutions_governmental_sphere_id">
  125 + <%= _("Governmental Sphere") %>
  126 + <span class="required-field">(*)</span>
  127 + </label>
78 128
79 - <span class='required-field public-institutions-fields'>  
80 - <div class="formfield type-text">  
81 - <%= inst.label("governmental_sphere_id" ,_("Governmental Sphere:"), :class=>"formlabel") %>  
82 - <%= inst.select(:governmental_sphere, @governmental_sphere, :selected=>params[:institutions][:governmental_sphere], :class => flash[:error_institution_governmental_sphere])%>  
83 - </div>  
84 - </span> 129 + <%= inst.select(:governmental_sphere, @governmental_sphere, :selected=>params[:institutions][:governmental_sphere], :class => flash[:error_institution_governmental_sphere])%>
  130 + </div>
  131 + </div>
85 132
86 - <span class='required-field public-institutions-fields'>  
87 - <div class="formfield type-text">  
88 - <%= inst.label("governmental_power_id" ,_("Governmental Power:"), :class=>"formlabel") %>  
89 - <%= inst.select(:governmental_power, @governmental_power, :selected=>params[:institutions][:governmental_sphere], :class => flash[:error_institution_governmental_power])%>  
90 - </div>  
91 - </span>  
92 - <span class='required-field public-institutions-fields'>  
93 - <div class="formfield type-text">  
94 - <%= inst.label("juridical_nature_id" ,_("Juridical Nature:"), :class=>"formlabel") %>  
95 - <%= inst.select(:juridical_nature, @juridical_nature, :selected=>params[:institutions][:juridical_nature], :class => flash[:error_institution_juridical_nature])%>  
96 - </div>  
97 - </span> 133 + <div class="spb-row public-institutions-fields">
  134 + <div class="spb-col spb-col-6">
  135 + <label class="formlabel" for="institutions_governmental_power_id">
  136 + <%= _("Governmental Power") %>
  137 + <span class="required-field">(*)</span>
  138 + </label>
  139 +
  140 + <%= inst.select(:governmental_power, @governmental_power, :selected=>params[:institutions][:governmental_sphere], :class => flash[:error_institution_governmental_power])%>
  141 + </div>
  142 + </div>
  143 +
  144 + <div class="spb-row public-institutions-fields">
  145 + <div class="spb-col spb-col-6">
  146 + <label class="formlabel" for="institutions_juridical_nature_id">
  147 + <%= _("Juridical Nature") %>
  148 + <span class="required-field">(*)</span>
  149 + </label>
  150 +
  151 + <%= inst.select(:juridical_nature, @juridical_nature, :selected=>params[:institutions][:juridical_nature], :class => flash[:error_institution_juridical_nature])%>
  152 + </div>
  153 + </div>
  154 +
  155 + <div class="spb-row public-institutions-fields">
  156 + <div class="spb-col spb-col-12">
  157 + <%= _("SISP ?") %>
  158 + </div>
98 159
99 - <span class='required-field public-institutions-fields'>  
100 - <div class="formfield type-text">  
101 - <%= _("SISP?") %> 160 + <div class="spc-col spb-col-12 sisp-fields">
  161 + <div class="spb-col spb-col-3">
102 <% if @show_sisp_field %> 162 <% if @show_sisp_field %>
  163 + <div class="spb-col spb-col-5">
103 <%= inst.radio_button(:sisp, true, :class => "#{flash[:error_institution_sisp]}" ) %> 164 <%= inst.radio_button(:sisp, true, :class => "#{flash[:error_institution_sisp]}" ) %>
104 <%= inst.label :sisp ,_("Yes"), :value => true %> 165 <%= inst.label :sisp ,_("Yes"), :value => true %>
  166 + </div>
  167 +
  168 + <div class="spb-col spb-col-6">
105 <%= inst.radio_button(:sisp, false, :checked=>"checked", :class => "#{flash[:error_institution_sisp]}") %> 169 <%= inst.radio_button(:sisp, false, :checked=>"checked", :class => "#{flash[:error_institution_sisp]}") %>
106 <%= inst.label :sisp ,_("No"), :value => false %> 170 <%= inst.label :sisp ,_("No"), :value => false %>
  171 + </div>
107 <% else %> 172 <% else %>
108 - <%= inst.label("sisp", _("No")) %> 173 + <div class="spb-col spb-col-6">
  174 + <%= inst.label("sisp", _("No")) %>
  175 + </div>
109 <% end %> 176 <% end %>
110 - </div>  
111 - </span>  
112 -  
113 - <% if @url_token == "create_institution_admin" %>  
114 - <%= submit_button :save, _('Save') %>  
115 - <%= button(:cancel, _("Cancel"), {:controller => "admin_panel", :action => 'index'}) %>  
116 - <%else%>  
117 - <div>  
118 - <%= link_to(_('Save'), '#', :id=>'save_institution_button', :class=>'button with-text icon-add') %>  
119 - <%= link_to(_('Cancel'), '#', :id=>"cancel_institution_button", :class=>'button with-text icon-cancel') %>  
120 </div> 177 </div>
121 - <%= hidden_field_tag :institution_error_message, _("Could not send the form data to the server") %>  
122 - <%end%>  
123 -  
124 - <% end %> 178 + </div>
  179 + </div>
  180 +
  181 + <div class="spb-row modal-form-actions">
  182 + <div class="spb-col spb-col-6">
  183 + <% if @url_token == "create_institution_admin" %>
  184 + <%= submit_button :save, _('Save') %>
  185 + <%= button(:cancel, _("Cancel"), {:controller => "admin_panel", :action => 'index'}) %>
  186 + <% else %>
  187 + <%= link_to(_('Save'), '#', :id=>'save_institution_button', :class=>'button with-text icon-add') %>
  188 + <%= link_to(_('Cancel'), '#', :id=>"cancel_institution_button", :class=>'button with-text icon-cancel') %>
  189 + <%= hidden_field_tag :institution_error_message, _("Could not send the form data to the server") %>
  190 + <% end %>
  191 + </div>
  192 + </div>
125 193
126 <% end %> 194 <% end %>
  195 +<% end %>
127 </div> 196 </div>
128 <%= hidden_field_tag :loading_message, _("Creating institution") %> 197 <%= hidden_field_tag :loading_message, _("Creating institution") %>
src/noosfero-spb/gov_user/views/person_editor_extras.html.erb
@@ -19,8 +19,8 @@ @@ -19,8 +19,8 @@
19 </div> 19 </div>
20 20
21 <%= content_tag(:div, _("No institution found"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %> 21 <%= content_tag(:div, _("No institution found"), :id=>"institution_empty_ajax_message", :class=>"errorExplanation hide-field") %>
22 - <%= link_to(_("Create new institution"), "#", :id=>"create_institution_link", :class=>'button with-text icon-add') %>  
23 - <%= content_tag(:div, "", :id=>"institution_dialog") %> 22 +
  23 + <%= InstitutionModalHelper.modal_button %>
24 24
25 <%= hidden_field_tag("user[institution_ids][]", "", :class => 'user_institutions') %> 25 <%= hidden_field_tag("user[institution_ids][]", "", :class => 'user_institutions') %>
26 <%= hidden_field_tag("institution_selected", "") %> 26 <%= hidden_field_tag("institution_selected", "") %>
src/noosfero-spb/gov_user/views/ratings_extra_field.html.erb
@@ -3,8 +3,11 @@ @@ -3,8 +3,11 @@
3 <span class="star-tooltip" title="Órgão ou Empresa que você representa e utiliza o software"></span> 3 <span class="star-tooltip" title="Órgão ou Empresa que você representa e utiliza o software"></span>
4 <input type="text" id="input_institution"> 4 <input type="text" id="input_institution">
5 5
6 - <%= content_tag(:div, _("No institution found"),  
7 - :id=>"institution_empty_ajax_message",  
8 - :class=>"errorExplanation hide-field") %> 6 + <div id="institution_empty_ajax_message" class="errorExplanation hide-field rating-create-institution-container">
  7 + <span class="institution-not-found"><%= _("No organization or company found") %></span>
  8 + <%= InstitutionModalHelper.modal_button(_("Add"), "none") %>
  9 + </div>
  10 +
9 <%= hidden_field_tag "organization_rating[institution_id]", "", id: "institution_selected" %> 11 <%= hidden_field_tag "organization_rating[institution_id]", "", id: "institution_selected" %>
10 </div> 12 </div>
  13 +
src/noosfero-spb/noosfero-spb-theme/css/modal.css 0 → 100644
@@ -0,0 +1,257 @@ @@ -0,0 +1,257 @@
  1 +/* Bootstrap modal default css */
  2 +.modal {
  3 + position: fixed;
  4 + top: 0px;
  5 + right: 0px;
  6 + bottom: 0px;
  7 + left: 0px;
  8 + z-index: 1050;
  9 + display: none;
  10 + overflow: hidden;
  11 + outline: 0px none;
  12 + background-color: rgba(0, 0, 0, 0.5);
  13 + height: 100%;
  14 +}
  15 +
  16 +.modal-open .modal {
  17 + overflow-x: hidden;
  18 + overflow-y: auto;
  19 +}
  20 +
  21 +.fade {
  22 + opacity: 0;
  23 + transition: opacity 0.15s linear 0s;
  24 +}
  25 +
  26 +.fade.in {
  27 + opacity: 1;
  28 +}
  29 +
  30 +.modal-dialog {
  31 + width: 45%;
  32 + margin: 15px auto;
  33 + position: relative;
  34 +}
  35 +
  36 +.modal.in .modal-dialog {
  37 + transform: translate(0px, 0px);
  38 +}
  39 +
  40 +.modal.fade .modal-dialog {
  41 + transition: transform 0.3s ease-out 0s;
  42 +}
  43 +
  44 +.modal-content {
  45 + box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.5);
  46 +}
  47 +
  48 +.modal-content {
  49 + position: relative;
  50 + background-color: #FFF;
  51 + background-clip: padding-box;
  52 + border: 1px solid rgba(0, 0, 0, 0.2);
  53 + border-radius: 6px;
  54 + outline: 0px none;
  55 + box-shadow: 0px 3px 9px rgba(0, 0, 0, 0.5);
  56 +}
  57 +
  58 +.modal-header {
  59 + min-height: 16.43px;
  60 + padding: 15px;
  61 + border-bottom: 1px solid #E5E5E5;
  62 +}
  63 +
  64 +.modal-header .close {
  65 + margin-top: -2px;
  66 +}
  67 +
  68 +.modal-header button.close {
  69 + padding: 0px;
  70 + cursor: pointer;
  71 + background: transparent none repeat scroll 0px 0px;
  72 + border: 0px none;
  73 +}
  74 +
  75 +.modal-header .close {
  76 + float: right;
  77 + font-size: 21px;
  78 + font-weight: 700;
  79 + line-height: 1;
  80 + color: #000;
  81 + text-shadow: 0px 1px 0px #FFF;
  82 + opacity: 0.2;
  83 +}
  84 +
  85 +.modal-title {
  86 + margin: 0px !important;
  87 + line-height: 1.42857 !important;
  88 +}
  89 +
  90 +.modal-body {
  91 + position: relative;
  92 + padding: 15px;
  93 +}
  94 +
  95 +.modal-footer {
  96 + padding: 15px;
  97 + text-align: right;
  98 + border-top: 1px solid #E5E5E5;
  99 +}
  100 +
  101 +
  102 +/* Bootstrap modal override */
  103 +.modal-title {
  104 + font-family: 'open_sansregular', Arial, Helvetica, sans-serif;
  105 +}
  106 +
  107 +.modal-header h4 {
  108 + color: #333 !important;
  109 + font-size: 17px !important;
  110 +}
  111 +
  112 +.modal-body {
  113 + overflow: hidden;
  114 +}
  115 +
  116 +/* Bootstrap modal form fields */
  117 +.modal,
  118 +.modal input,
  119 +.modal select,
  120 +.modal .formlabel {
  121 + font-family: 'open_sansregular', Arial, Helvetica, sans-serif;
  122 + color: #333;
  123 + font-style: normal;
  124 +}
  125 +
  126 +.modal label {
  127 + margin-left: 4px;
  128 +}
  129 +
  130 +.modal .sisp-fields label {
  131 + margin-left: 0px;
  132 +}
  133 +
  134 +.modal h2 {
  135 + margin-top: 0px !important;
  136 +}
  137 +
  138 +.modal .form-description {
  139 + border-bottom: 1px solid #E5E5E5;
  140 + padding-bottom: 15px;
  141 + overflow: hidden;
  142 +}
  143 +
  144 +.modal .formfieldline {
  145 + padding: 0px;
  146 + margin: 0px;
  147 +}
  148 +
  149 +.modal input[type="text"],
  150 +.modal select {
  151 + padding: 10px;
  152 + border-radius: 5px;
  153 + border: solid 1px #ccc;
  154 + background-color: #fff;
  155 +}
  156 +
  157 +.modal input[type="radio"] {
  158 + vertical-align: middle;
  159 +}
  160 +
  161 +.modal .explanation {
  162 + color: #3F60C6;
  163 + font-size: 12px;
  164 +}
  165 +
  166 +.modal .required-field, .modal .errorExplanation {
  167 + color: #EA1C00;
  168 + font-size:12px;
  169 +}
  170 +
  171 +.modal .spb-row {
  172 + margin-top: 15px;
  173 +}
  174 +
  175 +.no-margin-top {
  176 + margin-top: 0px !important;
  177 +}
  178 +
  179 +.modal .modal-margin-right {
  180 + margin-right: 4%;
  181 +}
  182 +
  183 +.modal .modal-margin-left {
  184 + margin-left: 4%;
  185 +}
  186 +
  187 +.modal #community_name {
  188 + width: 200px;
  189 +}
  190 +
  191 +.modal #institutions_corporate_name {
  192 + width: 285px;
  193 +}
  194 +
  195 +.modal #community_country {
  196 + width: 220px;
  197 +}
  198 +
  199 +.modal #community_state {
  200 + width: 80px;
  201 +}
  202 +
  203 +.modal #community_city {
  204 + width: 190px;
  205 + margin-top: 2px;
  206 +}
  207 +
  208 +.modal #institutions_cnpj,
  209 +.modal #institutions_acronym {
  210 + width: 530px;
  211 +}
  212 +
  213 +.modal a.button.with-text.icon-add,
  214 +.modal a.button.with-text.icon-cancel {
  215 + line-height: 25px !important;
  216 + padding: 5px 15px !important;
  217 + font-size: 12px !important;
  218 +}
  219 +
  220 +.modal a.button.with-text.icon-add {
  221 + background-color: #3E67B1 !important;
  222 + color: #fff !important;
  223 +}
  224 +
  225 +.modal .public-institutions-fields {
  226 + display: none;
  227 +}
  228 +
  229 +.modal .modal-form-actions {
  230 + margin-top: 20px;
  231 +}
  232 +
  233 +/* New rating page */
  234 +.rating-create-institution-container {
  235 + overflow: hidden;
  236 +}
  237 +
  238 +.rating-create-institution-container > .institution-not-found {
  239 + line-height: 30px;
  240 +}
  241 +
  242 +.rating-create-institution-container .institution-not-found {
  243 + position: relative;
  244 + float: left;
  245 +}
  246 +
  247 +.rating-create-institution-container #institution_modal_container {
  248 + position: relative;
  249 + float: left;
  250 +}
  251 +
  252 +.rating-create-institution-container #create_institution_link {
  253 + background-color: #3E67B1 !important;
  254 + color: #FFF !important;
  255 + text-transform: none !important;
  256 +}
  257 +
src/noosfero-spb/noosfero-spb-theme/css/spb-grid.css 0 → 100644
@@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
  1 +.spb-row,
  2 +.spb-col {
  3 + box-sizing: border-box;
  4 +}
  5 +
  6 +.spb-row:before,
  7 +.spb-row:after {
  8 + content: "";
  9 + display: table;
  10 +}
  11 +
  12 +.spb-row:after {
  13 + clear: both;
  14 +}
  15 +
  16 +.spb-col {
  17 + position: relative;
  18 + float: left;
  19 +}
  20 +
  21 +.spb-col {
  22 + margin-right: 1.6%;
  23 +}
  24 +.spb-col:last-child {
  25 + margin-right: 0%;
  26 +}
  27 +
  28 +
  29 +.spb-col-1 {
  30 + width: 6.86666666667%;
  31 +}
  32 +
  33 +.spb-col-2 {
  34 + width: 15.3333333333%;
  35 +}
  36 +
  37 +.spb-col-3 {
  38 + width: 23.8%;
  39 +}
  40 +
  41 +.spb-col-4 {
  42 + width: 32.2666666667%;
  43 +}
  44 +
  45 +.spb-col-5 {
  46 + width: 40.7333333333%;
  47 +}
  48 +
  49 +.spb-col-6 {
  50 + width: 49.2%;
  51 +}
  52 +
  53 +.spb-col-7 {
  54 + width: 57.6666666667%;
  55 +}
  56 +
  57 +.spb-col-8 {
  58 + width: 66.1333333333%;
  59 +}
  60 +
  61 +.spb-col-9 {
  62 + width: 74.6%;
  63 +}
  64 +
  65 +.spb-col-10 {
  66 + width: 83.0666666667%;
  67 +}
  68 +
  69 +.spb-col-11 {
  70 + width: 91.5333333333%;
  71 +}
  72 +
  73 +.spb-col-12 {
  74 + width: 100%;
  75 +}
  76 +
src/noosfero-spb/noosfero-spb-theme/css/use-report.css
@@ -239,7 +239,7 @@ @@ -239,7 +239,7 @@
239 239
240 #content .star-rate-form .star-comment-container .comments-software-extra-fields { 240 #content .star-rate-form .star-comment-container .comments-software-extra-fields {
241 height: 0; 241 height: 0;
242 - overflow: hidden; 242 + overflow: initial;
243 } 243 }
244 244
245 #content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments { 245 #content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments {
@@ -248,11 +248,11 @@ @@ -248,11 +248,11 @@
248 height: 50px; 248 height: 50px;
249 } 249 }
250 250
251 -#content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments label { 251 +#content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments > label {
252 font-size: 12px; 252 font-size: 12px;
253 } 253 }
254 254
255 -#content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments input { 255 +#content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments > input {
256 display: block; 256 display: block;
257 height: 19px; 257 height: 19px;
258 width: 335px; 258 width: 335px;
src/noosfero-spb/noosfero-spb-theme/style.css
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 /*** SPB Theme section styles ***/ 10 /*** SPB Theme section styles ***/
11 @import url(css/overwriting-base-theme.css); 11 @import url(css/overwriting-base-theme.css);
  12 +@import url(css/spb-grid.css);
12 @import url(css/header.css); 13 @import url(css/header.css);
13 @import url(css/footer.css); 14 @import url(css/footer.css);
14 @import url(css/left-bar.css); 15 @import url(css/left-bar.css);
@@ -26,6 +27,7 @@ @@ -26,6 +27,7 @@
26 @import url(css/tooltip.css); 27 @import url(css/tooltip.css);
27 @import url(css/popover.css); 28 @import url(css/popover.css);
28 @import url(css/notifications.css); 29 @import url(css/notifications.css);
  30 +@import url(css/modal.css);
29 31
30 @font-face{ 32 @font-face{
31 font-weight: normal; 33 font-weight: normal;
src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb
@@ -18,6 +18,28 @@ Given /^SoftwareInfo has initial default values on database$/ do @@ -18,6 +18,28 @@ Given /^SoftwareInfo has initial default values on database$/ do
18 OperatingSystemName.create(:name=>"CentOS") 18 OperatingSystemName.create(:name=>"CentOS")
19 end 19 end
20 20
  21 +Given /^Institutions has initial default values on database$/ do
  22 + GovernmentalPower.create(:name => "Executivo")
  23 + GovernmentalPower.create(:name => "Legislativo")
  24 + GovernmentalPower.create(:name => "Judiciario")
  25 +
  26 + GovernmentalSphere.create(:name => "Federal")
  27 +
  28 + JuridicalNature.create(:name => "Autarquia")
  29 + JuridicalNature.create(:name => "Administracao Direta")
  30 + JuridicalNature.create(:name => "Empresa Publica")
  31 + JuridicalNature.create(:name => "Fundacao")
  32 + JuridicalNature.create(:name => "Orgao Autonomo")
  33 + JuridicalNature.create(:name => "Sociedade")
  34 + JuridicalNature.create(:name => "Sociedade Civil")
  35 + JuridicalNature.create(:name => "Sociedade de Economia Mista")
  36 +
  37 + national_region = NationalRegion.new
  38 + national_region.name = "Distrito Federal"
  39 + national_region.national_region_code = '35'
  40 + national_region.national_region_type_id = NationalRegionType::STATE
  41 + national_region.save
  42 +end
21 43
22 Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select| 44 Given /^I type in "([^"]*)" in autocomplete list "([^"]*)" and I choose "([^"]*)"$/ do |typed, input_field_selector, should_select|
23 # Wait the page javascript load 45 # Wait the page javascript load
@@ -42,6 +64,27 @@ Given /^I type in &quot;([^&quot;]*)&quot; in autocomplete list &quot;([^&quot;]*)&quot; and I choose &quot;([^&quot;]*) @@ -42,6 +64,27 @@ Given /^I type in &quot;([^&quot;]*)&quot; in autocomplete list &quot;([^&quot;]*)&quot; and I choose &quot;([^&quot;]*)
42 sleep 1 64 sleep 1
43 end 65 end
44 66
  67 +Given /^the following public institutions?$/ do |table|
  68 + # table is a Cucumber::Ast::Table
  69 + table.hashes.each do |item|
  70 + community = Community.new
  71 + community.name = item[:name]
  72 + community.country = item[:country]
  73 + community.state = item[:state]
  74 + community.city = item[:city]
  75 + community.save!
  76 +
  77 + governmental_power = GovernmentalPower.where(:name => item[:governmental_power]).first
  78 + governmental_sphere = GovernmentalSphere.where(:name => item[:governmental_sphere]).first
  79 +
  80 + juridical_nature = JuridicalNature.create(:name => item[:juridical_nature])
  81 +
  82 + institution = PublicInstitution.new(:name => item[:name], :type => "PublicInstitution", :acronym => item[:acronym], :cnpj => item[:cnpj], :juridical_nature => juridical_nature, :governmental_power => governmental_power, :governmental_sphere => governmental_sphere)
  83 + institution.community = community
  84 + institution.corporate_name = item[:corporate_name]
  85 + institution.save!
  86 + end
  87 +end
45 88
46 Given /^the following software language$/ do |table| 89 Given /^the following software language$/ do |table|
47 table.hashes.each do |item| 90 table.hashes.each do |item|
src/noosfero-spb/software_communities/public/style.css
@@ -110,6 +110,10 @@ @@ -110,6 +110,10 @@
110 cursor: pointer; 110 cursor: pointer;
111 } 111 }
112 112
  113 +.extra-fields-container {
  114 + overflow: auto;
  115 +}
  116 +
113 .catalog_rating_block { 117 .catalog_rating_block {
114 margin-top: 5px; 118 margin-top: 5px;
115 } 119 }
src/noosfero-spb/software_communities/views/comments_extra_fields.html.erb
@@ -7,17 +7,17 @@ @@ -7,17 +7,17 @@
7 </div> 7 </div>
8 8
9 <div class="comments-software-extra-fields"> 9 <div class="comments-software-extra-fields">
10 - <div class="comments-software-people-benefited">  
11 - <%= label_tag "comments_people_benefited", _("Number of Beneficiaries")%>  
12 - <span class="star-tooltip" title="Quantidade de pessoas beneficiadas com a utilização do software"></span>  
13 - <%= text_field_tag "people_benefited_tmp", "" %>  
14 - <%= hidden_field_tag "organization_rating[people_benefited]", "" %>  
15 - </div> 10 + <div class="extra-fields-container">
  11 + <div class="comments-software-people-benefited">
  12 + <%= label_tag "comments_people_benefited", _("Number of Beneficiaries")%>
  13 + <span class="star-tooltip" title="Estimativa do número de pessoas beneficiadas com a utilização do software"></span>
  14 + <%= text_field_tag "organization_rating[people_benefited]", "" %>
  15 + </div>
16 16
17 - <div class="comments-software-saved-values">  
18 - <%= label_tag "comments_saved_value", _("Saved Resources")%>  
19 - <span class="star-tooltip" title="Valores em “Real” economizados com a utilização do software"></span>  
20 - <%= text_field_tag "saved_value_tmp", "", :placeholder=>"R$" %>  
21 - <%= hidden_field_tag "organization_rating[saved_value]","" %> 17 + <div class="comments-software-saved-values">
  18 + <%= label_tag "comments_saved_value", _("Saved resources")%>
  19 + <span class="star-tooltip" title='Estimativa dos valores em "Real" economizados com a utilização do software'></span>
  20 + <%= text_field_tag "organization_rating[saved_value]", "", :placeholder=>"R$"%>
  21 + </div>
22 </div> 22 </div>
23 </div> 23 </div>