Class: PostRunner::RecordListPageView
- Includes:
- Fit4Ruby::Converters
- Defined in:
- lib/postrunner/RecordListPageView.rb
Overview
Generates an HTML page with all personal records for a particular sport type.
Instance Attribute Summary
Attributes inherited from View
Instance Method Summary collapse
-
#initialize(ffs, records, page_count, page_index) ⇒ RecordListPageView
constructor
Create a RecordListPageView object.
Methods inherited from View
Constructor Details
#initialize(ffs, records, page_count, page_index) ⇒ RecordListPageView
Create a RecordListPageView object.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/postrunner/RecordListPageView.rb', line 35 def initialize(ffs, records, page_count, page_index) #@unit_system = ffs.store['config']['unit_system'].to_sym @records = records views = ffs.views views.current_page = "records-0.html" pages = PagingButtons.new((0..(page_count - 1)).map do |i| "records-#{i}.html" end) pages.current_page = "records-#{page_index}.html" @sport_name = Activity::ActivityTypes[@records.sport] super("#{@sport_name} Records", views, pages) body { frame_width = 800 @doc.div({ :class => 'main' }) { ViewFrame.new('all_time_records', "All-time #{@sport_name} Records", frame_width, @records.all_time).to_html(@doc) @records.yearly.sort{ |y1, y2| y2[0].to_i <=> y1[0].to_i }. each do |year, record| next if record.empty? ViewFrame.new("year_#{year}_records", "#{year} #{@sport_name} Records", frame_width, record).to_html(@doc) end } } end |