diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-04-02 22:56:22 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-04-02 22:56:22 +0200 |
| commit | b5cad4fdafacd1d1eced5784e449996db5dc8e84 (patch) | |
| tree | fd89b907ec0beeb2cab88691e8b65ef71f6ab91d /data | |
| parent | 81e9ac241907e0a802122e6787e648ce3bb1b494 (diff) | |
| download | phorkie-b5cad4fdafacd1d1eced5784e449996db5dc8e84.tar.gz phorkie-b5cad4fdafacd1d1eced5784e449996db5dc8e84.zip | |
move js-add button and logic into separate file, make it available in new pastes
Diffstat (limited to 'data')
| -rw-r--r-- | data/templates/edit-add.htm | 23 | ||||
| -rw-r--r-- | data/templates/edit.htm | 25 | ||||
| -rw-r--r-- | data/templates/index.htm | 4 |
3 files changed, 27 insertions, 25 deletions
diff --git a/data/templates/edit-add.htm b/data/templates/edit-add.htm new file mode 100644 index 0000000..8435852 --- /dev/null +++ b/data/templates/edit-add.htm @@ -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> diff --git a/data/templates/edit.htm b/data/templates/edit.htm index 6c1899f..d60598f 100644 --- a/data/templates/edit.htm +++ b/data/templates/edit.htm @@ -12,16 +12,7 @@ {% 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"> @@ -38,18 +29,4 @@ </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 %} diff --git a/data/templates/index.htm b/data/templates/index.htm index 05989df..3893d2a 100644 --- a/data/templates/index.htm +++ b/data/templates/index.htm @@ -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"> |
