right-rails 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.rdoc +1 -1
  3. data/Rakefile +1 -1
  4. data/init.rb +1 -0
  5. data/lib/generators/right_rails/right_rails_generator.rb +15 -6
  6. data/lib/right_rails.rb +1 -1
  7. data/lib/right_rails/controller_extensions.rb +28 -15
  8. data/lib/right_rails/helpers/misc.rb +38 -38
  9. data/lib/right_rails/helpers/rails.rb +50 -7
  10. data/lib/rjs_renderer.rb +26 -0
  11. data/spec/lib/right_rails/controller_extensions_spec.rb +25 -14
  12. data/spec/lib/right_rails/helpers/forms_spec.rb +6 -6
  13. data/spec/lib/right_rails/helpers/rails_spec.rb +44 -45
  14. data/vendor/assets/images/rightjs-ui/rte.png +0 -0
  15. data/vendor/assets/javascripts/right-safe-src.js +2 -2
  16. data/vendor/assets/javascripts/right-safe.js +2 -2
  17. data/vendor/assets/javascripts/right-src.js +386 -100
  18. data/vendor/assets/javascripts/right.js +2 -2
  19. data/vendor/assets/javascripts/right/calendar-src.js +19 -3
  20. data/vendor/assets/javascripts/right/calendar.js +2 -2
  21. data/vendor/assets/javascripts/right/colorpicker-src.js +59 -20
  22. data/vendor/assets/javascripts/right/colorpicker.js +2 -2
  23. data/vendor/assets/javascripts/right/i18n/de.js +43 -42
  24. data/vendor/assets/javascripts/right/i18n/es.js +1 -0
  25. data/vendor/assets/javascripts/right/i18n/fi.js +1 -0
  26. data/vendor/assets/javascripts/right/i18n/fr.js +1 -0
  27. data/vendor/assets/javascripts/right/i18n/hu.js +1 -0
  28. data/vendor/assets/javascripts/right/i18n/it.js +1 -0
  29. data/vendor/assets/javascripts/right/i18n/jp.js +1 -0
  30. data/vendor/assets/javascripts/right/i18n/lt.js +96 -0
  31. data/vendor/assets/javascripts/right/i18n/nl.js +1 -0
  32. data/vendor/assets/javascripts/right/i18n/pt-br.js +1 -0
  33. data/vendor/assets/javascripts/right/i18n/ru.js +1 -0
  34. data/vendor/assets/javascripts/right/i18n/ua.js +1 -0
  35. data/vendor/assets/javascripts/right/jquerysh-src.js +4 -4
  36. data/vendor/assets/javascripts/right/jquerysh.js +2 -2
  37. data/vendor/assets/javascripts/right/rails-src.js +51 -15
  38. data/vendor/assets/javascripts/right/rails.js +2 -2
  39. data/vendor/assets/javascripts/right/resizable-src.js +11 -11
  40. data/vendor/assets/javascripts/right/rte-src.js +33 -13
  41. data/vendor/assets/javascripts/right/rte.js +2 -2
  42. data/vendor/assets/javascripts/right/slider-src.js +137 -28
  43. data/vendor/assets/javascripts/right/slider.js +2 -2
  44. metadata +24 -126
  45. data/generators/right_rails/right_rails_generator.rb +0 -46
  46. data/generators/right_rails/templates/iframed.html.erb +0 -10
  47. data/generators/right_scaffold/right_scaffold_generator.rb +0 -53
  48. data/generators/right_scaffold/templates/controller.rb +0 -99
  49. data/generators/right_scaffold/templates/helper.rb +0 -2
  50. data/generators/right_scaffold/templates/layout.html.erb +0 -18
  51. data/generators/right_scaffold/templates/style.css +0 -54
  52. data/generators/right_scaffold/templates/view__form.html.erb +0 -16
  53. data/generators/right_scaffold/templates/view__item.html.erb +0 -13
  54. data/generators/right_scaffold/templates/view_edit.html.erb +0 -6
  55. data/generators/right_scaffold/templates/view_index.html.erb +0 -9
  56. data/generators/right_scaffold/templates/view_new.html.erb +0 -5
  57. data/generators/right_scaffold/templates/view_show.html.erb +0 -10
  58. data/lib/generators/right_rails/templates/iframed.html.erb +0 -10
  59. data/public/images/rightjs-ui/colorpicker.png +0 -0
  60. data/public/images/rightjs-ui/resizable.png +0 -0
  61. data/public/images/rightjs-ui/rte.png +0 -0
  62. data/public/javascripts/right-olds-src.js +0 -652
  63. data/public/javascripts/right-olds.js +0 -9
  64. data/public/javascripts/right-safe-src.js +0 -68
  65. data/public/javascripts/right-safe.js +0 -7
  66. data/public/javascripts/right-src.js +0 -6014
  67. data/public/javascripts/right.js +0 -7
  68. data/public/javascripts/right/autocompleter-src.js +0 -625
  69. data/public/javascripts/right/autocompleter.js +0 -7
  70. data/public/javascripts/right/billboard-src.js +0 -564
  71. data/public/javascripts/right/billboard.js +0 -7
  72. data/public/javascripts/right/calendar-src.js +0 -1464
  73. data/public/javascripts/right/calendar.js +0 -7
  74. data/public/javascripts/right/casting-src.js +0 -183
  75. data/public/javascripts/right/casting.js +0 -7
  76. data/public/javascripts/right/colorpicker-src.js +0 -981
  77. data/public/javascripts/right/colorpicker.js +0 -7
  78. data/public/javascripts/right/dialog-src.js +0 -768
  79. data/public/javascripts/right/dialog.js +0 -7
  80. data/public/javascripts/right/dnd-src.js +0 -591
  81. data/public/javascripts/right/dnd.js +0 -7
  82. data/public/javascripts/right/effects-src.js +0 -508
  83. data/public/javascripts/right/effects.js +0 -7
  84. data/public/javascripts/right/i18n/de.js +0 -95
  85. data/public/javascripts/right/i18n/en-us.js +0 -11
  86. data/public/javascripts/right/i18n/es.js +0 -95
  87. data/public/javascripts/right/i18n/fi.js +0 -96
  88. data/public/javascripts/right/i18n/fr.js +0 -95
  89. data/public/javascripts/right/i18n/hu.js +0 -100
  90. data/public/javascripts/right/i18n/it.js +0 -95
  91. data/public/javascripts/right/i18n/jp.js +0 -99
  92. data/public/javascripts/right/i18n/nl.js +0 -95
  93. data/public/javascripts/right/i18n/pt-br.js +0 -95
  94. data/public/javascripts/right/i18n/ru.js +0 -95
  95. data/public/javascripts/right/i18n/ua.js +0 -99
  96. data/public/javascripts/right/in-edit-src.js +0 -373
  97. data/public/javascripts/right/in-edit.js +0 -7
  98. data/public/javascripts/right/jquerysh-src.js +0 -362
  99. data/public/javascripts/right/jquerysh.js +0 -7
  100. data/public/javascripts/right/json-src.js +0 -147
  101. data/public/javascripts/right/json.js +0 -7
  102. data/public/javascripts/right/keys-src.js +0 -87
  103. data/public/javascripts/right/keys.js +0 -7
  104. data/public/javascripts/right/lightbox-src.js +0 -931
  105. data/public/javascripts/right/lightbox.js +0 -7
  106. data/public/javascripts/right/rails-src.js +0 -402
  107. data/public/javascripts/right/rails.js +0 -7
  108. data/public/javascripts/right/rater-src.js +0 -384
  109. data/public/javascripts/right/rater.js +0 -7
  110. data/public/javascripts/right/resizable-src.js +0 -465
  111. data/public/javascripts/right/resizable.js +0 -7
  112. data/public/javascripts/right/rte-src.js +0 -2685
  113. data/public/javascripts/right/rte.js +0 -7
  114. data/public/javascripts/right/selectable-src.js +0 -725
  115. data/public/javascripts/right/selectable.js +0 -7
  116. data/public/javascripts/right/sizzle-src.js +0 -1132
  117. data/public/javascripts/right/sizzle.js +0 -7
  118. data/public/javascripts/right/slider-src.js +0 -395
  119. data/public/javascripts/right/slider.js +0 -7
  120. data/public/javascripts/right/sortable-src.js +0 -430
  121. data/public/javascripts/right/sortable.js +0 -7
  122. data/public/javascripts/right/table-src.js +0 -176
  123. data/public/javascripts/right/table.js +0 -7
  124. data/public/javascripts/right/tabs-src.js +0 -1157
  125. data/public/javascripts/right/tabs.js +0 -7
  126. data/public/javascripts/right/tags-src.js +0 -745
  127. data/public/javascripts/right/tags.js +0 -7
  128. data/public/javascripts/right/tooltips-src.js +0 -331
  129. data/public/javascripts/right/tooltips.js +0 -7
  130. data/public/javascripts/right/uploader-src.js +0 -302
  131. data/public/javascripts/right/uploader.js +0 -7
