rich_cms 2.0.7 → 2.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.
Files changed (89) hide show
  1. data/CHANGELOG +10 -1
  2. data/README.textile +58 -16
  3. data/Rakefile +3 -3
  4. data/VERSION +1 -1
  5. data/{lib/app → app}/controllers/rich/cms_controller.rb +7 -7
  6. data/{lib/app → app}/views/rich/cms/_dock.html.erb +1 -1
  7. data/{lib/app → app}/views/rich/cms/dock/_menu.html.erb +1 -1
  8. data/{lib/app → app}/views/rich/cms/dock/_panel.html.erb +1 -1
  9. data/app/views/rich/cms/dock/panel/_edit.html.erb +1 -0
  10. data/app/views/rich/cms/dock/panel/_login.html.erb +1 -0
  11. data/app/views/rich/cms/dock/panel/edit/_rails3.html.erb +10 -0
  12. data/{lib/app/views/rich/cms/dock/panel/_login.html.erb → app/views/rich/cms/dock/panel/login/_rails2.html.erb} +4 -4
  13. data/app/views/rich/cms/dock/panel/login/_rails3.html.erb +15 -0
  14. data/{lib/app → app}/views/rich_cms.html.erb +1 -1
  15. data/{lib/assets → assets}/jzip/jquery/cleditor.js +14 -14
  16. data/assets/jzip/jquery/extensions/ajaxify.js +26 -0
  17. data/{lib/assets → assets}/jzip/jquery/raccoon_tip.js +22 -22
  18. data/assets/jzip/jquery/ui/components/draggable.js +797 -0
  19. data/assets/jzip/jquery/ui/components/mouse.js +151 -0
  20. data/assets/jzip/jquery/ui/components/widget.js +237 -0
  21. data/{lib/assets → assets}/jzip/rich/cms/dock.js +5 -5
  22. data/{lib/assets → assets}/jzip/rich/cms/editor.js +21 -21
  23. data/{lib/assets → assets}/jzip/rich/cms/menu.js +3 -3
  24. data/{lib/assets → assets}/jzip/rich/cms.js +1 -1
  25. data/{lib/assets → assets}/sass/rich_cms/_dock.sass +2 -2
  26. data/{lib/assets → assets}/sass/rich_cms/_menu.sass +2 -2
  27. data/{lib/assets → assets}/sass/rich_cms/_panel.sass +2 -2
  28. data/{lib/assets → assets}/sass/tools/_mixins.sass +5 -5
  29. data/config/routes.rb +36 -0
  30. data/lib/generators/rich/authlogic_user/authlogic_user_generator.rb +63 -0
  31. data/lib/generators/rich/authlogic_user/templates/migration.rb +25 -0
  32. data/lib/generators/rich/authlogic_user/templates/model.rb +12 -0
  33. data/lib/generators/rich/authlogic_user/templates/session.rb +7 -0
  34. data/lib/generators/rich/cms_content/cms_content_generator.rb +59 -0
  35. data/lib/generators/rich/cms_content/templates/migration.rb +15 -0
  36. data/lib/generators/rich.rb +25 -0
  37. data/lib/rich/cms/actionpack/action_controller/base.rb +8 -8
  38. data/lib/rich/cms/actionpack/action_view/base.rb +14 -14
  39. data/lib/rich/cms/activesupport/active_support/dependencies.rb +12 -0
  40. data/lib/rich/cms/activesupport.rb +1 -0
  41. data/lib/rich/cms/content/group.rb +13 -13
  42. data/lib/rich/cms/content/item.rb +17 -17
  43. data/lib/rich/cms/core/string/html_safe.rb +18 -0
  44. data/lib/rich/cms/core/string.rb +6 -0
  45. data/lib/rich/cms/core.rb +1 -0
  46. data/lib/rich/cms/engine.rb +85 -74
  47. data/lib/rich/cms/rails/engine.rb +5 -0
  48. data/lib/rich/cms/rails.rb +1 -0
  49. data/lib/rich_cms.rb +8 -6
  50. data/rails_generators/rich_authlogic_user/rich_authlogic_user_generator.rb +4 -4
  51. data/rails_generators/rich_authlogic_user/templates/migration.rb +1 -1
  52. data/rails_generators/rich_authlogic_user/templates/model.rb +1 -1
  53. data/rails_generators/rich_authlogic_user/templates/session.rb +4 -0
  54. data/rails_generators/rich_cms_content/rich_cms_content_generator.rb +3 -3
  55. data/rails_generators/rich_cms_content/templates/migration.rb +1 -1
  56. data/rich_cms.gemspec +69 -60
  57. data/test/test_helper.rb +4 -1
  58. metadata +73 -62
  59. data/lib/app/controllers/rich/._cms_controller.rb +0 -0
  60. data/lib/app/views/._rich_cms.html.erb +0 -0
  61. data/lib/app/views/rich/cms/dock/.__menu.html.erb +0 -0
  62. data/lib/app/views/rich/cms/dock/.__panel.html.erb +0 -0
  63. data/lib/app/views/rich/cms/dock/panel/.__login.html.erb +0 -0
  64. data/lib/assets/jzip/jquery/extensions/ajaxify.js +0 -26
  65. data/lib/assets/jzip/jquery/ui/components/draggable.js +0 -797
  66. data/lib/assets/jzip/jquery/ui/components/mouse.js +0 -151
  67. data/lib/assets/jzip/jquery/ui/components/widget.js +0 -237
  68. data/lib/config/routes.rb +0 -19
  69. data/lib/rich/cms/actionpack/action_controller/._base.rb +0 -0
  70. data/lib/rich/cms/actionpack/action_view/._base.rb +0 -0
  71. data/test/engine_test.rb +0 -15
  72. /data/{lib/app/views/rich/cms/dock/panel/_edit.html.erb → app/views/rich/cms/dock/panel/edit/_rails2.html.erb} +0 -0
  73. /data/{lib/assets → assets}/images/cleditor/buttons.gif +0 -0
  74. /data/{lib/assets → assets}/images/cleditor/toolbar.gif +0 -0
  75. /data/{lib/assets → assets}/jzip/jquery/core.jz +0 -0
  76. /data/{lib/assets → assets}/jzip/jquery/extensions/browser_detect.js +0 -0
  77. /data/{lib/assets → assets}/jzip/jquery/extensions/modules.js +0 -0
  78. /data/{lib/assets → assets}/jzip/jquery/extensions/object.js +0 -0
  79. /data/{lib/assets → assets}/jzip/jquery/ui/components/core.js +0 -0
  80. /data/{lib/assets → assets}/jzip/jquery/ui/rich_cms/core.jz +0 -0
  81. /data/{lib/assets → assets}/jzip/jquery/ui/rich_cms/draggable.jz +0 -0
  82. /data/{lib/assets → assets}/jzip/jquery/ui/rich_cms/mouse.jz +0 -0
  83. /data/{lib/assets → assets}/jzip/jquery/ui/rich_cms/widget.jz +0 -0
  84. /data/{lib/assets → assets}/jzip/rich.js +0 -0
  85. /data/{lib/assets → assets}/jzip/rich_cms.jz +0 -0
  86. /data/{lib/assets → assets}/sass/rich_cms/_content.sass +0 -0
  87. /data/{lib/assets → assets}/sass/rich_cms/_reset.sass +0 -0
  88. /data/{lib/assets → assets}/sass/rich_cms.sass +0 -0
  89. /data/{lib/assets → assets}/sass/tools/_css3.sass +0 -0
