From ba5d16c463e5b0817b4ce9a16e864f42fc6541c4 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Tue, 29 Oct 2013 19:24:25 +0400 Subject: [PATCH] Redesign of activity stream Part of blueprint review-punchcard Change-Id: Iacff003c85d0dd262e8ae7a3065f144827cab94b --- dashboard/parameters.py | 2 +- dashboard/static/css/style.css | 14 ++++++ .../js/jqplot.canvasAxisLabelRenderer.min.js | 3 ++ dashboard/templates/overview.html | 2 +- dashboard/templates/reports/base_report.html | 45 +++++++++++++++---- .../templates/reports/blueprint_summary.html | 2 +- 6 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 dashboard/static/js/jqplot.canvasAxisLabelRenderer.min.js diff --git a/dashboard/parameters.py b/dashboard/parameters.py index 26d370ed1..2ff9a30e7 100644 --- a/dashboard/parameters.py +++ b/dashboard/parameters.py @@ -48,7 +48,7 @@ METRIC_TO_RECORD_TYPE = { } DEFAULT_RECORDS_LIMIT = 10 -DEFAULT_STATIC_ACTIVITY_SIZE = 50 +DEFAULT_STATIC_ACTIVITY_SIZE = 100 def get_default(param_name): diff --git a/dashboard/static/css/style.css b/dashboard/static/css/style.css index 2335acc30..0134d9eae 100644 --- a/dashboard/static/css/style.css +++ b/dashboard/static/css/style.css @@ -167,6 +167,20 @@ div#right_list_wrapper { line-height: 135%; } +.activity { + margin-bottom: 2em; +} + +.activity h3 { + margin-bottom: 0.2em; +} +.activity b { + color: red; +} +.activity .message { + margin: 0; +} + a[href^="https://blueprints"]:after { content: "↗"; opacity: 0.3; diff --git a/dashboard/static/js/jqplot.canvasAxisLabelRenderer.min.js b/dashboard/static/js/jqplot.canvasAxisLabelRenderer.min.js new file mode 100644 index 000000000..4ecca1eac --- /dev/null +++ b/dashboard/static/js/jqplot.canvasAxisLabelRenderer.min.js @@ -0,0 +1,3 @@ +/* jqPlot 1.0.7r1224 | (c) 2009-2013 Chris Leonello | jplot.com + jsDate | (c) 2010-2013 Chris Leonello + */(function(a){a.jqplot.CanvasAxisLabelRenderer=function(b){this.angle=0;this.axis;this.show=true;this.showLabel=true;this.label="";this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';this.fontSize="11pt";this.fontWeight="normal";this.fontStretch=1;this.textColor="#666666";this.enableFontSupport=true;this.pt2px=null;this._elem;this._ctx;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null};a.extend(true,this,b);if(b.angle==null&&this.axis!="xaxis"&&this.axis!="x2axis"){this.angle=-90}var c={fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily};if(this.pt2px){c.pt2px=this.pt2px}if(this.enableFontSupport){if(a.jqplot.support_canvas_text()){this._textRenderer=new a.jqplot.CanvasFontRenderer(c)}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}};a.jqplot.CanvasAxisLabelRenderer.prototype.init=function(b){a.extend(true,this,b);this._textRenderer.init({fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily})};a.jqplot.CanvasAxisLabelRenderer.prototype.getWidth=function(d){if(this._elem){return this._elem.outerWidth(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.sin(f.angle)*e)+Math.abs(Math.cos(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getHeight=function(d){if(this._elem){return this._elem.outerHeight(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.cos(f.angle)*e)+Math.abs(Math.sin(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad=function(){var b=this.angle*Math.PI/180;return b};a.jqplot.CanvasAxisLabelRenderer.prototype.draw=function(c,f){if(this._elem){if(a.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce();this._elem=null}var e=f.canvasManager.getCanvas();this._textRenderer.setText(this.label,c);var b=this.getWidth(c);var d=this.getHeight(c);e.width=b;e.height=d;e.style.width=b;e.style.height=d;e=f.canvasManager.initCanvas(e);this._elem=a(e);this._elem.css({position:"absolute"});this._elem.addClass("jqplot-"+this.axis+"-label");e=null;return this._elem};a.jqplot.CanvasAxisLabelRenderer.prototype.pack=function(){this._textRenderer.draw(this._elem.get(0).getContext("2d"),this.label)}})(jQuery); \ No newline at end of file diff --git a/dashboard/templates/overview.html b/dashboard/templates/overview.html index a4b058fb9..3e70b1029 100644 --- a/dashboard/templates/overview.html +++ b/dashboard/templates/overview.html @@ -11,7 +11,7 @@ {% set show_module_contribution = (module) and (not user_id) %} {% set show_contribution = (show_user_contribution) or (show_module_contribution) %} {% set show_user_profile = (user_id) %} -{% set show_module_profile = (module) %} +{% set show_module_profile = (module) and (not user_id) and (not company) %} {% set show_top_mentors_options = (metric == 'tm_marks') %} {% set show_review_ratio = (metric in ['marks', 'tm_marks']) %} diff --git a/dashboard/templates/reports/base_report.html b/dashboard/templates/reports/base_report.html index e78292ff6..8681b1459 100644 --- a/dashboard/templates/reports/base_report.html +++ b/dashboard/templates/reports/base_report.html @@ -48,7 +48,7 @@ {% else %} {% for item in activity %} -
+
{% if show_gravatar %} @@ -57,11 +57,14 @@ {% endif %}
-
-
{{ item.date_str}}
-
{{ item.author_name }} ({{ item.company_name }})
+
+ {% if item.record_type == "commit" %} -
Commit “{{ item.subject }}” to {{ item.module }}
+ +

