rich_cms 2.0.7 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
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
data/CHANGELOG CHANGED
@@ -1,5 +1,14 @@
1
1
  = Rich-CMS CHANGELOG
2
2
 
3
+ == Version 2.1.0 (November 8, 2010)
4
+
5
+ * Made Rich-CMS Rails 2 and 3 compatible (woot!) Thanks Mark Mulder (@bitterzoet) for contributing
6
+ * Not using :div tag as default for cms content anymore: only use :div when content is rendered as :text or :html
7
+ * Corrected Rich::Cms::Content::Item.to_tag
8
+ * Perfected the Rails generators (for both Rails 2 and 3)
9
+ * Removed explicit inclusion of Formtastic::SemanticFormHelper
10
+ * Updated gem dependencies
11
+
3
12
  == Version 2.0.7 (October 20, 2010)
4
13
 
5
14
  * Being able to edit content with the WYSIWYG HTML editor: CLEditor v1.3.0 (yay!)
@@ -56,4 +65,4 @@
56
65
 
57
66
  == Version 1.0.0 (August 15, 2010)
58
67
 
59
- * Initial release
68
+ * Initial release
data/README.textile CHANGED
@@ -9,26 +9,44 @@ Rich-CMS is a module of E9s ("http://github.com/archan937/e9s":http://github.com
9
9
 
10
10
  h2. Installation
11
11
 
12
- h3. Using Rich-CMS as gem
12
+ h3. Using Rich-CMS as gem in Rails 3
13
13
 
14
- Install the Rich-CMS gem:
14
+ Add Rich-CMS in @Gemfile@ as a gem dependency:
15
15
 
16
16
  <pre>
17
- sudo gem install rich_cms
17
+ gem "rich_cms"
18
18
  </pre>
19
19
 
20
- Add rich_cms in @environment.rb@ as a gem dependency:
20
+ Run the following in your console to install with Bundler:
21
+
22
+ <pre>
23
+ bundle install
24
+ </pre>
25
+
26
+ h3. Using Rich-CMS as gem in Rails 2
27
+
28
+ Add Rich-CMS in @environment.rb@ as a gem dependency:
21
29
 
22
30
  <pre>
23
31
  config.gem "rich_cms"
24
32
  </pre>
25
33
 
26
- h3. Using Rich-CMS as plugin
34
+ Run the following in your console:
35
+
36
+ <pre>
37
+ sudo rake gems:install
38
+ </pre>
27
39
 
28
- Install the Rich-CMS plugin:
40
+ h3. Using Rich-CMS as plugin in Rails 3
29
41
 
30
42
  <pre>
31
- ./script/plugin install git://github.com/archan937/rich_cms.git
43
+ rails plugin install git://github.com/archan937/rich_cms.git
44
+ </pre>
45
+
46
+ h3. Using Rich-CMS as plugin in Rails 2
47
+
48
+ <pre>
49
+ script/plugin install git://github.com/archan937/rich_cms.git
32
50
  </pre>
33
51
 
34
52
  h2. Use the provided Rails generators
@@ -42,32 +60,52 @@ Fortunately, Rich-CMS is provided with two Rails generators with which you can g
42
60
 
43
61
  h3. Authlogic user
44
62
 
63
+ h4. In Rails 3
64
+
45
65
  Run the following in your console:
46
66
 
47
67
  <pre>
48
- script/generate rich_authlogic_user
68
+ rails g rich:authlogic_user -m
49
69
  </pre>
50
70
 
51
71
  *Note*: At default, it will create both the @User@ and @UserSession@ classes and @CreateUsers@ migration. You can alter the class names with the following:
52
72
 
53
73
  <pre>
54
- script/generate rich_authlogic_user CodeHeroes::User --migrate
74
+ rails g rich:authlogic_user CodeHeroes::User -m
55
75
  </pre>
56
76
 
57
77
  *Note*: Both generators have the @-m@ or @--migrate@ option which runs @rake db:migrate@ after creating the files.
58
78
 
79
+ h4. In Rails 2
80
+
81
+ Run the following in your console:
82
+
83
+ <pre>
84
+ script/generate rich_authlogic_user -m
85
+ </pre>
86
+
59
87
  h3. CMS content
60
88
 
89
+ h4. In Rails 3
90
+
61
91
  Run the following in your console:
62
92
 
63
93
  <pre>
64
- script/generate rich_cms_content
94
+ rails g rich:cms_content -m
65
95
  </pre>
66
96
 
67
97
  *Note*: At default, it will create the @CmsContent@ model and @CreateCmsContents@ migration. You can alter the class name with the following:
68
98
 
69
99
  <pre>
70
- script/generate rich_cms_content CmsItem
100
+ rails g rich:cms_content CmsItem -m
101
+ </pre>
102
+
103
+ h4. In Rails 2
104
+
105
+ Run the following in your console:
106
+
107
+ <pre>
108
+ script/generate rich_cms_content -m
71
109
  </pre>
72
110
 
73
111
  In case you have used the Rails generators, you can skip the *Create required entities manually* section and go straight to *Render Rich-CMS in your views*.
@@ -80,7 +118,7 @@ Provide the mechanism as a symbol (e.g. @:authlogic@) and the authenticated clas
80
118
 
81
119
  <pre>
82
120
  Rich::Cms::Engine.authenticate(:authlogic, {:class_name => "User", :identifier => :email})
83
- </pre>
121
+ </pre>
84
122
 
85
123
  Unfortunately, only AuthLogic ("http://github.com/binarylogic/authlogic":http://github.com/binarylogic/authlogic) is supported, but we are working hard on making Rich-CMS compatible with other mechanisms.
86
124
 
@@ -139,8 +177,8 @@ When using a combined key for content identification, just call it as follows:
139
177
 
140
178
  We have also provided you a helper method to render Rich-CMS content tags. It is provided with several options:
141
179
 
142
- * @:as@ (default: auto-detect @:string@ or @:text@) - Specify the input type shown in the edit form (@:string@ for an input text, @:text@ for a textarea and @:html@ for a WYSIWYG HTML editor).
143
- * @:tag@ (default: @:div@) - The HTML tag used for content items.
180
+ * @:as@ (default: auto-determine @:string@ or @:text@) - Specify the input type shown in the edit form (@:string@ for an input text, @:text@ for a textarea and @:html@ for a WYSIWYG HTML editor).
181
+ * @:tag@ (default: auto-determine @:div@ or @:span@) - The HTML tag used for content items.
144
182
  * @:html@ (default: @{}@) - HTML attributes added to the content tag (e.g. @:id@, @:class@)
145
183
 
146
184
  <pre>
@@ -168,11 +206,11 @@ When specifying a custom after update Javascript function, you probably want to
168
206
 
169
207
  <pre>
170
208
  class Translation < ActiveRecord::Base
171
-
209
+
172
210
  def to_rich_cms_response(params)
173
211
  {:value => value, :translations => Hash[*params[:derivative_keys].split(";").uniq.collect{|x| [x, x.t]}.flatten]}
174
212
  end
175
-
213
+
176
214
  end
177
215
  </pre>
178
216
 
@@ -217,6 +255,10 @@ SeatHolder<br>
217
255
  CLEditor<br>
218
256
  "http://premiumsoftware.net/cleditor/index.html":http://premiumsoftware.net/cleditor/index.html
219
257
 
258
+ h2. Contributors
259
+
260
+ Mark Mulder - "@bitterzoet":http://twitter.com/bitterzoet - "http://ikbenbitterzoet.com":http://ikbenbitterzoet.com
261
+
220
262
  h2. ToDo's
221
263
 
222
264
  * Provide better conventions for content rendering
data/Rakefile CHANGED
@@ -12,10 +12,10 @@ begin
12
12
  gemspec.homepage = "http://codehero.es/rails_gems_plugins/rich_cms"
13
13
  gemspec.author = "Paul Engel"
14
14
 
15
- gemspec.add_dependency "authlogic"
16
- gemspec.add_dependency "formtastic", "1.0.1"
15
+ gemspec.add_dependency "authlogic" , ">= 2.1.2"
16
+ gemspec.add_dependency "formtastic", ">= 1.1.0"
17
17
  gemspec.add_dependency "haml" , ">= 3"
18
- gemspec.add_dependency "jzip" , ">= 1.0.10"
18
+ gemspec.add_dependency "jzip" , ">= 1.0.11"
19
19
  end
20
20
  Jeweler::GemcutterTasks.new
21
21
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.7
1
+ 2.1.0
@@ -3,12 +3,12 @@ module Rich
3
3
  class CmsController < ::ApplicationController
4
4
 
5
5
  before_filter :require_current_rich_cms_admin, :except => [:display, :position, :login]
6
-
6
+
7
7
  def display
8
8
  (session[:rich_cms] ||= {})[:display] = params[:display]
9
9
  request.xhr? ? render(:nothing => true) : redirect_to(request.referrer)
10
10
  end
11
-
11
+
12
12
  def position
13
13
  session[:rich_cms][:position] = params[:position]
14
14
  render :nothing => true
@@ -19,7 +19,7 @@ module Rich
19
19
  when :authlogic
20
20
  @current_rich_cms_admin_session = rich_cms_authenticated_class.new params[key = rich_cms_authenticated_class.name.underscore.gsub("/", "_")]
21
21
  authenticated = @current_rich_cms_admin_session.save
22
-
22
+
23
23
  after_rich_cms_login authenticated, key
24
24
  end
25
25
  end
@@ -30,10 +30,10 @@ module Rich
30
30
  (@current_rich_cms_admin_session ||= rich_cms_authenticated_class.find).destroy
31
31
  end
32
32
  session[:rich_cms] = nil
33
-
33
+
34
34
  after_rich_cms_logout
35
35
  end
36
-
36
+
37
37
  unless ::ApplicationController.instance_methods.include?("after_rich_cms_login")
38
38
  def after_rich_cms_login(authenticated, key)
39
39
  if request.xhr?
@@ -49,7 +49,7 @@ module Rich
49
49
  end
50
50
  end
51
51
  end
52
-
52
+
53
53
  unless ::ApplicationController.instance_methods.include?("after_rich_cms_logout")
54
54
  def after_rich_cms_logout
55
55
  redirect_to request.referrer
@@ -61,5 +61,5 @@ module Rich
61
61
  end
62
62
 
63
63
  end
64
-
64
+
65
65
  end
@@ -5,4 +5,4 @@
5
5
 
6
6
  <div id="x1" style="height: 100%; width : 1px; position: fixed; background: red"></div>
7
7
  <div id="x2" style="height: 100%; width : 1px; position: fixed; background: red"></div>
8
- <div id="y1" style="width : 100%; height: 1px; position: fixed; background: red"></div>
8
+ <div id="y1" style="width : 100%; height: 1px; position: fixed; background: red"></div>
@@ -20,4 +20,4 @@
20
20
  <%= link_to "Logout", rich_cms_logout_path %>
21
21
  </li>
22
22
  <% end %>
23
- </ul>
23
+ </ul>
@@ -1,3 +1,3 @@
1
1
  <div id="rich_cms_panel" style="display: none">
2
2
  <%= render :partial => "rich/cms/dock/panel/#{current_rich_cms_admin.nil? ? "login" : "edit"}" %>
3
- </div>
3
+ </div>
@@ -0,0 +1 @@
1
+ <%= render :partial => "rich/cms/dock/panel/edit/rails#{Rails::VERSION::MAJOR}" %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "rich/cms/dock/panel/login/rails#{Rails::VERSION::MAJOR}" %>
@@ -0,0 +1,10 @@
1
+ <div class="edit">
2
+ <%= form_tag rich_cms_update_path, :name => "rich_cms_content", :class => "ajaxify" do %>
3
+ <fieldset class="inputs">
4
+ <label></label>
5
+ </fieldset>
6
+ <fieldset class="buttons">
7
+ <%= submit_tag "Save" %> <%= link "Close" %>
8
+ </fieldset>
9
+ <% end %>
10
+ </div>
@@ -1,15 +1,15 @@
1
1
  <div class="login">
2
2
  <% semantic_form_for rich_cms_authenticated_class.new, :url => rich_cms_login_path, :html => {:class => "ajaxify"} do |form| %>
3
-
4
- <% form.inputs do %>
3
+
4
+ <% form.inputs do %>
5
5
  <% rich_cms_authentication_inputs.each do |input| %>
6
6
  <%= form.input input, :input_html => {:size => ""} %>
7
7
  <% end %>
8
8
  <% end %>
9
-
9
+
10
10
  <% form.buttons do %>
11
11
  <%= form.submit "Login" %>
12
12
  <% end %>
13
-
13
+
14
14
  <% end %>
15
15
  </div>
@@ -0,0 +1,15 @@
1
+ <div class="login">
2
+ <%= semantic_form_for rich_cms_authenticated_class.new, :url => rich_cms_login_path, :html => {:class => "ajaxify"} do |form| %>
3
+
4
+ <%= form.inputs do %>
5
+ <% rich_cms_authentication_inputs.each do |input| %>
6
+ <%= form.input input, :input_html => {:size => ""} %>
7
+ <% end %>
8
+ <% end %>
9
+
10
+ <%= form.buttons do %>
11
+ <%= form.submit "Login" %>
12
+ <% end %>
13
+
14
+ <% end %>
15
+ </div>
@@ -7,4 +7,4 @@
7
7
  $(function() {
8
8
  Rich.Cms.Editor.register(<%= Rich::Cms::Engine.editable_content_javascript_hash %>);
9
9
  });
10
- </script>
10
+ </script>
@@ -36,7 +36,7 @@
36
36
  "999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C " +
37
37
  "666 900 C60 C93 990 090 399 33F 60C 939 " +
38
38
  "333 600 930 963 660 060 366 009 339 636 " +
39
- "000 300 630 633 330 030 033 006 309 303",
39
+ "000 300 630 633 330 030 033 006 309 303",
40
40
  fonts: // font names in the font popup
41
41
  "Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond," +
42
42
  "Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",
@@ -50,13 +50,13 @@
50
50
  docType: // Document type contained within the editor
51
51
  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
52
52
  docCSSFile: // CSS file used to style the document contained within the editor
53
- "",
53
+ "",
54
54
  bodyStyle: // style to assign to document body contained within the editor
55
55
  "margin:4px; font:10pt Arial,Verdana; cursor:text"
56
56
  },
57
57
 
58
- // Define all usable toolbar buttons - the init string property is
59
- // expanded during initialization back into the buttons object and
58
+ // Define all usable toolbar buttons - the init string property is
59
+ // expanded during initialization back into the buttons object and
60
60
  // seperate object properties are created for each button.
61
61
  // e.g. buttons.size.title = "Font Size"
62
62
  buttons: {
@@ -120,7 +120,7 @@
120
120
  return $result;
121
121
 
122
122
  };
123
-
123
+
124
124
  //==================
125
125
  // Private Variables
126
126
  //==================
@@ -223,7 +223,7 @@
223
223
  var $group = $(DIV_TAG)
224
224
  .addClass(GROUP_CLASS)
225
225
  .appendTo($toolbar);
226
-
226
+
227
227
  // Add the buttons to the toolbar
228
228
  $.each(options.controls.split(" "), function(idx, buttonName) {
229
229
  if (buttonName === "") return true;
@@ -245,7 +245,7 @@
245
245
 
246
246
  // Button
247
247
  else {
248
-
248
+
249
249
  // Get the button definition
250
250
  var button = buttons[buttonName];
251
251
 
@@ -273,7 +273,7 @@
273
273
  if (button.popupName)
274
274
  createPopup(button.popupName, options, button.popupClass,
275
275
  button.popupContent, button.popupHover);
276
-
276
+
277
277
  }
278
278
 
279
279
  });
@@ -562,7 +562,7 @@
562
562
  //==================
563
563
  // Private Functions
564
564
  //==================
565
-
565
+
566
566
  // checksum - returns a checksum using the Adler-32 method
567
567
  function checksum(text)
568
568
  {
@@ -799,7 +799,7 @@
799
799
  options = editor.options;
800
800
 
801
801
  // Remove the old iframe
802
- if (editor.$frame)
802
+ if (editor.$frame)
803
803
  editor.$frame.remove();
804
804
 
805
805
  // Create a new iframe
@@ -836,11 +836,11 @@
836
836
  // reset the selection just after the beforedeactivate event and just
837
837
  // before the beforeactivate event.
838
838
  $doc.bind("beforedeactivate beforeactivate selectionchange keypress", function(e) {
839
-
839
+
840
840
  // Flag the editor as inactive
841
841
  if (e.type == "beforedeactivate")
842
842
  editor.inactive = true;
843
-
843
+
844
844
  // Get rid of the bogus selection and flag the editor as active
845
845
  else if (e.type == "beforeactivate") {
846
846
  if (!editor.inactive && editor.range && editor.range.length > 1)
@@ -850,7 +850,7 @@
850
850
 
851
851
  // Save the selection when the editor is active
852
852
  else if (!editor.inactive) {
853
- if (!editor.range)
853
+ if (!editor.range)
854
854
  editor.range = [];
855
855
  editor.range.unshift(getRange(editor));
856
856
 
@@ -1064,7 +1064,7 @@
1064
1064
 
1065
1065
  // updateFrame - updates the iframe with the textarea contents
1066
1066
  function updateFrame(editor, checkForChange) {
1067
-
1067
+
1068
1068
  var code = editor.$area.val(),
1069
1069
  options = editor.options,
1070
1070
  updateFrameCallback = options.updateFrame,
@@ -0,0 +1,26 @@
1
+
2
+ $.ajaxFormHandlers = {};
3
+
4
+ $.extend({
5
+ registerAjaxFormHandler: function(handlers) {
6
+ $.extend($.ajaxFormHandlers, handlers);
7
+ }
8
+ });
9
+
10
+ $("form.ajaxify").live("submit", function(event) {
11
+ var form = $(this);
12
+
13
+ $.ajax({
14
+ type: form.attr("method") || "GET",
15
+ url : form.attr("action") || window.location.href,
16
+ data: form.serialize(),
17
+ success: function(response) {
18
+ var handler = $.ajaxFormHandlers[form.attr("name")];
19
+ if (handler) {
20
+ handler(form, response);
21
+ }
22
+ }
23
+ });
24
+
25
+ event.preventDefault();
26
+ });
@@ -16,10 +16,10 @@ if (typeof(RaccoonTip) == "undefined") {
16
16
  RaccoonTip = (function() {
17
17
  var html = '<div id="raccoon_tip" style="display: none"><div class="rt_tip"></div><div class="rt_content"></div></div>';
18
18
  var css = '<style>#raccoon_tip{*padding:14px;position:absolute;z-index:9999}#raccoon_tip .rt_tip{width:0;font-size:0;line-height:0;position:absolute;filter:chroma(color=pink)}#raccoon_tip.rt_bottom_right{margin-left:-28px;padding-top:14px}#raccoon_tip.rt_bottom_right .rt_tip{top:0;left:14px;border-bottom-width:14px;border-bottom-style:solid;border-bottom-color:#f9e98e;border-right-width:14px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_bottom_middle{padding-top:14px}#raccoon_tip.rt_bottom_middle .rt_tip{top:0;left:50%;margin-left:-7px;border-bottom-width:14px;border-bottom-style:solid;border-bottom-color:#f9e98e;border-left-width:7px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink;border-right-width:7px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_bottom_left{margin-left:28px;padding-top:14px}#raccoon_tip.rt_bottom_left .rt_tip{top:0;right:14px;border-bottom-width:14px;border-bottom-style:solid;border-bottom-color:#f9e98e;border-left-width:14px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink}#raccoon_tip.rt_middle_left{margin-left:-7px;padding-right:14px}#raccoon_tip.rt_middle_left .rt_tip{top:50%;right:0;margin-top:-7px;border-left-width:14px;border-left-style:solid;border-left-color:#f9e98e;border-top-width:7px;border-top-style:solid;border-top-color:transparent;*border-top-color:pink;border-bottom-width:7px;border-bottom-style:solid;border-bottom-color:transparent;*border-bottom-color:pink}#raccoon_tip.rt_top_left{margin-left:28px;padding-bottom:14px}#raccoon_tip.rt_top_left .rt_tip{bottom:0;right:14px;border-top-width:14px;border-top-style:solid;border-top-color:#f9e98e;border-left-width:14px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink}#raccoon_tip.rt_top_middle{padding-bottom:14px}#raccoon_tip.rt_top_middle .rt_tip{bottom:0;left:50%;margin-left:-7px;border-top-width:14px;border-top-style:solid;border-top-color:#f9e98e;border-left-width:7px;border-left-style:solid;border-left-color:transparent;*border-left-color:pink;border-right-width:7px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_top_right{margin-left:-28px;padding-bottom:14px}#raccoon_tip.rt_top_right .rt_tip{bottom:0;left:14px;border-top-width:14px;border-top-style:solid;border-top-color:#f9e98e;border-right-width:14px;border-right-style:solid;border-right-color:transparent;*border-right-color:pink}#raccoon_tip.rt_middle_right{margin-left:7px;padding-left:14px}#raccoon_tip.rt_middle_right .rt_tip{top:50%;left:0;margin-top:-7px;border-right-width:14px;border-right-style:solid;border-right-color:#f9e98e;border-top-width:7px;border-top-style:solid;border-top-color:transparent;*border-top-color:pink;border-bottom-width:7px;border-bottom-style:solid;border-bottom-color:transparent;*border-bottom-color:pink}#raccoon_tip .rt_content{padding:6px 12px 8px 12px;overflow:hidden;background:#fbf7aa;border-width:10px;border-style:solid;border-color:#f9e98e;*border-width:7px;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;box-shadow:rgba(0, 0, 0, 0.1) 0 1px 3px;-moz-box-shadow:rgba(0, 0, 0, 0.1) 0 1px 3px;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0 1px 3px}#raccoon_tip .rt_content,#raccoon_tip .rt_content a{color:#a27d35;text-shadow:none}#raccoon_tip .rt_content a{outline:0}</style>';
19
-
19
+
20
20
  var default_options = {event: "click", duration: "fast", position: "bottom_right", beforeShow: function() {}, canHide: function() { return true; }, afterHide: function() {}}, opts = null;
21
21
  var displaying = false, mouseover = false;
22
-
22
+
23
23
  var register = function(target, content, options) {
24
24
  var attachFunction = $.inArray(options.event || default_options.event, ["focus"]) == -1 ? "live" : "bind";
25
25
  $(target)[attachFunction]((options || {}).event || "click", function(event) {
@@ -27,7 +27,7 @@ RaccoonTip = (function() {
27
27
  display(event.target, content, options);
28
28
  });
29
29
  };
30
-
30
+
31
31
  var display = function(target, content, options) {
32
32
  displaying = true;
33
33
  setup();
@@ -35,11 +35,11 @@ RaccoonTip = (function() {
35
35
  show();
36
36
  displaying = false;
37
37
  };
38
-
38
+
39
39
  var close = function() {
40
40
  hide();
41
41
  };
42
-
42
+
43
43
  var setup = function() {
44
44
  if (!$("#raccoon_tip").length) {
45
45
  $("body").mouseup(function(event) {
@@ -56,25 +56,25 @@ RaccoonTip = (function() {
56
56
  hide();
57
57
  }
58
58
  };
59
-
59
+
60
60
  var deriveOptions = function(__target__, __content__, options) {
61
61
  opts = $.extend({}, default_options, options, {target: $(__target__), content: $(__content__)});
62
62
  };
63
-
63
+
64
64
  var show = function() {
65
65
  beforeShow();
66
66
  setContent();
67
67
  position();
68
68
  $("#raccoon_tip").data("rt_options", opts).show(opts.duration);
69
69
  };
70
-
70
+
71
71
  var beforeShow = function() {
72
72
  var options = opts.beforeShow.apply(opts.target, [opts.content, opts]);
73
73
  if (options) {
74
74
  $.extend(opts, options);
75
75
  }
76
76
  };
77
-
77
+
78
78
  var setContent = function() {
79
79
  opts.content = $(opts.content);
80
80
  if (opts.content.length) {
@@ -89,17 +89,17 @@ RaccoonTip = (function() {
89
89
  $("#raccoon_tip .rt_content").html(opts.content.selector);
90
90
  }
91
91
  };
92
-
92
+
93
93
  var position = function() {
94
94
  var raccoon_tip = $("#raccoon_tip"),
95
95
  positions = ["bottom_right", "bottom_middle", "bottom_left", "middle_left", "top_left", "top_middle", "top_right", "middle_right"],
96
96
  pos_index = positions.indexOf(opts.position),
97
97
  variants = [];
98
-
98
+
99
99
  for (var i = 0; i < pos_index; i++) {
100
100
  positions.push(positions.shift());
101
101
  }
102
-
102
+
103
103
  for (var direction = 0; direction < 2; direction++) {
104
104
 
105
105
  if (direction == 1) {
@@ -114,7 +114,7 @@ RaccoonTip = (function() {
114
114
  }
115
115
 
116
116
  raccoon_tip.attr("class", "rt_" + positions[i]);
117
-
117
+
118
118
  for (var axis_index = 0; axis_index < 2; axis_index++) {
119
119
  switch(positions[i].split("_")[axis_index]) {
120
120
  case "top":
@@ -134,9 +134,9 @@ RaccoonTip = (function() {
134
134
  break;
135
135
  }
136
136
  }
137
-
137
+
138
138
  variants[direction] = {index: i, position: positions[i], top: raccoon_tip.css("top"), left: raccoon_tip.css("left")};
139
-
139
+
140
140
  if (!((parseInt(raccoon_tip.css("top" ), 10) < $(window).scrollTop() ) ||
141
141
  (parseInt(raccoon_tip.css("left"), 10) < $(window).scrollLeft()) ||
142
142
  (parseInt(raccoon_tip.css("top" ), 10) + raccoon_tip.outerHeight() > $(window).scrollTop() + $(window).height()) ||
@@ -145,14 +145,14 @@ RaccoonTip = (function() {
145
145
  }
146
146
  }
147
147
  }
148
-
148
+
149
149
  var pos = variants[variants[0].index < variants[1].index ? 0 : 1];
150
150
 
151
151
  raccoon_tip.attr("class", "rt_" + pos.position);
152
152
  raccoon_tip.css({top: pos.top, left: pos.left});
153
153
  opts.position = pos.position;
154
154
  };
155
-
155
+
156
156
  var hide = function() {
157
157
  var options = $("#raccoon_tip").data("rt_options");
158
158
  $("#raccoon_tip").hide(0);
@@ -161,7 +161,7 @@ RaccoonTip = (function() {
161
161
  $("#raccoon_tip").data("rt_marker").before($("#raccoon_tip .rt_content").children()).remove();
162
162
  }
163
163
  };
164
-
164
+
165
165
  return {
166
166
  version: "1.0.8",
167
167
  init: function() {
@@ -177,11 +177,11 @@ RaccoonTip = (function() {
177
177
 
178
178
  (function requireMissingLibs() {
179
179
  var missing_libs = [];
180
-
180
+
181
181
  if (typeof(jQuery) == "undefined") {
182
182
  missing_libs.push("core");
183
183
  }
184
-
184
+
185
185
  if (missing_libs.length == 0) {
186
186
  RaccoonTip.init();
187
187
  } else {
@@ -194,9 +194,9 @@ RaccoonTip = (function() {
194
194
  element = element.previousSibling;
195
195
  }
196
196
  dummyScript.parentNode.removeChild(dummyScript);
197
-
197
+
198
198
  var src = element.getAttribute("src").replace(/(development\/)?(\w+)(\-min)?\.js.*$/, "jquery/" + missing_libs.sort().join(".") + ".js");
199
- document.write('<script src="' + src + '" type="text/javascript" ' +
199
+ document.write('<script src="' + src + '" type="text/javascript" ' +
200
200
  'onload="RaccoonTip.init()" onreadystatechange="RaccoonTip.init()">' +
201
201
  '</script>');
202
202
  }