Commit 5db7f142fcd5022dbcc3ddee087b69c3551b05a6
1 parent
a5eca913
Exists in
master
and in
3 other branches
Fix javascript for modal institution.
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
Showing
8 changed files
with
59 additions
and
23 deletions
Show diff stats
features/institution_registration.feature
... | ... | @@ -4,10 +4,10 @@ Feature: Institution Field |
4 | 4 | So others users can use it |
5 | 5 | |
6 | 6 | Background: |
7 | - Given "SoftwareCommunitiesPlugin" plugin is enabled | |
7 | + Given "GovUserPlugin" plugin is enabled | |
8 | 8 | And I am logged in as mpog_admin |
9 | 9 | And I go to /admin/plugins |
10 | - And I check "SoftwareCommunitiesPlugin" | |
10 | + And I check "GovUserPlugin" | |
11 | 11 | And I press "Save changes" |
12 | 12 | And Institutions has initial default values on database |
13 | 13 | And I am logged in as mpog_admin |
... | ... | @@ -29,4 +29,4 @@ Feature: Institution Field |
29 | 29 | And I choose "Public Institution" |
30 | 30 | Then I should see "Governmental Sphere:" |
31 | 31 | And I should see "Governmental Power:" |
32 | - And I should see "Juridical Nature:" | |
33 | 32 | \ No newline at end of file |
33 | + And I should see "Juridical Nature:" | ... | ... |
features/steps_definitions/gov_user_steps.rb
... | ... | @@ -21,6 +21,29 @@ Given /^Institutions has initial default values on database$/ do |
21 | 21 | national_region.save |
22 | 22 | end |
23 | 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 | + | |
24 | 47 | |
25 | 48 | Given /^the following public institutions?$/ do |table| |
26 | 49 | # table is a Cucumber::Ast::Table | ... | ... |
features/user_profile_edition.feature
... | ... | @@ -15,6 +15,14 @@ Feature: Institution Field |
15 | 15 | And I check "person_fields_state_active" |
16 | 16 | And I check "person_fields_city_active" |
17 | 17 | And I press "Save changes" |
18 | + And Institutions has initial default values on database | |
19 | + And the following public institutions | |
20 | + | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name | | |
21 | + | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | Ministerio das Cidades | | |
22 | + | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | Governo do DF | | |
23 | + | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento | | |
24 | + And I am logged in as mpog_admin | |
25 | + | |
18 | 26 | And I am logged in as mpog_admin |
19 | 27 | |
20 | 28 | Scenario: Go to control panel when clicked on 'Complete your profile' link | ... | ... |
lib/gov_user_plugin.rb
... | ... | @@ -125,13 +125,15 @@ class GovUserPlugin < Noosfero::Plugin |
125 | 125 | vendor/modulejs-1.5.0.min.js |
126 | 126 | vendor/jquery.js |
127 | 127 | lib/noosfero-root.js |
128 | + lib/select-element.js | |
129 | + lib/select-field-choices.js | |
128 | 130 | views/complete-registration.js |
129 | - initializer.js | |
130 | - app.js | |
131 | 131 | views/control-panel.js |
132 | 132 | views/create-institution.js |
133 | 133 | views/new-community.js |
134 | 134 | views/user-edit-profile.js |
135 | + initializer.js | |
136 | + app.js | |
135 | 137 | ) |
136 | 138 | end |
137 | 139 | ... | ... |
public/initializer.js
public/views/complete-registration.js
... | ... | @@ -4,7 +4,7 @@ modulejs.define('CompleteRegistration', ['jquery', 'NoosferoRoot'], function($, |
4 | 4 | |
5 | 5 | var AJAX_URL = { |
6 | 6 | hide_registration_incomplete_percentage: |
7 | - NoosferoRoot.urlWithSubDirectory("/plugin/software_communities/hide_registration_incomplete_percentage") | |
7 | + NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/hide_registration_incomplete_percentage") | |
8 | 8 | }; |
9 | 9 | |
10 | 10 | ... | ... |
public/views/create-institution.js
... | ... | @@ -3,13 +3,13 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
3 | 3 | |
4 | 4 | var AJAX_URL = { |
5 | 5 | create_institution_modal: |
6 | - NoosferoRoot.urlWithSubDirectory("/plugin/software_communities/create_institution"), | |
6 | + NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/create_institution"), | |
7 | 7 | new_institution: |
8 | - NoosferoRoot.urlWithSubDirectory("/plugin/software_communities/new_institution"), | |
8 | + NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/new_institution"), | |
9 | 9 | institution_already_exists: |
10 | - NoosferoRoot.urlWithSubDirectory("/plugin/software_communities/institution_already_exists"), | |
10 | + NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/institution_already_exists"), | |
11 | 11 | get_institutions: |
12 | - NoosferoRoot.urlWithSubDirectory("/plugin/software_communities/get_institutions") | |
12 | + NoosferoRoot.urlWithSubDirectory("/plugin/gov_user/get_institutions") | |
13 | 13 | }; |
14 | 14 | |
15 | 15 | |
... | ... | @@ -43,7 +43,6 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
43 | 43 | |
44 | 44 | function show_private_institutions_fields() { |
45 | 45 | $(".public-institutions-fields").hide(); |
46 | - | |
47 | 46 | $("#institutions_governmental_power option").selected(0); |
48 | 47 | $("#institutions_governmental_sphere option").selected(0); |
49 | 48 | } |
... | ... | @@ -188,6 +187,8 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
188 | 187 | |
189 | 188 | |
190 | 189 | function add_new_institution(evt) { |
190 | + (" JAJAjAjAJAJaJ ADD NEW INST") | |
191 | + | |
191 | 192 | evt.preventDefault(); |
192 | 193 | var selected = $("#institution_selected"); |
193 | 194 | var institution_already_added = $(".institutions_added li[data-institution='"+selected.val()+"']").length; |
... | ... | @@ -218,7 +219,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
218 | 219 | |
219 | 220 | |
220 | 221 | function add_mask_to_form_items() { |
221 | - $(".intitution_cnpj_field").mask("99.999.999/9999-99"); | |
222 | +// $(".intitution_cnpj_field").mask("99.999.999/9999-99"); | |
222 | 223 | } |
223 | 224 | |
224 | 225 | ... | ... |
public/views/user-edit-profile.js
... | ... | @@ -23,7 +23,7 @@ modulejs.define('UserEditProfile', ['jquery', 'SelectElement', 'SelectFieldChoic |
23 | 23 | |
24 | 24 | |
25 | 25 | function show_state_if_country_is_brazil() { |
26 | - var selectFieldChoices = new SelectFieldChoices("#state_field", "#city_field", "/plugin/software_communities/get_brazil_states"); | |
26 | + var selectFieldChoices = new SelectFieldChoices("#state_field", "#city_field", "/plugin/gov_user/get_brazil_states"); | |
27 | 27 | set_initial_form_custom_data(selectFieldChoices); |
28 | 28 | |
29 | 29 | $("#profile_data_country").change(function(){ |
... | ... | @@ -43,14 +43,14 @@ modulejs.define('UserEditProfile', ['jquery', 'SelectElement', 'SelectFieldChoic |
43 | 43 | function show_or_hide_phone_mask() { |
44 | 44 | if($("#profile_data_country").val() === "BR") { |
45 | 45 | if( (typeof $("#profile_data_cell_phone").data("rawMaskFn") === 'undefined') ) { |
46 | - $("#profile_data_cell_phone").mask("(99) 9999?9-9999"); | |
47 | - $("#profile_data_comercial_phone").mask("(99) 9999?9-9999"); | |
48 | - $("#profile_data_contact_phone").mask("(99) 9999?9-9999"); | |
46 | + // $("#profile_data_cell_phone").mask("(99) 9999?9-9999"); | |
47 | + // $("#profile_data_comercial_phone").mask("(99) 9999?9-9999"); | |
48 | + // $("#profile_data_contact_phone").mask("(99) 9999?9-9999"); | |
49 | 49 | } |
50 | 50 | } else { |
51 | - $("#profile_data_cell_phone").unmask(); | |
52 | - $("#profile_data_comercial_phone").unmask(); | |
53 | - $("#profile_data_contact_phone").unmask(); | |
51 | + // $("#profile_data_cell_phone").unmask(); | |
52 | + // $("#profile_data_comercial_phone").unmask(); | |
53 | + // $("#profile_data_contact_phone").unmask(); | |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
... | ... | @@ -182,7 +182,7 @@ modulejs.define('UserEditProfile', ['jquery', 'SelectElement', 'SelectFieldChoic |
182 | 182 | function set_fields_validations() { |
183 | 183 | $("#profile_data_country").blur(show_or_hide_phone_mask); |
184 | 184 | |
185 | - $("#profile_data_birth_date").mask("99/99/9999"); | |
185 | + // $("#profile_data_birth_date").mask("99/99/9999"); | |
186 | 186 | |
187 | 187 | fix_phone_mask_format("#profile_data_cell_phone"); |
188 | 188 | fix_phone_mask_format("#profile_data_comercial_phone"); | ... | ... |