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>';
98 $('#id_modules,#id_hosts,#id_master_file,#id_executable,#id_input,#id_stage_in,#id_preprocess_script,#id_postprocess_script').selectize({
99 plugins: ['remove_button']
102 // hide delete checkbox in empty env form
103 $('#env-form-empty').find('div.form-group:last-of-type').hide();
104 $('#env-controls').find('> div').formset({
105 formTemplate: '#env-form-empty',
106 parent: '#env-controls',
107 addLinkParent: '#add-env-form',
109 addCssClass: 'add-btn',
111 deleteCssClass: 'delete-btn btn btn-xs btn-danger'
114 $('input[name="notify_type"],input[name="watch_output_type"],input[name="preprocess_type"],input[name="postprocess_type"]').on('change', function () {
121 $('#toggle-advanced').click(function(e) {
123 $('form .collapse').collapse('toggle');
124 $(this).find('span').text(this.text == "Pokaż zaawansowane" ? "Ukryj zaawansowane" : "Pokaż zaawansowane");
127 $('#gridftp').one('show.bs.modal', function() {
129 $(this).find('.modal-body').css('height', window.innerHeight - 200 + 'px');
132 $('#template').on('show.bs.modal', function() {
134 }).on('shown.bs.modal', function() {
135 $(this).find('input[type="text"]')[0].focus();
136 }).on('submit', function(e) {
139 // copy this form's fields to description form and send it
140 $('#description').append($(this).find('input').clone().attr('type', 'hidden')).submit();
146 {% block container %}
147 <div class="pull-right">
149 <button class="btn btn-default" data-toggle="modal" data-target="#template">Zapisz</button>
150 <button class="btn btn-default" data-toggle="modal" data-target="#delete-modal">Usuń</button>
152 <button class="btn btn-default" data-toggle="modal" data-target="#template">Zapisz jako szablon</button>
156 <h1 class="page-header">{% block title %}Zleć zadanie{% endblock %} <small>{{ template.name }}</small></h1>
159 <div class="alert alert-danger">
160 <strong>Uwaga!</strong> Formularz zawiera błędy.
161 {{ form.non_field_errors }}
162 {{ env_formset.non_field_errors }}
163 {{ template_form.non_field_errors }}
167 <form id="description" action="." method="post" class="form-horizontal">
170 {% include 'qcg/job_submit_form.html' %}
175 <div class="col-sm-offset-3 col-md-offset-4 col-sm-9 col-md-6">
176 <button type="submit" class="btn btn-primary">Zleć zadanie</button>
177 <button type="reset" class="btn btn-warning">Resetuj</button>
178 <a id="toggle-advanced" href="#"><span class="text-muted">Pokaż zaawansowane</span></a>
183 <div id="gridftp" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridftp-modal-label" aria-hidden="true">
184 <div class="modal-dialog modal-lg">
185 <div class="modal-content">
186 <div class="modal-header">
187 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
188 <h4 class="modal-title" id="gridftp-modal-label">Wybierz plik</h4>
190 <div class="modal-body">
191 {% include 'filex/source.html' %}
193 <div class="modal-footer">
194 <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
195 <button id="select-btn" type="button" class="btn btn-primary">Wybierz</button>
201 <form id="template" action="." method="post" class="modal fade form-horizontal" tabindex="-1"
202 role="dialog" aria-labelledby="template-modal-label" aria-hidden="true">
203 <div class="modal-dialog">
204 <div class="modal-content">
205 <div class="modal-header">
206 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
207 <h4 class="modal-title" id="template-modal-label">Podaj nazwę szablonu</h4>
209 <div class="modal-body">
211 <input type="hidden" name="save-template" value="1">
212 {% bootstrap_field template_form.name layout="horizontal" %}
214 <div class="modal-footer">
215 <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
216 <button type="submit" class="btn btn-primary" data-loading-text="Zapisywanie...">Zapisz</button>
223 <form id="delete-modal" action="{% url 'template_delete' template.id %}" method="post" class="modal fade" tabindex="-1"
224 role="dialog" aria-labelledby="delete-modal-label" aria-hidden="true">
225 <div class="modal-dialog">
226 <div class="modal-content">
227 <div class="modal-header">
228 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
229 <h4 class="modal-title" id="delete-modal-label">Usuwanie szablonu</h4>
231 <div class="modal-body">
233 <p>Czy na pewno usunąć szablon <em>{{ template.name }}</em>?</p>
235 <div class="modal-footer">
236 <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
237 <button type="submit" class="btn btn-danger">Usuń</button>