job templates list view
authorMaciej Tronowski <mtro@man.poznan.pl>
Wed, 29 Apr 2015 16:01:09 +0000 (18:01 +0200)
committerMaciej Tronowski <mtro@man.poznan.pl>
Wed, 29 Apr 2015 16:01:09 +0000 (18:01 +0200)
qcg/templates/qcg/base.html
qcg/templates/qcg/job_templates.html [new file with mode: 0644]
qcg/urls.py
qcg/views.py

index e5eecc7..64cb5bf 100644 (file)
                                     {% firstof user.get_full_name user.username  %} <b class="caret"></b>
                                 </a>
                                 <ul class="dropdown-menu">
+                                    <li><a href="{% url 'job_templates' %}">
+                                        <span class="glyphicon glyphicon-floppy-disk"></span>&nbsp;Zapisane zadania</a>
+                                    </li>
+
                                     {% if request.user.is_superuser %}
-                                        <li><a href="{% url 'admin:index' %}" target="_blank">
-                                            <span class="glyphicon glyphicon-wrench"></span>&nbsp;Panel Administracyjny</a></li>
                                         <li class="divider"></li>
+                                        <li><a href="{% url 'admin:index' %}" target="_blank">
+                                            <span class="glyphicon glyphicon-wrench"></span>&nbsp;Panel Administracyjny</a>
+                                        </li>
                                     {% endif %}
 
+                                    <li class="divider"></li>
                                     <li>
                                         <a href="{% url 'logout' %}" role="button">
                                             <span class="glyphicon glyphicon-off"></span>&nbsp;Wyloguj
diff --git a/qcg/templates/qcg/job_templates.html b/qcg/templates/qcg/job_templates.html
new file mode 100644 (file)
index 0000000..7bdeea1
--- /dev/null
@@ -0,0 +1,40 @@
+{% extends 'qcg/base.html' %}
+
+{% block container %}
+    <h1 class="page-header">{% block title %}Szablony zadania{% endblock %}</h1>
+
+    {% if templates %}
+        <table class="table table-hover">
+            <thead>
+                <tr>
+                    <th class="text-right" style="width: 40px">#</th>
+                    <th>Nazwa</th>
+                    <th style="width: 200px">Data utworzenia</th>
+                    <th style="width: 200px">Data modyfikacji</th>
+                    <th></th>
+                </tr>
+            </thead>
+            <tbody>
+                {% for template in templates %}
+                    <tr>
+                        <td class="text-right">{{ forloop.counter }}</td>
+                        <td><a href="#">{{ template.name }}</a></td>
+                        <td>{{ template.created }}</td>
+                        <td>{{ template.updated }}</td>
+                        <td class="text-right">
+                            <button class="btn btn-xs btn-danger" title="Usuń">
+                                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
+                            </button>
+                        </td>
+                    </tr>
+                {% endfor %}
+            </tbody>
+        </table>
+    {% else %}
+        <div id="no-items" class="alert alert-info">
+            <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
+            Brak zapisanych szablonów zadań
+        </div>
+    {% endif %}
+
+{% endblock %}
index 6d9f0cc..f3a99ab 100644 (file)
@@ -13,6 +13,7 @@ urlpatterns = patterns('',
 
     url(r'^$', views.index, name='index'),
     url(r'^jobs/$', views.jobs_list, name='jobs'),
+    url(r'^job/templates/$', views.job_templates, name='job_templates'),
 
     url(r'^job/submit/$', views.job_submit, name='job_submit'),
     url(r'^job/cancel/(?P<job_id>[\w]+)/$', views.job_cancel, name='job_cancel'),
index 12827a9..973247b 100644 (file)
@@ -272,3 +272,8 @@ def gridftp_upload(request):
                   {'error': error, 'url': reverse('filex:upload') + '?' + urlencode(form.cleaned_data),
                    'host': form.cleaned_data['host'], 'path': form.cleaned_data['path'],
                    'sep': '/' if form.cleaned_data['path'].startswith('~') else ''})
+
+
+@login_required
+def job_templates(request):
+    return render(request, 'qcg/job_templates.html', {'templates': request.user.templates.all()})