@@ -0,0 +1,151 @@
1
+ /*!
2
+ * jQuery UI Mouse 1.8.4
3
+ *
4
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Mouse
9
+ *
10
+ * Depends:
11
+ * jquery.ui.widget.js
12
+ */
13
+ (function( $, undefined ) {
14
+
15
+ $.widget("ui.mouse", {
16
+ options: {
17
+ cancel: ':input,option',
18
+ distance: 1,
19
+ delay: 0
20
+ },
21
+ _mouseInit: function() {
22
+ var self = this;
23
+
24
+ this.element
25
+ .bind('mousedown.'+this.widgetName, function(event) {
26
+ return self._mouseDown(event);
27
+ })
28
+ .bind('click.'+this.widgetName, function(event) {
29
+ if(self._preventClickEvent) {
30
+ self._preventClickEvent = false;
31
+ event.stopImmediatePropagation();
32
+ return false;
33
+ }
34
+ });
35
+
36
+ this.started = false;
37
+ },
38
+
39
+ // TODO: make sure destroying one instance of mouse doesn't mess with
40
+ // other instances of mouse
41
+ _mouseDestroy: function() {
42
+ this.element.unbind('.'+this.widgetName);
43
+ },
44
+
45
+ _mouseDown: function(event) {
46
+ // don't let more than one widget handle mouseStart
47
+ // TODO: figure out why we have to use originalEvent
48
+ event.originalEvent = event.originalEvent || {};
49
+ if (event.originalEvent.mouseHandled) { return; }
50
+
51
+ // we may have missed mouseup (out of window)
52
+ (this._mouseStarted && this._mouseUp(event));
53
+
54
+ this._mouseDownEvent = event;
55
+
56
+ var self = this,
57
+ btnIsLeft = (event.which == 1),
58
+ elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
59
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
60
+ return true;
61
+ }
62
+
63
+ this.mouseDelayMet = !this.options.delay;
64
+ if (!this.mouseDelayMet) {
65
+ this._mouseDelayTimer = setTimeout(function() {
66
+ self.mouseDelayMet = true;
67
+ }, this.options.delay);
68
+ }
69
+
70
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
71
+ this._mouseStarted = (this._mouseStart(event) !== false);
72
+ if (!this._mouseStarted) {
73
+ event.preventDefault();
74
+ return true;
75
+ }
76
+ }
77
+
78
+ // these delegates are required to keep context
79
+ this._mouseMoveDelegate = function(event) {
80
+ return self._mouseMove(event);
81
+ };
82
+ this._mouseUpDelegate = function(event) {
83
+ return self._mouseUp(event);
84
+ };
85
+ $(document)
86
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
87
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
88
+
89
+ // preventDefault() is used to prevent the selection of text here -
90
+ // however, in Safari, this causes select boxes not to be selectable
91
+ // anymore, so this fix is needed
92
+ ($.browser.safari || event.preventDefault());
93
+
94
+ event.originalEvent.mouseHandled = true;
95
+ return true;
96
+ },
97
+
98
+ _mouseMove: function(event) {
99
+ // IE mouseup check - mouseup happened when mouse was out of window
100
+ if ($.browser.msie && !event.button) {
101
+ return this._mouseUp(event);
102
+ }
103
+
104
+ if (this._mouseStarted) {
105
+ this._mouseDrag(event);
106
+ return event.preventDefault();
107
+ }
108
+
109
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
110
+ this._mouseStarted =
111
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
112
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
113
+ }
114
+
115
+ return !this._mouseStarted;
116
+ },
117
+
118
+ _mouseUp: function(event) {
119
+ $(document)
120
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
121
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
122
+
123
+ if (this._mouseStarted) {
124
+ this._mouseStarted = false;
125
+ this._preventClickEvent = (event.target == this._mouseDownEvent.target);
126
+ this._mouseStop(event);
127
+ }
128
+
129
+ return false;
130
+ },
131
+
132
+ _mouseDistanceMet: function(event) {
133
+ return (Math.max(
134
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
135
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
136
+ ) >= this.options.distance
137
+ );
138
+ },
139
+
140
+ _mouseDelayMet: function(event) {
141
+ return this.mouseDelayMet;
142
+ },
143
+
144
+ // These are placeholder methods, to be overriden by extending plugin
145
+ _mouseStart: function(event) {},
146
+ _mouseDrag: function(event) {},
147
+ _mouseStop: function(event) {},
148
+ _mouseCapture: function(event) { return true; }
149
+ });
150
+
151
+ })(jQuery);
@@ -0,0 +1,237 @@
1
+ /*!
2
+ * jQuery UI Widget 1.8.4
3
+ *
4
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Widget
9
+ */
10
+ (function( $, undefined ) {
11
+
12
+ var _remove = $.fn.remove;
13
+
14
+ $.fn.remove = function( selector, keepData ) {
15
+ return this.each(function() {
16
+ if ( !keepData ) {
17
+ if ( !selector || $.filter( selector, [ this ] ).length ) {
18
+ $( "*", this ).add( [ this ] ).each(function() {
19
+ $( this ).triggerHandler( "remove" );
20
+ });
21
+ }
22
+ }
23
+ return _remove.call( $(this), selector, keepData );
24
+ });
25
+ };
26
+
27
+ $.widget = function( name, base, prototype ) {
28
+ var namespace = name.split( "." )[ 0 ],
29
+ fullName;
30
+ name = name.split( "." )[ 1 ];
31
+ fullName = namespace + "-" + name;
32
+
33
+ if ( !prototype ) {
34
+ prototype = base;
35
+ base = $.Widget;
36
+ }
37
+
38
+ // create selector for plugin
39
+ $.expr[ ":" ][ fullName ] = function( elem ) {
40
+ return !!$.data( elem, name );
41
+ };
42
+
43
+ $[ namespace ] = $[ namespace ] || {};
44
+ $[ namespace ][ name ] = function( options, element ) {
45
+ // allow instantiation without initializing for simple inheritance
46
+ if ( arguments.length ) {
47
+ this._createWidget( options, element );
48
+ }
49
+ };
50
+
51
+ var basePrototype = new base();
52
+ // we need to make the options hash a property directly on the new instance
53
+ // otherwise we'll modify the options hash on the prototype that we're
54
+ // inheriting from
55
+ // $.each( basePrototype, function( key, val ) {
56
+ // if ( $.isPlainObject(val) ) {
57
+ // basePrototype[ key ] = $.extend( {}, val );
58
+ // }
59
+ // });
60
+ basePrototype.options = $.extend( true, {}, basePrototype.options );
61
+ $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
62
+ namespace: namespace,
63
+ widgetName: name,
64
+ widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
65
+ widgetBaseClass: fullName
66
+ }, prototype );
67
+
68
+ $.widget.bridge( name, $[ namespace ][ name ] );
69
+ };
70
+
71
+ $.widget.bridge = function( name, object ) {
72
+ $.fn[ name ] = function( options ) {
73
+ var isMethodCall = typeof options === "string",
74
+ args = Array.prototype.slice.call( arguments, 1 ),
75
+ returnValue = this;
76
+
77
+ // allow multiple hashes to be passed on init
78
+ options = !isMethodCall && args.length ?
79
+ $.extend.apply( null, [ true, options ].concat(args) ) :
80
+ options;
81
+
82
+ // prevent calls to internal methods
83
+ if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
84
+ return returnValue;
85
+ }
86
+
87
+ if ( isMethodCall ) {
88
+ this.each(function() {
89
+ var instance = $.data( this, name ),
90
+ methodValue = instance && $.isFunction( instance[options] ) ?
91
+ instance[ options ].apply( instance, args ) :
92
+ instance;
93
+ if ( methodValue !== instance && methodValue !== undefined ) {
94
+ returnValue = methodValue;
95
+ return false;
96
+ }
97
+ });
98
+ } else {
99
+ this.each(function() {
100
+ var instance = $.data( this, name );
101
+ if ( instance ) {
102
+ if ( options ) {
103
+ instance.option( options );
104
+ }
105
+ instance._init();
106
+ } else {
107
+ $.data( this, name, new object( options, this ) );
108
+ }
109
+ });
110
+ }
111
+
112
+ return returnValue;
113
+ };
114
+ };
115
+
116
+ $.Widget = function( options, element ) {
117
+ // allow instantiation without initializing for simple inheritance
118
+ if ( arguments.length ) {
119
+ this._createWidget( options, element );
120
+ }
121
+ };
122
+
123
+ $.Widget.prototype = {
124
+ widgetName: "widget",
125
+ widgetEventPrefix: "",
126
+ options: {
127
+ disabled: false
128
+ },
129
+ _createWidget: function( options, element ) {
130
+ // $.widget.bridge stores the plugin instance, but we do it anyway
131
+ // so that it's stored even before the _create function runs
132
+ $.data( element, this.widgetName, this );
133
+ this.element = $( element );
134
+ this.options = $.extend( true, {},
135
+ this.options,
136
+ $.metadata && $.metadata.get( element )[ this.widgetName ],
137
+ options );
138
+
139
+ var self = this;
140
+ this.element.bind( "remove." + this.widgetName, function() {
141
+ self.destroy();
142
+ });
143
+
144
+ this._create();
145
+ this._init();
146
+ },
147
+ _create: function() {},
148
+ _init: function() {},
149
+
150
+ destroy: function() {
151
+ this.element
152
+ .unbind( "." + this.widgetName )
153
+ .removeData( this.widgetName );
154
+ this.widget()
155
+ .unbind( "." + this.widgetName )
156
+ .removeAttr( "aria-disabled" )
157
+ .removeClass(
158
+ this.widgetBaseClass + "-disabled " +
159
+ "ui-state-disabled" );
160
+ },
161
+
162
+ widget: function() {
163
+ return this.element;
164
+ },
165
+
166
+ option: function( key, value ) {
167
+ var options = key,
168
+ self = this;
169
+
170
+ if ( arguments.length === 0 ) {
171
+ // don't return a reference to the internal hash
172
+ return $.extend( {}, self.options );
173
+ }
174
+
175
+ if (typeof key === "string" ) {
176
+ if ( value === undefined ) {
177
+ return this.options[ key ];
178
+ }
179
+ options = {};
180
+ options[ key ] = value;
181
+ }
182
+
183
+ $.each( options, function( key, value ) {
184
+ self._setOption( key, value );
185
+ });
186
+
187
+ return self;
188
+ },
189
+ _setOption: function( key, value ) {
190
+ this.options[ key ] = value;
191
+
192
+ if ( key === "disabled" ) {
193
+ this.widget()
194
+ [ value ? "addClass" : "removeClass"](
195
+ this.widgetBaseClass + "-disabled" + " " +
196
+ "ui-state-disabled" )
197
+ .attr( "aria-disabled", value );
198
+ }
199
+
200
+ return this;
201
+ },
202
+
203
+ enable: function() {
204
+ return this._setOption( "disabled", false );
205
+ },
206
+ disable: function() {
207
+ return this._setOption( "disabled", true );
208
+ },
209
+
210
+ _trigger: function( type, event, data ) {
211
+ var callback = this.options[ type ];
212
+
213
+ event = $.Event( event );
214
+ event.type = ( type === this.widgetEventPrefix ?
215
+ type :
216
+ this.widgetEventPrefix + type ).toLowerCase();
217
+ data = data || {};
218
+
219
+ // copy original event properties over to the new event
220
+ // this would happen if we could call $.event.fix instead of $.Event
221
+ // but we don't have a way to force an event to be fixed multiple times
222
+ if ( event.originalEvent ) {
223
+ for ( var i = $.event.props.length, prop; i; ) {
224
+ prop = $.event.props[ --i ];
225
+ event[ prop ] = event.originalEvent[ prop ];
226
+ }
227
+ }
228
+
229
+ this.element.trigger( event, data );
230
+
231
+ return !( $.isFunction(callback) &&
232
+ callback.call( this.element[0], event, data ) === false ||
233
+ event.isDefaultPrevented() );
234
+ }
235
+ };
236
+
237
+ })( jQuery );
@@ -5,7 +5,7 @@ Rich.Cms.Dock = (function() {
5
5
  makeDraggable();
6
6
  }
7
7
  };
