modal for gridftp file chooser
authorMaciej Tronowski <mtro@man.poznan.pl>
Mon, 23 Mar 2015 09:34:10 +0000 (10:34 +0100)
committerMaciej Tronowski <mtro@man.poznan.pl>
Mon, 23 Mar 2015 09:34:10 +0000 (10:34 +0100)
qcg/templates/qcg/job_new.html

index cf00b20..fca86fe 100644 (file)
@@ -9,8 +9,28 @@
     <script src="{% static 'qcg/selectize/selectize.min.js' %}"></script>
     <script src="{% static 'qcg/formset/jquery.formset.js' %}"></script>
 
+    {% include 'filex/source.js.html' %}
+
     <script>
         $(function() {
+            $('#id_executable,#id_input,#id_stage_in,#id_preprocess_script,#id_postprocess_script').before(function() {
+                var target = this;
+                return $('<button/>', {
+                    'type': 'button',
+                    'class': 'btn btn-default pull-right',
+                    'text': 'Wybierz',
+                    'data-toggle': 'modal',
+                    'data-target': '#gridftp'
+                }).click(function() {
+                    filex.once('selected:file', function(file) {
+                        target.selectize.addOption({value: file, text: file});
+                        target.selectize.addItem(file);
+                        target.selectize.refreshItems();
+                        $('#gridftp').modal('hide');
+                    });
+                });
+            }).wrap('<div style="margin-right: 80px"></div>');
+
             $('#id_application').selectize();
             $('#id_arguments,#id_properties,#id_native').selectize({
                 plugins: ['remove_button'],
@@ -29,7 +49,7 @@
                     }
                 }
             });
-            $('#id_modules, #id_hosts').selectize({
+            $('#id_modules,#id_hosts,#id_executable,#id_input,#id_stage_in,#id_preprocess_script,#id_postprocess_script').selectize({
                 plugins: ['remove_button']
             });
 
         </div>
     </form>
 
+    <div id="gridftp" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">
+        <div class="modal-dialog modal-lg">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                    <h4 class="modal-title" id="modal-label">Wybierz plik</h4>
+                </div>
+                <div class="modal-body">
+                    {% include 'filex/source.html' %}
+                </div>
+            </div>
+        </div>
+    </div>
+
 {% endblock %}