diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/static/forms/container.js | 13 | ||||
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 2 | ||||
-rw-r--r-- | ishtar_common/templates/window.html | 51 |
3 files changed, 45 insertions, 21 deletions
diff --git a/ishtar_common/static/forms/container.js b/ishtar_common/static/forms/container.js new file mode 100644 index 000000000..517b3b86d --- /dev/null +++ b/ishtar_common/static/forms/container.js @@ -0,0 +1,13 @@ +$(document).ready(function(){ + var location_changed = false; + + $("#id_select_responsible").on("autocompleteselect", function(event, ui) { + if (location_changed) return; + $("#id_select_location").val(ui.item.label); + $("#id_location").val(ui.item.id); + }); + + $("#id_select_location").on("autocompleteselect", function(event, ui){ + location_changed = true; + }); +}); diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 0aac181ab..910ee92d0 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -672,7 +672,7 @@ function load_url(url, callback){ function open_window(url){ var newwindow = window.open( - url, '_blank', 'height=400,width=600,scrollbars=yes'); + url, '_blank', 'height=500,width=600,scrollbars=yes'); if (window.focus) {newwindow.focus()} return false; } diff --git a/ishtar_common/templates/window.html b/ishtar_common/templates/window.html index dcb4d4084..dc94b4aae 100644 --- a/ishtar_common/templates/window.html +++ b/ishtar_common/templates/window.html @@ -12,36 +12,47 @@ </script> <script language="javascript" type="text/javascript" src="{{JQUERY_URL}}?ver={{VERSION}}"></script> <script language="javascript" type="text/javascript" src="{{JQUERY_UI_URL}}jquery-ui.js?ver={{VERSION}}"></script> + <script language="javascript" type="text/javascript" src="{{STATIC_URL}}bootstrap/bootstrap.js?ver={{VERSION}}"></script> <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/chosen/chosen.jquery.min.js?ver={{VERSION}}"></script> <script language="javascript" type="text/javascript" src="{{STATIC_URL}}js/ishtar.js?ver={{VERSION}}"></script> {{form.media}} - <link type="text/css" href="{{JQUERY_UI_URL}}jquery-ui.css?ver={{VERSION}}" rel="stylesheet" /> + <link rel="stylesheet" href="{{STATIC_URL}}bootstrap/bootstrap.css?ver={{VERSION}}"> <link type="text/css" href="{{STATIC_URL}}js/chosen/chosen.min.css?ver={{VERSION}}" rel="stylesheet" /> - <link rel="stylesheet" href="{{STATIC_URL}}media/style.css?ver={{VERSION}}" /> + <link rel="stylesheet" href="{{STATIC_URL}}media/styles.css?ver={{VERSION}}" /> {% block extra_head %} {% endblock %} </head> -<body> -{% if new_item_label %} +<body class="window-pop"> +<div class="modal-content"> + <div class="modal-header"> + <h2>{{title}}</h2> + </div> + + <form action="." method="post" class='form'>{% csrf_token %} + <div class="modal-body body-scroll"> + <div class="form"> + {% include "blocks/bs_form_snippet.html" %} + </div> + </div> + + <div class="modal-footer"> + <input type="submit" class="btn btn-primary" id="submit_new_item" + value="{% trans 'Add' %}"/> + <button type="button" id="cancel-btn" class="btn btn-secondary"> + {% trans 'Cancel' %}</button> + </div> + + + </form> +</div> <script type='text/javascript' language='javascript'> +{% if new_item_label %} save_and_close_window{% if many %}_many{% endif %}("{{parent_name}}", "{{parent_pk}}", "{{new_item_label|safe}}", "{{new_item_pk}}"); -</script> {% endif %} -<div id="window_content"> - <h3>{{title}}</h3> - <form action="." method="post" class='form'>{% csrf_token %} - <table> - {% for field in form %} - <tr{% if field.field.required %} class='required'{% endif %}> - <th>{{ field.label_tag }}</th> - <td>{{ field.errors }}{{field|safe}}</td> - </tr>{% endfor %} - <tr><td colspan='2' class='submit_button'><input type="submit" id="submit_new_item" value="{% trans "Add" %}"/></td></tr> - </table> - </form> - </div> +$("#cancel-btn").click(function(){ + close(); +}); +</script> -</div> </body> - </html> |