Class: PostRunner::TrackView

Inherits:
Object
  • Object
show all
Includes:
ViewWidgets
Defined in:
lib/postrunner/TrackView.rb

Instance Method Summary collapse

Methods included from ViewWidgets

#button, #footer, #frame, #titlebar, #view_widgets_style

Constructor Details

#initialize(activity) ⇒ TrackView

Returns a new instance of TrackView.



23
24
25
26
27
# File 'lib/postrunner/TrackView.rb', line 23

def initialize(activity)
  @activity = activity
  @session = @activity.fit_activity.sessions[0]
  @has_geo_data = @session.has_geo_data?
end

Instance Method Details

#div(doc) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/postrunner/TrackView.rb', line 40

def div(doc)
  return unless @has_geo_data

  frame(doc, 'Map') {
    doc.div({ 'id' => 'map', 'class' => 'trackmap' })
  }
end

#head(doc) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/postrunner/TrackView.rb', line 29

def head(doc)
  return unless @has_geo_data

  doc.link({ 'rel' => 'stylesheet',
             'href' => 'openlayers/theme/default/style.css',
             'type' => 'text/css' })
  doc.style(style)
  doc.script({ 'src' => 'openlayers/OpenLayers.js' })
  doc.script(java_script)
end