move js-add button and logic into separate file, make it available in new pastes
authorChristian Weiske <cweiske@cweiske.de>
Mon, 2 Apr 2012 20:56:22 +0000 (22:56 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 2 Apr 2012 20:56:22 +0000 (22:56 +0200)
data/templates/edit-add.htm [new file with mode: 0644]
data/templates/edit.htm
data/templates/index.htm

diff --git a/data/templates/edit-add.htm b/data/templates/edit-add.htm
new file mode 100644 (file)
index 0000000..8435852
--- /dev/null
@@ -0,0 +1,23 @@
+ <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'} %}
+
+<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>
index 6c1899ff9817be32c09bd2407389152301e81f5b..d60598f79741fe875cb1686ff7f2e2ca2adc4c50 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'} %}
-
+ {% include 'edit-add.htm' %}
 
  <div class="well">
   <div class="row-fluid">
  </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 %}
index 05989dfa062894318286b13700c48c6a3abfad97..3893d2ab47d78185b9fd8bec0e19ecb0d9f9cb20 100644 (file)
@@ -8,7 +8,9 @@
    <input type="text" name="description" id="description" value="{{description}}"/>
  </div>
 
- {% include 'edit-file.htm' with {'file': file[1], 'fileid': 1} %}
+ {% include 'edit-file.htm' with {'file': file[1], 'fileid': 0} %}
+
+ {% include 'edit-add.htm' %}
 
  <div class="well" style="text-align: right">
   <button class="btn btn-primary" type="submit">