From 78386b9daa7ed371751050adfd82bdf1643d72ec Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Sun, 22 Sep 2013 20:02:03 -0300 Subject: [PATCH] Fixing home chart --- src/colab/deprecated/templates/base.html | 3 +-- src/colab/deprecated/templates/home.html | 16 ++++++++-------- src/colab/deprecated/templates/pizza-chart.html | 8 ++++++-- src/colab/static/css/screen.css | 5 ----- src/colab/static/third-party/jquery.debouncedresize.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 src/colab/static/third-party/jquery.debouncedresize.js diff --git a/src/colab/deprecated/templates/base.html b/src/colab/deprecated/templates/base.html index a88eee9..57e3f7e 100644 --- a/src/colab/deprecated/templates/base.html +++ b/src/colab/deprecated/templates/base.html @@ -6,12 +6,11 @@ - - + diff --git a/src/colab/deprecated/templates/home.html b/src/colab/deprecated/templates/home.html index 2717185..30c4559 100644 --- a/src/colab/deprecated/templates/home.html +++ b/src/colab/deprecated/templates/home.html @@ -2,7 +2,7 @@ {% load i18n %} {% block head_js %} - {% include "pizza-chart.html" with chart_div="collabs" chart_width=410 chart_height=330 %} + {% include "pizza-chart.html" with chart_div="collabs" chart_width="100%" chart_height=330 %} {% endblock %} {% block header %} @@ -40,19 +40,19 @@
-

{% trans "Distribution of Collaborations" %}

-
 
+

{% trans "Collaboration Graph" %}

+

- {% trans "Most Relevant Discussions" %} + {% trans "Most Relevant Threads" %}

+ title="{% trans "RSS - Most Relevant Threads" %}">
    {% for thread in hottest_threads %} @@ -61,18 +61,18 @@
- {% trans "View more discussions relevance..." %} + {% trans "View more discussions..." %}
 

- {% trans "Latest Discussions" %} + {% trans "Latest Threads" %}

+ title="{% trans "RSS - Latest Threads" %}">
    {% for thread in latest_threads %} diff --git a/src/colab/deprecated/templates/pizza-chart.html b/src/colab/deprecated/templates/pizza-chart.html index 81f8b1d..37fb35d 100644 --- a/src/colab/deprecated/templates/pizza-chart.html +++ b/src/colab/deprecated/templates/pizza-chart.html @@ -28,8 +28,8 @@ ]); // Set chart options - var options = {'width': {{ chart_width }}, - 'height': {{ chart_height }}, + var options = {'width': '{{ chart_width }}', + 'height': '{{ chart_height }}', 'legend': 'bottom', chartArea: { top:10, @@ -40,6 +40,10 @@ // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.PieChart(document.getElementById('{{ chart_div }}')); chart.draw(data, options); + + $(window).on("debouncedresize", function( event ) { + chart.draw(data, options); + }); } {% endif %} diff --git a/src/colab/static/css/screen.css b/src/colab/static/css/screen.css index 6fb0361..7525543 100644 --- a/src/colab/static/css/screen.css +++ b/src/colab/static/css/screen.css @@ -4,14 +4,9 @@ body { padding-top: 70px; } -/* better fit for xm and sm screens */ -h3 { - font-size: 160%; -} /* Header */ - #header-searchbox { width: 140px; } diff --git a/src/colab/static/third-party/jquery.debouncedresize.js b/src/colab/static/third-party/jquery.debouncedresize.js new file mode 100644 index 0000000..5261fbf --- /dev/null +++ b/src/colab/static/third-party/jquery.debouncedresize.js @@ -0,0 +1,47 @@ +/* + * debouncedresize: special jQuery event that happens once after a window resize + * + * latest version and complete README available on Github: + * https://github.com/louisremi/jquery-smartresize + * + * Copyright 2012 @louis_remi + * Licensed under the MIT license. + * + * This saved you an hour of work? + * Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON + */ +(function($) { + +var $event = $.event, + $special, + resizeTimeout; + +$special = $event.special.debouncedresize = { + setup: function() { + $( this ).on( "resize", $special.handler ); + }, + teardown: function() { + $( this ).off( "resize", $special.handler ); + }, + handler: function( event, execAsap ) { + // Save the context + var context = this, + args = arguments, + dispatch = function() { + // set correct event type + event.type = "debouncedresize"; + $event.dispatch.apply( context, args ); + }; + + if ( resizeTimeout ) { + clearTimeout( resizeTimeout ); + } + + execAsap ? + dispatch() : + resizeTimeout = setTimeout( dispatch, $special.threshold ); + }, + threshold: 150 +}; + +})(jQuery); \ No newline at end of file -- libgit2 0.21.2