Last active
August 29, 2015 13:58
-
-
Save cra/9972942 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% block extra_scripts %} | |
| <script src="{{STATIC_URL}}bootstrap/js/bootstrap.js" type="text/javascript"></script> | |
| <script src="{{ STATIC_URL }}js/autoresize.jquery.min.js"></script> | |
| <script type="text/javascript"> | |
| function update_parent_fields() { | |
| var p_fullname, p_phone; | |
| var radio0 = $("#id_dossier-and-contacts-parental_confirm_0"); | |
| var radio1 = $("#id_dossier-and-contacts-parental_confirm_1"); | |
| if (ask_parents == true) { | |
| p_fullname = ""; | |
| p_phone = ""; | |
| radio0.prop('checked', false); | |
| radios.prop('checked', false); | |
| } | |
| else | |
| { | |
| console.log("no need to ask parents"); | |
| p_fullname = "не актуально"; | |
| p_phone = "не актуально"; | |
| radio0.prop("checked", true); | |
| } | |
| $('input[name=dossier-and-contacts-parental_full_name]').val(p_fullname); | |
| $('input[name=dossier-and-contacts-parental_phone]').val(p_phone); | |
| }; | |
| $(document).ready(function() { | |
| $('textarea').autoResize(); | |
| var alert_box = $('.photo-upload-alert').css("display", "none"); | |
| var photo_place = $('.photo-upload-place').mouseover(function(){ alert_box.css("display", "block"); }); | |
| photo_place.mouseout(function(){ alert_box.css("display", "none"); }); | |
| /* $('.button').bind('click', function() { | |
| /** The Opera workaround: doesn't show the file-choosing-dialof if the input widget is hidden. *//* | |
| var photo_upload_widget = $('input[id=id_dossier-photo]').show(); | |
| photo_upload_widget.click(); | |
| photo_upload_widget.hide(); | |
| });*/ | |
| var ask_parents = $('input[name=dossier-and-contacts-age]').val() >= 18; | |
| var display_tag = ask_parents ? "none" : "block"; | |
| $('#parents').css("display", display_tag); | |
| update_parents_fields(); | |
| }); | |
| /* TODO: find out if this is actually necessary */ | |
| $('input[id=id_dossier-and-contacts-photo]').change(function() { | |
| $('#upload-message').hide(); | |
| $('#upload-confirm').show().css("display", "block"); | |
| $('#upload-filename').text("(" + $(this).val().replace("C:\\fakepath\\", "") + ")"); | |
| }); | |
| $('input[name=dossier-and-contacts-age]').change(function() { | |
| var ask_parents = $(this).val() < 18; | |
| var display_tag = ask_parents ? "block" : "none"; | |
| $('#parents').css("display", display_tag); | |
| update_parent_fields(); | |
| }); | |
| </script> | |
| {% endblock extra_scripts %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment