allow people to add more files when editing
[phorkie.git] / data / templates / edit.htm
index 45650b6257b03fff8000fd4720f18a1ce9613b5c..6c1899ff9817be32c09bd2407389152301e81f5b 100644 (file)
   {% include 'edit-file.htm' with {'file': file, 'fileid': fileid} %}
  {% endfor %}
 
+
+ <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'} %}
+
+
  <div class="well">
   <div class="row-fluid">
    <div class="span6">
  </div>
 
 </form>
+<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': '###'} %}
+            {% endfilter %}"
+            .replace(/###/g, $('.filegroup').length)
+        );
+        return false;
+    });
+});
+</script>
 {% endblock %}