@@ -1,7 +0,0 @@
1
- /**
2
- * RightJS-UI Rater v2.2.0
3
- * http://rightjs.org/ui/rater
4
- *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
6
- */
7
- var Rater=RightJS.Rater=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d={assignTo:function(b){var c=e(function(a,b){(a=f(a))&&a[a.setValue?"setValue":"update"](b.target.getValue())}).curry(b),d=e(function(a,b){a=f(a),a&&a.onChange&&a.onChange(e(function(){this.setValue(a.value())}).bind(b))}).curry(b);f(b)?(c({target:this}),d(this)):f(a).onReady(e(function(){c({target:this}),d(this)}.bind(this)));return this.onChange(c)}},e=b,f=b.$,g=b.$w,h=b.Xhr,i=b.isString,j=b.isNumber,k=new c({include:d,extend:{version:"2.2.0",EVENTS:g("change hover send"),Options:{html:"&#9733;",size:5,value:null,update:null,disabled:!1,disableOnVote:!1,url:null,param:"rate",Xhr:null}},initialize:function(a){this.$super("rater",a).on({click:this._clicked,mouseover:this._hovered,mouseout:this._left});if(this.empty())for(var b=0;b<this.options.size;b++)this.insert("<div>"+this.options.html+"</div>");a=this.options,a.value===null&&(a.value=this.find(".active").length),this.setValue(a.value),a.disabled&&this.disable(),a.update&&this.assignTo(a.update)},setValue:function(a){this.disabled()||(a=i(a)?e(a).toInt():a,a=j(a)?e(a).round():0,a=e(a).max(this.options.size),a=e(a).min(0),this.highlight(a),this.value!=a&&this.fire("change",{value:this.value=a}));return this},getValue:function(){return this.value},send:function(){this.options.url&&(this.request=(new h(this.options.url,this.options.Xhr)).send(this.options.param+"="+this.value),this.fire("send",{value:this.value}));return this},disable:function(){return this.addClass("rui-rater-disabled")},enable:function(){return this.removeClass("rui-rater-disabled")},disabled:function(){return this.hasClass("rui-rater-disabled")},_hovered:function(a){var b=this.children().indexOf(a.target);!this.disabled()&&b>-1&&(this.highlight(b+1),this.fire("hover",{value:b+1}))},_clicked:function(a){var b=this.children().indexOf(a.target);!this.disabled()&&b>-1&&(this.setValue(b+1),this.options.disableOnVote&&this.disable(),this.send())},_left:function(){this.setValue(this.value)},highlight:function(a){this.children().each(function(b,c){b[a-1<c?"removeClass":"addClass"]("active")})}});f(a).onMouseover(function(a){var b=a.target,c=a.find(".rui-rater");c&&(c instanceof k||(c=new k(c),b.parent()===c&&b.fire("mouseover")))});var l=a.createElement("style"),m=a.createTextNode("div.rui-rater,div.rui-rater div{margin:0;padding:0;background:none;border:none;display:inline-block; *display:inline; *zoom:1;font-family:Arial;font-size:110%}div.rui-rater{width:6em;height:1em;vertical-align:middle}div.rui-rater div{float:left;width:1em;height:1em;line-height:1em;text-align:center;cursor:pointer;color:#888}div.rui-rater div.active{color:brown;text-shadow:#666 .05em .05em .15em}div.rui-rater-disabled div{cursor:default}");l.type="text/css",a.getElementsByTagName("head")[0].appendChild(l),l.styleSheet?l.styleSheet.cssText=m.nodeValue:l.appendChild(m);return k}(document,RightJS)
@@ -1,465 +0,0 @@
1
- /**
2
- * RightJS-UI Resizable v2.2.3
3
- * http://rightjs.org/ui/resizable
4
- *
5
- * Copyright (C) 2010-2011 Nikolay Nemshilov
6
- */
7
- var Resizable = RightJS.Resizable = (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
- * The filenames to include
109
- *
110
- * Copyright (C) 2010-2011 Nikolay Nemshilov
111
- */
112
- var R = RightJS,
113
- $ = RightJS.$,
114
- $w = RightJS.$w,
115
- $E = RightJS.$E,
116
- Class = RightJS.Class,
117
- Element = RightJS.Element;
118
-
119
-
120
-
121
-
122
- /**
123
- * The resizable unit main file
124
- *
125
- * Copyright (C) 2010-2011 Nikolay Nemshilov
126
- */
127
- var Resizable = new Widget({
128
- extend: {
129
- version: '2.2.3',
130
-
131
- EVENTS: $w('resize start release'),
132
-
133
- Options: {
134
- direction: null, // 'top', 'left', 'right', 'bottom', null for bidrectional
135
-
136
- minWidth: null,
137
- maxWidth: null,
138
- minHeight: null,
139
- maxHeight: null
140
- }
141
- },
142
-
143
- /**
144
- * Basic constructor
145
- *
146
- * @param Element reference
147
- * @param Object options
148
- * @return void
149
- */
150
- initialize: function(element, options) {
151
- this
152
- .$super('resizable', this.old_inst = $(element))
153
- .setOptions(options);
154
-
155
- if (this.options.direction) {
156
- this.addClass('rui-resizable-'+ this.options.direction);
157
- } else {
158
- this.addClass('rui-resizable');
159
- }
160
-
161
- // initializing the inner structure
162
- this.content = this.first('.rui-resizable-content') ||
163
- $E('div', {'class': 'rui-resizable-content'}).insert(this.children()).insertTo(this);
164
- this.handle = this.first('.rui-resizable-handle') ||
165
- $E('div', {'class': 'rui-resizable-handle'}).insertTo(this);
166
-
167
- // resizing the content block so it fully fit the resizable element
168
- this.content.setWidth(this.size().x -
169
- parseInt(this.getStyle('borderLeftWidth'), 10) -
170
- parseInt(this.getStyle('borderRightWidth'), 10)
171
- );
172
- if (this.options.direction !== 'left' && this.options.direction !== 'right') {
173
- this.content.setHeight(this.size().y -
174
- parseInt(this.getStyle('borderTopWidth'), 10) -
175
- parseInt(this.getStyle('borderBottomWidth'), 10)
176
- );
177
- }
178
- },
179
-
180
- /**
181
- * destructor
182
- *
183
- * @return Resizable this
184
- */
185
- destroy: function() {
186
- this
187
- .removeClass('rui-resizable')
188
- .removeClass('rui-resizable-top')
189
- .removeClass('rui-resizable-left')
190
- .removeClass('rui-resizable-right')
191
- .removeClass('rui-resizable-bottom')
192
- .insert(this.content._.childNodes);
193
-
194
- this.content.remove();
195
- this.handle.remove();
196
-
197
- // swapping the old element back
198
- if (this.old_inst) {
199
- Wrapper.Cache[$uid(this._)] = this.old_inst;
200
- }
201
-
202
- return this;
203
- },
204
-
205
- /**
206
- * Overriding the method to recognize the direction
207
- * option from the element class-name
208
- *
209
- * @param Object options
210
- * @return Resizable this
211
- */
212
- setOptions: function(options, context) {
213
- options = options || {};
214
-
215
- // trying to recognize the direction
216
- $w('top left right bottom').each(function(direction) {
217
- if (this.hasClass('rui-resizable-'+ direction)) {
218
- options.direction = direction;
219
- }
220
- }, this);
221
-
222
- return this.$super(options, context);
223
- },
224
-
225
- /**
226
- * Starts the resizing process
227
- *
228
- * @param Event mouse event
229
- */
230
- start: function(event) {
231
- this.prevSizes = this.size();
232
- this.prevEvPos = event.position();
233
-
234
- // used later during the resize process
235
- this.contXDiff = this.size().x - this.content.size().x;
236
- this.contYDiff = this.size().y - this.content.size().y;
237
-
238
- // trying to recognize the boundaries
239
- $w('minWidth maxWidth minHeight maxHeight').each(function(dimension) {
240
- this[dimension] = this.findDim(dimension);
241
- }, this);
242
-
243
- return this.fire('start', {original: event});
244
- },
245
-
246
- /**
247
- * Tracks the event during the resize process
248
- *
249
- * @param Event mouse event
250
- */
251
- track: function(event) {
252
- var event_pos = event.position(), prev_pos = this.prevEvPos,
253
- handle = this.handle.dimensions(),
254
- prev_size = this.prevSizes, width = prev_size.x, height = prev_size.y,
255
- x_diff = prev_pos.x - event_pos.x,
256
- y_diff = prev_pos.y - event_pos.y,
257
- min_x = this.minWidth,
258
- max_x = this.maxWidth,
259
- min_y = this.minHeight,
260
- max_y = this.maxHeight,
261
- options = this.options,
262
- direction = options.direction;
263
-
264
- // calculating the new size
265
- width += (direction === 'left' ? 1 : -1) * x_diff;
266
- height += (direction === 'top' ? 1 : -1) * y_diff;
267
-
268
- // applying the boundaries
269
- if (width < min_x) { width = min_x; }
270
- if (width > max_x) { width = max_x; }
271
- if (height < min_y) { height = min_y; }
272
- if (height > max_y) { height = max_y; }
273
-
274
- // applying the sizes
275
- if (prev_size.x !== width && direction !== 'top' && direction !== 'bottom') {
276
- this.setWidth(width);
277
- }
278
- if (prev_size.y !== height && direction !== 'left' && direction !== 'right') {
279
- this.setHeight(height);
280
- }
281
-
282
- // adjusting the previous cursor position so that it didn't had a shift
283
- if (width == min_x || width == max_x) {
284
- event_pos.x = handle.left + handle.width / 2;
285
- }
286
- if (height == min_y || height == max_y) {
287
- event_pos.y = handle.top + handle.height / 2;
288
- }
289
-
290
- this.prevEvPos = event_pos;
291
- this.prevSizes = this.size();
292
-
293
- this.fire('resize', {original: event});
294
- },
295
-
296
- /**
297
- * Sets the width of the widget
298
- *
299
- * @param Number width
300
- * @return Resizable this
301
- */
302
- setWidth: function(width) {
303
- this.content.setWidth(width - this.contXDiff);
304
- return this.$super(width);
305
- },
306
-
307
- /**
308
- * Sets the height of the widget
309
- *
310
- * @param Number height
311
- * @return Resizable this
312
- */
313
- setHeight: function(height) {
314
- this.content.setHeight(height - this.contYDiff);
315
- return this.$super(height);
316
- },
317
-
318
- /**
319
- * Marks it the end of the action
320
- *
321
- * @return Resizable this
322
- */
323
- release: function(event) {
324
- return this.fire('release', {original: event});
325
- },
326
-
327
- // protected
328
-
329
- // finds dimensions of the element
330
- findDim: function(dimension) {
331
- var style = this.options[dimension] || this.getStyle(dimension);
332
-
333
- if (style && /\d+/.test(style) && parseFloat(style) > 0) {
334
- var what = R(dimension).include('Width') ? 'width' : 'height',
335
- dummy = (this._dummy || (this._dummy = $E('div', {
336
- style: 'visibility:hidden;z-index:-1'
337
- })))
338
- .setStyle(what, style)
339
- .insertTo(this, 'before');
340
-
341
- var size = dummy._['offset' + R(what).capitalize()];
342
- dummy.remove();
343
-
344
- return size;
345
- }
346
- }
347
- });
348
-
349
-
350
- /**
351
- * Document level hooks for resizables
352
- *
353
- * Copyright (C) 2010 Nikolay Nemshilov
354
- */
355
- $(document).on({
356
- mousedown: function(event) {
357
- var handle = event.find('.rui-resizable-handle');
358
- if (handle) {
359
- var resizable = handle.parent();
360
-
361
- if (!(resizable instanceof Resizable)) {
362
- resizable = new Resizable(resizable);
363
- }
364
-
365
- Resizable.current = resizable.start(event.stop());
366
- }
367
- },
368
-
369
- mousemove: function(event) {
370
- var resizable = Resizable.current;
371
- if (resizable) {
372
- resizable.track(event);
373
- }
374
- },
375
-
376
- mouseup: function(event) {
377
- var resizable = Resizable.current;
378
-
379
- if (resizable) {
380
- resizable.release(event);
381
- Resizable.current = null;
382
- }
383
- }
384
- });
385
-
386
- $(window).onBlur(function(event) {
387
- var resizable = Resizable.current;
388
- if (resizable) {
389
- resizable.release(event);
390
- Resizable.current = null;
391
- }
392
- });
393
-
394
-
395
- /**
396
- * Element level hook to make things resizable
397
- *
398
- * Copyright (C) 2010 Nikolay Nemshilov
399
- */
400
- Element.include({
401
- /**
402
- * Makes a resizeable out of the element
403
- *
404
- * @param Object options
405
- * @return Element this
406
- */
407
- makeResizable: function(options) {
408
- return new Resizable(this, options);
409
- },
410
-
411
- /**
412
- * Destroys a resizable functionality
413
- *
414
- * @return Element this
415
- */
416
- undoResizable: function() {
417
- if (this instanceof Resizable) {
418
- this.destroy();
419
- }
420
- return this;
421
- }
422
- });
423
-
424
-
425
- /**
426
- * The drag-n-drop module patch so it was possible
427
- * to use dnd and resizable at the same time
428
- *
429
- * NOTE: to make it work, the DND module should be
430
- * included _before_ the resizable widget!
431
- *
432
- * Copyright (C) 2011 Nikolay Nemshilov
433
- */
434
- if ('Draggable' in RightJS) {
435
- RightJS.Draggable.include({
436
- /**
437
- * Overloading the method so that it didn't trigger
438
- * the drag process if the click is happened on
439
- * a resizable unit handle
440
- *
441
- * @return void
442
- */
443
- dragStart: function(event) {
444
- if (!event.target.hasClass('rui-resizable-handle')) {
445
- this.$super(event);
446
- }
447
- }
448
- });
449
- }
450
-
451
- var embed_style = document.createElement('style'),
452
- embed_rules = document.createTextNode(".rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom,.rui-resizable-content .rui-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.rui-resizable-content{overflow:auto;padding:.5em;position:relative}.rui-resizable-handle{position:absolute;background-image:url(/images/rightjs-ui/resizable.png);background-repeat:no-repeat;background-color:#DDD;cursor:move}.rui-resizable .rui-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.rui-resizable-top .rui-resizable-handle,.rui-resizable-bottom .rui-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.rui-resizable-left .rui-resizable-handle,.rui-resizable-right .rui-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.rui-resizable-top .rui-resizable-content{padding-top:1em}.rui-resizable-top .rui-resizable-handle{top:0}.rui-resizable-bottom .rui-resizable-content{padding-bottom:1em}.rui-resizable-bottom .rui-resizable-handle{bottom:0}.rui-resizable-left .rui-resizable-content{padding-left:1em}.rui-resizable-left .rui-resizable-handle{left:0}.rui-resizable-right .rui-resizable-content{padding-right:1em}.rui-resizable-right .rui-resizable-handle{right:0}");
453
-
454
- embed_style.type = 'text/css';
455
- document.getElementsByTagName('head')[0].appendChild(embed_style);
456
-
457
- if(embed_style.styleSheet) {
458
- embed_style.styleSheet.cssText = embed_rules.nodeValue;
459
- } else {
460
- embed_style.appendChild(embed_rules);
461
- }
462
-
463
-
464
- return Resizable;
465
- })(document, RightJS);