RubyApp 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/lib/ruby_app/configuration.yml +7 -0
- data/lib/ruby_app/elements/pages/.cache/default_page.css +37 -0
- data/lib/ruby_app/elements/pages/.cache/default_page.js +205 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/button_test_page.css +37 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/button_test_page.js +212 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/default_test_page.css +47 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/default_test_page.js +212 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/dialog_test_page.css +75 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/dialog_test_page.js +230 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/input_test_page.css +47 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/input_test_page.js +241 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/link_test_page.css +37 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/link_test_page.js +212 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/linked_test_page.css +37 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/linked_test_page.js +205 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/list_test_page.css +47 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/list_test_page.js +226 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/markdown_test_page.css +37 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/markdown_test_page.js +205 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/test_page.css +47 -0
- data/lib/ruby_app/elements/pages/test_pages/.cache/test_page.js +220 -0
- data/lib/ruby_app/mixins/render_mixin.rb +4 -0
- data/lib/ruby_app/mixins/template_mixin.rb +5 -0
- data/lib/ruby_app/rack/request.rb +1 -1
- data/lib/ruby_app/rack/response.rb +1 -1
- data/lib/ruby_app/rack/route.rb +2 -1
- data/lib/ruby_app/rack/session.rb +1 -1
- data/lib/ruby_app/response.rb +24 -0
- data/lib/ruby_app/version.rb +1 -1
- data/rakefile +26 -10
- metadata +88 -68
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
RubyApp (0.2.
|
4
|
+
RubyApp (0.2.5)
|
5
5
|
BlueCloth
|
6
6
|
chronic
|
7
7
|
chronic_duration
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
json (1.6.5)
|
54
54
|
launchy (2.1.0)
|
55
55
|
addressable (~> 2.2.6)
|
56
|
-
mime-types (1.
|
56
|
+
mime-types (1.18)
|
57
57
|
multi_json (1.1.0)
|
58
58
|
nokogiri (1.5.2)
|
59
59
|
numerizer (0.1.1)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/* /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/base/base_page.css.haml */
|
2
|
+
body > div.overlay {
|
3
|
+
display: none;
|
4
|
+
height: 100%;
|
5
|
+
left: 0px;
|
6
|
+
position: absolute;
|
7
|
+
top: 0px;
|
8
|
+
width: 100%;
|
9
|
+
z-index: 1; }
|
10
|
+
body > div.wait {
|
11
|
+
display: none;
|
12
|
+
height: 100%;
|
13
|
+
left: 0px;
|
14
|
+
position: absolute;
|
15
|
+
top: 0px;
|
16
|
+
width: 100%;
|
17
|
+
z-index: 2; }
|
18
|
+
body > div.wait > div.image {
|
19
|
+
background-image: url("/ruby_app/resources/elements/base/base_page.gif");
|
20
|
+
background-position: center center;
|
21
|
+
background-repeat: no-repeat;
|
22
|
+
height: 48px;
|
23
|
+
position: absolute;
|
24
|
+
width: 48px; }
|
25
|
+
body > ul.log {
|
26
|
+
display: none; }
|
27
|
+
/* /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/pages/base/base_blank_page.css.haml */
|
28
|
+
body > div.body > div.header {
|
29
|
+
display: table;
|
30
|
+
width: 100%; }
|
31
|
+
body > div.body > div.header > div {
|
32
|
+
display: table-cell; }
|
33
|
+
body > div.body > div.header > div.left {
|
34
|
+
width: 75%; }
|
35
|
+
body > div.body > div.header > div.right {
|
36
|
+
text-align: right;
|
37
|
+
width: 25%; }
|
@@ -0,0 +1,205 @@
|
|
1
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/base/base_page.js.haml
|
2
|
+
var RubyApp = new function() {
|
3
|
+
this._interval = 0,
|
4
|
+
this._waitCount = 0,
|
5
|
+
this.getData = function(name, _default) {
|
6
|
+
var value = $('meta[name="' + name + '"]').attr('content');
|
7
|
+
return value == undefined ? _default : value;
|
8
|
+
},
|
9
|
+
this.maximize = function(selector) {
|
10
|
+
var element = $(selector);
|
11
|
+
var _document = $(document);
|
12
|
+
element.css('width', '0px');
|
13
|
+
element.css('height', '0px');
|
14
|
+
element.css('width', _document.width() + 'px');
|
15
|
+
element.css('height', _document.height() + 'px');
|
16
|
+
},
|
17
|
+
this.center = function(selector) {
|
18
|
+
var element = $(selector);
|
19
|
+
var _window = $(window);
|
20
|
+
element.css('top', _window.scrollTop() + (_window.height() - element.outerHeight(true)) / 2 + 'px');
|
21
|
+
element.css('left', _window.scrollLeft() + (_window.width() - element.outerWidth(true)) / 2 + 'px');
|
22
|
+
},
|
23
|
+
this.maximizeWait = function() {
|
24
|
+
RubyApp.maximize('body div.wait');
|
25
|
+
},
|
26
|
+
this.centerWaitImage = function() {
|
27
|
+
RubyApp.center('body div.wait > div.image');
|
28
|
+
},
|
29
|
+
this.maximizeOverlay = function() {
|
30
|
+
RubyApp.maximize('body div.overlay');
|
31
|
+
},
|
32
|
+
this.centerDialog = function(id) {
|
33
|
+
RubyApp.center('#'+id);
|
34
|
+
},
|
35
|
+
this.log = function(message) {
|
36
|
+
$('ul.log > li.status').text(new Date().toString() + ' - ' + message);
|
37
|
+
$('ul.log').append('<li>' + new Date().toString() + ' - ' + message + '</li>');
|
38
|
+
},
|
39
|
+
this.queueEvent = function(event, wait) {
|
40
|
+
event.session_id = RubyApp.getData('session_id', null);
|
41
|
+
event.now = new Date().toString();
|
42
|
+
RubyApp.log('RubyApp.queueEvent ENQUEUE event.class=' + event._class + ' wait=' + wait);
|
43
|
+
$(window).queue( function() {
|
44
|
+
RubyApp.log('RubyApp.queueEvent SEND event.class=' + event._class + ' wait=' + wait);
|
45
|
+
request = $.ajax({type:'POST', url:location.href, data:event, wait:wait});
|
46
|
+
request
|
47
|
+
.success( function(event) {
|
48
|
+
RubyApp.log('RubyApp.queueEvent SUCCESS event.class=' + event._class + ' wait=' + wait);
|
49
|
+
$.each(event.statements, function(index, statement) {
|
50
|
+
eval(statement);
|
51
|
+
} );
|
52
|
+
} )
|
53
|
+
.error( function(request, message, exception) {
|
54
|
+
RubyApp.log('RubyApp.queueEvent ERROR event.class=' + event._class + ' wait=' + wait);
|
55
|
+
if ($.parseJSON(RubyApp.getData('_event_error', 'true')) == true)
|
56
|
+
RubyApp.confirmRefresh(RubyApp.getData('_event_error_message', null));
|
57
|
+
} )
|
58
|
+
.complete( function() {
|
59
|
+
RubyApp.log('RubyApp.queueEvent COMPLETE event.class=' + event._class + ' wait=' + wait);
|
60
|
+
$(window).dequeue();
|
61
|
+
} )
|
62
|
+
} );
|
63
|
+
},
|
64
|
+
this.alert = function(message) {
|
65
|
+
alert(message);
|
66
|
+
},
|
67
|
+
this.refresh = function() {
|
68
|
+
RubyApp.showWait();
|
69
|
+
$(window).clearQueue();
|
70
|
+
location.assign(location.href);
|
71
|
+
},
|
72
|
+
this.confirmRefresh = function(message) {
|
73
|
+
if (confirm(message))
|
74
|
+
{
|
75
|
+
RubyApp.refresh();
|
76
|
+
}
|
77
|
+
},
|
78
|
+
this.go = function(url) {
|
79
|
+
RubyApp.showWait();
|
80
|
+
$(window).clearQueue();
|
81
|
+
location.assign(url);
|
82
|
+
},
|
83
|
+
this.showWait = function() {
|
84
|
+
if (RubyApp._waitCount <= 0)
|
85
|
+
{
|
86
|
+
var wait = $('body div.wait');
|
87
|
+
wait.show();
|
88
|
+
RubyApp.maximizeWait();
|
89
|
+
RubyApp.centerWaitImage();
|
90
|
+
$(window).bind('resize.wait', function() {
|
91
|
+
RubyApp.maximizeWait();
|
92
|
+
RubyApp.centerWaitImage();
|
93
|
+
} );
|
94
|
+
$(window).bind('scroll.wait', function() {
|
95
|
+
RubyApp.centerWaitImage();
|
96
|
+
} );
|
97
|
+
}
|
98
|
+
RubyApp._waitCount ++;
|
99
|
+
},
|
100
|
+
this.hideWait = function() {
|
101
|
+
if (RubyApp._waitCount == 1)
|
102
|
+
{
|
103
|
+
$(window).unbind('.wait');
|
104
|
+
$('body div.wait').hide();
|
105
|
+
}
|
106
|
+
RubyApp._waitCount --;
|
107
|
+
},
|
108
|
+
this.showDialog = function(id) {
|
109
|
+
request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html', wait:true});
|
110
|
+
request
|
111
|
+
.success( function(dialog) {
|
112
|
+
var overlay = $('body div.overlay');
|
113
|
+
overlay.append(dialog);
|
114
|
+
overlay.show();
|
115
|
+
RubyApp.maximizeOverlay();
|
116
|
+
RubyApp.centerDialog(id);
|
117
|
+
$(window).bind('resize.dialog', function() {
|
118
|
+
RubyApp.maximizeOverlay();
|
119
|
+
RubyApp.centerDialog(id);
|
120
|
+
} );
|
121
|
+
$(window).bind('scroll.dialog', function() {
|
122
|
+
RubyApp.centerDialog(id);
|
123
|
+
} );
|
124
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Dialog::ShownEvent', source_id:id}, false);
|
125
|
+
} );
|
126
|
+
},
|
127
|
+
this.hideDialog = function(id) {
|
128
|
+
$(window).unbind('.dialog');
|
129
|
+
$('body div.overlay').hide();
|
130
|
+
$('#'+id).remove();
|
131
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Dialog::HiddenEvent', source_id:id}, false);
|
132
|
+
},
|
133
|
+
this.updateElement = function(id) {
|
134
|
+
request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html', wait:true});
|
135
|
+
request
|
136
|
+
.success( function(content) {
|
137
|
+
$('#'+id).replaceWith(content);
|
138
|
+
} );
|
139
|
+
},
|
140
|
+
this.addClass = function(selector, _class) {
|
141
|
+
$(selector).addClass(_class);
|
142
|
+
},
|
143
|
+
this.removeClass = function(selector, _class) {
|
144
|
+
$(selector).removeClass(_class);
|
145
|
+
},
|
146
|
+
this.updateText = function(selector, value) {
|
147
|
+
$(selector).text(value);
|
148
|
+
},
|
149
|
+
this.updateValue = function(selector, value) {
|
150
|
+
$(selector).val(value);
|
151
|
+
},
|
152
|
+
this.setCookie = function(name, value, expires) {
|
153
|
+
document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
$(document).ready(function() {
|
158
|
+
$('body div.wait')
|
159
|
+
.bind('ajaxSend', function(event, request, options) {
|
160
|
+
if (options.wait)
|
161
|
+
RubyApp.showWait();
|
162
|
+
} )
|
163
|
+
.bind('ajaxComplete', function(event, request, options) {
|
164
|
+
if (options.wait)
|
165
|
+
RubyApp.hideWait();
|
166
|
+
} );
|
167
|
+
});
|
168
|
+
|
169
|
+
$(window).load(function() {
|
170
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Page::LoadedEvent', source_id:$('html').attr('id')}, false);
|
171
|
+
interval = parseInt(RubyApp.getData('interval', 0)) * 1000;
|
172
|
+
if ( interval > 0 ) {
|
173
|
+
RubyApp._interval = window.setInterval(function() {
|
174
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Page::TriggeredEvent', source_id:$('html').attr('id')}, false);
|
175
|
+
}, interval);
|
176
|
+
}
|
177
|
+
});
|
178
|
+
|
179
|
+
$(window).unload(function() {
|
180
|
+
if ( RubyApp._interval != 0 ) {
|
181
|
+
window.clearInterval(RubyApp._interval);
|
182
|
+
$(window).clearQueue();
|
183
|
+
}
|
184
|
+
});
|
185
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/navigation/base/base_breadcrumbs.js.haml
|
186
|
+
$(document).ready(function() {
|
187
|
+
$('div.breadcrumbs > a.breadcrumb').click(function(event) {
|
188
|
+
event.preventDefault();
|
189
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Navigation::Breadcrumbs::ClickedEvent', source_id:$(this).parents('div.breadcrumbs').attr('id'), page_id:$(this).attr('page_id')}, true);
|
190
|
+
});
|
191
|
+
});
|
192
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/navigation/page_link.js.haml
|
193
|
+
$(document).ready(function() {
|
194
|
+
$('span.link > a.page').click(function(event) {
|
195
|
+
event.preventDefault();
|
196
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Navigation::PageLink::ClickedEvent', source_id:$(this).parents('span.link').attr('id'), page:$(this).attr('page')}, true);
|
197
|
+
});
|
198
|
+
});
|
199
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/markdown.js.haml
|
200
|
+
$(document).ready(function() {
|
201
|
+
$('div.markdown a').live('click', function(event) {
|
202
|
+
event.preventDefault();
|
203
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Markdown::ClickedEvent', source_id:$(this).parents('div.markdown').attr('id'), name:$(this).attr('href')}, true);
|
204
|
+
});
|
205
|
+
});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/* /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/base/base_page.css.haml */
|
2
|
+
body > div.overlay {
|
3
|
+
display: none;
|
4
|
+
height: 100%;
|
5
|
+
left: 0px;
|
6
|
+
position: absolute;
|
7
|
+
top: 0px;
|
8
|
+
width: 100%;
|
9
|
+
z-index: 1; }
|
10
|
+
body > div.wait {
|
11
|
+
display: none;
|
12
|
+
height: 100%;
|
13
|
+
left: 0px;
|
14
|
+
position: absolute;
|
15
|
+
top: 0px;
|
16
|
+
width: 100%;
|
17
|
+
z-index: 2; }
|
18
|
+
body > div.wait > div.image {
|
19
|
+
background-image: url("/ruby_app/resources/elements/base/base_page.gif");
|
20
|
+
background-position: center center;
|
21
|
+
background-repeat: no-repeat;
|
22
|
+
height: 48px;
|
23
|
+
position: absolute;
|
24
|
+
width: 48px; }
|
25
|
+
body > ul.log {
|
26
|
+
display: none; }
|
27
|
+
/* /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/pages/base/base_blank_page.css.haml */
|
28
|
+
body > div.body > div.header {
|
29
|
+
display: table;
|
30
|
+
width: 100%; }
|
31
|
+
body > div.body > div.header > div {
|
32
|
+
display: table-cell; }
|
33
|
+
body > div.body > div.header > div.left {
|
34
|
+
width: 75%; }
|
35
|
+
body > div.body > div.header > div.right {
|
36
|
+
text-align: right;
|
37
|
+
width: 25%; }
|
@@ -0,0 +1,212 @@
|
|
1
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/base/base_page.js.haml
|
2
|
+
var RubyApp = new function() {
|
3
|
+
this._interval = 0,
|
4
|
+
this._waitCount = 0,
|
5
|
+
this.getData = function(name, _default) {
|
6
|
+
var value = $('meta[name="' + name + '"]').attr('content');
|
7
|
+
return value == undefined ? _default : value;
|
8
|
+
},
|
9
|
+
this.maximize = function(selector) {
|
10
|
+
var element = $(selector);
|
11
|
+
var _document = $(document);
|
12
|
+
element.css('width', '0px');
|
13
|
+
element.css('height', '0px');
|
14
|
+
element.css('width', _document.width() + 'px');
|
15
|
+
element.css('height', _document.height() + 'px');
|
16
|
+
},
|
17
|
+
this.center = function(selector) {
|
18
|
+
var element = $(selector);
|
19
|
+
var _window = $(window);
|
20
|
+
element.css('top', _window.scrollTop() + (_window.height() - element.outerHeight(true)) / 2 + 'px');
|
21
|
+
element.css('left', _window.scrollLeft() + (_window.width() - element.outerWidth(true)) / 2 + 'px');
|
22
|
+
},
|
23
|
+
this.maximizeWait = function() {
|
24
|
+
RubyApp.maximize('body div.wait');
|
25
|
+
},
|
26
|
+
this.centerWaitImage = function() {
|
27
|
+
RubyApp.center('body div.wait > div.image');
|
28
|
+
},
|
29
|
+
this.maximizeOverlay = function() {
|
30
|
+
RubyApp.maximize('body div.overlay');
|
31
|
+
},
|
32
|
+
this.centerDialog = function(id) {
|
33
|
+
RubyApp.center('#'+id);
|
34
|
+
},
|
35
|
+
this.log = function(message) {
|
36
|
+
$('ul.log > li.status').text(new Date().toString() + ' - ' + message);
|
37
|
+
$('ul.log').append('<li>' + new Date().toString() + ' - ' + message + '</li>');
|
38
|
+
},
|
39
|
+
this.queueEvent = function(event, wait) {
|
40
|
+
event.session_id = RubyApp.getData('session_id', null);
|
41
|
+
event.now = new Date().toString();
|
42
|
+
RubyApp.log('RubyApp.queueEvent ENQUEUE event.class=' + event._class + ' wait=' + wait);
|
43
|
+
$(window).queue( function() {
|
44
|
+
RubyApp.log('RubyApp.queueEvent SEND event.class=' + event._class + ' wait=' + wait);
|
45
|
+
request = $.ajax({type:'POST', url:location.href, data:event, wait:wait});
|
46
|
+
request
|
47
|
+
.success( function(event) {
|
48
|
+
RubyApp.log('RubyApp.queueEvent SUCCESS event.class=' + event._class + ' wait=' + wait);
|
49
|
+
$.each(event.statements, function(index, statement) {
|
50
|
+
eval(statement);
|
51
|
+
} );
|
52
|
+
} )
|
53
|
+
.error( function(request, message, exception) {
|
54
|
+
RubyApp.log('RubyApp.queueEvent ERROR event.class=' + event._class + ' wait=' + wait);
|
55
|
+
if ($.parseJSON(RubyApp.getData('_event_error', 'true')) == true)
|
56
|
+
RubyApp.confirmRefresh(RubyApp.getData('_event_error_message', null));
|
57
|
+
} )
|
58
|
+
.complete( function() {
|
59
|
+
RubyApp.log('RubyApp.queueEvent COMPLETE event.class=' + event._class + ' wait=' + wait);
|
60
|
+
$(window).dequeue();
|
61
|
+
} )
|
62
|
+
} );
|
63
|
+
},
|
64
|
+
this.alert = function(message) {
|
65
|
+
alert(message);
|
66
|
+
},
|
67
|
+
this.refresh = function() {
|
68
|
+
RubyApp.showWait();
|
69
|
+
$(window).clearQueue();
|
70
|
+
location.assign(location.href);
|
71
|
+
},
|
72
|
+
this.confirmRefresh = function(message) {
|
73
|
+
if (confirm(message))
|
74
|
+
{
|
75
|
+
RubyApp.refresh();
|
76
|
+
}
|
77
|
+
},
|
78
|
+
this.go = function(url) {
|
79
|
+
RubyApp.showWait();
|
80
|
+
$(window).clearQueue();
|
81
|
+
location.assign(url);
|
82
|
+
},
|
83
|
+
this.showWait = function() {
|
84
|
+
if (RubyApp._waitCount <= 0)
|
85
|
+
{
|
86
|
+
var wait = $('body div.wait');
|
87
|
+
wait.show();
|
88
|
+
RubyApp.maximizeWait();
|
89
|
+
RubyApp.centerWaitImage();
|
90
|
+
$(window).bind('resize.wait', function() {
|
91
|
+
RubyApp.maximizeWait();
|
92
|
+
RubyApp.centerWaitImage();
|
93
|
+
} );
|
94
|
+
$(window).bind('scroll.wait', function() {
|
95
|
+
RubyApp.centerWaitImage();
|
96
|
+
} );
|
97
|
+
}
|
98
|
+
RubyApp._waitCount ++;
|
99
|
+
},
|
100
|
+
this.hideWait = function() {
|
101
|
+
if (RubyApp._waitCount == 1)
|
102
|
+
{
|
103
|
+
$(window).unbind('.wait');
|
104
|
+
$('body div.wait').hide();
|
105
|
+
}
|
106
|
+
RubyApp._waitCount --;
|
107
|
+
},
|
108
|
+
this.showDialog = function(id) {
|
109
|
+
request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html', wait:true});
|
110
|
+
request
|
111
|
+
.success( function(dialog) {
|
112
|
+
var overlay = $('body div.overlay');
|
113
|
+
overlay.append(dialog);
|
114
|
+
overlay.show();
|
115
|
+
RubyApp.maximizeOverlay();
|
116
|
+
RubyApp.centerDialog(id);
|
117
|
+
$(window).bind('resize.dialog', function() {
|
118
|
+
RubyApp.maximizeOverlay();
|
119
|
+
RubyApp.centerDialog(id);
|
120
|
+
} );
|
121
|
+
$(window).bind('scroll.dialog', function() {
|
122
|
+
RubyApp.centerDialog(id);
|
123
|
+
} );
|
124
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Dialog::ShownEvent', source_id:id}, false);
|
125
|
+
} );
|
126
|
+
},
|
127
|
+
this.hideDialog = function(id) {
|
128
|
+
$(window).unbind('.dialog');
|
129
|
+
$('body div.overlay').hide();
|
130
|
+
$('#'+id).remove();
|
131
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Dialog::HiddenEvent', source_id:id}, false);
|
132
|
+
},
|
133
|
+
this.updateElement = function(id) {
|
134
|
+
request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html', wait:true});
|
135
|
+
request
|
136
|
+
.success( function(content) {
|
137
|
+
$('#'+id).replaceWith(content);
|
138
|
+
} );
|
139
|
+
},
|
140
|
+
this.addClass = function(selector, _class) {
|
141
|
+
$(selector).addClass(_class);
|
142
|
+
},
|
143
|
+
this.removeClass = function(selector, _class) {
|
144
|
+
$(selector).removeClass(_class);
|
145
|
+
},
|
146
|
+
this.updateText = function(selector, value) {
|
147
|
+
$(selector).text(value);
|
148
|
+
},
|
149
|
+
this.updateValue = function(selector, value) {
|
150
|
+
$(selector).val(value);
|
151
|
+
},
|
152
|
+
this.setCookie = function(name, value, expires) {
|
153
|
+
document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
$(document).ready(function() {
|
158
|
+
$('body div.wait')
|
159
|
+
.bind('ajaxSend', function(event, request, options) {
|
160
|
+
if (options.wait)
|
161
|
+
RubyApp.showWait();
|
162
|
+
} )
|
163
|
+
.bind('ajaxComplete', function(event, request, options) {
|
164
|
+
if (options.wait)
|
165
|
+
RubyApp.hideWait();
|
166
|
+
} );
|
167
|
+
});
|
168
|
+
|
169
|
+
$(window).load(function() {
|
170
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Page::LoadedEvent', source_id:$('html').attr('id')}, false);
|
171
|
+
interval = parseInt(RubyApp.getData('interval', 0)) * 1000;
|
172
|
+
if ( interval > 0 ) {
|
173
|
+
RubyApp._interval = window.setInterval(function() {
|
174
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Page::TriggeredEvent', source_id:$('html').attr('id')}, false);
|
175
|
+
}, interval);
|
176
|
+
}
|
177
|
+
});
|
178
|
+
|
179
|
+
$(window).unload(function() {
|
180
|
+
if ( RubyApp._interval != 0 ) {
|
181
|
+
window.clearInterval(RubyApp._interval);
|
182
|
+
$(window).clearQueue();
|
183
|
+
}
|
184
|
+
});
|
185
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/navigation/base/base_breadcrumbs.js.haml
|
186
|
+
$(document).ready(function() {
|
187
|
+
$('div.breadcrumbs > a.breadcrumb').click(function(event) {
|
188
|
+
event.preventDefault();
|
189
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Navigation::Breadcrumbs::ClickedEvent', source_id:$(this).parents('div.breadcrumbs').attr('id'), page_id:$(this).attr('page_id')}, true);
|
190
|
+
});
|
191
|
+
});
|
192
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/navigation/page_link.js.haml
|
193
|
+
$(document).ready(function() {
|
194
|
+
$('span.link > a.page').click(function(event) {
|
195
|
+
event.preventDefault();
|
196
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Navigation::PageLink::ClickedEvent', source_id:$(this).parents('span.link').attr('id'), page:$(this).attr('page')}, true);
|
197
|
+
});
|
198
|
+
});
|
199
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/click.js.haml
|
200
|
+
$(document).ready(function() {
|
201
|
+
$('.click').live('click', function(event) {
|
202
|
+
event.preventDefault();
|
203
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Click::ClickedEvent', source_id:$(this).attr('id')}, true);
|
204
|
+
});
|
205
|
+
});
|
206
|
+
// /Users/fficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/markdown.js.haml
|
207
|
+
$(document).ready(function() {
|
208
|
+
$('div.markdown a').live('click', function(event) {
|
209
|
+
event.preventDefault();
|
210
|
+
RubyApp.queueEvent({_class:'RubyApp::Elements::Markdown::ClickedEvent', source_id:$(this).parents('div.markdown').attr('id'), name:$(this).attr('href')}, true);
|
211
|
+
});
|
212
|
+
});
|