Commit afe6caef144aa5f85ee15363700904a4a1c55f2e
1 parent
3fff11dc
Exists in
institution_modal_on_rating
creating triggers to hide add button
Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com>
Showing
1 changed file
with
24 additions
and
4 deletions
Show diff stats
src/noosfero-spb/gov_user/public/views/create-institution.js
... | ... | @@ -16,11 +16,16 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
16 | 16 | NoosferoRoot.urlWithSubDirectory("/account/search_cities") |
17 | 17 | }; |
18 | 18 | |
19 | + function set_institution_field_name(name) { | |
20 | + $("#input_institution").attr("value", ""); | |
21 | + $("#input_institution").attr("value", name); | |
22 | + } | |
19 | 23 | |
20 | 24 | function open_create_institution_modal(evt) { |
21 | 25 | evt.preventDefault(); |
26 | + var institution_name = $("#input_institution").val(); | |
22 | 27 | |
23 | - $.get(AJAX_URL.create_institution_modal, function(response){ | |
28 | + $.get(AJAX_URL.create_institution_modal, {"community[name]" : institution_name}).done(function(response){ | |
24 | 29 | $("#institution_dialog").html(response); |
25 | 30 | |
26 | 31 | set_form_count_custom_data(); |
... | ... | @@ -32,6 +37,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
32 | 37 | height: 530, |
33 | 38 | position: 'center', |
34 | 39 | close: function() { |
40 | + set_institution_field_name($("#community_name").val()); | |
35 | 41 | $("#institution_dialog").html(""); |
36 | 42 | $('#institution_empty_ajax_message').switchClass("show-field", "hide-field"); |
37 | 43 | toggle_extra_fields_style_status(false); |
... | ... | @@ -228,9 +234,22 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
228 | 234 | toggle_extra_fields_style_status(true); |
229 | 235 | $("#create_institution_link").click(open_create_institution_modal); |
230 | 236 | } else { |
231 | - $('#institution_empty_ajax_message').switchClass("show-field", "hide-field"); | |
232 | - $("#create_institution_link").remove(); | |
233 | - toggle_extra_fields_style_status(false); | |
237 | + $("li.ui-menu-item a.ui-corner-all").click(function() { | |
238 | + $('#institution_empty_ajax_message').switchClass("show-field", "hide-field"); | |
239 | + $("#create_institution_link").remove(); | |
240 | + toggle_extra_fields_style_status(false); | |
241 | + }); | |
242 | + $("li.ui-menu-item a.ui-corner-all").keypress(function(e) { | |
243 | + alert(e); | |
244 | + var key = e.keyCode; | |
245 | + alert(key); | |
246 | + if(key == 13) { | |
247 | + $("li.ui-menu-item a.ui-corner-all").click(); | |
248 | + } | |
249 | + }); | |
250 | + //$('#institution_empty_ajax_message').switchClass("show-field", "hide-field"); | |
251 | + //$("#create_institution_link").remove(); | |
252 | + //toggle_extra_fields_style_status(false); | |
234 | 253 | } |
235 | 254 | }, |
236 | 255 | error: function(ajax, stat, errorThrown) { |
... | ... | @@ -425,5 +444,6 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] |
425 | 444 | institution_autocomplete: function(){ |
426 | 445 | institution_autocomplete(); |
427 | 446 | } |
447 | + | |
428 | 448 | }; |
429 | 449 | }); | ... | ... |