mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-10 03:08:50 +01:00
Tweaks to the new stats page to implement a workaround for a bug in the Flash add-in for Firefox/Mac. The workaround involves removing the opacity from the header navigation area for the stats page.
Also introduced FlashObject.js to handle Flash embedding, and removed some duplication in the views. This changeset should also resolve problems with the stats page for people who don't run tracks from the root of their website. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@589 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
054f6d6a77
commit
839feddb63
18 changed files with 215 additions and 50 deletions
|
|
@ -23,7 +23,7 @@ window.onload=function(){
|
|||
<title><%= @page_title %></title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<body class="<%= @controller.controller_name %>">
|
||||
<div id="topbar">
|
||||
<div id="date">
|
||||
<h1>
|
||||
|
|
|
|||
|
|
@ -5,25 +5,26 @@ The minimum time to complete is <%= @actions_min_ttc_sec %></p>
|
|||
<p>In the last 30 days you created on average <%=@sum_actions_created_last30days/30%> actions
|
||||
and completed on average <%=@sum_actions_done_last30days/30%> actions per day.
|
||||
In the last 12 months you created on average <%=@sum_actions_created_last12months/12 %> actions
|
||||
and completed on average <%=@sum_actions_done_last12months/12%> actions per month.
|
||||
<p><br/>
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_done_last30days_data'} -%>
|
||||
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_done_last12months_data'} -%>
|
||||
and completed on average <%=@sum_actions_done_last12months/12%> actions per month.</p>
|
||||
|
||||
<p><br/>
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_completion_time_data'} -%>
|
||||
<p><br/>
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_visible_running_time_data'} -%>
|
||||
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_running_time_data'} -%>
|
||||
<% %w{ actions_done_last30days_data
|
||||
actions_done_last12months_data
|
||||
actions_completion_time_data
|
||||
}.each do |action|
|
||||
%><%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => url_for(:action => action)} -%><%
|
||||
end
|
||||
%>
|
||||
|
||||
<p><br/>
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_day_of_week_all_data'} -%>
|
||||
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_day_of_week_30days_data'} -%>
|
||||
<br style="clear:both">
|
||||
|
||||
<p><br/>
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_time_of_day_all_data'} -%>
|
||||
|
||||
<%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => '/stats/actions_time_of_day_30days_data'} -%>
|
||||
<% %w{ actions_visible_running_time_data
|
||||
actions_running_time_data
|
||||
actions_day_of_week_all_data
|
||||
actions_day_of_week_30days_data
|
||||
actions_day_of_week_30days_data
|
||||
actions_time_of_day_all_data
|
||||
actions_time_of_day_30days_data
|
||||
}.each do |action|
|
||||
%><%= render :partial => 'chart', :locals => {:width => @chart_width, :height => @chart_height, :data => url_for(:action => action)} -%><%
|
||||
end
|
||||
%>
|
||||
|
|
@ -1,5 +1 @@
|
|||
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="<%=width-%>" height="<%=height-%>" id="graph-2" align="middle">
|
||||
<param name="allowScriptAccess" value="sameDomain" />
|
||||
<param name="movie" value="/open-flash-chart.swf?width=<%=width-%>&height=<%=height-%>&data=<%=data-%>" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" />
|
||||
<embed src="/open-flash-chart.swf?width=<%=width-%>&height=<%=height-%>&data=<%=data-%>" quality="high" bgcolor="#FFFFFF" width="<%=width-%>" height="<%=height-%>" name="open-flash-chart" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
|
||||
</object>
|
||||
<%= flashobject_tag "open-flash-chart.swf", :query_params => { 'width' => width, 'height' => height, 'data' => data}, :size => "#{width}x#{height}", :parameters => { 'allowScriptAccess' => 'sameDomain'}, :class_name => 'open-flash-chart' %>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<p><br/>
|
||||
<%= render :partial => 'chart', :locals => {:width => @pie_width, :height => @pie_height, :data => '/stats/context_total_actions_data'} -%>
|
||||
|
||||
<%= render :partial => 'chart', :locals => {:width => @pie_width, :height => @pie_height, :data => '/stats/context_running_actions_data'} -%>
|
||||
<%= render :partial => 'chart', :locals => {:width => @pie_width, :height => @pie_height, :data => url_for(:action => 'context_total_actions_data')} -%>
|
||||
|
||||
<br/><p><b>Top 5 Contexts</b><br>
|
||||
<%= render :partial => 'chart', :locals => {:width => @pie_width, :height => @pie_height, :data => url_for(:action => 'context_running_actions_data')} -%>
|
||||
|
||||
<div class="stats_module">
|
||||
<h3>Top 5 Contexts</h3>
|
||||
<%
|
||||
1.upto 5 do |i|
|
||||
%><%=i-%> -
|
||||
|
|
@ -14,9 +14,10 @@
|
|||
<br/><%
|
||||
end
|
||||
-%>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<br/><p><b>Top 5 Visible Contexts with uncomplete actions</b><br>
|
||||
<div class="stats_module">
|
||||
<h3>Top 5 Visible Contexts with uncomplete actions</h3>
|
||||
<%
|
||||
1.upto 5 do |i|
|
||||
%><%=i-%> -
|
||||
|
|
@ -27,4 +28,4 @@
|
|||
<br/><%
|
||||
end
|
||||
-%>
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<br/>
|
||||
<p><b>Top 10 projects</b><br/>
|
||||
<div class="stats_module">
|
||||
<h3>Top 10 projects</h3>
|
||||
<% i=0
|
||||
@projects_and_actions.each do |p|
|
||||
i+=1 -%>
|
||||
|
|
@ -11,9 +11,10 @@
|
|||
<% end
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<p><b>Top 10 project in past 30 days</b><br/>
|
||||
<div class="stats_module">
|
||||
<h3>Top 10 project in past 30 days</h3>
|
||||
<% i=0
|
||||
@projects_and_actions_last30days.each do |p|
|
||||
i+=1 -%>
|
||||
|
|
@ -25,9 +26,10 @@
|
|||
<% end
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<p><b>Top 10 longest running projects</b><br/>
|
||||
<div class="stats_module">
|
||||
<h3>Top 10 longest running projects</h3>
|
||||
<% i=0
|
||||
@projects_and_runtime.each do |p|
|
||||
i+=1 -%>
|
||||
|
|
@ -39,4 +41,4 @@
|
|||
<% end
|
||||
end
|
||||
%>
|
||||
<br/>
|
||||
</div>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<br/>
|
||||
<P><B>Tag Cloud</b></p>
|
||||
<div class="stats_module">
|
||||
<h3>Tag Cloud</h3>
|
||||
<p>
|
||||
<% if @tags_for_cloud.size < 1
|
||||
%> no tags available <%
|
||||
|
|
@ -12,4 +12,5 @@
|
|||
-%> <%
|
||||
end
|
||||
end-%>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
<h2>Totals</h2>
|
||||
<div class="stats_content">
|
||||
<h2>Totals</h2>
|
||||
|
||||
<%= render :partial => 'totals' -%>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
<h2>Actions</h2>
|
||||
|
||||
<%= render :partial => 'actions' -%>
|
||||
|
||||
<br/><br/>
|
||||
<h2>Contexts</h2>
|
||||
|
||||
<%= render :partial => 'contexts' -%>
|
||||
|
||||
<br/><br/>
|
||||
<h2>Projects</h2>
|
||||
|
||||
<%= render :partial => 'projects' -%>
|
||||
|
|
@ -21,3 +18,4 @@
|
|||
<h2>Tags</h2>
|
||||
|
||||
<%= render :partial => 'tags' -%>
|
||||
</div>
|
||||
|
|
@ -15,6 +15,7 @@ javascripts:
|
|||
- niftycube
|
||||
- protoload
|
||||
- lowpro
|
||||
- flashobject
|
||||
stylesheets:
|
||||
- tracks:
|
||||
- standard
|
||||
|
|
|
|||
8
tracks/public/javascripts/flashobject.js
Normal file
8
tracks/public/javascripts/flashobject.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -185,7 +185,11 @@ a.show_notes:hover, a.link_to_notes:hover {background-image: url(../images/notes
|
|||
width: 100%;
|
||||
z-index:1100;
|
||||
}
|
||||
|
||||
body.stats #topbar {
|
||||
filter: alpha(opacity=100);
|
||||
-moz-opacity: 1;
|
||||
opacity: 1;
|
||||
}
|
||||
#date {
|
||||
float: left;
|
||||
width: 45%;
|
||||
|
|
@ -1033,4 +1037,16 @@ button.positive, .widgets a.positive{
|
|||
background-repeat:no-repeat;
|
||||
background-position:center center;
|
||||
background-color:black;
|
||||
}
|
||||
.stats_content .open-flash-chart, .stats_content .stats_module {
|
||||
float: left;
|
||||
width: 450px;
|
||||
margin-right:20px;
|
||||
padding-bottom:20px;
|
||||
}
|
||||
.stats_content h2
|
||||
{
|
||||
clear:both;
|
||||
margin-top:15px;
|
||||
margin-bottom:15px;
|
||||
}
|
||||
|
|
@ -44,6 +44,7 @@ a.show_notes:hover, a.link_to_notes:hover {background-image: url(../images/notes
|
|||
#navlist a:link#current, #navlist a:visited#current, #navlist a:hover {border-bottom: 4px solid #CCC; padding-bottom: 2px; background: transparent; color: #CCC}
|
||||
#navlist a:hover {color: #CCC}
|
||||
#topbar {position: fixed; top: 0px; left: 0px; height: 68px; margin-bottom: 20px; clear: both; background-color: #000; filter: alpha(opacity=75); -moz-opacity: .75; opacity: .75; color: #eee; width: 100%; z-index:1100}
|
||||
body.stats #topbar {filter: alpha(opacity=100); -moz-opacity: 1; opacity: 1}
|
||||
#date {float: left; width: 45%; padding-left: 15px; margin-top: 15px; margin-bottom: 5px; white-space: nowrap}
|
||||
#date h1 {font-size: 152%}
|
||||
#minilinks {text-align: right; position: fixed; right: 15px; top: 10px; font-size: 0.9em}
|
||||
|
|
@ -191,6 +192,8 @@ button.positive, .widgets a.positive{ color: #498111}
|
|||
.bigWaiting {background-image:url('/images/bigWaiting.gif'); background-repeat:no-repeat; background-position:center 20%; background-color:white}
|
||||
.blackWaiting {background-image:url('/images/blackWaiting.gif'); background-repeat:no-repeat; background-position:center center; background-color:black}
|
||||
.bigBlackWaiting {background-image:url('/images/bigBlackWaiting.gif'); background-repeat:no-repeat; background-position:center center; background-color:black}
|
||||
.stats_content .open-flash-chart, .stats_content .stats_module {float: left; width: 450px; margin-right:20px; padding-bottom:20px}
|
||||
.stats_content h2 {clear:both; margin-top:15px; margin-bottom:15px}
|
||||
div.calendar {position: relative}
|
||||
.calendar, .calendar table {border: 1px solid #556; font-size: 11px; color: #000; cursor: default; background: #eef; z-index: 110; font-family: tahoma,verdana,sans-serif}
|
||||
.calendar .button {text-align: center; padding: 2px}
|
||||
|
|
|
|||
35
tracks/vendor/plugins/flashobject_helper/README
vendored
Normal file
35
tracks/vendor/plugins/flashobject_helper/README
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
FlashObject v.1.0
|
||||
====================
|
||||
This FlashObject Helper is based on the flash view helper of the plugin http://laszlo-plugin.rubyforge.org/
|
||||
|
||||
It's only copy the FlashObject.js (version 1.5) on your public/javascript directory and register it in the AssetTagHelper of rails,
|
||||
so for include the javascript in your page you only can add this (if you havn't yet):
|
||||
|
||||
<%= javascript_include_tag :defaults %>
|
||||
|
||||
or if you only need the flashobject add this:
|
||||
|
||||
<%= javascript_include_tag "flashobject" %>
|
||||
|
||||
The is very simple for add a Flash in your page add this:
|
||||
|
||||
<%= flashobject_tag "/source/of/your/flash.swf" %>
|
||||
|
||||
It's simple.
|
||||
|
||||
You can add some options if you want:
|
||||
|
||||
- div_id: the HTML +id+ of the +div+ element that is used to contain the Flash object; default "flashcontent"
|
||||
- flash_id: the +id+ of the Flash object itself.
|
||||
- background_color: the background color of the Flash object; default white
|
||||
- flash_version: the version of the Flash player that is required; default "7"
|
||||
- size: the size of the Flash object, in the form "100x100". Defaults to "100%x100%"
|
||||
- variables: a Hash of initialization variables that are passed to the object; default <tt>{:lzproxied => false}</tt>
|
||||
- parameters: a Hash of parameters that configure the display of the object; default <tt>{:scale => 'noscale'}</tt>
|
||||
- fallback_html: HTML text that is displayed when the Flash player is not available.
|
||||
|
||||
Example:
|
||||
<%= flashobject_tag "/source/of/your/flash.swf", :size => "350x320" %>
|
||||
|
||||
|
||||
Vist my website: http://blog.lipsiasoft.com
|
||||
4
tracks/vendor/plugins/flashobject_helper/init.rb
vendored
Normal file
4
tracks/vendor/plugins/flashobject_helper/init.rb
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Author:: Davide D'Agostino Aka DAddYE
|
||||
# WebSite:: http://www.lipsiasoft.com
|
||||
|
||||
require 'flashobject_view_helper'
|
||||
5
tracks/vendor/plugins/flashobject_helper/install.rb
vendored
Normal file
5
tracks/vendor/plugins/flashobject_helper/install.rb
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require 'fileutils'
|
||||
|
||||
flashobject = File.dirname(__FILE__) + '/../../../public/javascripts/flashobject.js'
|
||||
FileUtils.cp File.dirname(__FILE__) + '/javascripts/flashobject.js', flashobject unless File.exist?(flashobject)
|
||||
puts IO.read(File.join(File.dirname(__FILE__), 'README'))
|
||||
8
tracks/vendor/plugins/flashobject_helper/javascripts/flashobject.js
vendored
Normal file
8
tracks/vendor/plugins/flashobject_helper/javascripts/flashobject.js
vendored
Normal file
File diff suppressed because one or more lines are too long
85
tracks/vendor/plugins/flashobject_helper/lib/flashobject_view_helper.rb
vendored
Normal file
85
tracks/vendor/plugins/flashobject_helper/lib/flashobject_view_helper.rb
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
# Author:: Davide D'Agostino aka DAddYE
|
||||
# WebSite:: http://www.lipsiasoft.com
|
||||
require 'action_view'
|
||||
|
||||
module ActionView #:nodoc:
|
||||
module Helpers # :nodoc:
|
||||
module FlashObjectHelper # :nodoc:
|
||||
def self.included(base)
|
||||
base.class_eval do
|
||||
include InstanceMethods
|
||||
end
|
||||
end
|
||||
module InstanceMethods
|
||||
# Returns a set of tags that display a Flash object within an
|
||||
# HTML page.
|
||||
#
|
||||
# Options:
|
||||
# * <tt>:div_id</tt> - the HTML +id+ of the +div+ element that is used to contain the Flash object; default "flashcontent"
|
||||
# * <tt>:flash_id</tt> - the +id+ of the Flash object itself.
|
||||
# * <tt>:background_color</tt> - the background color of the Flash object; default white
|
||||
# * <tt>:flash_version</tt> - the version of the Flash player that is required; default "7"
|
||||
# * <tt>:size</tt> - the size of the Flash object, in the form "100x100". Defaults to "100%x100%"
|
||||
# * <tt>:variables</tt> - a Hash of initialization variables that are passed to the object; default <tt>{:lzproxied => false}</tt>
|
||||
# * <tt>:parameters</tt> - a Hash of parameters that configure the display of the object; default <tt>{:scale => 'noscale'}</tt>
|
||||
# * <tt>:fallback_html</tt> - HTML text that is displayed when the Flash player is not available.
|
||||
#
|
||||
# The following options are for developers. They default to true in
|
||||
# development mode, and false otherwise.
|
||||
# * <tt>:check_for_javascript_include</tt> - if true, the return value will cause the browser to display a diagnostic message if the FlashObject JavaScript was not included.
|
||||
# * <tt>:verify_file_exists</tt> - if true, the return value will cause the browser to display a diagnostic message if the Flash object does not exist.
|
||||
#
|
||||
# (This method is called flashobject_tag instead of flashobject_tag
|
||||
# because it returns a *sequence* of HTML tags: a +div+, followed by
|
||||
# a +script+.)
|
||||
def flashobject_tag source, options={}
|
||||
source = flash_path(source)
|
||||
query_params = '?' + options[:query_params].map{ |key, value| "#{key}=#{value}" }.join('&') if options[:query_params]
|
||||
div_id = options[:div_id] || "flashcontent_#{rand(1_100)}"
|
||||
flash_id = options[:flash_id] || File.basename(source, '.swf') + "_#{rand(1_100)}"
|
||||
width, height = (options[:size]||'100%x100%').scan(/^(\d*%?)x(\d*%?)$/).first
|
||||
background_color = options[:background_color] || '#ffffff'
|
||||
flash_version = options[:flash_version] || 7
|
||||
class_name = options[:class_name] || 'flash'
|
||||
variables = options.fetch(:variables, {})
|
||||
parameters = options.fetch(:parameters, {:scale => 'noscale'})
|
||||
fallback_html = options[:fallback_html] || %q{<p>Requires the Flash plugin. If the plugin is already installed, click <a href="?detectflash=false">here</a>.</p>}
|
||||
if options.fetch(:check_for_javascript_include, ENV['RAILS_ENV'] == 'development')
|
||||
check_for_javascript ="if (typeof FlashObject == 'undefined') document.getElementById('#{div_id}').innerHTML = '<strong>Warning:</strong> FlashObject is undefined. Did you forget to execute <tt>rake update_javascripts</tt>, or to include <tt><%= javascript_include_tag :defaults %></tt> in your view file?';"
|
||||
end
|
||||
return <<-"EOF"
|
||||
<div id="#{div_id}" class="#{class_name}" style="height: #{height}">
|
||||
#{fallback_html}
|
||||
</div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
#{check_for_javascript}
|
||||
var fo = new FlashObject("#{source}#{query_params}", "#{flash_id}", "#{width}", "#{height}", "#{flash_version}", "#{background_color}");
|
||||
#{parameters.map{|k,v|%Q[fo.addParam("#{k}", "#{v}");]}.join("\n")}
|
||||
#{variables.map{|k,v|%Q[fo.addVariable("#{k}", "#{v}");]}.join("\n")}
|
||||
fo.write("#{div_id}");
|
||||
//]]>
|
||||
</script>
|
||||
EOF
|
||||
end
|
||||
|
||||
# Computes the path to a flash asset in the public swf directory.
|
||||
# If the +source+ filename has no extension, .swf will be appended.
|
||||
# Full paths from the document root will be passed through.
|
||||
#
|
||||
# flash_path "movie" # => /swf/movie.swf
|
||||
# flash_path "dir/movie.swf" # => /swf/dir/movie.swf
|
||||
# flash_path "/dir/movie" # => /dir/movie.swf
|
||||
def flash_path(source)
|
||||
compute_public_path(source, 'swf', 'swf', false)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ActionView::Base.class_eval do
|
||||
include ActionView::Helpers::FlashObjectHelper
|
||||
end
|
||||
|
||||
ActionView::Helpers::AssetTagHelper.register_javascript_include_default 'flashobject'
|
||||
Loading…
Add table
Add a link
Reference in a new issue