Commit cb63bc25 by Kálmán Viktor

dashboard: new features

- delete directory
- create new directory
- move store html for a new file
parent cc40257a
{% load i18n %}
<div class="list-group" id="store-list-list">
<a href="?directory={{ up_url }}" class="list-group-item store-list-item" data-item-type="D">
<i class="icon-reply store-list-item-icon"></i>
..
<div class="pull-right">
{{ current }}
</div>
</a>
{% for f in root %}
<a class="list-group-item store-list-item" data-item-type="{{ f.TYPE }}"
href="{% if f.TYPE == "D" %}?directory={{ f.path }}{% else %}
{% url "dashboard.views.store-download" %}?path={{ f.path }}{% endif %}"
>
<div class="store-list-item-icon">
<i class="
icon-{% if f.TYPE == "D" %}folder-open-alt store-list-item-icon-directory{% else %}file-alt{% endif %}"
></i>
</div>
{{ f.NAME }}
<div class="store-list-item-new">
{% if f.is_new and f.TYPE == "F" %}
<span class="badge badge-pulse">{% trans "new" %}</span>
{% endif %}
</div>
<div class="store-list-item-size">
{{ f.human_readable_size }}
</div>
<div class="clearfix"></div>
</a>
<div class="store-list-file-infos">
<a href="{% url "dashboard.views.store-download" %}?path={{ f.path }}"
class="btn btn-primary btn-sm store-download-button">
<i class="icon-download"></i>
{% trans "Download" %}
</a>
<a href="{% url "dashboard.views.store-remove" %}?path={{ f.path }}"
class="btn btn-danger btn-xs store-remove-button">
<i class="icon-remove"></i>
{% trans "Remove" %}
</a>
<dl class="dl-horizontal" style="margin: 0; padding: 0;">
<dt>{% trans "Filename" %}</dt>
<dd>{{ f.NAME }}</dd>
<dt>{% trans "Size" %}</dt>
<dd>{{ f.human_readable_size }}</dd>
<dt>{% trans "Latest modification" %}</dt>
<dd>{{ f.human_readable_date }}</dd>
</dl>
</div>
{% empty %}
<a class="list-group-item">
{% trans "This folder is empty." %}
</a>
{% endfor %}
<div class="list-group-item">
{% trans "Upload file to this folder" %}
<a href="{% url "dashboard.views.store-upload"%}?directory={{ current }}"
class="btn btn-info btn-xs pull-right js-hidden">
{% trans "Upload" %}
</a>
<form action="" data-action="{% url "dashboard.views.store-upload-url" %}"
method="POST" enctype="multipart/form-data" class="pull-right no-js-hidden"
id="store-upload-form">
{% csrf_token %}
<input type="hidden" name="current_dir" value="{{ current }}"/>
<input type="hidden" name="next" value="{{ next_url }}"/>
<div class="input-group" style="max-width: 350px;">
<span class="input-group-btn" id="store-upload-browse">
<span class="btn btn-primary btn-xs">
{% trans "Browse..." %}
</span>
</span>
<input type="text" class="form-control input-tags"
id="store-upload-filename"/>
<span class="input-group-btn">
<input type="submit" class="btn btn-primary btn-xs" disabled
value="{% trans "Upload" %}"/>
</span>
</div>
<input id="store-upload-file" name="data" type="file" style="display:none" multiple>
</form>
</div>
</div><!-- closing list-group -->
<div class="list-group">
<div class="list-group-item">
<a href="{% url "dashboard.views.store-remove" %}?path={{ current }}"
class="btn btn-danger btn-xs pull-right">
<i class="icon-remove"></i> {% trans "Remove" %}
</a>
<form method="POST" action="{% url "dashboard.views.store-new-directory" %}">
{% csrf_token %}
<input type="hidden" name="path" value="{{ current }}"/>
<div class="input-group" style="max-width: 350px;">
<span class="input-group-addon input-tags" title="{% trans "New directory" %}">
<i class="icon-folder-open-alt"></i>
</span>
<input type="text" class="form-control input-tags" name="name"
placeholder="{% trans "Name "%}"/>
<span class="input-group-btn">
<input type="submit" class="btn btn-success btn-xs" value="{% trans "Create" %}"/>
</span>
</div>
</form>
</div>
</div>
{% extends "dashboard/base.html" %}
{% load i18n %}
{% load store_tags %}
{% block title-page %}{% trans "Virtual machines" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-12">
<div class="list-group" id="store-list-list">
<a href="?directory={{ up_url }}" class="list-group-item store-list-item" data-item-type="D">
<i class="icon-reply store-list-item-icon"></i>
..
<div class="pull-right">
{{ current }}
</div>
</a>
{% for f in root %}
<a class="list-group-item store-list-item" data-item-type="{{ f.TYPE }}"
href="{% if f.TYPE == "D" %}?directory={{ f.path }}{% else %}
{% url "dashboard.views.store-download" %}?path={{ f.path }}{% endif %}"
>
<div class="store-list-item-icon">
<i class="
icon-{% if f.TYPE == "D" %}folder-open-alt store-list-item-icon-directory{% else %}file-alt{% endif %}"
></i>
</div>
{{ f.NAME }}
<div class="store-list-item-new">
{% if f.is_new %}
<span class="badge badge-pulse">{% trans "new" %}</span>
{% endif %}
</div>
<div class="store-list-item-size">
{{ f.human_readable_size }}
</div>
<div class="clearfix"></div>
</a>
<div class="store-list-file-infos">
<a href="{% url "dashboard.views.store-download" %}?path={{ f.path }}"
class="btn btn-primary btn-sm store-download-button">
<i class="icon-download"></i>
{% trans "Download" %}
</a>
<a href="{% url "dashboard.views.store-remove" %}?path={{ f.path }}"
class="btn btn-danger btn-xs store-remove-button">
<i class="icon-remove"></i>
{% trans "Remove" %}
</a>
<dl class="dl-horizontal" style="margin: 0; padding: 0;">
<dt>{% trans "Filename" %}</dt>
<dd>{{ f.NAME }}</dd>
<dt>{% trans "Size" %}</dt>
<dd>{{ f.human_readable_size }}</dd>
<dt>{% trans "Latest modification" %}</dt>
<dd>{{ f.human_readable_date }}</dd>
</dl>
</div>
{% empty %}
<a class="list-group-item">
{% trans "This folder is empty." %}
</a>
{% endfor %}
<div class="list-group-item">
Upload file to this folder
<a href="{% url "dashboard.views.store-upload"%}?directory={{ current }}"
class="btn btn-info btn-xs pull-right js-hidden">
{% trans "Upload" %}
</a>
<form action="" data-action="{% url "dashboard.views.store-upload-url" %}"
method="POST" enctype="multipart/form-data" class="pull-right no-js-hidden"
id="store-upload-form">
{% csrf_token %}
<input type="hidden" name="current_dir" value="{{ current }}"/>
<input type="hidden" name="next" value="{{ next_url }}"/>
<div class="input-group" style="max-width: 400px;">
<span class="input-group-btn" id="store-upload-browse">
<span class="btn btn-primary btn-xs">
{% trans "Browse..." %}
</span>
</span>
<input type="text" class="form-control input-tags"
id="store-upload-filename"/>
<span class="input-group-btn">
<input type="submit" class="btn btn-primary btn-xs" disabled
value="{% trans "Upload" %}"/>
</span>
</div>
<input id="store-upload-file" name="data" type="file" style="display:none" multiple>
</form>
</div>
<div>
{% include "dashboard/store/_list-box.html" %}
</div>
</div>
</div>
......
......@@ -23,7 +23,7 @@
Are you sure you want to remove the file at <strong>{{ path }}</strong>?
{% endblocktrans %}
{% else %}
{% blocktrans with directory=directory name=name %}
{% blocktrans with directory=directory %}
Are you sure you want to remove the directory <strong>{{ directory }}</strong>?
{% endblocktrans %}
{% endif %}
......
......@@ -38,6 +38,7 @@ from .views import (
ProfileView, toggle_use_gravatar, UnsubscribeFormView,
UserKeyDelete, UserKeyDetail, UserKeyCreate,
StoreList, store_download, store_upload, store_get_upload_url, StoreRemove,
store_new_directory,
)
urlpatterns = patterns(
......@@ -181,4 +182,6 @@ urlpatterns = patterns(
name="dashboard.views.store-upload"),
url(r"^store/remove/$", StoreRemove.as_view(),
name="dashboard.views.store-remove"),
url(r"^store/new_directory/$", store_new_directory,
name="dashboard.views.store-new-directory"),
)
......@@ -3051,3 +3051,14 @@ class StoreRemove(LoginRequiredMixin, TemplateView):
reverse("dashboard.views.store-list"),
os.path.dirname(path),
))
@require_POST
@login_required
def store_new_directory(request):
path = request.POST.get("path")
name = request.POST.get("name")
store_api.requestnewfolder("test", path + name)
return redirect("%s?directory=%s" % (
reverse("dashboard.views.store-list"), path))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment