Permalink
Browse files

Cut out client side views. Also makes admin applet management easier.

  • Loading branch information...
1 parent 78b1d67 commit 13b5dee3f1eb2117dc92efaebbc3a20fb81ed65e @nagisa committed Feb 11, 2012

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -23,188 +23,8 @@
<script type="text/javascript" src="{{ STATIC_URL }}django_bfm/application.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}django_bfm/upload.jquery.js"></script>
- <!--
- ******************************************************
- File Browser templates
- ******************************************************
- -->
- <script id="browse_head_tpl" type="text/template">
- <th>{% trans "Actions" %}</th>
- <th class="<%= filename %>" data-name="filename"><a>{% trans "Filename" %}</a></th>
- <th class="<%= size %>" data-name="size"><a>{% trans "Size" %}</a></th>
- <th class="<%= date %>" data-name="date"><a>{% trans "Date" %}</a></th>
- <th class="<%= mime %>" data-name="mime"><a>{% trans "Type" %}</a></th>
- </script>
-
-
- <script id="browse_file_tpl" type="text/template">
- <td class="tight icons">
- <a class="delete iconic trash" title="{% trans "Delete" %}"></a>
- <a class="touch iconic pin" title="{% trans "Touch" %}"></a>
- <a class="rename iconic tag" title="{% trans "Rename" %}"></a>
- <a class="resize iconic image" title="{% trans "Resize" %}"></a>
- </td>
- <td><a href="<%= url %>" target="_blank"><%= filename %></a></td>
- <td class="tight"><%= psize %></td>
- <td class="tight"><%= pdate %></td>
- <td class="tight"><%= mimetype %></td>
- </script>
-
-
- <script id="file_rename_tpl" type="text/template">
- <h2>{% trans "Rename file" %}</h2>
- <input type="text" name="new" value="<%= filename %>">
- <input type="hidden" name="file" value="<%= filename %>">
- <input type="hidden" name="directory" value="<%= rel_dir %>">
- <input type="submit" class="submit" value="{% trans "Rename" %}">
- <input type="submit" class="cancel" value="{% trans "Cancel" %}">
- </script>
+ {# Templates #}{% include 'django_bfm/client_side/base.html' %}
-
- <script id="image_resize_tpl" type="text/template">
- <h2>{% trans "Resize image" %}</h2>
- <input type="hidden" name="file" value="<%= filename %>">
- <input type="hidden" name="directory" value="<%= rel_dir %>">
- {% trans "New width" %}
- <input type="text" style="width:50px" name="new_w" value="">
- <br />
- {% trans "New height" %}
- <input type="text" style="width:50px" name="new_h" value="">
- <br />
- {% trans "Keep ratio" %}
- <input type="checkbox" name="keepratio" value="yes" checked>
- <br />
- {% trans "Resize filter" %}
- <select name="filter">
- <option value="ANTIALIAS">{% trans "Antialiasing" %}</option>
- <option value="BICUBIC">{% trans "Bicubic" %}</option>
- <option value="BILINEAR">{% trans "Bilinear" %}</option>
- <option value="NEAREST">{% trans "Nearest" %}</option>
- </select>
- <br />
- <input type="submit" class="submit" value="{% trans "Resize" %}">
- <input type="submit" class="cancel" value="{% trans "Cancel" %}">
- </script>
-
- <!-- Paginator templates -->
- <script id="pgn_current_page_tpl" type="text/template">
- <span class="this-page"><%= page %></span>&nbsp;
- </script>
-
-
- <script id="pgn_page_tpl" type="text/template">
- <a href="#"><%= page %></a>&nbsp;
- </script>
-
-
- <script id="pgn_first_page_tpl" type="text/template">
- <a href="#" class="firstpage">{% trans "First page" %}</a>&nbsp;
- </script>
-
-
- <script id="pgn_last_page_tpl" type="text/template">
- <a href="#" class="lastpage">{% trans "Last page" %}</a>&nbsp;
- </script>
-
- <!--
- ******************************************************
- Uploader templates
- ******************************************************
- -->
- <script id="uploader_tpl" type="text/template">
- <div class="uploader-head">
- {% trans "Uploader" %}
- <a class="control iconic fullscreen" title="{% trans "Expand uploader" %}"
- data-alttitle="{% trans "Minimize uploader" %}">
- </a>
- </div>
- <div class="uploader-controls breadcrumbs">
- <form class="selector">
- <input type="file" multiple>
- <a class="iconic plus" href="#"> {% trans "Add files" %}</a>
- </form>
- <form class="selector directory">
- <input type="file" webkitdirectory directory mozdirectory>
- <a class="iconic plus" href="#"> {% trans "Add folder (experimental)" %}</a>
- </form>
- <a class="iconic trash finished" href="#"> {% trans "Clear finished" %}</a>
- <a class="iconic trash rqueued" href="#"> {% trans "Remove queued" %}</a>
- </div>
- <div class="uploader-table-container">
- <div class="uploader-table">
- </div>
- </div>
- </script>
-
-
- <script id="file_upload_tpl" type="text/template">
- <div class="file">
- <div class="status"></div>
- <a class="abort iconic x" title="{% trans "Cancel this upload" %}"></a>
- <span class="filename"><%= filename %></span>
- <span class="indicators">
- (<span class="percent">0</span>% @ <span class="speed">0 B/s</span>)
- </span>
- <span class="failed">({% trans "Failed" %})</span>
- <span class="aborted">({% trans "Aborted" %})</span>
- </div>
- </script>
-
-
- <script id="upload_cancel_tpl" type="text/template">
- {% trans "Uploading in progress!" %}
- </script>
-
- <script id="uploader_droptarget" type="text/template">
- <div id="uploader-droptarget">
- {% trans "Drop files here!" %}
- </div>
- </script>
-
- <!--
- ******************************************************
- Directory templates
- ******************************************************
- -->
- <script id="directory_actions_tpl" type="text/template">
- <li><a>{% trans "New directory" %}</a></li>
- <li><a>{% trans "Rename" %}</a></li>
- <li><a>{% trans "Delete" %}</a></li>
- </script>
-
-
- <script id="rootdirectory_actions_tpl" type="text/template">
- <li><a>{% trans "New directory" %}</a></li>
- </script>
-
-
- <script id="new_directory_tpl" type="text/template">
- <h2>{% trans "Create new directory" %}</h2>
- {% trans "You are going to create a new directory inside '/<%= rel_dir %>'. Enter it's name." %}
- <input type="text" name="new" value="">
- <input type="submit" class="submit" value="{% trans "Create" %}">
- <input type="submit" class="cancel" value="{% trans "Cancel" %}">
- </script>
-
-
- <script id="rename_directory_tpl" type="text/template">
- <h2>{% trans "Rename directory" %}</h2>
- <input type="text" name="new" value="<%= name %>">
- <input type="submit" class="submit" value="{% trans "Rename" %}">
- <input type="submit" class="cancel" value="{% trans "Cancel" %}">
- </script>
-
-
- <script id="delete_directory_tpl" type="text/template">
- <h2>{% trans "Delete directory" %}</h2>
- <div>
- {% trans "You are going to delete a directory with all files and directories inside it. Are you sure?" %}
- </div>
- <input type="submit" class="cancel" value="{% trans "No" %}">
- <input type="submit" class="cancel" value="{% trans "Over my dead body!" %}">
- <input type="submit" class="submit" value="{% trans "I'm sure" %}">
- <input type="submit" class="cancel" value="{% trans "Just kill this dialog" %}">
- </script>
{% endblock %}
{% block extrastyle %}
@@ -0,0 +1,3 @@
+{% include 'django_bfm/client_side/file_browser.html' %}
+{% include 'django_bfm/client_side/uploader.html' %}
+{% include 'django_bfm/client_side/directories.html' %}
@@ -0,0 +1,37 @@
+{% load i18n %}
+
+<script id="directory_actions_tpl" type="text/template">
+ <li><a>{% trans "New directory" %}</a></li>
+ <li><a>{% trans "Rename" %}</a></li>
+ <li><a>{% trans "Delete" %}</a></li>
+</script>
+
+<script id="rootdirectory_actions_tpl" type="text/template">
+ <li><a>{% trans "New directory" %}</a></li>
+</script>
+
+<script id="new_directory_tpl" type="text/template">
+ <h2>{% trans "Create new directory" %}</h2>
+ {% trans "You are going to create a new directory inside '/<%= rel_dir %>'. Enter it's name." %}
+ <input type="text" name="new" value="">
+ <input type="submit" class="submit" value="{% trans "Create" %}">
+ <input type="submit" class="cancel" value="{% trans "Cancel" %}">
+</script>
+
+<script id="rename_directory_tpl" type="text/template">
+ <h2>{% trans "Rename directory" %}</h2>
+ <input type="text" name="new" value="<%= name %>">
+ <input type="submit" class="submit" value="{% trans "Rename" %}">
+ <input type="submit" class="cancel" value="{% trans "Cancel" %}">
+</script>
+
+<script id="delete_directory_tpl" type="text/template">
+ <h2>{% trans "Delete directory" %}</h2>
+ <div>
+ {% trans "You are going to delete a directory with all files and directories inside it. Are you sure?" %}
+ </div>
+ <input type="submit" class="cancel" value="{% trans "No" %}">
+ <input type="submit" class="cancel" value="{% trans "Over my dead body!" %}">
+ <input type="submit" class="submit" value="{% trans "I'm sure" %}">
+ <input type="submit" class="cancel" value="{% trans "Just kill this dialog" %}">
+</script>
@@ -0,0 +1,72 @@
+{% load i18n %}
+
+<script id="browse_head_tpl" type="text/template">
+ <th>{% trans "Actions" %}</th>
+ <th class="<%= filename %>" data-name="filename"><a>{% trans "Filename" %}</a></th>
+ <th class="<%= size %>" data-name="size"><a>{% trans "Size" %}</a></th>
+ <th class="<%= date %>" data-name="date"><a>{% trans "Date" %}</a></th>
+ <th class="<%= mime %>" data-name="mime"><a>{% trans "Type" %}</a></th>
+</script>
+
+<script id="browse_file_tpl" type="text/template">
+ <td class="tight icons">
+ <a class="delete iconic trash" title="{% trans "Delete" %}"></a>
+ <a class="touch iconic pin" title="{% trans "Touch" %}"></a>
+ <a class="rename iconic tag" title="{% trans "Rename" %}"></a>
+ <a class="resize iconic image" title="{% trans "Resize" %}"></a>
+ </td>
+ <td><a href="<%= url %>" target="_blank"><%= filename %></a></td>
+ <td class="tight"><%= psize %></td>
+ <td class="tight"><%= pdate %></td>
+ <td class="tight"><%= mimetype %></td>
+</script>
+
+<script id="file_rename_tpl" type="text/template">
+ <h2>{% trans "Rename file" %}</h2>
+ <input type="text" name="new" value="<%= filename %>">
+ <input type="hidden" name="file" value="<%= filename %>">
+ <input type="hidden" name="directory" value="<%= rel_dir %>">
+ <input type="submit" class="submit" value="{% trans "Rename" %}">
+ <input type="submit" class="cancel" value="{% trans "Cancel" %}">
+</script>
+
+<script id="image_resize_tpl" type="text/template">
+ <h2>{% trans "Resize image" %}</h2>
+ <input type="hidden" name="file" value="<%= filename %>">
+ <input type="hidden" name="directory" value="<%= rel_dir %>">
+ {% trans "New width" %}
+ <input type="text" style="width:50px" name="new_w" value="">
+ <br />
+ {% trans "New height" %}
+ <input type="text" style="width:50px" name="new_h" value="">
+ <br />
+ {% trans "Keep ratio" %}
+ <input type="checkbox" name="keepratio" value="yes" checked>
+ <br />
+ {% trans "Resize filter" %}
+ <select name="filter">
+ <option value="ANTIALIAS">{% trans "Antialiasing" %}</option>
+ <option value="BICUBIC">{% trans "Bicubic" %}</option>
+ <option value="BILINEAR">{% trans "Bilinear" %}</option>
+ <option value="NEAREST">{% trans "Nearest" %}</option>
+ </select>
+ <br />
+ <input type="submit" class="submit" value="{% trans "Resize" %}">
+ <input type="submit" class="cancel" value="{% trans "Cancel" %}">
+</script>
+
+<script id="pgn_current_page_tpl" type="text/template">
+ <span class="this-page"><%= page %></span>&nbsp;
+</script>
+
+<script id="pgn_page_tpl" type="text/template">
+ <a href="#"><%= page %></a>&nbsp;
+</script>
+
+<script id="pgn_first_page_tpl" type="text/template">
+ <a href="#" class="firstpage">{% trans "First page" %}</a>&nbsp;
+</script>
+
+<script id="pgn_last_page_tpl" type="text/template">
+ <a href="#" class="lastpage">{% trans "Last page" %}</a>&nbsp;
+</script>
@@ -0,0 +1,49 @@
+{% load i18n %}
+
+<script id="uploader_tpl" type="text/template">
+ <div class="uploader-head">
+ {% trans "Uploader" %}
+ <a class="control iconic fullscreen" title="{% trans "Expand uploader" %}"
+ data-alttitle="{% trans "Minimize uploader" %}">
+ </a>
+ </div>
+ <div class="uploader-controls breadcrumbs">
+ <form class="selector">
+ <input type="file" multiple>
+ <a class="iconic plus" href="#"> {% trans "Add files" %}</a>
+ </form>
+ <form class="selector directory">
+ <input type="file" webkitdirectory directory mozdirectory>
+ <a class="iconic plus" href="#"> {% trans "Add folder (experimental)" %}</a>
+ </form>
+ <a class="iconic trash finished" href="#"> {% trans "Clear finished" %}</a>
+ <a class="iconic trash rqueued" href="#"> {% trans "Remove queued" %}</a>
+ </div>
+ <div class="uploader-table-container">
+ <div class="uploader-table">
+ </div>
+ </div>
+</script>
+
+<script id="file_upload_tpl" type="text/template">
+ <div class="file">
+ <div class="status"></div>
+ <a class="abort iconic x" title="{% trans "Cancel this upload" %}"></a>
+ <span class="filename"><%= filename %></span>
+ <span class="indicators">
+ (<span class="percent">0</span>% @ <span class="speed">0 B/s</span>)
+ </span>
+ <span class="failed">({% trans "Failed" %})</span>
+ <span class="aborted">({% trans "Aborted" %})</span>
+ </div>
+</script>
+
+<script id="upload_cancel_tpl" type="text/template">
+ {% trans "Uploading in progress!" %}
+</script>
+
+<script id="uploader_droptarget" type="text/template">
+ <div id="uploader-droptarget">
+ {% trans "Drop files here!" %}
+ </div>
+</script>
View
@@ -9,5 +9,6 @@
url(r'^directory/$', views.DirectoryActions.as_view()),
url(r'^upfile/$', 'django_bfm.views.file_upload', name="bfm_upload"),
url(r'^image/$', views.ImageActions.as_view()),
- url(r'^admin_options/$', 'django_bfm.views.admin_options', name="bfm_opt")
+ url(r'^admin_options/$', 'django_bfm.views.admin_options', name="bfm_opt"),
+ url(r'^client_templates/$', views.client_templates, name='bfm_templates')
)
View
@@ -48,6 +48,11 @@ def admin_options(request):
return render_to_response('django_bfm/admin.js', c)
+def client_templates(request):
+ c = RequestContext(request, {})
+ return render_to_response('django_bfm/client_side/base.html', c)
+
+
@login_required
@staff_member_required
def list_files(request):

0 comments on commit 13b5dee

Please sign in to comment.