From ac1a2f004af7e9c39a4417e42592487b3638da6e Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Tue, 4 Apr 2017 12:17:02 +0200
Subject: [PATCH] page listing configuration items implemented

---
 .../templates/configuration/breadcrumb.html   |  4 ++
 smash/web/templates/configuration/index.html  | 69 +++++++++++++++++++
 smash/web/templates/sidebar.html              |  7 ++
 smash/web/urls.py                             |  6 ++
 smash/web/views/__init__.py                   |  1 +
 smash/web/views/configuration_item.py         |  6 ++
 6 files changed, 93 insertions(+)
 create mode 100644 smash/web/templates/configuration/breadcrumb.html
 create mode 100644 smash/web/templates/configuration/index.html
 create mode 100644 smash/web/views/configuration_item.py

diff --git a/smash/web/templates/configuration/breadcrumb.html b/smash/web/templates/configuration/breadcrumb.html
new file mode 100644
index 00000000..236d1bc3
--- /dev/null
+++ b/smash/web/templates/configuration/breadcrumb.html
@@ -0,0 +1,4 @@
+<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
+<li class="active">
+    <a href="{% url 'web.views.configuration' %}">Configuration</a>
+</li>
diff --git a/smash/web/templates/configuration/index.html b/smash/web/templates/configuration/index.html
new file mode 100644
index 00000000..60e11a3d
--- /dev/null
+++ b/smash/web/templates/configuration/index.html
@@ -0,0 +1,69 @@
+{% extends "_base.html" %}
+{% load static %}
+
+
+{% block styles %}
+    {{ block.super }}
+    <!-- DataTables -->
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
+
+{% endblock styles %}
+
+{% block ui_active_tab %}'configuration'{% endblock ui_active_tab %}
+{% block page_header %}Configuration{% endblock page_header %}
+{% block page_description %}{% endblock page_description %}
+
+{% block title %}{{ block.super }} - Configuration{% endblock %}
+
+{% block breadcrumb %}
+    {% include "configuration/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+
+    <div>
+        <div>
+            <table id="table" class="table table-bordered table-striped">
+                <thead>
+                <tr>
+                    <th>Name</th>
+                    <th>Value</th>
+                </tr>
+                </thead>
+                <tbody>
+                </tbody>
+            </table>
+
+            <hr/>
+
+        </div>
+
+    </div>
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+
+    <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script>
+    <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script>
+    <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script>
+
+    <script>
+        $(function () {
+            $(function () {
+                var table = $('#table').DataTable({
+                    serverSide: true,
+                    processing: true,
+                    ordering: false,
+                    ajax: "{% url 'web.api.configuration_items' %}",
+                    columns: [
+                        {"data": "name"},
+                        {"data": "value"},
+                    ],
+                });
+
+                $('#table_filter').css("display", "none");
+            });
+        });
+    </script>
+{% endblock scripts %}
diff --git a/smash/web/templates/sidebar.html b/smash/web/templates/sidebar.html
index 7dbbeb01..19cd2afa 100644
--- a/smash/web/templates/sidebar.html
+++ b/smash/web/templates/sidebar.html
@@ -58,4 +58,11 @@
         </a>
     </li>
 
+    <li data-desc="configuration">
+        <a href="{% url 'web.views.configuration' %}">
+            <i class="fa fa-wrench"></i>
+            <span>Configuration</span>
+        </a>
+    </li>
+
 </ul>
\ No newline at end of file
diff --git a/smash/web/urls.py b/smash/web/urls.py
index 0a9c9be7..83a16c80 100644
--- a/smash/web/urls.py
+++ b/smash/web/urls.py
@@ -115,6 +115,12 @@ urlpatterns = [
     url(r'^export$', views.export.export, name='web.views.export'),
     url(r'^export/(?P<type>[A-z]+)$', views.export.export_to_csv2, name='web.views.export_to_csv2'),
 
+    ####################
+    #       CONFIGURATION     #
+    ####################
+
+    url(r'^configuration$', views.configuration_item.configuration_items, name='web.views.configuration'),
+
     ####################
     #       AUTH       #
     ####################
diff --git a/smash/web/views/__init__.py b/smash/web/views/__init__.py
index 49820e91..e78ca58c 100644
--- a/smash/web/views/__init__.py
+++ b/smash/web/views/__init__.py
@@ -61,3 +61,4 @@ import mails
 import statistics
 import export
 import contact_attempt
+import configuration_item
diff --git a/smash/web/views/configuration_item.py b/smash/web/views/configuration_item.py
new file mode 100644
index 00000000..039e6290
--- /dev/null
+++ b/smash/web/views/configuration_item.py
@@ -0,0 +1,6 @@
+# coding=utf-8
+from . import wrap_response
+
+
+def configuration_items(request):
+    return wrap_response(request, "configuration/index.html", {})
-- 
GitLab