1 {% extends 'qcg/base.html' %}
2 {% load staticfiles bootstrap3 %}
5 <link href="{% static 'qcg/selectize/selectize.bootstrap3.css' %}" rel="stylesheet">
9 <script src="{% static 'qcg/selectize/selectize.min.js' %}"></script>
10 <script src="{% static 'qcg/formset/jquery.formset.js' %}"></script>
12 {% include 'filex/source.js.html' %}
15 var filex = filex || {};
20 var gridftpButton = $('<button/>', {
22 'class': 'btn btn-default pull-right',
24 'data-toggle': 'modal',
25 'data-target': '#gridftp'
28 function fullPath(path, file) {
29 var res = path + file.get('name');
37 $('#id_master_file,#id_pdb_file,#id_executable,#id_input,#id_preprocess_script,#id_postprocess_script').before(function() {
39 return gridftpButton.clone().click(function() {
40 $('#select-btn').off().click(function() {
41 var selected = filex.selectedFiles();
43 if (selected.length != 1 || !selected[0].isFile()) {
44 alert('Wybierz dokładnie jeden plik.');
48 var file = fullPath(filex.host + '/' + filex.path.full() + '/', selected[0]);
50 target.selectize.clear();
51 target.selectize.addOption({value: file, text: file});
52 target.selectize.addItem(file);
53 target.selectize.refreshItems();
55 $('#gridftp').modal('hide');
56 filex.clearSelection();
59 }).wrap('<div style="margin-right: 80px"></div>');
61 $('#id_stage_in').before(function() {
63 return gridftpButton.clone().click(function() {
64 $('#select-btn').off().click(function() {
65 var path = filex.host + '/' + filex.path.full() + '/';
67 _.each(filex.selectedFiles(), function(item) {
68 var file = fullPath(path, item);
69 target.selectize.addOption({value: file, text: file});
70 target.selectize.addItem(file);
72 target.selectize.refreshItems();
74 $('#gridftp').modal('hide');
75 filex.clearSelection();
78 }).wrap('<div style="margin-right: 80px"></div>');
80 $('#id_application,#id_force_field').selectize();
81 $('#id_arguments,#id_properties,#id_native').selectize({
82 plugins: ['remove_button'],
85 option_create: function(data, escape) {
86 return '<div class="create">Dodaj <strong>' + escape(data.input) + '</strong>…</div>';
90 $('#id_queue').selectize({
93 option_create: function(data, escape) {
94 return '<div class="create">Wybierz <strong>' + escape(data.input) + '</strong>…</div>';
99 $('#id_modules,#id_hosts,#id_pdb_file,#id_master_file,#id_executable,#id_input,#id_stage_in,#id_preprocess_script,#id_postprocess_script').selectize({
100 plugins: ['remove_button']
103 $('#id_sequence').on("click keyup", function(){
104 $(this).val($(this).val().toUpperCase());
107 // hide delete checkbox in empty env form
108 $('#env-form-empty').find('div.form-group:last-of-type').hide();
109 $('#env-controls').find('> div').formset({
110 formTemplate: '#env-form-empty',
111 parent: '#env-controls',
112 addLinkParent: '#add-env-form',
114 addCssClass: 'add-btn',
116 deleteCssClass: 'delete-btn btn btn-xs btn-danger'
119 $('input[name="notify_type"],input[name="watch_output_type"],input[name="preprocess_type"],input[name="postprocess_type"]').on('change', function () {
126 $('#toggle-advanced').click(function(e) {
128 $('form .collapse').collapse('toggle');
129 $(this).find('span').text(this.text == "Pokaż zaawansowane" ? "Ukryj zaawansowane" : "Pokaż zaawansowane");
132 $('#gridftp').one('show.bs.modal', function() {
134 $(this).find('.modal-body').css('height', window.innerHeight - 200 + 'px');
137 $('#template').on('show.bs.modal', function() {
139 }).on('shown.bs.modal', function() {
140 $(this).find('input[type="text"]')[0].focus();
141 }).on('submit', function(e) {
144 // copy this form's fields to description form and send it
145 $('#description').append($(this).find('input').clone().attr('type', 'hidden')).submit();
151 {% block container %}
152 <div class="pull-right">
154 <button class="btn btn-default" data-toggle="modal" data-target="#template">Zapisz</button>
155 <button class="btn btn-default" data-toggle="modal" data-target="#delete-modal">Usuń</button>
157 <button class="btn btn-default" data-toggle="modal" data-target="#template">Zapisz jako szablon</button>
161 <h1 class="page-header">{% block title %}Zleć zadanie{% endblock %} <small>{{ template.name }}</small></h1>
164 <div class="alert alert-danger">
165 <strong>Uwaga!</strong> Formularz zawiera błędy.
166 {{ form.non_field_errors }}
167 {{ env_formset.non_field_errors }}
168 {{ template_form.non_field_errors }}
172 <form id="description" action="." method="post" class="form-horizontal">
175 {% include 'qcg/job_submit_form.html' %}
180 <div class="col-sm-offset-3 col-md-offset-4 col-sm-9 col-md-6">
181 <button type="submit" class="btn btn-primary">Zleć zadanie</button>
182 <button type="reset" class="btn btn-warning">Resetuj</button>
183 <a id="toggle-advanced" href="#"><span class="text-muted">Pokaż zaawansowane</span></a>
188 <div id="gridftp" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridftp-modal-label" aria-hidden="true">
189 <div class="modal-dialog modal-lg">
190 <div class="modal-content">
191 <div class="modal-header">
192 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
193 <h4 class="modal-title" id="gridftp-modal-label">Wybierz plik</h4>
195 <div class="modal-body">
196 {% include 'filex/source.html' %}
198 <div class="modal-footer">
199 <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
200 <button id="select-btn" type="button" class="btn btn-primary">Wybierz</button>
206 <form id="template" action="." method="post" class="modal fade form-horizontal" tabindex="-1"
207 role="dialog" aria-labelledby="template-modal-label" aria-hidden="true">
208 <div class="modal-dialog">
209 <div class="modal-content">
210 <div class="modal-header">
211 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
212 <h4 class="modal-title" id="template-modal-label">Podaj nazwę szablonu</h4>
214 <div class="modal-body">
216 <input type="hidden" name="save-template" value="1">
217 {% bootstrap_field template_form.name layout="horizontal" %}
219 <div class="modal-footer">
220 <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
221 <button type="submit" class="btn btn-primary" data-loading-text="Zapisywanie...">Zapisz</button>
228 <form id="delete-modal" action="{% url 'template_delete' template.id %}" method="post" class="modal fade" tabindex="-1"
229 role="dialog" aria-labelledby="delete-modal-label" aria-hidden="true">
230 <div class="modal-dialog">
231 <div class="modal-content">
232 <div class="modal-header">
233 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
234 <h4 class="modal-title" id="delete-modal-label">Usuwanie szablonu</h4>
236 <div class="modal-body">
238 <p>Czy na pewno usunąć szablon <em>{{ template.name }}</em>?</p>
240 <div class="modal-footer">
241 <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
242 <button type="submit" class="btn btn-danger">Usuń</button>