From 79b6f50c48ed7bf8bb56f9d2439f64aeab2861ee Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 14 Oct 2014 18:31:32 +0200 Subject: Re-arrange dashboard in tabs --- ishtar_common/static/media/style.css | 27 +++++ .../ishtar/dashboards/dashboard_main.html | 133 ++------------------- .../ishtar/dashboards/dashboard_main_detail.html | 88 ++++++++++++++ .../dashboards/dashboard_main_detail_users.html | 36 ++++++ ishtar_common/urls.py | 2 + ishtar_common/views.py | 43 +++++++ 6 files changed, 206 insertions(+), 123 deletions(-) create mode 100644 ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html create mode 100644 ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html (limited to 'ishtar_common') diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css index 4990fa111..32e957b74 100644 --- a/ishtar_common/static/media/style.css +++ b/ishtar_common/static/media/style.css @@ -573,6 +573,33 @@ table.confirm tr.spacer td:last-child{ right:135px; } +.ui-widget-header { + background:none; +} + +.ui-tabs .ui-tabs-nav li a{ + color: #D14; +} + +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { + background:none; + background-color: #F1F2F6; + border: 1px solid #CCC; + border-radius-top: 4px; +} + +.ui-tabs .ui-tabs-nav li.ui-tabs-active a{ + background-color:#fff; +} + +#dashboard{ + padding-top: 20px; +} + +#dash-tabs .ui-tabs .ui-tabs-panel{ + padding:0; +} + .dashboard > div, .dashboard h3{ width:760px; diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html index 3242da9a3..06b671343 100644 --- a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load i18n %} -{% load range %} +{% load url from future %} {% block extra_head %} {{form.media}} @@ -11,128 +11,15 @@ {% endblock %} {% block content %} -
-{% for lbl, dashboard in items %} - -

{{lbl}}

-
-

{% trans "Numbers" %}

-

{% trans "Total:" %} {{dashboard.total_number}}

-
-
- {% comment %} - - {% for idx, lbl, values in dashboard.values %} - - - {% for value in values %}{% endfor%} - - {% endfor%} -
{{lbl}}{{value}}
{% endcomment %} -
- {% if dashboard.years %} -

{% trans "By years" %}

-
    -
  • {% trans "Average:" %} {{dashboard.average}}
  • -
  • {% trans "Variance:" %} {{dashboard.variance}}
  • -
  • {% trans "Standard deviation:" %} {{dashboard.standard_deviation}}
  • -
  • {% trans "Median:" %} {{dashboard.median}}
  • -
  • {% trans "Mode:" %} {{dashboard.mode}}
  • -
- {% endif %} - {% if dashboard.operation_average %} -

{% trans "By operations" %}

-
    -
  • {% trans "Average:" %} {{dashboard.operation_average}}
  • -
  • {% trans "Variance:" %} {{dashboard.operation_variance}}
  • -
  • {% trans "Standard deviation:" %} {{dashboard.operation_standard_deviation}}
  • -
  • {% trans "Median:" %} {{dashboard.operation_median}}
  • -
  • {% trans "Mode:" %} {{dashboard.operation_mode}}
  • -
- {% endif %} -

{% trans "Created last" %}

-
- - - {% for item in dashboard.lasts %} - - - - {% endfor %} -
{{lbl}}{% trans "Created" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
-
-

{% trans "Recent changes" %}

-
- - - {% for item in dashboard.recents %} - - - - {% endfor %} -
{{lbl}}{% trans "Modified" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
-
-
-{% endfor%} - -

{% trans "Users" %}

-
- -
-
- - - {% for user_type in ishtar_users.types %} - - - - - {% endfor%} -
{% trans "User type" %}{% trans "Number" %}
{{user_type.person__person_types__label}}{#TODO: Display all#}{{user_type.number}}
-
+
+
+
    + {% for label, app in app_list %} +
  • {{label}}
  • + {% endfor %}
+
{% endblock %} diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html new file mode 100644 index 000000000..6a99c4fdd --- /dev/null +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail.html @@ -0,0 +1,88 @@ +{% load i18n %} +
+ +

{{lbl}}

+
+

{% trans "Numbers" %}

+

{% trans "Total:" %} {{dashboard.total_number}}

+
+
+ {% comment %} + + {% for idx, lbl, values in dashboard.values %} + + + {% for value in values %}{% endfor%} + + {% endfor%} +
{{lbl}}{{value}}
{% endcomment %} +
+ {% if dashboard.years %} +

{% trans "By years" %}

+
    +
  • {% trans "Average:" %} {{dashboard.average}}
  • +
  • {% trans "Variance:" %} {{dashboard.variance}}
  • +
  • {% trans "Standard deviation:" %} {{dashboard.standard_deviation}}
  • +
  • {% trans "Median:" %} {{dashboard.median}}
  • +
  • {% trans "Mode:" %} {{dashboard.mode}}
  • +
+ {% endif %} + {% if dashboard.operation_average %} +

{% trans "By operations" %}

+
    +
  • {% trans "Average:" %} {{dashboard.operation_average}}
  • +
  • {% trans "Variance:" %} {{dashboard.operation_variance}}
  • +
  • {% trans "Standard deviation:" %} {{dashboard.operation_standard_deviation}}
  • +
  • {% trans "Median:" %} {{dashboard.operation_median}}
  • +
  • {% trans "Mode:" %} {{dashboard.operation_mode}}
  • +
+ {% endif %} +

{% trans "Created last" %}

+
+ + + {% for item in dashboard.lasts %} + + + + {% endfor %} +
{{lbl}}{% trans "Created" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
+
+

{% trans "Recent changes" %}

+
+ + + {% for item in dashboard.recents %} + + + + {% endfor %} +
{{lbl}}{% trans "Modified" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
+
+
diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html new file mode 100644 index 000000000..6602d5193 --- /dev/null +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main_detail_users.html @@ -0,0 +1,36 @@ +{% load i18n %} +

{% trans "Users" %}

+
+ +
+
+ + + {% for user_type in ishtar_users.types %} + + + + + {% endfor%} +
{% trans "User type" %}{% trans "Number" %}
{{user_type.person__person_types__label}}{#TODO: Display all#}{{user_type.number}}
+
+
+ diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index c46f555e9..8b148530e 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -63,6 +63,8 @@ urlpatterns += patterns('ishtar_common.views', # General url(r'dashboard-main/$', 'dashboard_main', name='dashboard-main'), + url(r'dashboard-main/(?P[a-z-]+)/$', 'dashboard_main_detail', + name='dashboard-main-detail'), url(r'update-current-item/$', 'update_current_item', name='update-current-item'), url(r'new-person/(?:(?P[^/]+)/)?(?:(?P[^/]+)/)?$', diff --git a/ishtar_common/views.py b/ishtar_common/views.py index c3e6dbb33..9f193fdec 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -703,6 +703,7 @@ def dashboard_main(request, dct, obj_id=None, *args, **kwargs): """ Main dashboard """ + """ items = [] if 'archaeological_files' in settings.INSTALLED_APPS: from archaeological_files.models import File @@ -718,5 +719,47 @@ def dashboard_main(request, dct, obj_id=None, *args, **kwargs): items.append((_(u"Finds"), models.Dashboard(Find))) dct = {'items':items, 'ishtar_users':models.UserDashboard()} + """ + app_list = [] + if 'archaeological_files' in settings.INSTALLED_APPS: + app_list.append((_(u"Archaeological files"), 'files')) + app_list.append((_(u"Operations"), 'operations')) + if 'archaeological_context_records' in settings.INSTALLED_APPS: + app_list.append((_(u"Context records"), 'context-records')) + if 'archaeological_finds' in settings.INSTALLED_APPS: + app_list.append((_(u"Finds"), 'finds')) + dct = {'app_list':app_list} return render_to_response('ishtar/dashboards/dashboard_main.html', dct, context_instance=RequestContext(request)) + +def dashboard_main_detail(request, item_name): + """ + Specific tab of the main dashboard + """ + if item_name == 'users': + dct = {'ishtar_users':models.UserDashboard()} + return render_to_response( + 'ishtar/dashboards/dashboard_main_detail_users.html', + dct, context_instance=RequestContext(request)) + lbl, dashboard = None, None + if item_name == 'files' and \ + 'archaeological_files' in settings.INSTALLED_APPS: + from archaeological_files.models import File + lbl, dashboard = (_(u"Archaeological files"), models.Dashboard(File)) + if item_name == 'operations': + from archaeological_operations.models import Operation + lbl, dashboard = (_(u"Operations"), models.Dashboard(Operation)) + if item_name == 'context-records' and \ + 'archaeological_context_records' in settings.INSTALLED_APPS: + from archaeological_context_records.models import ContextRecord + lbl, dashboard = (_(u"Context records"), models.Dashboard(ContextRecord)) + if item_name == 'finds' and \ + 'archaeological_finds' in settings.INSTALLED_APPS: + from archaeological_finds.models import Find + lbl, dashboard = (_(u"Finds"), models.Dashboard(Find)) + if not lbl: + raise Http404 + dct = {'lbl':lbl, 'dashboard':dashboard, + 'item_name':item_name.replace('-', '_')} + return render_to_response('ishtar/dashboards/dashboard_main_detail.html', + dct, context_instance=RequestContext(request)) -- cgit v1.2.3