Class: OMF::Web::Theme::Page
Instance Attribute Summary
Attributes inherited from AbstractPage
#opts
Instance Method Summary
collapse
add_depends_on, #collect_data_sources, #data_source_widgets, #initialize, #render_additional_headers, #render_data_source, #render_data_sources, #render_flash, #to_html
Instance Method Details
#content ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/omf-web/theme/bright/page.rb', line 36
def content
super
@renderer = @widget.content
div :id => 'doc3' do
if @renderer.render? :header
div :id => 'hd' do
if @renderer.render? :top_line
render_top_line
end
if @renderer.render? :title
render_title
end
end
end
div :id => 'bd' do
render_body
end
if @renderer.render? :footer
div :id => 'ft' do
end
end
end
end
|
#render_body ⇒ Object
152
153
154
155
|
# File 'lib/omf-web/theme/bright/page.rb', line 152
def render_body
render_flash
render_card_body
end
|
#render_card_body ⇒ Object
157
158
159
160
161
|
# File 'lib/omf-web/theme/bright/page.rb', line 157
def render_card_body
return unless @widget
Thread.current["top_renderer"] = self
rawtext @renderer.to_html
end
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
# File 'lib/omf-web/theme/bright/page.rb', line 163
def
if @footer_right.is_a? Proc
widget(Erector.inline(&@footer_right))
else
span :style => 'float:right;margin-right:10pt' do
text @footer_right || "omf-web V#{OMF::Web::VERSION}"
end
end
if @footer_left.is_a? Proc
widget(Erector.inline(&@footer_left))
else
text @footer_left || 'Brought to you by the TEMPO Team'
end
end
|
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/omf-web/theme/bright/page.rb', line 68
def
ol :id => :tab_menu do
@tabs.each do |h|
lopts = h[:id] == @tab ? {:class => :current} : {}
li lopts do
a :href => "#{@prefix}/#{h[:id]}" do
span h[:name], :class => :tab_text
end
end
end
end
end
|
#render_title ⇒ Object
148
149
150
|
# File 'lib/omf-web/theme/bright/page.rb', line 148
def render_title
h1 @page_title || 'Missing :page_title'
end
|
88
89
90
91
92
|
# File 'lib/omf-web/theme/bright/page.rb', line 88
def
ol :id => :tools_menu do
end
end
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/omf-web/theme/bright/page.rb', line 94
def
if user = OMF::Web::Rack::SessionAuthenticator.user()
puts "USER>>>>> #{user}"
li do
a href: '#', class: 'user' do
i class: "icon-user icon-white"
text user[:name]
end
end
li id: 'logout_li' do
a id: 'logout_a', href: '#', class: 'logout' do
i class: "icon-off icon-white"
text 'Log out'
end
end
am = "render_tools_menu_authenticate_#{user[:method]}".to_sym
puts "METHOD>>>>> #{am}"
if respond_to?(am)
send(am, user)
else
javascript %{
$('#logout_a').href = '/auth/logout'
}
end
end
end
|
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/omf-web/theme/bright/page.rb', line 121
def (user)
javascript %{
$('#logout_li').hide();
$.getScript("https://login.persona.org/include.js")
.done(function(script, textStatus) {
$('#logout_li').show();
$('#logout_a').click(function() {
navigator.id.logout();
})
navigator.id.watch({
loggedInUser: '#{user}',
onlogin: function(assertion) {},
onlogout: function() {
$.ajax({
type: 'POST',
url: '/auth/logout',
success: function(res, status, xhr) {
window.location = '/';
},
error: function(xhr, status, err) { alert("Logout failure: " + err); }
});
}
})
});
}
end
|
#render_top_line ⇒ Object
61
62
63
64
65
66
|
# File 'lib/omf-web/theme/bright/page.rb', line 61
def render_top_line
div :id => :top_line do
end
end
|