Update jQuery from 1.12.4 to 3.7.1
[phorkie.git] / data / templates / edit-add.htm
index 8435852d8ebea2f8336ce54413394e40f6a36c1a..3a3741b4073b31fac664b98b8cd06fd94d15c29f 100644 (file)
@@ -1,22 +1,22 @@
- <div class="well" style="text-align: center; display:none" id="add-button">
-    <a class="btn" href="#">
-     <i class="icon-plus"></i>
-     Add file
-    </a>
- </div>
-
- {% include 'edit-file.htm' with {'file': '', 'fileid': 'new'} %}
+{% include 'edit-file.htm' with {'file': null, 'fileid': 'new', 'newfile': true} %}
 
 <script type="application/javascript">
 $(document).ready(function() {
     $('#add-button').show();
     $('#filegroupnew').hide();
-    $('#add-button a').bind('click', function() {
-        $('#add-button').before("{% filter escape('js') %}
-            {% include 'edit-file.htm' with {'file': '', 'fileid': '###'} %}
+    $('#add-button').bind('click', function() {
+        $('.filegroup:last').before("{% filter escape('js') %}
+            {% include 'edit-file.htm' with {'file': null, 'fileid': '###', 'newfile': true} %}
             {% endfilter %}"
             .replace(/###/g, $('.filegroup').length)
         );
+        toggleAdditional($('.filegroup:visible .additional-btn:last')[0], 0);
+        jQuery($('.filegroup:visible .additional-btn:last')[0]).show();
+
+        $('html, body').animate({
+            scrollTop: $('.filegroup:visible:last').offset().top
+        });
+        $('.filegroup:visible:last textarea').focus();
         return false;
     });
 });