{{ item.date_str}} — commit “{{item.subject}}” to {{ item.module }}

+ +
Author: {{ item.author_name }} ({{ item.company_name }})
+
{{ item.message | safe }}
+{{ item.lines_added }} - {{ item.lines_deleted }} @@ -70,21 +73,45 @@
Commit corrected: {{ item.correction_comment }}
{% endif %} + {% elif item.record_type == "mark" %} -
Review “{{item.subject}}” in {{ item.module }}
- + +

{{ item.date_str}} — review “{{item.subject}}” in {{ item.module }}

+ +
Patch submitted by: {{ item.parent_author_name }} ({{ item.parent_company_name }})
{{item.description}}: {{item.value}}
+ {% elif item.record_type == "review" %} -
Patch “{{item.subject}}” in {{ item.module }}
+ +

{{ item.date_str}} — patch “{{item.subject}}” posted into {{ item.module }}

+ +
Author: {{ item.author_name }} ({{ item.company_name }})
+
Current Status: {{ item.status }}
Change Id: {{item.id}}
+ {% elif item.record_type == "email" %} -
Email “{{item.subject}}”
+ +

{{ item.date_str}} — email “{{item.subject}}”

+ +
Author: {{ item.author_name }} ({{ item.company_name }})
{% if item.body %}
{{ item.body|safe }}
{% endif %} + + {% elif item.record_type in ["bpd", "bpc"] %} + +

{{ item.date_str}} — blueprint “{{item.title}}” in {{ item.module }}

+ +
Author: {{ item.author_name }} ({{ item.company_name }})
+ +
Report: {{ item.blueprint_link | safe}}
+ {% if item.summary %} +
{{ item.summary|safe }}
+ {% endif %} + {% endif %}
diff --git a/dashboard/templates/reports/blueprint_summary.html b/dashboard/templates/reports/blueprint_summary.html index fbc451584..d11fec9c4 100644 --- a/dashboard/templates/reports/blueprint_summary.html +++ b/dashboard/templates/reports/blueprint_summary.html @@ -1,7 +1,7 @@ {% extends "reports/base_report.html" %} {% block title %} -Blueprint {{ blueprint.title }} detailed report +Blueprint “{{ blueprint.title }}” report {% endblock %} {% block body %}