Module: PostRunner::ViewWidgets
- Included in:
- ActivityListView, ActivitySummary, ActivityView, ChartView, DeviceList, TrackView, UserProfileView
- Defined in:
- lib/postrunner/ViewWidgets.rb
Instance Method Summary collapse
- #button(doc, link, icon) ⇒ Object
- #footer(doc) ⇒ Object
- #frame(doc, title) ⇒ Object
- #titlebar(doc, first_page = nil, prev_page = nil, home_page = nil, next_page = nil, last_page = nil) ⇒ Object
- #view_widgets_style(doc) ⇒ Object
Instance Method Details
#button(doc, link, icon) ⇒ Object
128 129 130 131 132 133 134 135 136 |
# File 'lib/postrunner/ViewWidgets.rb', line 128 def (doc, link, icon) if link doc.a({ :href => link }) { doc.img({ :src => "icons/#{icon}", :class => 'active_button' }) } else doc.img({ :src => "icons/#{icon}", :class => 'inactive_button' }) end end |
#footer(doc) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/postrunner/ViewWidgets.rb', line 138 def (doc) doc.div({ :class => 'footer' }){ doc.hr doc.div({ :class => 'copyright' }) { doc.text("Generated by ") doc.a('PostRunner', { :href => 'https://github.com/scrapper/postrunner' }) doc.text(" #{VERSION} on #{Time.now}") } } end |
#frame(doc, title) ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/postrunner/ViewWidgets.rb', line 102 def frame(doc, title) doc.div({ 'class' => 'widget_frame' }) { doc.div({ 'class' => 'widget_frame_title' }) { doc.b(title) } doc.div { yield if block_given? } } end |
#titlebar(doc, first_page = nil, prev_page = nil, home_page = nil, next_page = nil, last_page = nil) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/postrunner/ViewWidgets.rb', line 113 def (doc, first_page = nil, prev_page = nil, home_page = nil, next_page = nil, last_page = nil) # The top title bar. doc.div({ :class => 'titlebar' }) { doc.div('PostRunner', { :class => 'title' }) doc.div({ :class => 'navigator' }) { (doc, first_page, 'first.png') (doc, prev_page, 'back.png') (doc, home_page, 'home.png') (doc, next_page, 'forward.png') (doc, last_page, 'last.png') } } end |
#view_widgets_style(doc) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/postrunner/ViewWidgets.rb', line 17 def (doc) doc.style(<<EOT .titlebar { width: 100%; height: 50px; margin: 0px; background: linear-gradient(#7FA1FF 0, #002EAC 50px); } .title { float: left; font-size: 24pt; font-style: italic; font-weight: bold; color: #F8F8F8; text-shadow: -1px -1px 0 #5C5C5C, 1px -1px 0 #5C5C5C, -1px 1px 0 #5C5C5C, 1px 1px 0 #5C5C5C; padding: 3px 30px; } .navigator { float: right; padding: 3px 30px; } .active_button { padding: 5px; } .inactive_button { padding: 5px; opacity: 0.4; } .widget_frame { box-sizing: border-box; width: 600px; padding: 10px 15px 15px 15px; margin: 15px auto 15px auto; border: 1px solid #ddd; background: #fff; background: linear-gradient(#f6f6f6 0, #fff 50px); background: -o-linear-gradient(#f6f6f6 0, #fff 50px); background: -ms-linear-gradient(#f6f6f6 0, #fff 50px); background: -moz-linear-gradient(#f6f6f6 0, #fff 50px); background: -webkit-linear-gradient(#f6f6f6 0, #fff 50px); box-shadow: 0 3px 10px rgba(0,0,0,0.15); -o-box-shadow: 0 3px 10px rgba(0,0,0,0.1); -ms-box-shadow: 0 3px 10px rgba(0,0,0,0.1); -moz-box-shadow: 0 3px 10px rgba(0,0,0,0.1); -webkit-box-shadow: 0 3px 10px rgba(0,0,0,0.1); } .widget_frame_title { font-size:13pt; padding-bottom: 5px; text-align: left; } .flexitable { width: 100%; border: 2px solid #545454; border-collapse: collapse; font-size:11pt; } .ft_head_row { background-color: #DEDEDE } .ft_even_row { background-color: #FCFCFC } .ft_odd_row { background-color: #F1F1F1 } .ft_cell { border: 1px solid #CCCCCC; padding: 1px 3px; } .footer { clear: both; width: 100%; height: 30px; padding: 15px; text-align: center; font-size: 9pt; } EOT ) end |