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 Tags v2.2.1
3
- * http://rightjs.org/ui/tags
4
- *
5
- * Copyright (C) 2011 Nikolay Nemshilov
6
- */
7
- var Tags=RightJS.Tags=function(a){function b(b,c){c||(c=b,b="DIV");var d=new a.Class(a.Element.Wrappers[b]||a.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof a.Input||this instanceof a.Form||e.unshift(b),this.$super.apply(this,e),a.isString(d)&&(d=a.$(d)),d instanceof a.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return a.Wrapper.Cache[a.$uid(this._)]=this},setOptions:function(b,c){c&&(b=a.Object.merge(b,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),b&&a.Options.setOptions.call(this,a.Object.merge(this.options,b));return this}}),e=new a.Class(d,c);a.Observer.createShortcuts(e.prototype,e.EVENTS||a([]));return e}var c=a,d=a.$,e=a.$w,f=a.Class,g=a.Input,h=a.Element,i=new b("INPUT",{extend:{version:"2.2.1",EVENTS:e("add remove"),Options:{tags:[],vertical:!1,allowNew:!0,nocase:!0,autocomplete:!0,separator:",",cssRule:"input[data-tags]"},rescan:function(a){d(a||document).find(i.Options.cssRule).each(function(a){a instanceof i||(a=new i(a))})}},initialize:function(b,e){var f=c(c(""+d(b).get("data-tags")).trim());f.startsWith("[")&&f.endsWith("]")&&(e||(e={}),e.tags=(new Function("return "+f))()),this.$super("tags",b).setOptions(e),a.Browser.OLD&&this.setStyle({color:this.getStyle("backgroundColor")}),this.container=(new h("div",{"class":"rui-tags"})).insertTo(this,"after"),this.list=new i.List(this),this.input=new i.Input(this),this.completer=new i.Completer(this),this.onFocus(function(){this.input.focus()}),this.setValue(this._.value)},setValue:function(a){isString(a)&&(a=c(a.split(this.options.separator)).map("trim").reject("blank")),this.options.tags=c(this.options.tags).merge(a),this.list.setTags(a);return this.$super(a.join(this.options.separator+" "))}});i.List=new f(h,{initialize:function(a){function b(b){return a.getStyle(b).replace(/[\d\.]+/,function(a){return parseFloat(a)*2})}this.main=a,this.$super("ul",{"class":"list"}),this.insertTo(a.container),this.main.options.vertical&&this.addClass("vertical"),this.setStyle({fontSize:a.getStyle("fontSize"),fontFamily:a.getStyle("fontFamily"),fontWeight:a.getStyle("fontWeight"),letterSpacing:a.getStyle("letterSpacing"),paddingTop:b("borderTopWidth"),paddingLeft:b("borderLeftWidth"),paddingRight:b("borderRightWidth"),paddingBottom:a.getStyle("borderBottomWidth")}),a.getStyle("fontSize")==="0em"&&this.setStyle({fontSize:"1em"}),this.setWidth(a.size().x),this.reposition(!0),this.onClick(this._click)},setTags:function(a){a.uniq().each(this.clean().addTag,this);return this},getTags:function(){return this.find("div.text").map("text")},addTag:function(a){this._allowed(a)&&(this.append('<li><div class="text">'+c(a).trim()+'</div><div class="close">&times;</div></li>').reposition(),this.main.fire("add",{tag:a})),this.main._.value=this.getTags().join(this.main.options.separator+" ");return this},removeLast:function(){var a=this.find("li").last();a&&this._remove(a);return this},reposition:function(a){var b=this.size().y,c=this.main.size().y,d;if(b!==c||a===!0)this.main.setHeight(b),d=this._.style,d.top="0px",d.left="0px",b=this.position(),c=this.main.position(),d.top=c.y-b.y+"px",d.left=c.x-b.x+"px";return this},_click:function(a){a.target.hasClass("close")?this._remove(a.target.parent()):this.main.input.focus()},_allowed:function(a){var b=this.getTags(),c=this.main.options,d=!c.nocase;return!(d?b.include(a):b.map("toLowerCase").include(a.toLowerCase()))&&(c.allowNew||(d?b.include(a):c.tags.map("toLowerCase").include(a.toLowerCase())))},_remove:function(a){var b=a.first("div.text").text();this.main.setValue(this.getTags().without(b)),this.main.fire("remove",{tag:b})}}),i.Input=new f(g,{initialize:function(a){this.main=a,this.list=a.list,this.$super({type:"text",size:1}),this.onKeydown(this._keydown),this.onKeyup(this._keyup),this.onBlur(this._blur),this.insertTo(a.list),this.meter=(new h("div",{"class":"meter",style:{whiteSpace:"nowrap",position:"absolute",left:"-99999em"}})).insertTo(this,"after")},focus:function(){this.main.list.append(this,this.meter).reposition();return this.$super()},reset:function(){this.remove(),this.meter.remove(),this.list.reposition(),this._.value="";return this},_keydown:function(a){a.keyCode===8&&this._.value===""?(this.list.removeLast(),this.focus()):a.keyCode===13&&a.preventDefault()},_keyup:function(a){c([9,27,37,38,39,40,13]).include(a.keyCode)||(this._.value.indexOf(this.main.options.separator)!==-1?(this._add(),this.focus()):(this._resize(),this.main.completer.suggest(this._.value)))},_blur:function(a){this.main.completer.hidden()&&this._.value!==""&&(this._add(),this.reset())},_resize:function(){this.meter.html(this._.value+"xx"),this._.style.width=this.meter.size().x+"px",this.list.reposition()},_add:function(){var a=this._.value.replace(this.main.options.separator,"");this._.value="",/^\s*$/.test(a)||this.list.addTag(a),this.main.completer.visible()&&this.main.completer.hide()}}),i.Completer=new f(h,{extend:{current:null},initialize:function(a){this.main=a,this.list=a.list,this.input=a.input,this.$super("ul",{"class":"completer"}),this.addClass("rui-dd-menu"),this.insertTo(a.container),this.onClick(this._click)},suggest:function(a){if(!/^\s*$/.test(a)&&this.main.options.autocomplete){var b=this._filter(this.main.options.tags,a);if(b.length!==0){this.html(b.map(function(b){return"<li>"+b.replace(a,"<b>"+a+"</b>")+"</li>"}).join("")),this.picked=!1;return this.show()}}return this.hide()},show:function(){var a=this.input.dimensions(),b=this._.style,c;b.display="block",b.top="0px",b.left="0px",c=this.position(),b.left=a.left-c.x+"px",b.top=a.top-c.y+a.height+"px";return i.Completer.current=this},hide:function(){this._.innerHTML="",this._.style.display="none",i.Completer.current=null;return this},next:function(){var a=this.first(".current");a&&(a=a.next()),a||(a=this.first()),a&&a.radioClass("current");return this},prev:function(){var a=this.first(".current");a&&(a=a.prev()),a||(a=this.children().last()),a&&a.radioClass("current");return this},done:function(){var a=this.first(".current");a&&(this.list.addTag(a.text()),this.input.reset().focus());return this.hide()},_click:function(a){var b=a.find("li");b&&b.radioClass("current"),this.done()},_filter:function(a,b){var c=this.list.getTags(),d=this.main.options.nocase;d&&(c=c.map("toLowerCase"),b=b.toLowerCase());return a.filter(function(a){var e=d?a.toLowerCase():a;return e.indexOf(b)!==-1&&!c.include(e)})}}),d(document).on({ready:function(){i.rescan()},keydown:function(a){var b=i.Completer.current,c={13:"done",27:"hide",38:"prev",40:"next"};b!==null&&a.keyCode in c&&(a.stop(),b[c[a.keyCode]]())},click:function(a){i.Completer.current&&i.Completer.current.hide()}});var j=document.createElement("style"),k=document.createTextNode("*.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em}div.rui-tags,div.rui-tags ul.list,div.rui-tags ul.list *{position:static;top:auto;left:auto;right:auto;bottom:auto;float:none;margin:0;padding:0;border:none;background:none;display:block}input[data-tags],input.rui-tags{color:transparent;color:rgba(0,0,0,0)}div.rui-tags{position:absolute;display:inline}div.rui-tags ul.list{position:absolute;overflow:hidden;min-height:1.3em}div.rui-tags ul.list li{display:inline-block; *display:inline; *zoom:1;position:relative;cursor:default;margin-right:.1em;margin-bottom:.1em;padding:0 .5em;padding-right:1.1em;background:#ddd;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;vertical-align:top}div.rui-tags ul.list li div.text{position:inline}div.rui-tags ul.list li div.close{margin-left:.25em;cursor:pointer;font-family:Arial;font-weight:normal;opacity:0.5;position:absolute;right:.25em;top:0.04em}div.rui-tags ul.list li div.close:hover{opacity:1}div.rui-tags ul.vertical li{display:block}div.rui-tags ul.list input{width:auto;height:auto;display:inline-block; *display:inline; *zoom:1;width:1em;outline:none;vertical-align:top;font-family:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit}");j.type="text/css",document.getElementsByTagName("head")[0].appendChild(j),j.styleSheet?j.styleSheet.cssText=k.nodeValue:j.appendChild(k);return i}(RightJS)
@@ -1,331 +0,0 @@
1
- /**
2
- * RightJS-UI Tooltips v2.2.1
3
- * http://rightjs.org/ui/tooltips
4
- *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
6
- */
7
- var Tooltip = RightJS.Tooltip = (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 tooltips initialization script
109
- *
110
- * Copyright (C) 2010 Nikolay Nemshilov
111
- */
112
- var R = RightJS,
113
- $ = RightJS.$,
114
- $w = RightJS.$w,
115
- $uid = RightJS.$uid,
116
- Element = RightJS.Element;
117
-
118
-
119
-
120
-
121
- /**
122
- * The native tooltips feature for RithJS
123
- *
124
- * Copyright (C) 2009-2011 Nikolay Nemshilov
125
- */
126
- var Tooltip = new Widget({
127
- extend: {
128
- version: '2.2.1',
129
-
130
- EVENTS: $w('show hide'),
131
-
132
- Options: {
133
- cssRule: '[data-tooltip]', // a css-marker of an element with a tooltip
134
-
135
- fxName: 'fade', // the appearance effect name
136
- fxDuration: 400, // the appearance effect duration
137
- delay: 400, // the appearance delay
138
-
139
- move: true, // if it should be moved with the mouse
140
-
141
- idSuffix: '-tooltip' // ID prefix for tooltips with ID
142
- },
143
-
144
- current: null, // the currently active tooltip reference
145
- instances: R([]), // keeps the list of instances
146
-
147
- // tries to find a tip closest to the event
148
- find: function(event) {
149
- var element = event.target;
150
-
151
- if (element.match(Tooltip.Options.cssRule)) {
152
- var uid = $uid(element);
153
- return (Tooltip.instances[uid] || (Tooltip.instances[uid] = new Tooltip(element)));
154
- }
155
- }
156
- },
157
-
158
- /**
159
- * Constructor
160
- *
161
- * @param Element associated element
162
- * @param Object options
163
- */
164
- initialize: function(element, options) {
165
- this.associate = element = $(element);
166
-
167
- this
168
- .$super('tooltip')
169
- .setOptions(options, element)
170
- .insert('<div class="rui-tooltip-arrow"></div>'+
171
- '<div class="rui-tooltip-container">'+
172
- (element.get('title') || element.get('alt'))+
173
- '</div>'
174
- )
175
- .on({
176
- mouseout: this._mouseOut,
177
- mouseover: this._cancelTimer
178
- })
179
- .insertTo(document.body);
180
-
181
- // adding the ID if needed
182
- if (element.has('id')) {
183
- this.set('id', element.get('id') + this.options.idSuffix);
184
- }
185
-
186
- // removing the titles from the elment
187
- element.set({ title: '', alt: ''});
188
- },
189
-
190
- /**
191
- * Hides the tooltip
192
- *
193
- * @return Tooltip this
194
- */
195
- hide: function() {
196
- this._cancelTimer();
197
-
198
- this._timer = R(function() {
199
- Element.prototype.hide.call(this, this.options.fxName, {
200
- engine: 'javascript', // Webkit too slow in here
201
- duration: this.options.fxDuration
202
- });
203
- Tooltip.current = null;
204
- this.fire('hide');
205
- }).bind(this).delay(100);
206
-
207
- return this;
208
- },
209
-
210
- /**
211
- * Shows the tooltip with a dealy
212
- *
213
- * @param Boolean if true will show tooltip immediately
214
- * @return Tooltip this
215
- */
216
- show: function(immediately) {
217
- // hidding all the others
218
- Tooltip.instances.each(function(tip) {
219
- if (tip && tip !== this) { tip.hide(); }
220
- }, this);
221
-
222
- // show the tooltip with a delay
223
- this._timer = R(function() {
224
- Element.prototype.show.call(this.stop(),
225
- this.options.fxName, {
226
- engine: 'javascript', // webkit it too slow on that
227
- duration: this.options.fxDuration
228
- }
229
- );
230
-
231
- Tooltip.current = this.fire('show');
232
- }).bind(this).delay(this.options.delay);
233
-
234
- return (Tooltip.current = this);
235
- },
236
-
237
- /**
238
- * Moves it to where the event happened
239
- *
240
- * @return Tooltip this
241
- */
242
- moveToEvent: function(event) {
243
- if (this.options.move) {
244
- this._.style.left = event.pageX + 'px';
245
- this._.style.top = event.pageY + 'px';
246
- }
247
-
248
- return this;
249
- },
250
-
251
- // protected
252
-
253
- // cancels a show timeout
254
- _cancelTimer: function() {
255
- if (this._timer) {
256
- this._timer.cancel();
257
- this._timer = null;
258
- }
259
- return false;
260
- },
261
-
262
- _mouseOut: function(event) {
263
- event.stop();
264
- if (event.relatedTarget !== this.associate) {
265
- this.hide();
266
- }
267
- }
268
- });
269
-
270
-
271
- /**
272
- * The post load tooltips initialization script
273
- *
274
- * Copyright (C) 2009-2011 Nikolay Nemshilov
275
- */
276
- $(document).on({
277
- /**
278
- * Watches all the mouse-over events and reacts if one of the targets
279
- * matches a tooltip
280
- *
281
- * @param Event event
282
- */
283
- mouseenter: function(event) {
284
- var tip = Tooltip.find(event);
285
- if (tip) {
286
- tip.show().moveToEvent(event);
287
- }
288
- },
289
-
290
- /**
291
- * Catches the mouseout events and hides tooltips when needed
292
- *
293
- * @param Event event
294
- */
295
- mouseleave: function(event) {
296
- var tip = Tooltip.find(event);
297
-
298
- if (tip) {
299
- tip.hide();
300
- }
301
- },
302
-
303
- /**
304
- * Moves tooltips when active
305
- *
306
- * @param Event event
307
- */
308
- mousemove: function(event) {
309
- var tip = Tooltip.current;
310
- if (tip !== null && tip.options.move) {
311
- tip.moveToEvent(event);
312
- }
313
- }
314
- });
315
-
316
-
317
- var embed_style = document.createElement('style'),
318
- embed_rules = document.createTextNode("div.rui-tooltip{display:none;position:absolute;z-index:99999;font-size:90%;margin-top:16pt;margin-left:5pt;color:#FFF;text-shadow:0 0 .2em #000;border:.3em solid rgba(255,255,255,0.2);background-color:rgba(25,25,25,0.92);background-color:#000 \\9;border:.3em solid #444 \\9;background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(transparent) ,to(#000) );border-radius:.4em;-moz-border-radius:.4em;-webkit-border-radius:.4em;box-shadow:0 0 .4em #555;-moz-box-shadow:0 0 .4em #555;-webkit-box-shadow:0 0 .4em #555}div.rui-tooltip-container{margin:.4em .6em}");
319
-
320
- embed_style.type = 'text/css';
321
- document.getElementsByTagName('head')[0].appendChild(embed_style);
322
-
323
- if(embed_style.styleSheet) {
324
- embed_style.styleSheet.cssText = embed_rules.nodeValue;
325
- } else {
326
- embed_style.appendChild(embed_rules);
327
- }
328
-
329
-
330
- return Tooltip;
331
- })(document, RightJS);
@@ -1,7 +0,0 @@
1
- /**
2
- * RightJS-UI Tooltips v2.2.1
3
- * http://rightjs.org/ui/tooltips
4
- *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
6
- */
7
- var Tooltip=RightJS.Tooltip=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=b,e=b.$,f=b.$w,g=b.$uid,h=b.Element,i=new c({extend:{version:"2.2.1",EVENTS:f("show hide"),Options:{cssRule:"[data-tooltip]",fxName:"fade",fxDuration:400,delay:400,move:!0,idSuffix:"-tooltip"},current:null,instances:d([]),find:function(a){var b=a.target;if(b.match(i.Options.cssRule)){var c=g(b);return i.instances[c]||(i.instances[c]=new i(b))}}},initialize:function(b,c){this.associate=b=e(b),this.$super("tooltip").setOptions(c,b).insert('<div class="rui-tooltip-arrow"></div><div class="rui-tooltip-container">'+(b.get("title")||b.get("alt"))+"</div>").on({mouseout:this._mouseOut,mouseover:this._cancelTimer}).insertTo(a.body),b.has("id")&&this.set("id",b.get("id")+this.options.idSuffix),b.set({title:"",alt:""})},hide:function(){this._cancelTimer(),this._timer=d(function(){h.prototype.hide.call(this,this.options.fxName,{engine:"javascript",duration:this.options.fxDuration}),i.current=null,this.fire("hide")}).bind(this).delay(100);return this},show:function(a){i.instances.each(function(a){a&&a!==this&&a.hide()},this),this._timer=d(function(){h.prototype.show.call(this.stop(),this.options.fxName,{engine:"javascript",duration:this.options.fxDuration}),i.current=this.fire("show")}).bind(this).delay(this.options.delay);return i.current=this},moveToEvent:function(a){this.options.move&&(this._.style.left=a.pageX+"px",this._.style.top=a.pageY+"px");return this},_cancelTimer:function(){this._timer&&(this._timer.cancel(),this._timer=null);return!1},_mouseOut:function(a){a.stop(),a.relatedTarget!==this.associate&&this.hide()}});e(a).on({mouseenter:function(a){var b=i.find(a);b&&b.show().moveToEvent(a)},mouseleave:function(a){var b=i.find(a);b&&b.hide()},mousemove:function(a){var b=i.current;b!==null&&b.options.move&&b.moveToEvent(a)}});var j=a.createElement("style"),k=a.createTextNode("div.rui-tooltip{display:none;position:absolute;z-index:99999;font-size:90%;margin-top:16pt;margin-left:5pt;color:#FFF;text-shadow:0 0 .2em #000;border:.3em solid rgba(255,255,255,0.2);background-color:rgba(25,25,25,0.92);background-color:#000 \\9;border:.3em solid #444 \\9;background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(transparent) ,to(#000) );border-radius:.4em;-moz-border-radius:.4em;-webkit-border-radius:.4em;box-shadow:0 0 .4em #555;-moz-box-shadow:0 0 .4em #555;-webkit-box-shadow:0 0 .4em #555}div.rui-tooltip-container{margin:.4em .6em}");j.type="text/css",a.getElementsByTagName("head")[0].appendChild(j),j.styleSheet?j.styleSheet.cssText=k.nodeValue:j.appendChild(k);return i}(document,RightJS)
@@ -1,302 +0,0 @@
1
- /**
2
- * RightJS-UI Uploader v2.2.1
3
- * http://rightjs.org/ui/uploader
4
- *
5
- * Copyright (C) 2010-2011 Nikolay Nemshilov
6
- */
7
- var Uploader = RightJS.Uploader = (function(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 uploader initialization script
109
- *
110
- * Copyright (C) 2010 Nikolay Nemshilov
111
- */
112
- var R = RightJS,
113
- $ = RightJS.$,
114
- $w = RightJS.$w,
115
- $E = RightJS.$E,
116
- Xhr = RightJS.Xhr,
117
- Form = RightJS.Form,
118
- RegExp = RightJS.RegExp;
119
-
120
-
121
-
122
-
123
-
124
-
125
- /**
126
- * The uploading progress feature
127
- *
128
- * Copyright (C) 2010-2011 Nikolay Nemshilov
129
- */
130
- var Uploader = new Widget({
131
- extend: {
132
- version: '2.2.1',
133
-
134
- EVENTS: $w('start update finish error'),
135
-
136
- Options: {
137
- url: '/progress',
138
- param: 'X-Progress-ID',
139
-
140
- timeout: 1000,
141
- round: 0,
142
- fxDuration: 400,
143
-
144
- cssRule: '[data-uploader]'
145
- }
146
- },
147
-
148
- /**
149
- * Basic constructor
150
- *
151
- * @param mixed a form reference
152
- * @param Object options
153
- */
154
- initialize: function(form, options) {
155
- this.form = form = $(form);
156
-
157
- // trying to find an existing progress-bar
158
- var element = form.first('.rui-uploader');
159
-
160
- this
161
- .$super('uploader', element)
162
- .setOptions(options, this.form)
163
- .addClass('rui-progress-bar')
164
- .insert([
165
- this.bar = this.first('.bar') || $E('div', {'class': 'bar'}),
166
- this.num = this.first('.num') || $E('div', {'class': 'num'})
167
- ]);
168
-
169
- if (!element) {
170
- this.insertTo(form);
171
- }
172
- },
173
-
174
- /**
175
- * Starts the uploading monitoring
176
- *
177
- * @return Uploader this
178
- */
179
- start: function() {
180
- var data = {state: 'starting'};
181
- return this.paint(data).prepare().request().fire('start', {data: data});
182
- },
183
-
184
- // protected
185
-
186
- // updates uploading bar progress
187
- update: function(data) {
188
- this.paint(data).fire('update', {data: data});
189
-
190
- switch (data.state) {
191
- case 'starting':
192
- case 'uploading':
193
- R(this.request).bind(this).delay(this.options.timeout);
194
- break;
195
- case 'done':
196
- this.fire('finish', {data: data});
197
- break;
198
- case 'error':
199
- this.fire('error', {data: data});
200
- break;
201
- }
202
-
203
- return this;
204
- },
205
-
206
- // changes the actual element styles
207
- paint: function(data) {
208
- var percent = (this.percent || 0)/100;
209
-
210
- switch (data.state) {
211
- case 'starting': percent = 0; break;
212
- case 'done': percent = 1; break;
213
- case 'uploading': percent = data.received / (data.size||1); break;
214
- }
215
-
216
- this.percent = R(percent * 100).round(this.options.round);
217
-
218
- if (this.percent === 0 || !RightJS.Fx || !this.options.fxDuration) {
219
- this.bar._.style.width = this.percent + '%';
220
- this.num._.innerHTML = this.percent + '%';
221
- } else {
222
- this.bar.morph({width: this.percent + '%'}, {duration: this.options.fxDuration});
223
- R(function() {
224
- this.num._.innerHTML = this.percent + '%';
225
- }).bind(this).delay(this.options.fxDuration / 2);
226
- }
227
-
228
- // marking the failed uploads
229
- this[data.state === 'error' ? 'addClass' : 'removeClass']('rui-progress-bar-failed');
230
-
231
- return this;
232
- },
233
-
234
- // sends a request to the server
235
- request: function() {
236
- Xhr.load(this.options.url + "?" + this.options.param + "=" + this.uid, {
237
- evalJS: false,
238
- evalJSON: false,
239
- onSuccess: R(function(xhr) {
240
- this.update(new Function('return '+xhr.text)());
241
- }).bind(this)
242
- });
243
-
244
- return this;
245
- },
246
-
247
- // prepares the form to carry the x-progress-id param
248
- prepare: function() {
249
- this.uid = "";
250
- for (i = 0; i < 32; i++) { this.uid += Math.random(0, 15).toString(16); }
251
-
252
- var param = this.options.param;
253
- var url = this.form.get('action').replace(new RegExp('(\\?|&)'+RegExp.escape(param) + '=[^&]*', 'i'), '');
254
- this.form.set('action', url + (R(url).includes('?') ? '&' : '?') + param + '=' + this.uid);
255
-
256
- this.show();
257
-
258
- return this;
259
- }
260
-
261
- });
262
-
263
-
264
- /**
265
- * Overloading the Form#send method so we could
266
- * catch up the moment when a form was sent and show the bar
267
- *
268
- * Copyright (C) 2010 Nikolay Nemshilov
269
- */
270
- var old_send = Form.prototype.send;
271
-
272
- Form.include({
273
- send: function() {
274
-
275
- if (!this.uploader && (this.match(Uploader.Options.cssRule) || this.first('.rui-uploader'))) {
276
- this.uploader = new Uploader(this);
277
- }
278
-
279
- if (this.uploader) {
280
- this.uploader.start();
281
- }
282
-
283
- return old_send.apply(this, arguments);
284
- }
285
- });
286
-
287
-
288
- var embed_style = document.createElement('style'),
289
- embed_rules = document.createTextNode("div.rui-progress-bar,div.rui-progress-bar *{margin:0;padding:0;border:none;background:none}div.rui-progress-bar{position:relative;height:1.4em;line-height:1.4em;width:20em;border:1px solid #999}div.rui-progress-bar,div.rui-progress-bar div.bar{border-radius:0.25em;-moz-border-radius:0.25em;-webkit-border-radius:0.25em}div.rui-progress-bar div.bar{position:absolute;left:0;top:0;width:0%;height:100%;background:#CCC;z-index:1}div.rui-progress-bar div.num{position:absolute;width:100%;height:100%;z-index:2;text-align:center}div.rui-progress-bar-failed{border-color:red;color:red;background:pink}.rui-uploader{display:none}");
290
-
291
- embed_style.type = 'text/css';
292
- document.getElementsByTagName('head')[0].appendChild(embed_style);
293
-
294
- if(embed_style.styleSheet) {
295
- embed_style.styleSheet.cssText = embed_rules.nodeValue;
296
- } else {
297
- embed_style.appendChild(embed_rules);
298
- }
299
-
300
-
301
- return Uploader;
302
- })(RightJS);