summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-16 13:55:43 +0200
committerChris Schlaeger <chris@linux.com>2014-08-16 13:55:43 +0200
commite8885b131d8095aa0340a02c644e1f4543dc9630 (patch)
tree9cae29dc0171ec276de51218b784471851e6ede3
parente4bf70f46a8050631d9064a1f5eb762e8df31233 (diff)
downloadpostrunner-e8885b131d8095aa0340a02c644e1f4543dc9630.zip
Layout improvements
-rw-r--r--lib/postrunner/Activity.rb5
-rw-r--r--lib/postrunner/ActivityReport.rb12
-rw-r--r--lib/postrunner/ActivityView.rb13
-rw-r--r--lib/postrunner/ChartView.rb2
-rw-r--r--lib/postrunner/FlexiTable.rb5
-rw-r--r--lib/postrunner/TrackView.rb2
-rw-r--r--lib/postrunner/ViewWidgets.rb1
7 files changed, 25 insertions, 15 deletions
diff --git a/lib/postrunner/Activity.rb b/lib/postrunner/Activity.rb
index 56dabbf..c52fbe8 100644
--- a/lib/postrunner/Activity.rb
+++ b/lib/postrunner/Activity.rb
@@ -19,8 +19,7 @@ module PostRunner
class Activity
- attr_reader :fit_file, :name, :fit_activity, :html_dir, :html_file
- attr_accessor :db
+ attr_reader :db, :fit_file, :name, :fit_activity, :html_dir, :html_file
# This is a list of variables that provide data from the fit file. To
# speed up access to it, we cache the data in the activity database.
@@ -94,7 +93,7 @@ module PostRunner
def summary
@fit_activity = load_fit_file unless @fit_activity
- puts ActivityReport.new(@fit_activity).to_s
+ puts ActivityReport.new(self).to_s
end
def rename(name)
diff --git a/lib/postrunner/ActivityReport.rb b/lib/postrunner/ActivityReport.rb
index 4a9d54a..65edc48 100644
--- a/lib/postrunner/ActivityReport.rb
+++ b/lib/postrunner/ActivityReport.rb
@@ -27,15 +27,15 @@ module PostRunner
end
def to_s
- session = @activity.sessions[0]
+ session = @activity.fit_activity.sessions[0]
summary(session).to_s + "\n" + laps.to_s
end
def to_html(doc)
- session = @activity.sessions[0]
+ session = @activity.fit_activity.sessions[0]
- frame(doc, 'Summary') {
+ frame(doc, "Summary of #{@activity.name}") {
summary(session).to_html(doc)
}
frame(doc, 'Laps') {
@@ -75,9 +75,9 @@ module PostRunner
t.row([ 'Avg. Stride Length:',
session.avg_stride_length ?
"#{'%.2f' % (session.avg_stride_length / 2)} m" : '-' ])
- rec_time = @activity.recovery_time
+ rec_time = @activity.fit_activity.recovery_time
t.row([ 'Recovery Time:', rec_time ? secsToHMS(rec_time * 60) : '-' ])
- vo2max = @activity.vo2max
+ vo2max = @activity.fit_activity.vo2max
t.row([ 'VO2max:', vo2max ? vo2max : '-' ])
t
@@ -90,7 +90,7 @@ module PostRunner
'Avg. HR', 'Max. HR' ])
t.set_column_attributes(Array.new(8, { :halign => :right }))
t.body
- @activity.sessions[0].laps.each.with_index do |lap, index|
+ @activity.fit_activity.sessions[0].laps.each.with_index do |lap, index|
t.cell(index + 1)
t.cell(secsToHMS(lap.total_timer_time))
t.cell('%.2f' % (lap.total_distance / 1000.0))
diff --git a/lib/postrunner/ActivityView.rb b/lib/postrunner/ActivityView.rb
index 17c0c70..3c6312a 100644
--- a/lib/postrunner/ActivityView.rb
+++ b/lib/postrunner/ActivityView.rb
@@ -75,7 +75,7 @@ module PostRunner
def generate_html(doc)
- @report = ActivityReport.new(@activity.fit_activity)
+ @report = ActivityReport.new(@activity)
@track_view = TrackView.new(@activity)
@chart_view = ChartView.new(@activity)
@@ -103,6 +103,9 @@ module PostRunner
def style(doc)
doc.style(<<EOT
+.body {
+ font-family: verdana,arial,sans-serif;
+}
.main {
width: 1210px;
margin: 0 auto;
@@ -117,7 +120,9 @@ module PostRunner
}
.flexitable {
width: 100%;
- background-color: #CCCCCC
+ border: 1px solid #CCCCCC;
+ border-collapse: collapse;
+ font-size:11pt;
}
.ft_head_row {
background-color: #DEDEDE
@@ -128,6 +133,10 @@ module PostRunner
.ft_odd_row {
background-color: #F1F1F1
}
+.ft_cell {
+ border: 1px solid #CCCCCC;
+ padding: 1px 3px;
+}
EOT
)
end
diff --git a/lib/postrunner/ChartView.rb b/lib/postrunner/ChartView.rb
index a343f53..3265aa1 100644
--- a/lib/postrunner/ChartView.rb
+++ b/lib/postrunner/ChartView.rb
@@ -66,7 +66,7 @@ module PostRunner
-webkit-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.chart-placeholder {
- width: 570px;
+ width: 580px;
height: 200px;
font-size: 14px;
line-height: 1.2em;
diff --git a/lib/postrunner/FlexiTable.rb b/lib/postrunner/FlexiTable.rb
index 0b8ab38..bbb9d06 100644
--- a/lib/postrunner/FlexiTable.rb
+++ b/lib/postrunner/FlexiTable.rb
@@ -83,9 +83,10 @@ module PostRunner
def to_html(doc)
text_align = get_attribute(:halign)
+ attrs = { :class => 'ft_cell' }
+ attrs[:style] = "text-align: #{text_align.to_s}" if text_align
doc.td(@content.respond_to?('to_html') ?
- @content.to_html(doc) : @content.to_s,
- text_align ? { :style => "text-align: #{text_align.to_s}" } : {})
+ @content.to_html(doc) : @content.to_s, attrs)
end
private
diff --git a/lib/postrunner/TrackView.rb b/lib/postrunner/TrackView.rb
index 8609a8d..4a914c0 100644
--- a/lib/postrunner/TrackView.rb
+++ b/lib/postrunner/TrackView.rb
@@ -54,7 +54,7 @@ module PostRunner
}
.trackmap {
- width: 570px;
+ width: 565px;
height: 400px;
border: 2px solid #545454;
}
diff --git a/lib/postrunner/ViewWidgets.rb b/lib/postrunner/ViewWidgets.rb
index e503af6..f9e6848 100644
--- a/lib/postrunner/ViewWidgets.rb
+++ b/lib/postrunner/ViewWidgets.rb
@@ -35,6 +35,7 @@ module PostRunner
-webkit-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.widget_frame_title {
+ font-size:13pt;
padding-bottom: 5px;
}
EOT