From a133cf3f56ba185e325e5798a3755b73fd2be323 Mon Sep 17 00:00:00 2001 From: Daniel Cloud Date: Fri, 20 Jan 2012 14:25:13 -0500 Subject: [PATCH] Improved project_detail.html layout and styling. Now more grid-like and dashboardy! Added extra observations, which should have been there from the get-go. Could use some more template snippets to make it more DRY, but whatevs. --- site_static/css/style.css | 93 ++++++++++++++-- site_static/js/script.js | 4 +- templates/dashboard/project_detail.html | 104 +++++++++++------- .../snippets/_render_observation_value.html | 6 +- 4 files changed, 155 insertions(+), 52 deletions(-) diff --git a/site_static/css/style.css b/site_static/css/style.css index b3e09af..499d999 100644 --- a/site_static/css/style.css +++ b/site_static/css/style.css @@ -148,6 +148,10 @@ h2 { font-size: 150%; } +h2 > a { + text-decoration: none; +} + h3 { margin-bottom: 8px; } @@ -355,7 +359,9 @@ p.observation { font-size: 180%; } +ol.observation { margin-bottom: 10px;} ol.observation > li { + list-style-type: decimal; padding-bottom: 3px; margin-bottom: 2px; border-bottom: 1px dashed #E9E9E9; @@ -485,10 +491,81 @@ li { background-image: url('/static/img/blue_arrow_down.png'); } +/* +.project section.unit-observations { + width: 470px; + float: left; + margin-right: 5px; +} +*/ + +a.internal { + text-decoration: none; +} + +.analytics-items a.internal { + position: absolute; + bottom: 10px; +} + +.analytics-items p.observation { + font-size: 276.5%; +} + +div.analytics-items h2 { + margin-bottom: 20px; +} + +div.analytics-items { + position: relative; +} + +div.analytics-items > ul { + margin-left: 0px; +} + +div.analytics-items li > div { + padding: 15px 40px; +} + +div.analytics-items > ul > li { + position: relative; + width: 300px; + min-height: 182px; + margin: 0 7px 10px; + border: 1px solid #E1DFDA; + background-color: #F8F7F2; + vertical-align: top; + display: inline-block; + zoom: 1; + *display: inline; + _height: 140px; +} + #annotation_dialog { display: none; } +#home-floater { + display: block; + padding: 8px 12px; + text-align: center; + background-color: #E1DFDA; + border: 1px solid #CAC8C2; + position: fixed; + left: 15px; + bottom: 10px; +} + +#home-floater p { + margin: 0; +} + +#home-floater a { + text-decoration: none; + font-weight: bold; +} + tr.primary > th { border-right: 1px dashed #DCDBD6; } @@ -520,20 +597,24 @@ td.top-traffic-referrers { background-repeat: no-repeat; } -.increased { +.increased { color: #9CC71B;} +.increased .observation { color: #9CC71B; background-image: url('/static/img/arrow_green.png'); background-repeat: no-repeat; - background-position: 95% 45%; + background-position: 95% 50%; padding-right: 22px; + display: inline; } -.decreased { +.decreased { color: #F74D0F; } +.decreased .observation { color: #F74D0F; background-image: url('/static/img/arrow_red.png'); background-repeat: no-repeat; - background-position: 95% 45%; + background-position: 95% 50%; padding-right: 22px; + display: inline; } td.increased > * { @@ -575,10 +656,6 @@ p.metric { width: auto; } -.average-time-on-site-per-visit { - margin-left: 12px; -} - .balance { white-space: nowrap; } diff --git a/site_static/js/script.js b/site_static/js/script.js index dc2b091..371b985 100644 --- a/site_static/js/script.js +++ b/site_static/js/script.js @@ -25,8 +25,8 @@ if (fromDate > toDate) dfFrom.datepicker("setDate", toDate); }); - $('th').on('click', 'a[href^="#"]', function(event) { - event.preventDefault(); + $('a[href^="#"].internal, #home-floater a').on('click', function(event) { + // event.preventDefault(); $('html, body').animate({scrollTop: $( $(this).attr('href') ).offset().top}, 800); }); }(jQuery)); diff --git a/templates/dashboard/project_detail.html b/templates/dashboard/project_detail.html index c66cf07..8ba0018 100644 --- a/templates/dashboard/project_detail.html +++ b/templates/dashboard/project_detail.html @@ -1,18 +1,13 @@ {% extends "dashboard/project_list.html" %}{% load dashboard_filters humanize %} {% block body_class %}project{% endblock body_class %} -{% block content %}{% with object_list.0 as object %} +{% block content %}{% with object=object_list.0 numcols=ordered_units|length|add:"1" %}

{{ object.project.name }}

- - - - {% for datap in object.observations %} - {% endfor %} - - - - {% for datap in object.observations %} - {% endfor %} - - - -
{% if "observations" in datap %}{{ datap.metric.unit.name }}{% else %}{{ datap.metric.unit.name }}{% endif %}
+
    {% for datap in object.observations %} +
  • +

    {{ datap.metric.unit.name }}

    +
    - {% if datap %}{% spaceless %}{% include "dashboard/snippets/_render_observation.html" %}{% endspaceless %}{% else %} {% endif %} -
 
+ {% include 'dashboard/snippets/_render_observation.html' %} + + {% if "observations" in datap %}View details…{% endif %} + {% endfor %} + {% for datap in object.extra_observations %}{% if datap %} +
  • +

    {{ datap.metric.unit.name }}

    +
    + {% include 'dashboard/snippets/_render_observation.html' %} +
    + {% if "observations" in datap %}View details…{% endif %} +
  • {% endif %}{% endfor %} + + {% if object.annotations %}

    Annotations

    @@ -47,41 +65,44 @@

    Annotations

    {{ datap.metric.unit.name|title }}

    {% ifnotequal datap.observation_model "objectobservation" %}
    - {% ifequal datap.observation_model "ratioobservation" %} -

    {% spaceless %}{% ifequal datap.data.antecedent.metric.unit.observation_unit "seconds" %} - {{ datap.data|secondstoduration }} - {% else %} - {% ifequal datap.metric.unit.observation_unit "percentage" %} - {{ datap.data|percentage:2}} - {% else %} - {{ datap.data|floatformat:1}} - {% endifequal %} - {% endifequal %} - {% endspaceless %}

    - {% endifequal %} - {% ifequal datap.observation_model "countobservation" %} -

    {% spaceless %}{% ifequal datap.metric.unit.observation_unit "seconds" %} - {{ datap.data|secondstoduration }} - {% else %} - {{ datap.data|intcomma }} - {% endifequal %} - {% endspaceless %}

    - {% endifequal %} +

    {% include "dashboard/snippets/_render_observation_value.html" with datap=datap %}

    -

    View Data Table

    +

    Data Table

    {% endifnotequal %}
    {% for sub_datap in datap.observations reversed %} {% endfor %}
    - {% spaceless %}{% include "dashboard/snippets/_render_observation.html" with datap=sub_datap list_slice=":20" %}{% endspaceless %} + {% spaceless %}{% include "dashboard/snippets/_render_observation.html" with datap=sub_datap list_slice=":10" %}{% endspaceless %}
    {% endif %}{% endfor %} +{% for datap in object.extra_observations %}{% if "observations" in datap %} +
    +

    {{ datap.metric.unit.name|title }}

    + {% ifnotequal datap.observation_model "objectobservation" %} +
    +

    {% include "dashboard/snippets/_render_observation_value.html" with datap=datap %}

    +
    +
    +

    Data Table

    + {% endifnotequal %} +
    + {% for sub_datap in datap.observations reversed %} + + + + {% endfor %} +
    + {% spaceless %}{% include "dashboard/snippets/_render_observation.html" with datap=sub_datap list_slice=":10" %}{% endspaceless %} +
    +
    +
    {% endif %}{% endfor %} +

    Add an Annotation

    {% csrf_token %} @@ -89,6 +110,11 @@

    Add an Annotation

    +
    +

    + Top ↑ +

    +
    {% endwith %}{% endblock content %} {% block js %} diff --git a/templates/dashboard/snippets/_render_observation_value.html b/templates/dashboard/snippets/_render_observation_value.html index d421936..7706f1c 100644 --- a/templates/dashboard/snippets/_render_observation_value.html +++ b/templates/dashboard/snippets/_render_observation_value.html @@ -1,5 +1,5 @@ -{% load dashboard_filters humanize %} -{% with slice_val=list_slice|default:":5" %}{% spaceless %} +{% load dashboard_filters humanize %}{% spaceless %} +{% with slice_val=list_slice|default:":5" %} {% ifequal datap.observation_model "objectobservation" %}{{ datap.data }}{% endifequal %} {% ifequal datap.observation_model "ratioobservation" %} {% ifequal datap.antecedent.metric.unit.observation_unit "seconds" %} @@ -19,4 +19,4 @@ {{ datap.data|intcomma }} {% endifequal %} {% endifequal %} -{% endspaceless %}{% endwith %} +{% endwith %}{% endspaceless %} \ No newline at end of file