puffer 0.0.32 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -0
- data/Gemfile +1 -26
- data/Gemfile.lock +66 -64
- data/README.md +34 -23
- data/Rakefile +1 -11
- data/VERSION +1 -1
- data/app/assets/javascripts/puffer/application.js +6 -1
- data/app/assets/javascripts/puffer/associations.js +18 -0
- data/app/assets/javascripts/puffer/puffer.js +7 -0
- data/app/assets/javascripts/puffer/right-calendar-src.js +19 -3
- data/app/assets/javascripts/puffer/right-dnd-src.js +591 -0
- data/app/assets/javascripts/puffer/right-in-edit-src.js +373 -0
- data/app/assets/javascripts/puffer/right-keys-src.js +87 -0
- data/app/assets/javascripts/puffer/{paginator.js → right-paginator-src.js} +0 -0
- data/app/assets/javascripts/puffer/right-slider-src.js +29 -32
- data/app/assets/javascripts/puffer/right-sortable-src.js +430 -0
- data/app/assets/javascripts/puffer/right-src.js +358 -99
- data/app/assets/stylesheets/puffer/puffer.css +29 -4
- data/app/components/base/form.html.erb +8 -14
- data/app/components/base_component.rb +1 -1
- data/app/components/boolean/form.html.erb +5 -3
- data/app/components/boolean/index.html.erb +6 -2
- data/app/components/boolean_component.rb +2 -2
- data/app/components/date_time/filter.html.erb +9 -0
- data/app/components/date_time/form.html.erb +8 -4
- data/app/components/date_time_component.rb +21 -5
- data/app/components/file/form.html.erb +8 -4
- data/app/components/hidden/form.html.erb +3 -1
- data/app/components/nested_attributes_many/form.html.erb +47 -0
- data/app/components/nested_attributes_many_component.rb +7 -0
- data/app/components/nested_attributes_one/form.html.erb +48 -0
- data/app/components/nested_attributes_one_component.rb +7 -0
- data/app/components/password/form.html.erb +8 -4
- data/app/components/password_component.rb +1 -1
- data/app/components/references_many/index.html.erb +1 -1
- data/app/components/references_one/choose.html.erb +1 -1
- data/app/components/references_one/form.html.erb +10 -9
- data/app/components/references_one_component.rb +0 -1
- data/app/components/render_component.rb +13 -0
- data/app/components/select/filter.html.erb +4 -2
- data/app/components/select/form.html.erb +8 -4
- data/app/components/text/form.html.erb +8 -4
- data/app/controllers/admin/sessions_controller.rb +1 -21
- data/app/controllers/puffer/base.rb +10 -3
- data/app/controllers/puffer/dashboard_base.rb +7 -1
- data/app/controllers/puffer/{sessions_base.rb → sessions/base.rb} +10 -7
- data/app/controllers/puffer/sessions/clearance.rb +29 -0
- data/app/controllers/puffer/{sessions_devise_base.rb → sessions/devise.rb} +1 -1
- data/app/controllers/puffer/sessions/simple.rb +28 -0
- data/app/controllers/puffer/tree_base.rb +1 -1
- data/app/models/puffer_user.rb +3 -0
- data/app/views/layouts/puffer.html.erb +3 -3
- data/app/views/puffer/base/_edit.html.erb +15 -0
- data/app/views/puffer/base/_index.html.erb +26 -0
- data/app/views/puffer/base/_show.html.erb +13 -0
- data/app/views/puffer/base/_table.html.erb +1 -1
- data/app/views/puffer/base/edit.html.erb +1 -15
- data/app/views/puffer/base/edit.js.erb +1 -0
- data/app/views/puffer/base/index.html.erb +1 -20
- data/app/views/puffer/base/index.js.erb +1 -0
- data/app/views/puffer/base/new.html.erb +1 -1
- data/app/views/puffer/base/show.html.erb +1 -22
- data/app/views/puffer/base/show.js.erb +1 -0
- data/app/views/puffer/base/update.js.erb +1 -0
- data/app/views/puffer/sessions/base/new.html.erb +11 -0
- data/app/views/puffer/tree_base/_record.html.erb +1 -1
- data/lib/puffer/component.rb +14 -47
- data/lib/puffer/controller/auth.rb +13 -9
- data/lib/puffer/controller/config.rb +18 -0
- data/lib/puffer/controller/mutate.rb +8 -8
- data/lib/puffer/engine.rb +5 -0
- data/lib/puffer/field.rb +5 -11
- data/lib/puffer/filters.rb +86 -56
- data/lib/puffer/helpers/component_helper.rb +24 -0
- data/lib/puffer/helpers/puffer_helper.rb +65 -0
- data/lib/puffer/helpers/puffer_tree_helper.rb +19 -0
- data/lib/puffer/orm_adapter/active_record.rb +40 -11
- data/lib/puffer/orm_adapter/base.rb +9 -0
- data/lib/puffer/orm_adapter/mongoid.rb +32 -9
- data/lib/puffer/resource/node.rb +2 -2
- data/lib/puffer/resource/routing.rb +30 -16
- data/lib/puffer/resource.rb +20 -20
- data/lib/puffer/version.rb +3 -0
- data/lib/puffer.rb +26 -5
- data/puffer.gemspec +34 -296
- data/spec/app/components/base_component_spec.rb +1 -1
- data/spec/app/components/boolean_component_spec.rb +2 -0
- data/spec/app/components/date_time_component_spec.rb +1 -0
- data/spec/app/components/file_component_spec.rb +1 -0
- data/spec/app/components/hidden_component_spec.rb +1 -0
- data/spec/app/components/password_component_spec.rb +2 -0
- data/spec/app/components/select_component_spec.rb +1 -0
- data/spec/app/components/string_component_spec.rb +1 -0
- data/spec/app/components/text_component_spec.rb +1 -0
- data/spec/dummy/app/controllers/admin/news_controller.rb +2 -0
- data/spec/dummy/app/controllers/admin/profiles_controller.rb +1 -1
- data/spec/dummy/app/controllers/admin/users_controller.rb +2 -0
- data/spec/dummy/app/controllers/orms/active_record_orm_primals_controller.rb +8 -0
- data/spec/dummy/app/helpers/news_helper.rb +7 -0
- data/spec/dummy/app/models/active_record_orm/has_many_reference.rb +5 -0
- data/spec/dummy/app/models/active_record_orm/has_one_reference.rb +5 -0
- data/spec/dummy/app/models/active_record_orm/primal.rb +4 -0
- data/spec/dummy/config/environments/development.rb +1 -1
- data/spec/dummy/db/migrate/20111120144025_create_active_record_orm_has_one_references.rb +10 -0
- data/spec/dummy/db/migrate/20111122203304_create_active_record_orm_has_many_references.rb +10 -0
- data/spec/dummy/db/schema.rb +15 -1
- data/spec/helpers/puffer_helper_spec.rb +1 -1
- data/spec/lib/fields_spec.rb +0 -9
- data/spec/lib/filters_spec.rb +4 -8
- data/spec/lib/orm_adapter/base_shared.rb +22 -0
- data/spec/spec_helper.rb +1 -1
- metadata +89 -60
- data/app/components/string/form.html.erb +0 -5
- data/app/helpers/puffer_helper.rb +0 -51
- data/app/helpers/puffer_tree_helper.rb +0 -15
- data/app/views/puffer/sessions_base/new.html.erb +0 -11
- data/lib/puffer/extensions/form.rb +0 -16
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RightJS-UI InEdit v2.2.0
|
|
3
|
+
* http://rightjs.org/ui/in-edit
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
|
6
|
+
*/
|
|
7
|
+
var InEdit = RightJS.InEdit = (function(document, RightJS) {
|
|
8
|
+
/**
|
|
9
|
+
* This module defines the basic widgets constructor
|
|
10
|
+
* it creates an abstract proxy with the common functionality
|
|
11
|
+
* which then we reuse and override in the actual widgets
|
|
12
|
+
*
|
|
13
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The widget units constructor
|
|
18
|
+
*
|
|
19
|
+
* @param String tag-name or Object methods
|
|
20
|
+
* @param Object methods
|
|
21
|
+
* @return Widget wrapper
|
|
22
|
+
*/
|
|
23
|
+
function Widget(tag_name, methods) {
|
|
24
|
+
if (!methods) {
|
|
25
|
+
methods = tag_name;
|
|
26
|
+
tag_name = 'DIV';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An Abstract Widget Unit
|
|
31
|
+
*
|
|
32
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
|
33
|
+
*/
|
|
34
|
+
var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
|
35
|
+
/**
|
|
36
|
+
* The common constructor
|
|
37
|
+
*
|
|
38
|
+
* @param Object options
|
|
39
|
+
* @param String optional tag name
|
|
40
|
+
* @return void
|
|
41
|
+
*/
|
|
42
|
+
initialize: function(key, options) {
|
|
43
|
+
this.key = key;
|
|
44
|
+
var args = [{'class': 'rui-' + key}];
|
|
45
|
+
|
|
46
|
+
// those two have different constructors
|
|
47
|
+
if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
|
|
48
|
+
args.unshift(tag_name);
|
|
49
|
+
}
|
|
50
|
+
this.$super.apply(this, args);
|
|
51
|
+
|
|
52
|
+
if (RightJS.isString(options)) {
|
|
53
|
+
options = RightJS.$(options);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// if the options is another element then
|
|
57
|
+
// try to dynamically rewrap it with our widget
|
|
58
|
+
if (options instanceof RightJS.Element) {
|
|
59
|
+
this._ = options._;
|
|
60
|
+
if ('$listeners' in options) {
|
|
61
|
+
options.$listeners = options.$listeners;
|
|
62
|
+
}
|
|
63
|
+
options = {};
|
|
64
|
+
}
|
|
65
|
+
this.setOptions(options, this);
|
|
66
|
+
|
|
67
|
+
return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// protected
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Catches the options
|
|
74
|
+
*
|
|
75
|
+
* @param Object user-options
|
|
76
|
+
* @param Element element with contextual options
|
|
77
|
+
* @return void
|
|
78
|
+
*/
|
|
79
|
+
setOptions: function(options, element) {
|
|
80
|
+
if (element) {
|
|
81
|
+
options = RightJS.Object.merge(options, new Function("return "+(
|
|
82
|
+
element.get('data-'+ this.key) || '{}'
|
|
83
|
+
))());
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (options) {
|
|
87
|
+
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Creating the actual widget class
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
var Klass = new RightJS.Class(AbstractWidget, methods);
|
|
99
|
+
|
|
100
|
+
// creating the widget related shortcuts
|
|
101
|
+
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([]));
|
|
102
|
+
|
|
103
|
+
return Klass;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A shared module to create textual spinners
|
|
109
|
+
*
|
|
110
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
|
111
|
+
*/
|
|
112
|
+
var Spinner = new RightJS.Class(RightJS.Element, {
|
|
113
|
+
/**
|
|
114
|
+
* Constructor
|
|
115
|
+
*
|
|
116
|
+
* @param Number optional spinner size (4 by default)
|
|
117
|
+
* @return void
|
|
118
|
+
*/
|
|
119
|
+
initialize: function(size) {
|
|
120
|
+
this.$super('div', {'class': 'rui-spinner'});
|
|
121
|
+
this.dots = [];
|
|
122
|
+
|
|
123
|
+
for (var i=0; i < (size || 4); i++) {
|
|
124
|
+
this.dots.push(new RightJS.Element('div'));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
this.dots[0].addClass('glowing');
|
|
128
|
+
this.insert(this.dots);
|
|
129
|
+
RightJS(this.shift).bind(this).periodical(300);
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Shifts the spinner elements
|
|
134
|
+
*
|
|
135
|
+
* @return void
|
|
136
|
+
*/
|
|
137
|
+
shift: function() {
|
|
138
|
+
if (this.visible()) {
|
|
139
|
+
var dot = this.dots.pop();
|
|
140
|
+
this.dots.unshift(dot);
|
|
141
|
+
this.insert(dot, 'top');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* In-Edit plugin initalization
|
|
149
|
+
*
|
|
150
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
|
151
|
+
*/
|
|
152
|
+
var R = RightJS,
|
|
153
|
+
$ = RightJS.$,
|
|
154
|
+
$w = RightJS.$w,
|
|
155
|
+
Xhr = RightJS.Xhr,
|
|
156
|
+
Object = RightJS.Object,
|
|
157
|
+
Element = RightJS.Element,
|
|
158
|
+
Input = RightJS.Input;
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* An inline editor feature
|
|
170
|
+
*
|
|
171
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
|
172
|
+
*/
|
|
173
|
+
var InEdit = new Widget('FORM', {
|
|
174
|
+
extend: {
|
|
175
|
+
version: '2.2.0',
|
|
176
|
+
|
|
177
|
+
EVENTS: $w('show hide send update'),
|
|
178
|
+
|
|
179
|
+
Options: {
|
|
180
|
+
url: null, // the url address where to send the stuff
|
|
181
|
+
name: 'text', // the field name
|
|
182
|
+
method: 'put', // the method
|
|
183
|
+
|
|
184
|
+
type: 'text', // the input type, 'text', 'file', 'password' or 'textarea'
|
|
185
|
+
|
|
186
|
+
toggle: null, // a reference to an element that should get hidden when the editor is active
|
|
187
|
+
|
|
188
|
+
update: true, // a marker if the element should be updated with the response-text
|
|
189
|
+
|
|
190
|
+
Xhr: {} // additional Xhr options
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
i18n: {
|
|
194
|
+
Save: 'Save',
|
|
195
|
+
Cancel: 'Cancel'
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
current: null // currently opened editor
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Constructor
|
|
203
|
+
*
|
|
204
|
+
* @param mixed an element reference
|
|
205
|
+
* @param Object options
|
|
206
|
+
* @return void
|
|
207
|
+
*/
|
|
208
|
+
initialize: function(element, options) {
|
|
209
|
+
this.element = $(element);
|
|
210
|
+
|
|
211
|
+
this
|
|
212
|
+
.$super('in-edit', options)
|
|
213
|
+
.set('action', this.options.url)
|
|
214
|
+
.insert([
|
|
215
|
+
this.field = new Input({type: this.options.type, name: this.options.name, 'class': 'field'}),
|
|
216
|
+
this.spinner = new Spinner(4),
|
|
217
|
+
this.submit = new Input({type: 'submit', 'class': 'submit', value: InEdit.i18n.Save}),
|
|
218
|
+
this.cancel = new Element('a', {'class': 'cancel', href: '#', html: InEdit.i18n.Cancel})
|
|
219
|
+
])
|
|
220
|
+
.onClick(this.clicked)
|
|
221
|
+
.onSubmit(this.send);
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Shows the inline-editor form
|
|
226
|
+
*
|
|
227
|
+
* @return InEdit this
|
|
228
|
+
*/
|
|
229
|
+
show: function() {
|
|
230
|
+
if (InEdit.current !== this) {
|
|
231
|
+
if (InEdit.current) { InEdit.current.hide(); }
|
|
232
|
+
|
|
233
|
+
this.oldContent = this.element.html();
|
|
234
|
+
|
|
235
|
+
if (!R(['file', 'password']).include(this.options.type)) {
|
|
236
|
+
this.field.setValue(this.oldContent);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
this.element.update(this);
|
|
240
|
+
|
|
241
|
+
this.spinner.hide();
|
|
242
|
+
this.submit.show();
|
|
243
|
+
|
|
244
|
+
if (this.options.toggle) {
|
|
245
|
+
$(this.options.toggle).hide();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (this.options.type !== 'file') {
|
|
250
|
+
this.field.focus();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
InEdit.current = this;
|
|
254
|
+
return this.fire('show');
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Hides the form and brings the content back
|
|
259
|
+
*
|
|
260
|
+
* @param String optional new content
|
|
261
|
+
* @return InEdit this
|
|
262
|
+
*/
|
|
263
|
+
hide: function() {
|
|
264
|
+
this.element._.innerHTML = this.oldContent;
|
|
265
|
+
|
|
266
|
+
if (this.xhr) {
|
|
267
|
+
this.xhr.cancel();
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return this.finish();
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Triggers the form remote submit
|
|
275
|
+
*
|
|
276
|
+
* @return InEdit this
|
|
277
|
+
*/
|
|
278
|
+
send: function(event) {
|
|
279
|
+
if (event) { event.stop(); }
|
|
280
|
+
|
|
281
|
+
this.spinner.show().resize(this.submit.size());
|
|
282
|
+
this.submit.hide();
|
|
283
|
+
|
|
284
|
+
this.xhr = new Xhr(this.options.url, Object.merge(this.options.Xhr, {
|
|
285
|
+
method: this.options.method,
|
|
286
|
+
spinner: this.spinner,
|
|
287
|
+
onComplete: R(this.receive).bind(this)
|
|
288
|
+
})).send(this);
|
|
289
|
+
|
|
290
|
+
return this.fire('send');
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
// protected
|
|
294
|
+
|
|
295
|
+
// finishes up with the form
|
|
296
|
+
finish: function() {
|
|
297
|
+
if (this.options.toggle) {
|
|
298
|
+
$(this.options.toggle).show();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
InEdit.current = null;
|
|
302
|
+
return this.fire('hide');
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
// the xhr callback
|
|
306
|
+
receive: function() {
|
|
307
|
+
if (this.options.update) {
|
|
308
|
+
this.element.update(this.xhr.text);
|
|
309
|
+
this.fire('update');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
this.xhr = null;
|
|
313
|
+
|
|
314
|
+
this.finish();
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
// catches clicks on the element
|
|
318
|
+
clicked: function(event) {
|
|
319
|
+
if (event.target === this.cancel) {
|
|
320
|
+
event.stop();
|
|
321
|
+
this.hide();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The document hooks for in-edit form
|
|
330
|
+
*
|
|
331
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
|
332
|
+
*/
|
|
333
|
+
$(document).onKeydown(function(event) {
|
|
334
|
+
// processing the `ESC` button
|
|
335
|
+
if (event.keyCode === 27 && InEdit.current) {
|
|
336
|
+
InEdit.current.hide();
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* The element level inline editor extension
|
|
343
|
+
*
|
|
344
|
+
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
|
345
|
+
*/
|
|
346
|
+
Element.include({
|
|
347
|
+
/**
|
|
348
|
+
* Triggers an inline-editor feature on the element
|
|
349
|
+
*
|
|
350
|
+
* @param Object options for the InEdit class
|
|
351
|
+
* @return InEdit object
|
|
352
|
+
*/
|
|
353
|
+
inEdit: function(options) {
|
|
354
|
+
return new InEdit(this, options).show();
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
var embed_style = document.createElement('style'),
|
|
360
|
+
embed_rules = document.createTextNode("div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}form.rui-in-edit,form.rui-in-edit .cancel{margin:0;padding:0;float:none;position:static}form.rui-in-edit{display:inline-block; *display:inline; *zoom:1;border:none;background:none}form.rui-in-edit div.rui-spinner{margin-right:.2em}form.rui-in-edit div.rui-spinner div{margin-top:.2em}form.rui-in-edit textarea.field{width:100%;margin-bottom:.5em}form.rui-in-edit .field,form.rui-in-edit .submit{margin-right:.2em}form.rui-in-edit,form.rui-in-edit .field,form.rui-in-edit .submit,form.rui-in-edit div.rui-spinner,form.rui-in-edit .cancel{vertical-align:middle}");
|
|
361
|
+
|
|
362
|
+
embed_style.type = 'text/css';
|
|
363
|
+
document.getElementsByTagName('head')[0].appendChild(embed_style);
|
|
364
|
+
|
|
365
|
+
if(embed_style.styleSheet) {
|
|
366
|
+
embed_style.styleSheet.cssText = embed_rules.nodeValue;
|
|
367
|
+
} else {
|
|
368
|
+
embed_style.appendChild(embed_rules);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
return InEdit;
|
|
373
|
+
})(document, RightJS);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pretty Keyboard Events v2.2.1
|
|
3
|
+
* http://rightjs.org/plugins/keys
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
|
6
|
+
*/
|
|
7
|
+
(function(RightJS) {
|
|
8
|
+
/**
|
|
9
|
+
* The keys plugin initialization
|
|
10
|
+
*
|
|
11
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
|
12
|
+
*/
|
|
13
|
+
RightJS.Keys = {
|
|
14
|
+
version: '2.2.1'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The Event level keyboard keycodes and stuff
|
|
21
|
+
*
|
|
22
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
|
23
|
+
*/
|
|
24
|
+
RightJS.Event.Keys = {
|
|
25
|
+
BACKSPACE: 8,
|
|
26
|
+
TAB: 9,
|
|
27
|
+
ENTER: 13,
|
|
28
|
+
ESC: 27,
|
|
29
|
+
SPACE: 32,
|
|
30
|
+
PAGEUP: 33,
|
|
31
|
+
PAGEDOWN: 34,
|
|
32
|
+
END: 35,
|
|
33
|
+
HOME: 36,
|
|
34
|
+
LEFT: 37,
|
|
35
|
+
UP: 38,
|
|
36
|
+
RIGHT: 39,
|
|
37
|
+
DOWN: 40,
|
|
38
|
+
INSERT: 45,
|
|
39
|
+
DELETE: 46
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Overloading the Element#on method to handle those fancy names
|
|
45
|
+
*
|
|
46
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
|
47
|
+
*/
|
|
48
|
+
[RightJS.Document, RightJS.Element, RightJS.Window].each('include', {
|
|
49
|
+
on: function() {
|
|
50
|
+
var args = RightJS.$A(arguments), name = args[0];
|
|
51
|
+
|
|
52
|
+
if (typeof(name) === 'string') {
|
|
53
|
+
var key = name.split(/[\+\-\_ ]+/);
|
|
54
|
+
key = (key[key.length - 1] || '').toUpperCase();
|
|
55
|
+
|
|
56
|
+
if (key in RightJS.Event.Keys || /^[A-Z0-9]$/.test(key)) {
|
|
57
|
+
var meta = /(^|\+|\-| )(meta|alt)(\+|\-| )/i.test(name),
|
|
58
|
+
ctrl = /(^|\+|\-| )(ctl|ctrl)(\+|\-| )/i.test(name),
|
|
59
|
+
shift = /(^|\+|\-| )(shift)(\+|\-| )/i.test(name),
|
|
60
|
+
code = RightJS.Event.Keys[key] || key.charCodeAt(0),
|
|
61
|
+
orig = args.slice(1),
|
|
62
|
+
method = orig.shift();
|
|
63
|
+
|
|
64
|
+
if (typeof(method) === 'string') {
|
|
65
|
+
method = this[method] || function() {};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// replacing the arguments
|
|
69
|
+
args = ['keydown', function(event) {
|
|
70
|
+
var raw = event._;
|
|
71
|
+
if (
|
|
72
|
+
(raw.keyCode === code) &&
|
|
73
|
+
(!meta || raw.metaKey || raw.altKey) &&
|
|
74
|
+
(!ctrl || raw.ctrlKey) &&
|
|
75
|
+
(!shift || raw.shiftKey)
|
|
76
|
+
) {
|
|
77
|
+
return method.call(this, [event].concat(orig));
|
|
78
|
+
}
|
|
79
|
+
}];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return this.$super.apply(this, args);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
})(RightJS);
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RightJS-UI Slider v2.
|
|
2
|
+
* RightJS-UI Slider v2.3.0
|
|
3
3
|
* http://rightjs.org/ui/slider
|
|
4
4
|
*
|
|
5
5
|
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
|
@@ -177,7 +177,7 @@ var Slider = new Widget({
|
|
|
177
177
|
include: Updater,
|
|
178
178
|
|
|
179
179
|
extend: {
|
|
180
|
-
version: '2.
|
|
180
|
+
version: '2.3.0',
|
|
181
181
|
|
|
182
182
|
EVENTS: $w('change'),
|
|
183
183
|
|
|
@@ -224,9 +224,9 @@ var Slider = new Widget({
|
|
|
224
224
|
|
|
225
225
|
if (options.range === true) {
|
|
226
226
|
this.handles = new Array();
|
|
227
|
-
this.handles[0] = this.first('.handle.from') || $E('div', {'class': 'handle
|
|
228
|
-
this.handles[1] = this.first('.handle.to') || $E('div', {'class': 'handle
|
|
229
|
-
|
|
227
|
+
this.handles[0] = this.first('.handle.from') || $E('div', {'class': 'handle from'}).insertTo(this);
|
|
228
|
+
this.handles[1] = this.first('.handle.to') || $E('div', {'class': 'handle to'}).insertTo(this);
|
|
229
|
+
|
|
230
230
|
this.values = [0, 0];
|
|
231
231
|
this.values[0] = options.values === null ? options.min : options.values[0];
|
|
232
232
|
this.values[1] = options.values === null ? options.max : options.values[1];
|
|
@@ -234,8 +234,6 @@ var Slider = new Widget({
|
|
|
234
234
|
this.setValue(this.values[0], 'from');
|
|
235
235
|
this.setValue(this.values[1], 'to');
|
|
236
236
|
|
|
237
|
-
//this.offsets = [0, 0];
|
|
238
|
-
|
|
239
237
|
} else {
|
|
240
238
|
this.handle = this.first('.handle') || $E('div', {'class': 'handle'}).insertTo(this);
|
|
241
239
|
this.setValue(this.value);
|
|
@@ -273,7 +271,7 @@ var Slider = new Widget({
|
|
|
273
271
|
},
|
|
274
272
|
|
|
275
273
|
/**
|
|
276
|
-
* Returns the values that used to store the range
|
|
274
|
+
* Returns the values that used to store the range
|
|
277
275
|
*
|
|
278
276
|
* @return An array storing the from/to float numbers
|
|
279
277
|
*/
|
|
@@ -307,9 +305,9 @@ var Slider = new Widget({
|
|
|
307
305
|
this.offset = horizontal ? handle_f.left - dims.left : dims.top + dims.height - handle_f.top - handle_size;
|
|
308
306
|
this.space = (horizontal ? dims.width : dims.height) - handle_size - (this.offset * 2);
|
|
309
307
|
|
|
310
|
-
var handle_t = this.handles[1].setStyle(horizontal ? {left: this.space + 'px'} :
|
|
308
|
+
var handle_t = this.handles[1].setStyle(horizontal ? {left: this.space + 'px'} :
|
|
311
309
|
{bottom: this.space + 'px'}).dimensions();
|
|
312
|
-
|
|
310
|
+
|
|
313
311
|
} else {
|
|
314
312
|
var handle = this.handle.setStyle(horizontal ? {left: 0} : {bottom: 0}).dimensions(),
|
|
315
313
|
handle_size = this.hSize = horizontal ? handle.width : handle.height;
|
|
@@ -322,13 +320,22 @@ var Slider = new Widget({
|
|
|
322
320
|
},
|
|
323
321
|
|
|
324
322
|
// initializes the slider drag
|
|
325
|
-
start: function(event
|
|
326
|
-
|
|
323
|
+
start: function(event) {
|
|
324
|
+
this._type = null
|
|
325
|
+
if (event.target.hasClass('handle')) {
|
|
326
|
+
if (event.target.hasClass('from')) {
|
|
327
|
+
this._type = "from";
|
|
328
|
+
} else if (event.target.hasClass('to')) {
|
|
329
|
+
this._type = "to";
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return this.precalc().e2val(event);
|
|
327
334
|
},
|
|
328
335
|
|
|
329
336
|
// processes the slider-drag
|
|
330
|
-
move: function(event
|
|
331
|
-
return this.e2val(event
|
|
337
|
+
move: function(event) {
|
|
338
|
+
return this.e2val(event);
|
|
332
339
|
},
|
|
333
340
|
|
|
334
341
|
// shifts the slider to the value
|
|
@@ -391,7 +398,7 @@ var Slider = new Widget({
|
|
|
391
398
|
if (fireEvent) {
|
|
392
399
|
this.fire('change', {value: value, values: this.values});
|
|
393
400
|
}
|
|
394
|
-
|
|
401
|
+
|
|
395
402
|
} else {
|
|
396
403
|
// calculating and setting the actual position
|
|
397
404
|
var position = this.space / (options.max - options.min) * (value - options.min);
|
|
@@ -410,16 +417,17 @@ var Slider = new Widget({
|
|
|
410
417
|
},
|
|
411
418
|
|
|
412
419
|
// converts the event position into the actual value in terms of the slider measures
|
|
413
|
-
e2val: function(event
|
|
420
|
+
e2val: function(event) {
|
|
414
421
|
var options = this.options, horizontal = options.direction === 'x',
|
|
415
422
|
dims = this.dims, offset = this.offset, space = this.space,
|
|
416
423
|
cur_pos = event.position()[horizontal ? 'x' : 'y'] - offset - this.hSize/2,
|
|
417
424
|
min_pos = horizontal ? dims.left + offset : dims.top + offset,
|
|
418
|
-
value = (options.max - options.min) / space * (cur_pos - min_pos)
|
|
425
|
+
value = (options.max - options.min) / space * (cur_pos - min_pos),
|
|
426
|
+
type = this._type;
|
|
419
427
|
|
|
420
|
-
if (
|
|
428
|
+
if (type == null) {
|
|
421
429
|
return this.shiftTo(horizontal ? options.min + value : options.max - value);
|
|
422
|
-
} else if (type === "to") {
|
|
430
|
+
} else if (type === "to") {
|
|
423
431
|
this.shiftTo(this.values[0], "from");
|
|
424
432
|
return this.shiftTo(horizontal ? options.min + value : options.max - value, "to");
|
|
425
433
|
} else {
|
|
@@ -453,23 +461,14 @@ $(document).on({
|
|
|
453
461
|
if (!(slider instanceof Slider)) {
|
|
454
462
|
slider = new Slider(slider);
|
|
455
463
|
}
|
|
456
|
-
|
|
457
|
-
if (event.target.hasClass('handle')) {
|
|
458
|
-
if (event.target.hasClass('from')) {
|
|
459
|
-
type = "from";
|
|
460
|
-
} else if (event.target.hasClass('to')) {
|
|
461
|
-
type = "to";
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
Slider.current = slider.start(event, type);
|
|
465
|
-
Slider.handleType = type;
|
|
464
|
+
Slider.current = slider.start(event);
|
|
466
465
|
}
|
|
467
466
|
},
|
|
468
467
|
|
|
469
468
|
// handles the slider move
|
|
470
469
|
mousemove: function(event) {
|
|
471
470
|
if (Slider.current) {
|
|
472
|
-
Slider.current.move(event
|
|
471
|
+
Slider.current.move(event);
|
|
473
472
|
}
|
|
474
473
|
},
|
|
475
474
|
|
|
@@ -477,7 +476,6 @@ $(document).on({
|
|
|
477
476
|
mouseup: function(event) {
|
|
478
477
|
if (Slider.current) {
|
|
479
478
|
Slider.current = false;
|
|
480
|
-
Slider.handleType = null;
|
|
481
479
|
}
|
|
482
480
|
}
|
|
483
481
|
});
|
|
@@ -485,7 +483,6 @@ $(document).on({
|
|
|
485
483
|
$(window).onBlur(function() {
|
|
486
484
|
if (Slider.current) {
|
|
487
485
|
Slider.current = false;
|
|
488
|
-
Slider.handleType = null;
|
|
489
486
|
}
|
|
490
487
|
});
|
|
491
488
|
|