right-rails 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.textile +50 -0
- data/Rakefile +23 -0
- data/generators/right_rails/right_rails_generator.rb +41 -0
- data/generators/right_rails/templates/iframed.html.erb +10 -0
- data/generators/right_scaffold/right_scaffold_generator.rb +53 -0
- data/generators/right_scaffold/templates/controller.rb +99 -0
- data/generators/right_scaffold/templates/helper.rb +2 -0
- data/generators/right_scaffold/templates/layout.html.erb +18 -0
- data/generators/right_scaffold/templates/style.css +54 -0
- data/generators/right_scaffold/templates/view__form.html.erb +16 -0
- data/generators/right_scaffold/templates/view__item.html.erb +13 -0
- data/generators/right_scaffold/templates/view_edit.html.erb +6 -0
- data/generators/right_scaffold/templates/view_index.html.erb +9 -0
- data/generators/right_scaffold/templates/view_new.html.erb +5 -0
- data/generators/right_scaffold/templates/view_show.html.erb +10 -0
- data/init.rb +12 -0
- data/javascripts/right-autocompleter-src.js +303 -0
- data/javascripts/right-autocompleter.js +9 -0
- data/javascripts/right-behavior-src.js +240 -0
- data/javascripts/right-behavior.js +8 -0
- data/javascripts/right-calendar-src.js +855 -0
- data/javascripts/right-calendar.js +9 -0
- data/javascripts/right-dnd-src.js +555 -0
- data/javascripts/right-dnd.js +9 -0
- data/javascripts/right-effects-src.js +425 -0
- data/javascripts/right-effects.js +6 -0
- data/javascripts/right-events-src.js +369 -0
- data/javascripts/right-events.js +6 -0
- data/javascripts/right-json-src.js +176 -0
- data/javascripts/right-json.js +6 -0
- data/javascripts/right-lightbox-src.js +597 -0
- data/javascripts/right-lightbox.js +9 -0
- data/javascripts/right-rails-src.js +269 -0
- data/javascripts/right-rails.js +9 -0
- data/javascripts/right-rater-src.js +248 -0
- data/javascripts/right-rater.js +9 -0
- data/javascripts/right-selectable-src.js +507 -0
- data/javascripts/right-selectable.js +7 -0
- data/javascripts/right-slider-src.js +291 -0
- data/javascripts/right-slider.js +7 -0
- data/javascripts/right-sortable-src.js +221 -0
- data/javascripts/right-sortable.js +9 -0
- data/javascripts/right-src.js +4939 -0
- data/javascripts/right-tabs-src.js +776 -0
- data/javascripts/right-tabs.js +6 -0
- data/javascripts/right-tooltips-src.js +130 -0
- data/javascripts/right-tooltips.js +9 -0
- data/javascripts/right-ui-i18n-de.js +29 -0
- data/javascripts/right-ui-i18n-en-us.js +11 -0
- data/javascripts/right-ui-i18n-es.js +29 -0
- data/javascripts/right-ui-i18n-fr.js +29 -0
- data/javascripts/right-ui-i18n-jp.js +33 -0
- data/javascripts/right-ui-i18n-ru.js +29 -0
- data/javascripts/right-ui-i18n-uk.js +29 -0
- data/javascripts/right.js +10 -0
- data/lib/right-rails.rb +11 -0
- data/lib/right_rails/controller_extensions.rb +85 -0
- data/lib/right_rails/helpers/basic.rb +111 -0
- data/lib/right_rails/helpers/forms.rb +239 -0
- data/lib/right_rails/helpers/misc.rb +164 -0
- data/lib/right_rails/helpers/rails.rb +166 -0
- data/lib/right_rails/helpers.rb +5 -0
- data/lib/right_rails/java_script_generator.rb +313 -0
- data/lib/right_rails.rb +6 -0
- data/spec/lib/right_rails/controller_extensions_spec.rb +60 -0
- data/spec/lib/right_rails/helpers/basic_spec.rb +74 -0
- data/spec/lib/right_rails/helpers/forms_spec.rb +51 -0
- data/spec/lib/right_rails/helpers/misc_spec.rb +120 -0
- data/spec/lib/right_rails/helpers/rails_spec.rb +149 -0
- data/spec/lib/right_rails/java_script_generator_spec.rb +317 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +15 -0
- metadata +128 -0
@@ -0,0 +1,507 @@
|
|
1
|
+
/**
|
2
|
+
* Selectable unit for RightJS (http://rightjs.org/ui/selectable)
|
3
|
+
*
|
4
|
+
* Copyright (C) 2009 Nikolay V. Nemshilov aka St.
|
5
|
+
*/
|
6
|
+
if (!self.RightJS) throw "Gimme RightJS";
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Selectable unit main script
|
10
|
+
*
|
11
|
+
* Copyright (C) 2009 Nikolay V. Nemshilov aka St.
|
12
|
+
*/
|
13
|
+
var Selectable = new Class(Observer, {
|
14
|
+
extend: {
|
15
|
+
EVENTS: $w('change select unselect disable enable hover leave show hide'),
|
16
|
+
|
17
|
+
Options: {
|
18
|
+
options: null, // a hash of key-value pairs
|
19
|
+
selected: null, // an array of selected keys
|
20
|
+
disabled: null, // an array of disabled keys
|
21
|
+
|
22
|
+
multiple: true, // a flag if it shoulde a multiselect or a single select widget
|
23
|
+
|
24
|
+
fxName: 'slide', // the drop-down options list fx-name null, 'slide', 'fade'
|
25
|
+
fxDuration: 'short', // the drop-down options list fx-duration
|
26
|
+
|
27
|
+
update: null, // a field to be assigned to
|
28
|
+
parseIds: false, // if it should parse integer ids out of the keys
|
29
|
+
|
30
|
+
refresh: true // a flag if it should automatically refresh the items list
|
31
|
+
},
|
32
|
+
|
33
|
+
rescan: function() {
|
34
|
+
$$('*.right-selectable').each(function(element) {
|
35
|
+
if (!element._selectable) {
|
36
|
+
new Selectable(element);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
}
|
40
|
+
},
|
41
|
+
|
42
|
+
// css-classes
|
43
|
+
baseClass: 'right-selectable',
|
44
|
+
singleClass: 'right-selectable-single',
|
45
|
+
selectedClass: 'right-selectable-selected',
|
46
|
+
disabledClass: 'right-selectable-disabled',
|
47
|
+
containerClass: 'right-selectable-container',
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Basic constructor
|
51
|
+
*
|
52
|
+
* @param mixed reference to an element or the options hash
|
53
|
+
* @param Object options hash
|
54
|
+
*/
|
55
|
+
initialize: function() {
|
56
|
+
var args = $A(arguments);
|
57
|
+
|
58
|
+
if (args[0] && !isHash(args[0])) this.element = $(args[0]);
|
59
|
+
this.$super(isHash(args.last()) ? args.last() : this.element ?
|
60
|
+
eval('('+this.element.get('data-selectable-options')+')') : null);
|
61
|
+
if (!this.element) this.element = this.build();
|
62
|
+
|
63
|
+
this.element._selectable = this.init();
|
64
|
+
},
|
65
|
+
|
66
|
+
// standard descructor
|
67
|
+
destroy: function() {
|
68
|
+
this.items.each(function(item) {
|
69
|
+
item.stopObserving('click', this.onClick)
|
70
|
+
.stopObserving('mouseout', this.onMouseout)
|
71
|
+
.stopObserving('mouseover', this.onMouseover)
|
72
|
+
.stopObserving('mousedown', this.onMousedown)
|
73
|
+
.stopObserving('mouseup', this.onMouseup);
|
74
|
+
}, this);
|
75
|
+
|
76
|
+
delete(this.element._selectable);
|
77
|
+
},
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Sets the value
|
81
|
+
*
|
82
|
+
* @param Array of selectee keys
|
83
|
+
* @return Selectable this
|
84
|
+
*/
|
85
|
+
setValue: function(value) {
|
86
|
+
// parsing the value
|
87
|
+
if (isString(value)) value = value.split(',').map('trim').filter(function(s) { return !s.blank(); });
|
88
|
+
|
89
|
+
// resetting the selections
|
90
|
+
this.items.each('removeClass', this.selectedClass);
|
91
|
+
|
92
|
+
// selecting the value
|
93
|
+
var items = this.mapEnabled(value).each('addClass', this.selectedClass);
|
94
|
+
if (this.isSingle) this.showItem(items[0]);
|
95
|
+
|
96
|
+
return this.calcValue();
|
97
|
+
},
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Returns the list of selected items
|
101
|
+
*
|
102
|
+
* @return Array of selectees
|
103
|
+
*/
|
104
|
+
getValue: function() {
|
105
|
+
return this.value;
|
106
|
+
},
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Inserts the widget into the element at the given position
|
110
|
+
*
|
111
|
+
* @param mixed element reference
|
112
|
+
* @param String optional position
|
113
|
+
* @return Selectable this
|
114
|
+
*/
|
115
|
+
insertTo: function(element, position) {
|
116
|
+
this.element.insertTo(element, position);
|
117
|
+
if (this.isSingle) this.container.insertTo(this.element, 'before');
|
118
|
+
return this;
|
119
|
+
},
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Assigns the widget to work in pair with the input element
|
123
|
+
*
|
124
|
+
* @param mixed an element reference
|
125
|
+
* @return Selectable this
|
126
|
+
*/
|
127
|
+
assignTo: function(element) {
|
128
|
+
var assign = function(element, value) {
|
129
|
+
if (element = $(element)) {
|
130
|
+
if (value === undefined || value === null) value = '';
|
131
|
+
element[element.setValue ? 'setValue' : 'update'](''+value);
|
132
|
+
}
|
133
|
+
}.curry(element);
|
134
|
+
|
135
|
+
var connect = function(element, object) {
|
136
|
+
var element = $(element);
|
137
|
+
if (element && element.onChange) {
|
138
|
+
element.onChange(function() {
|
139
|
+
this.setValue(element.value);
|
140
|
+
}.bind(object));
|
141
|
+
}
|
142
|
+
}.curry(element);
|
143
|
+
|
144
|
+
if ($(element)) {
|
145
|
+
assign(this.value);
|
146
|
+
connect(this);
|
147
|
+
} else {
|
148
|
+
document.onReady(function() {
|
149
|
+
assign(this.value);
|
150
|
+
connect(this);
|
151
|
+
}.bind(this));
|
152
|
+
}
|
153
|
+
|
154
|
+
return this.onChange(assign);
|
155
|
+
},
|
156
|
+
|
157
|
+
/**
|
158
|
+
* disables the given key or keys
|
159
|
+
* NOTE: if no keys specified, then all the items will be disabled
|
160
|
+
*
|
161
|
+
* @param mixed optional key or keys to disable
|
162
|
+
* @return Selectable this
|
163
|
+
*/
|
164
|
+
disable: function(keys) {
|
165
|
+
this.mapOrAll(keys).each(function(item) {
|
166
|
+
this.fire('disable', item.addClass(this.disabledClass));
|
167
|
+
}, this);
|
168
|
+
return this;
|
169
|
+
},
|
170
|
+
|
171
|
+
/**
|
172
|
+
* disables the given key or keys
|
173
|
+
* NOTE: if no keys specified, then all the items will be enabled
|
174
|
+
*
|
175
|
+
* @param mixed optional key or keys to enable
|
176
|
+
* @return Selectable this
|
177
|
+
*/
|
178
|
+
enable: function(keys) {
|
179
|
+
this.mapOrAll(keys).each(function(item) {
|
180
|
+
this.fire('enable', item.removeClass(this.disabledClass));
|
181
|
+
}, this);
|
182
|
+
return this;
|
183
|
+
},
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Checks if the given key or keys are disabled
|
187
|
+
* NOTE: if no keys specified, then will check if all the items are disabled
|
188
|
+
*
|
189
|
+
* @param mixed optional key or keys to enable
|
190
|
+
* @return Selectable this
|
191
|
+
*/
|
192
|
+
disabled: function(keys) {
|
193
|
+
return this.mapOrAll(keys).every('hasClass', this.disabledClass);
|
194
|
+
},
|
195
|
+
|
196
|
+
/**
|
197
|
+
* selects item(s) that refers to the given key or keys
|
198
|
+
*
|
199
|
+
* @param mixed key or keys
|
200
|
+
* @return Selectable this
|
201
|
+
*/
|
202
|
+
select: function(keys) {
|
203
|
+
var items = this.mapEnabled(keys);
|
204
|
+
|
205
|
+
if (this.isSingle && items) {
|
206
|
+
this.items.each('removeClass', this.selectedClass);
|
207
|
+
items = [items[0]];
|
208
|
+
}
|
209
|
+
|
210
|
+
items.each(function(item) {
|
211
|
+
this.fire('select', item.addClass(this.selectedClass));
|
212
|
+
}, this);
|
213
|
+
|
214
|
+
return this;
|
215
|
+
},
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Unselects item(s) that refers to the given key or keys
|
219
|
+
*
|
220
|
+
* @param mixed key or keys
|
221
|
+
* @return Selectable this
|
222
|
+
*/
|
223
|
+
unselect: function(keys) {
|
224
|
+
this.mapEnabled(keys).each(function(item) {
|
225
|
+
this.fire('unselect', item.removeClass(this.selectedClass));
|
226
|
+
}, this);
|
227
|
+
return this;
|
228
|
+
},
|
229
|
+
|
230
|
+
/**
|
231
|
+
* Checks if item(s) are selected
|
232
|
+
*
|
233
|
+
* @param mixed key or keys
|
234
|
+
* @return Boolean check result
|
235
|
+
*/
|
236
|
+
selected: function(keys) {
|
237
|
+
return this.mapEnabled(keys).every('hasClass', this.selectedClass);
|
238
|
+
},
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Checks for new selectees in the element and updates the internal index
|
242
|
+
*
|
243
|
+
* @return Selectable this
|
244
|
+
*/
|
245
|
+
refresh: function() {
|
246
|
+
this.items = this.element.select('li').each(function(item) {
|
247
|
+
if (!this.items || !this.items.include(item)) {
|
248
|
+
item.on({
|
249
|
+
click: this.onClick,
|
250
|
+
mouseup: this.onMouseup,
|
251
|
+
mousedown: this.onMousedown,
|
252
|
+
mouseover: this.onMouseover,
|
253
|
+
mouseout: this.onMouseout
|
254
|
+
});
|
255
|
+
}
|
256
|
+
}, this);
|
257
|
+
|
258
|
+
return this;
|
259
|
+
},
|
260
|
+
|
261
|
+
// protected
|
262
|
+
|
263
|
+
// initis the widget
|
264
|
+
init: function() {
|
265
|
+
this.element.addClass(this.baseClass);
|
266
|
+
|
267
|
+
if (this.isSingle = !this.options.multiple || this.element.hasClass(this.singleClass)) {
|
268
|
+
this.buildSingle().element.addClass(this.singleClass);
|
269
|
+
}
|
270
|
+
|
271
|
+
// creating static callbacks so they could be detached
|
272
|
+
this.onMousedown = this.mousedown.bind(this);
|
273
|
+
this.onMouseup = this.mouseup.bind(this);
|
274
|
+
this.onMouseover = this.mouseover.bind(this);
|
275
|
+
this.onMouseout = this.mouseout.bind(this);
|
276
|
+
this.onClick = this.click.bind(this);
|
277
|
+
|
278
|
+
this.value = null;
|
279
|
+
this.refresh().onSelect('calcValue').onUnselect('calcValue');
|
280
|
+
|
281
|
+
if (this.isSingle) this.onSelect('showItem');
|
282
|
+
if (this.options.disabled) this.disable(this.options.disabled);
|
283
|
+
if (this.options.selected) this.select(this.options.selected);
|
284
|
+
if (this.options.update) this.assignTo(this.options.update);
|
285
|
+
if (this.isSingle) {
|
286
|
+
if (this.options.selected === null) this.select(this.items[0]);
|
287
|
+
this.onSelect('hideList'); // don't move it upper, it will force the hide effect
|
288
|
+
}
|
289
|
+
|
290
|
+
// auto-refresh feature
|
291
|
+
if (this.options.refresh) {
|
292
|
+
var old_insert = this.element.update;
|
293
|
+
this.element.update = function() {
|
294
|
+
var result = old_insert.apply(this.element, arguments);
|
295
|
+
this.refresh();
|
296
|
+
return result;
|
297
|
+
}.bind(this);
|
298
|
+
}
|
299
|
+
|
300
|
+
return this;
|
301
|
+
},
|
302
|
+
|
303
|
+
// calculates the value out of the selected items
|
304
|
+
calcValue: function() {
|
305
|
+
if (this.isSingle) {
|
306
|
+
var item = this.items.first('hasClass', this.selectedClass);
|
307
|
+
var value = item ? this.itemValue(item) : null;
|
308
|
+
} else {
|
309
|
+
var value = this.items.filter('hasClass', this.selectedClass).map(function(item) {
|
310
|
+
return this.itemValue(item);
|
311
|
+
}, this);
|
312
|
+
}
|
313
|
+
|
314
|
+
if (value != this.value) {
|
315
|
+
this.value = value;
|
316
|
+
this.fire('change', value, this);
|
317
|
+
}
|
318
|
+
|
319
|
+
return this;
|
320
|
+
},
|
321
|
+
|
322
|
+
// finds out the value for the item
|
323
|
+
itemValue: function(item) {
|
324
|
+
return item.id ? this.options.parseIds ? item.id.match(/\d+/) : item.id : this.items.indexOf(item);
|
325
|
+
},
|
326
|
+
|
327
|
+
// wrapping the events trigger to feed it with some more options
|
328
|
+
fire: function(name, item) {
|
329
|
+
if (item && item.tagName) {
|
330
|
+
this.$super(name, item, this.items.indexOf(item), this);
|
331
|
+
} else {
|
332
|
+
this.$super.apply(this, arguments);
|
333
|
+
}
|
334
|
+
return this;
|
335
|
+
},
|
336
|
+
|
337
|
+
// collects the item elements by the various key defs
|
338
|
+
map: function(keys) {
|
339
|
+
if (!isArray(keys)) keys = [keys];
|
340
|
+
|
341
|
+
return keys.map(function(key) {
|
342
|
+
var index = (isString(key) && /^\d+$/.test(key)) ? key.toInt() : key, item = key;
|
343
|
+
|
344
|
+
if (isNumber(index)) {
|
345
|
+
item = this.items[index];
|
346
|
+
} else if(isString(key)) {
|
347
|
+
item = this.items.first(function(i) { return i.id == key; });
|
348
|
+
}
|
349
|
+
|
350
|
+
return item;
|
351
|
+
}, this).compact();
|
352
|
+
},
|
353
|
+
|
354
|
+
// returns matching items or all of them if there's no key
|
355
|
+
mapOrAll: function(keys) {
|
356
|
+
return keys ? this.map(keys) : this.items;
|
357
|
+
},
|
358
|
+
|
359
|
+
// maps and filters only enabled items
|
360
|
+
mapEnabled: function(keys) {
|
361
|
+
return this.mapOrAll(keys).filter(function(item) {
|
362
|
+
return !item.hasClass(this.disabledClass);
|
363
|
+
}, this);
|
364
|
+
},
|
365
|
+
|
366
|
+
// onmousedown callback
|
367
|
+
mousedown: function(event) {
|
368
|
+
event.stop();
|
369
|
+
var item = event.target;
|
370
|
+
|
371
|
+
if (!this.disabled(item)) {
|
372
|
+
if (this.isSingle) { // single-selects are always select
|
373
|
+
this.select(item);
|
374
|
+
} else if (this.selected(item)) {
|
375
|
+
this.unselect(item);
|
376
|
+
this._massRemove = true; // mass-removing start
|
377
|
+
} else {
|
378
|
+
this.select(item);
|
379
|
+
this._massSelect = true; // mass-selection start
|
380
|
+
}
|
381
|
+
|
382
|
+
// mass-selection with a shift/meta key
|
383
|
+
if ((event.shiftKey || event.metaKey) && this._prevItem) {
|
384
|
+
var index1 = this.items.indexOf(this._prevItem);
|
385
|
+
var index2 = this.items.indexOf(item);
|
386
|
+
|
387
|
+
if (index1 != index2) {
|
388
|
+
if (index1 > index2) {
|
389
|
+
var t = index1;
|
390
|
+
index1 = index2;
|
391
|
+
index2 = index1;
|
392
|
+
}
|
393
|
+
|
394
|
+
for (var i=index1; i < index2; i++) {
|
395
|
+
this[this._prevItem.hasClass(this.selectedClass) ? 'select' : 'unselect'](this.items[i]);
|
396
|
+
}
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
this._prevItem = item;
|
401
|
+
}
|
402
|
+
},
|
403
|
+
|
404
|
+
// onmouseup callback
|
405
|
+
mouseup: function(event) {
|
406
|
+
event.stop();
|
407
|
+
this._massRemove = this._massSelect = false; // mass-selection stop
|
408
|
+
},
|
409
|
+
|
410
|
+
// mouseover callback
|
411
|
+
mouseover: function(event) {
|
412
|
+
var item = event.target;
|
413
|
+
this.fire('hover', item);
|
414
|
+
|
415
|
+
if (!this.isSingle) {
|
416
|
+
if (this._massSelect) {
|
417
|
+
this.select(item);
|
418
|
+
} else if (this._massRemove) {
|
419
|
+
this.unselect(item);
|
420
|
+
}
|
421
|
+
}
|
422
|
+
},
|
423
|
+
|
424
|
+
// mouseout callback
|
425
|
+
mouseout: function(event) {
|
426
|
+
this.fire('leave', event.target);
|
427
|
+
},
|
428
|
+
|
429
|
+
// mouseclick callback
|
430
|
+
click: function(event) {
|
431
|
+
event.stop();
|
432
|
+
},
|
433
|
+
|
434
|
+
// builds the widget programmatically
|
435
|
+
build: function() {
|
436
|
+
var element = $E('ul'), options = this.options.options;
|
437
|
+
|
438
|
+
if (isArray(options)) {
|
439
|
+
options.each(function(option) {
|
440
|
+
element.insert($E('li', {html: option}));
|
441
|
+
});
|
442
|
+
} else {
|
443
|
+
for (var key in options) {
|
444
|
+
element.insert($E('li', {id: key, html: options[key]}));
|
445
|
+
}
|
446
|
+
}
|
447
|
+
|
448
|
+
return element;
|
449
|
+
},
|
450
|
+
|
451
|
+
// builds a container for a single-select
|
452
|
+
buildSingle: function() {
|
453
|
+
this.container = $E('div', {'class': this.containerClass})
|
454
|
+
.insert([$E('div', {'html': '•', 'class': 'right-selectable-handle'}), $E('ul')])
|
455
|
+
.insertTo(this.element, 'before')
|
456
|
+
.onClick(this.showList.bind(this));
|
457
|
+
|
458
|
+
document.onClick(this.hideList.bind(this));
|
459
|
+
|
460
|
+
return this;
|
461
|
+
},
|
462
|
+
|
463
|
+
// shows list for the single-selects
|
464
|
+
showList: function(event) {
|
465
|
+
event.stop();
|
466
|
+
if (this.isSingle) {
|
467
|
+
var dims = this.container.dimensions();
|
468
|
+
|
469
|
+
this.element.setStyle({
|
470
|
+
top: (dims.top + dims.height) + 'px',
|
471
|
+
left: dims.left + 'px',
|
472
|
+
width: dims.width + 'px'
|
473
|
+
}).show(this.options.fxName, {
|
474
|
+
duration: this.options.fxDuration,
|
475
|
+
onFinish: this.fire.bind(this, 'show', this)
|
476
|
+
});
|
477
|
+
|
478
|
+
if (!this.options.fxName) this.fire('show', this);
|
479
|
+
}
|
480
|
+
},
|
481
|
+
|
482
|
+
// hides the list for the single-selects
|
483
|
+
hideList: function() {
|
484
|
+
if (this.isSingle && this.element.visible()) {
|
485
|
+
this.element.hide(this.options.fxName, {
|
486
|
+
duration: this.options.fxDuration,
|
487
|
+
onFinish: this.fire.bind(this, 'hide', this)
|
488
|
+
});
|
489
|
+
|
490
|
+
if (!this.options.fxName) this.fire('hide', this);
|
491
|
+
}
|
492
|
+
},
|
493
|
+
|
494
|
+
// shows the item in the main view of a single-selector
|
495
|
+
showItem: function(item) {
|
496
|
+
this.container.first('ul').update(item ? item.cloneNode(true) : '<li> </li>');
|
497
|
+
}
|
498
|
+
});
|
499
|
+
|
500
|
+
/**
|
501
|
+
* The document on-load hook for Selectable
|
502
|
+
*
|
503
|
+
* Copyright (C) 2009 Nikolay V. Nemshilov aka St.
|
504
|
+
*/
|
505
|
+
document.onReady(function() { Selectable.rescan(); });
|
506
|
+
|
507
|
+
document.write("<style type=\"text/css\">*.right-selectable,*.right-selectable li,*.right-selectable dt,*.right-selectable dd,*.right-selectable ul,div.right-selectable-container ul,div.right-selectable-container ul li{margin:0;padding:0;border:none;background:none;list-style:none}*.right-selectable{border:1px solid #CCC;border-bottom:none;display:inline-block;*display:inline;*zoom:1;min-width:10em;-moz-border-radius:.2em;-webkit-border-radius:.2em}*.right-selectable li{padding:.3em 1em;cursor:pointer;border-bottom:1px solid #CCC}*.right-selectable li:hover{background:#EEE}*.right-selectable li.right-selectable-selected{font-weight:bold;background:#DDD}*.right-selectable li.right-selectable-disabled,*.right-selectable li.right-selectable-disabled:hover{background:#CCC;color:#777;cursor:default}dl.right-selectable dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE;border-bottom:1px solid #CCC}dl.right-selectable dd li{padding-left:1.5em}*.right-selectable-single{-moz-box-shadow:#AAA .2em .2em .5em;-webkit-box-shadow:#AAA .2em .2em .5em;display:none;position:absolute;background:#FFF}div.right-selectable-container{border:1px solid #CCC;-moz-border-radius:.2em;-webkit-border-radius:.2em;display:inline-block;*display:inline;*zoom:1;*width:10em;vertical-align:middle;min-width:10em;cursor:pointer;height:1.6em}div.right-selectable-container div.right-selectable-handle{font-family:Arial;float:right;width:0.8em;background:#DDD;text-align:center;height:100%;line-height:0.8em;font-size:200%;color:#888;border-left:1px solid #CCC}div.right-selectable-container:hover div{color:#666}div.right-selectable-container ul{display:block;width:auto;margin-right:2em;overflow:hidden}div.right-selectable-container ul li{line-height:1.6em;padding:0 .5em}</style>");
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/**
|
2
|
+
* Selectable unit for RightJS (http://rightjs.org/ui/selectable)
|
3
|
+
*
|
4
|
+
* Copyright (C) 2009 Nikolay V. Nemshilov aka St.
|
5
|
+
*/
|
6
|
+
if (!self.RightJS) throw "Gimme RightJS";
|
7
|
+
eval((function(s,d){for(var i=d.length-1;i>-1;i--)if(d[i])s=s.replace(new RegExp(i,'g'),d[i]);return s})("22 69=157 163(Observer,{extend:{EVENTS:$w('131 28 un28 72 105 80 141 110 107'),Options:{16:40,26:40,25:40,119:91,65:'slide',70:'short',36:40,120:139,50:91},128:11(){$$('*.13-12').33(11(e){if(!e._12)157 69(e)})}},111:'13-12',57:'13-12-132',17:'13-12-26',25163:'13-12-25',18163:'13-12-18',147ialize:11(){22 a=$A(74);if(a[0]&&!134(a[0]))9.15=$(a[0]);9.104(134(a.150())?a.150():9.15?eval('('+9.15.get('data-12-16')+')'):40);if(!9.15)9.15=9.144();9.15._12=9.147()},destroy:11(){9.19.33(11(i){i.27('96',9.48).27('64',9.68).27('46',9.54).27('51',9.56).27('73',9.76)},9);delete(9.15._12)},63:11(v){if(89(v))v=v.split(',').112('trim').99(11(a){14!a.blank()});9.19.33('38',9.17);22 i=9.34(v).33('41',9.17);if(9.21)9.87(i[0]);14 9.49()},getValue:11(){14 9.43},61:11(e,p){9.15.61(e,p);if(9.21)9.18.61(9.15,'136');14 9},117:11(b){22 a=11(e,v){if(e=$(e)){if(v===undefined||v===40)v='';e[e.63?'63':'36'](''+v)}}.143(b);22 c=11(e,o){22 e=$(e);if(e&&e.84)e.84(11(){9.63(e.43)}.31(o))}.143(b);if($(b)){a(9.43);c(9)}53 62.123(11(){a(9.43);c(9)}.31(9));14 9.84(a)},72:11(k){9.39(k).33(11(i){9.32('72',i.41(9.25163))},9);14 9},105:11(k){9.39(k).33(11(i){9.32('105',i.38(9.25163))},9);14 9},25:11(k){14 9.39(k).140('30',9.25163)},28:11(k){22 a=9.34(k);if(9.21&&a){9.19.33('38',9.17);a=[a[0]]}a.33(11(i){9.32('28',i.41(9.17))},9);14 9},un28:11(k){9.34(k).33(11(i){9.32('un28',i.38(9.17))},9);14 9},26:11(k){14 9.34(k).140('30',9.17)},50:11(){9.19=9.15.28('li').33(11(i){if(!9.19||!9.19.include(i))i.on({96:9.48,73:9.76,51:9.56,46:9.54,64:9.68})},9);14 9},147:11(){9.15.41(9.111);if(9.21=!9.16.119||9.15.30(9.57))9.95().15.41(9.57);9.56=9.51.31(9);9.76=9.73.31(9);9.54=9.46.31(9);9.68=9.64.31(9);9.48=9.96.31(9);9.43=40;9.50().86('49').onUn28('49');if(9.21)9.86('87');if(9.16.25)9.72(9.16.25);if(9.16.26)9.28(9.16.26);if(9.16.36)9.117(9.16.36);if(9.21){if(9.16.26===40)9.28(9.19[0]);9.86('85')}if(9.16.50){22 o=9.15.36;9.15.36=11(){22 r=o.138(9.15,74);9.50();14 r}.31(9)}14 9},49:11(){if(9.21){22 a=9.19.121('30',9.17);22 v=a?9.79(a):40}53 22 v=9.19.99('30',9.17).112(11(i){14 9.79(i)},9);if(v!=9.43){9.43=v;9.32('131',v,9)}14 9},79:11(i){14 i.id?9.16.120?i.id.match(/\\d+/):i.id:9.19.71(i)},32:11(n,i){if(i&&i.tagName)9.104(n,i,9.19.71(i),9);53 9.104.138(9,74);14 9},112:11(c){if(!125(c))c=[c];14 c.112(11(k){22 i=(89(k)&&/^\\d+$/.test(k))?k.toInt():k,b=k;if(isNumber(i))b=9.19[i];53 if(89(k))b=9.19.121(11(a){14 a.id==k});14 b},9).compact()},39:11(k){14 k?9.112(k):9.19},34:11(k){14 9.39(k).99(11(i){14!i.30(9.25163)},9)},51:11(e){e.108();22 c=e.98;if(!9.25(c)){if(9.21)9.28(c);53 if(9.26(c)){9.un28(c);9.58=91}53{9.28(c);9.55=91}if((e.shift165||e.meta165)&&9.52){22 a=9.19.71(9.52);22 b=9.19.71(c);if(a!=b){if(a>b){22 t=a;a=b;b=a}156(22 i=a;i<b;i++)9[9.52.30(9.17)?'28':'un28'](9.19[i])}}9.52=c}},73:11(e){e.108();9.58=9.55=139},46:11(e){22 i=e.98;9.32('80',i);if(!9.21){if(9.55)9.28(i);53 if(9.58)9.un28(i)}},64:11(e){9.32('141',e.98)},96:11(e){e.108()},144:11(){22 e=$E('ul'),a=9.16.16;if(125(a))a.33(11(o){e.101($E('li',{127:o}))});53 156(22 k in a)e.101($E('li',{id:k,127:a[k]}));14 e},95:11(){9.18=$E('42',{'145':9.18163}).101([$E('42',{'127':'•','145':'13-12-129'}),$E('ul')]).61(9.15,'136').48(9.110164.31(9));62.48(9.85.31(9));14 9},110164:11(e){e.108();if(9.21){22 d=9.18.dimensions();9.15.setStyle({158:(d.158+d.67)+'px',113:d.113+'px',45:d.45+'px'}).110(9.16.65,{114:9.16.70,116:9.32.31(9,'110',9)});if(!9.16.65)9.32('110',9)}},85:11(){if(9.21&&9.15.visible()){9.15.107(9.16.65,{114:9.16.70,116:9.32.31(9,'107',9)});if(!9.16.65)9.32('107',9)}},87:11(i){9.18.121('ul').36(i?i.cloneNode(91):'<li> </li>')}});62.123(11(){69.128()});62.write(\"<97 type=\\\"151/css\\\">*.13-12,*.13-12 li,*.13-12 dt,*.13-12 dd,*.13-12 ul,42.13-12-18 ul,42.13-12-18 ul li{130:0;47:0;23:92;24:92;list-97:92}*.13-12{23:106 75 #93;23-102:92;37:83-118;*37:83;*146:1;160-45:126;-137-23-81:.59;-103-23-81:.59}*.13-12 li{47:.153 1em;82:122;23-102:106 75 #93}*.13-12 li:80{24:#155}*.13-12 li.13-12-26{90-135:149;24:#161}*.13-12 li.13-12-25,*.13-12 li.13-12-25:80{24:#93;94:#777;82:124}dl.13-12 dt{47:.153 .109;82:124;90-135:149;90-97:italic;94:#444;24:#155;23-102:106 75 #93}dl.13-12 dd li{47-113:1.109}*.13-12-132{-137-154-133:#159 .59 .59 .109;-103-154-133:#159 .59 .59 .109;37:92;position:absolute;24:#FFF}42.13-12-18{23:106 75 #93;-137-23-81:.59;-103-23-81:.59;37:83-118;*37:83;*146:1;*45:126;vertical-142:middle;160-45:126;82:122;67:1.152}42.13-12-18 42.13-12-129{90-family:Arial;float:13;45:0.162;24:#161;151-142:center;67:100%;148-67:0.162;90-size:200%;94:#888;23-113:106 75 #93}42.13-12-18:80 42{94:#666}42.13-12-18 ul{37:118;45:auto;130-13:59;overflow:hidden}42.13-12-18 ul li{148-67:1.152;47:0 .109}</97>\");",",,,,,,,,,this,,function,selectable,right,return,element,options,selectedClass,container,items,,isSingle,var,border,background,disabled,selected,stopObserving,select,disabledClass,hasClass,bind,fire,each,mapEnabled,unselect,update,display,removeClass,mapOrAll,null,addClass,div,value,,width,mouseover,padding,onClick,calcValue,refresh,mousedown,_prevItem,else,onMouseover,_massSelect,onMousedown,singleClass,_massRemove,2em,_selectable,insertTo,document,setValue,mouseout,fxName,,height,onMouseout,Selectable,fxDuration,indexOf,disable,mouseup,arguments,solid,onMouseup,,containerClass,itemValue,hover,radius,cursor,inline,onChange,hideList,onSelect,showItem,,isString,font,true,none,CCC,color,buildSingle,click,style,target,filter,,insert,bottom,webkit,$super,enable,1px,hide,stop,5em,show,baseClass,map,left,duration,showList,onFinish,assignTo,block,multiple,parseIds,first,pointer,onReady,default,isArray,10em,html,rescan,handle,margin,change,single,shadow,isHash,weight,before,moz,apply,false,every,leave,align,curry,build,class,zoom,init,line,bold,last,text,6em,3em,box,EEE,for,new,top,AAA,min,DDD,8em,Class,List,Key".split(",")));
|