8
-
8
+
9
9
  var makeDraggable = function() {
10
10
  $("#rich_cms_dock").draggable({
11
11
  helper: "clone",
@@ -18,13 +18,13 @@ Rich.Cms.Dock = (function() {
18
18
  var y = event.pageY;
19
19
  var x_div = $(window).width() / 3;
20
20
  var y_div = $(window).height() / 2;
21
-
21
+
22
22
  $("#x" ).css({left: x });
23
23
  $("#y" ).css({top : y });
24
24
  $("#x1").css({left: x_div });
25
25
  $("#x2").css({left: x_div * 2});
26
26
  $("#y1").css({top : y_div });
27
-
27
+
28
28
  if (x < x_div) {
29
29
  $("#rich_cms_dock") .addClass("left").removeClass("middle").removeClass("right");
30
30
  } else if (x > (x_div * 2)) {
@@ -32,7 +32,7 @@ Rich.Cms.Dock = (function() {
32
32
  } else {
33
33
  $("#rich_cms_dock").removeClass("left"). addClass("middle").removeClass("right");
34
34
  }
35
-
35
+
36
36
  if (y < y_div) {
37
37
  $("#rich_cms_dock") .addClass("top").removeClass("bottom");
38
38
  } else {
@@ -52,7 +52,7 @@ Rich.Cms.Dock = (function() {
52
52
  }
53
53
  });
54
54
  };
55
-
55
+
56
56
  return {
57
57
  init: function() {
58
58
  bind();
@@ -4,18 +4,18 @@ Rich.Cms.Editor = (function() {
4
4
  editable_content = {}, content_items = "",
5
5
  cleditor_images_path = "/images/rich/cms/cleditor",
6
6
  cleditor_css = '<style>.cleditorMain {border:1px solid #999; padding:0 1px 1px; background-color:white} .cleditorMain iframe {border:none; margin:0; padding:0} .cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */} .cleditorToolbar {background: url("' + cleditor_images_path + '/toolbar.gif") repeat} .cleditorGroup {float:left; height:26px} .cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url("' + cleditor_images_path + '/buttons.gif")} .cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)} .cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC} .cleditorPopup {border:solid 1px #999; background-color:white; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000} .cleditorList div {padding:2px 4px 2px 4px} .cleditorList p, .cleditorList h1, .cleditorList h2, .cleditorList h3, .cleditorList h4, .cleditorList h5, .cleditorList h6, .cleditorList font {padding:0; margin:0; background-color:Transparent} .cleditorColor {width:150px; padding:1px 0 0 1px} .cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0} .cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt} .cleditorPrompt input, .cleditorPrompt textarea {font:8.5pt Arial,Verdana;} .cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt}</style>';
7
-
7
+
8
8
  var register = function(hash) {
9
9
  $.extend(editable_content, hash);
10
10
  content_items = $.keys(editable_content).join(",");
11
11
  };
12
-
12
+
13
13
  var bind = function() {
14
14
  $("#rich_cms_panel .edit a.close").bind("click", function(event) {
15
15
  event.preventDefault();
16
16
  RaccoonTip.close();
17
17
  });
18
-
18
+
19
19
  RaccoonTip.register("." + content_class + "." + mark_class, "#rich_cms_panel", {
20
20
  beforeShow: edit,
21
21
  canHide: function() { return !$("#cleditor_input").length },
@@ -24,16 +24,16 @@ Rich.Cms.Editor = (function() {
24
24
 
25
25
  bindSeatHolders();
26
26
  injectCleditorCss();
27
-
27
+
28
28
  $.registerAjaxFormHandler({
29
29
  "rich_cms_content": afterUpdate
30
30
  });
31
31
  };
32
-
32
+
33
33
  var bindSeatHolders = function() {
34
34
  RaccoonTip.register("." + content_class + "." + mark_class + ".sh_hint", "#rich_cms_panel", {event: "focus", beforeShow: edit, afterHide : function(content) { content.hide(); }});
35
35
  };
36
-
36
+
37
37
  var injectCleditorCss = function() {
38
38
  if (!$("head").length) {
39
39
  $(document.body).before("<head></head>");
@@ -43,9 +43,9 @@ Rich.Cms.Editor = (function() {
43
43
 
44
44
  var mark = function(event) {
45
45
  event.preventDefault();
46
-
46
+
47
47
  $(content_items).addClass(content_class).toggleClass(mark_class);
48
-
48
+
49
49
  var markedContentItems = $(content_items + "." + mark_class);
50
50
  if (markedContentItems.length) {
51
51
  $.each(markedContentItems, function() {
@@ -64,30 +64,30 @@ Rich.Cms.Editor = (function() {
64
64
  SeatHolder.react(!markedContentItems.length);
65
65
  }
66
66
  };
67
-
67
+
68
68
  var edit = function() {
69
69
  var content_item = $(this).closest(".rich_cms_content");
70
70
  var label = $("#rich_cms_panel .edit form fieldset.inputs label");
71
71
  var inputs = $("#rich_cms_panel .edit form fieldset.inputs");
72
-
72
+
73
73
  var attrs = content_item.get(0).attributes;
74
74
  var selector = $.grep($.keys(editable_content), function(s) {
75
75
  return content_item.is(s);
76
76
  })[0];
77
77
  var specs = editable_content[selector];
78
-
78
+
79
79
  label.html("Editing:&nbsp; " + $.map(specs.keys, function(key) { return "<strong>" + content_item.attr(key) + "</strong>"; }).join(", "));
80
-
80
+
81
81
  inputs.find(":input,div.cleditorMain").remove();
82
82
  inputs.append("<input name='content_item[__selector__]' type='hidden' value='" + selector + "'/>");
83
-
83
+
84
84
  $.each(attrs, function(index, attribute) {
85
85
  var attr = attribute.name;
86
-
86
+
87
87
  if (attr.match(/^data-/)) {
88
88
  var name = "content_item[" + attr.replace(/^data-/, "") + "]";
89
89
  var value = content_item.attr(attr);
90
-
90
+
91
91
  if (attr == specs.value) {
92
92
  var editable_input_type = content_item.attr("data-editable_input_type") || (content_item.is("textarea") || content_item.hasClass("block") ? "text" : "string");
93
93
 
@@ -104,12 +104,12 @@ Rich.Cms.Editor = (function() {
104
104
  }
105
105
  }
106
106
  });
107
-
107
+
108
108
  if (specs.beforeEdit) {
109
109
  var identifier = $.map(specs.keys, function(key) { return "[" + key + "=" + content_item.attr(key) + "]"; }).join("");
110
110
  specs.beforeEdit.apply(null, [inputs, selector, specs, identifier]);
111
111
  }
112
-
112
+
113
113
  $(edit_panel).show();
114
114
 
115
115
  setTimeout(function() {
@@ -121,22 +121,22 @@ Rich.Cms.Editor = (function() {
121
121
  }
122
122
  }, 250);
123
123
  };
124
-
124
+
125
125
  var afterUpdate = function(form, response) {
126
126
  var selector = response["__selector__"];
127
127
  var specs = editable_content[selector];
128
128
  var identifier = $.map(specs.keys, function(key) { return "[" + key + "=" + response["__identifier__"][key.replace(/^data-/, "")] + "]"; }).join("");
129
-
129
+
130
130
  var defaultFunction = function(form, response, selector, specs, identifier) {
131
131
  $(identifier).html(response[specs.value.replace(/^data-/, "")]);
132
132
  if (typeof(SeatHolder) != "undefined") {
133
133
  SeatHolder.rebind();
134
134
  }
135
135
  };
136
-
136
+
137
137
  (specs.afterUpdate || defaultFunction).apply(null, [form, response, selector, specs, identifier]);
138
138
  };
139
-
139
+
140
140
  return {
141
141
  init: function() {
142
142
  bind();
@@ -3,13 +3,13 @@ Rich.Cms.Menu = (function() {
3
3
  var bind = function() {
4
4
  $("#rich_cms_menu a.mark").bind("click", Rich.Cms.Editor.mark);
5
5
  };
6
-
6
+
7
7
  var register = function() {
8
- RaccoonTip.register("#rich_cms_menu a.login", "#rich_cms_panel",
8
+ RaccoonTip.register("#rich_cms_menu a.login", "#rich_cms_panel",
9
9
  {beforeShow: function(content) { content.show(); },
10
10
  afterHide : function(content) { content.hide(); }});
11
11
  };
12
-
12
+
13
13
  return {
14
14
  init: function() {
15
15
  bind();
@@ -11,7 +11,7 @@ Rich.Cms = {};
11
11
  element = element.previousSibling;
12
12
  }
13
13
  dummy_script.parentNode.removeChild(dummy_script);
14
-
14
+
15
15
  var libs_file = ["core", "widget", "mouse", "draggable"][$.inArray("undefined", [typeof($.ui), typeof($.widget), typeof(($.ui || {}).mouse), typeof(($.ui || {}).draggable)])];
16
16
 
17
17
  if (libs_file) {
@@ -5,7 +5,7 @@
5
5
  +inline_block
6
6
  +fixed
7
7
  *position: absolute
8
-
8
+
9
9
  &.top
10
10
  top: 0
11
11
  &.bottom
@@ -19,7 +19,7 @@
19
19
  left: 50%
20
20
  margin-left: -250px
21
21
  text-align: center
22
-
22
+
23
23
  &.ui-draggable-dragging
24
24
  +opacity(0.5)
25
25
 
@@ -11,7 +11,7 @@
11
11
  +inline_block
12
12
  +border_radius(5px)
13
13
  +box_shadow(rgba(0, 0, 0, 0.5), 0, 1px, 2px)
14
-
14
+
15
15
  li
16
16
  padding: 0 17px
17
17
  *padding: 1px 17px
@@ -19,7 +19,7 @@
19
19
  border-right: 1px solid #BBB
20
20
  +box-shadow(white, 1px, 0, 0)
21
21
  +inline_block
22
-
22
+
23
23
  &:first-child
24
24
  cursor: move
25
25
  &:last-child
@@ -15,10 +15,10 @@
15
15
  margin: 0
16
16
  padding: 0
17
17
  border: 0
18
-
18
+
19
19
  ol
20
20
  list-style: none
21
-
21
+
22
22
  .inputs
23
23
  label
24
24
  font-size: 12px
@@ -1,13 +1,13 @@
1
1
 
2
2
  =relative
3
3
  position: relative
4
-
4
+
5
5
  =absolute
6
6
  position: absolute
7
-
7
+
8
8
  =fixed
9
9
  position: fixed
10
-
10
+
11
11
  =left
12
12
  float: left
13
13
 
@@ -19,10 +19,10 @@
19
19
 
20
20
  =hidden
21
21
  display: none
22
-
22
+
23
23
  =block
24
24
  display: block
25
-
25
+
26
26
  =inline
27
27
  display: inline
28
28