mercury-rails 0.2.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/app/controllers/{images_controller.rb → mercury/images_controller.rb} +3 -3
  2. data/app/controllers/mercury_controller.rb +13 -3
  3. data/app/models/{image.rb → mercury/image.rb} +3 -1
  4. data/app/views/layouts/mercury.html.erb +14 -6
  5. data/app/views/mercury/lightviews/about.html +7 -3
  6. data/app/views/mercury/modals/character.html +2 -2
  7. data/app/views/mercury/modals/htmleditor.html +2 -2
  8. data/app/views/mercury/modals/link.html +3 -3
  9. data/app/views/mercury/modals/media.html +3 -3
  10. data/app/views/mercury/modals/table.html +3 -3
  11. data/app/views/mercury/panels/snippets.html +1 -1
  12. data/app/views/mercury/selects/formatblock.html +9 -9
  13. data/app/views/mercury/snippets/example/options.html.erb +27 -16
  14. data/config/engine.rb +35 -0
  15. data/db/migrate/{20110526035601_create_images.rb → 20110526035601_create_mercury_images.rb} +2 -2
  16. data/features/loading/loading.feature +1 -1
  17. data/features/loading/navigating.feature +1 -1
  18. data/features/loading/user_interface.feature +2 -2
  19. data/features/regions/editable/basic_editing.feature +8 -8
  20. data/features/regions/editable/inserting_snippets.feature +4 -5
  21. data/features/regions/editable/inserting_tables.feature +9 -9
  22. data/features/step_definitions/mercury_steps.rb +20 -23
  23. data/features/step_definitions/web_steps.rb +5 -5
  24. data/features/support/mercury_selectors.rb +1 -0
  25. data/lib/generators/mercury/install/install_generator.rb +24 -3
  26. data/lib/generators/mercury/install/templates/mongoid_paperclip_image.rb +17 -0
  27. data/lib/mercury-rails.rb +0 -1
  28. data/lib/mercury/authentication.rb +8 -0
  29. data/spec/javascripts/mercury/dialog_spec.js.coffee +28 -21
  30. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +0 -2
  31. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +0 -2
  32. data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +0 -2
  33. data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +0 -2
  34. data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +0 -2
  35. data/spec/javascripts/mercury/history_buffer_spec.js.coffee +0 -2
  36. data/spec/javascripts/mercury/lightview_spec.js.coffee +42 -21
  37. data/spec/javascripts/mercury/mercury_spec.js.coffee +87 -7
  38. data/spec/javascripts/mercury/modal_spec.js.coffee +53 -23
  39. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +0 -2
  40. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -3
  41. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +0 -2
  42. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +2 -2
  43. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +0 -2
  44. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +2 -4
  45. data/spec/javascripts/mercury/native_extensions_spec.js.coffee +20 -2
  46. data/spec/javascripts/mercury/page_editor_spec.js.coffee +130 -35
  47. data/spec/javascripts/mercury/palette_spec.js.coffee +4 -6
  48. data/spec/javascripts/mercury/panel_spec.js.coffee +44 -6
  49. data/spec/javascripts/mercury/region_spec.js.coffee +42 -8
  50. data/spec/javascripts/mercury/regions/editable_spec.js.coffee +0 -2
  51. data/spec/javascripts/mercury/regions/markupable_spec.js.coffee +0 -2
  52. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +3 -5
  53. data/spec/javascripts/mercury/select_spec.js.coffee +4 -6
  54. data/spec/javascripts/mercury/snippet_spec.js.coffee +3 -4
  55. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +2 -4
  56. data/spec/javascripts/mercury/statusbar_spec.js.coffee +0 -2
  57. data/spec/javascripts/mercury/table_editor_spec.js.coffee +2 -4
  58. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +0 -2
  59. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +34 -15
  60. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +0 -2
  61. data/spec/javascripts/mercury/toolbar_spec.js.coffee +41 -26
  62. data/spec/javascripts/mercury/tooltip_spec.js.coffee +3 -5
  63. data/spec/javascripts/mercury/uploader_spec.js.coffee +8 -14
  64. data/spec/javascripts/spec_helper.js +1 -0
  65. data/spec/javascripts/templates/mercury/page_editor.html +1 -0
  66. data/spec/javascripts/templates/mercury/region.html +2 -2
  67. data/vendor/assets/images/mercury/missing-image.png +0 -0
  68. data/vendor/assets/javascripts/mercury.js +218 -112
  69. data/vendor/assets/javascripts/mercury/dependencies/{jquery-1.6.js → jquery-1.7.js} +2030 -1595
  70. data/vendor/assets/javascripts/mercury/dependencies/jquery.additions.js +55 -0
  71. data/vendor/assets/javascripts/mercury/dialog.js.coffee +7 -5
  72. data/vendor/assets/javascripts/mercury/dialogs/backcolor.js.coffee +1 -1
  73. data/vendor/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
  74. data/vendor/assets/javascripts/mercury/dialogs/formatblock.js.coffee +1 -1
  75. data/vendor/assets/javascripts/mercury/dialogs/{objectspanel.js.coffee → snippetpanel.js.coffee} +2 -2
  76. data/vendor/assets/javascripts/mercury/dialogs/style.js.coffee +1 -1
  77. data/vendor/assets/javascripts/mercury/finalize.js.coffee +3 -0
  78. data/vendor/assets/javascripts/mercury/lightview.js.coffee +76 -30
  79. data/vendor/assets/javascripts/mercury/locales/da.locale.js.coffee +211 -0
  80. data/vendor/assets/javascripts/mercury/locales/de.locale.js.coffee +206 -0
  81. data/vendor/assets/javascripts/mercury/locales/es.locale.js.coffee +211 -0
  82. data/vendor/assets/javascripts/mercury/locales/example.local.js.coffee +211 -0
  83. data/vendor/assets/javascripts/mercury/locales/fr.locale.js.coffee +211 -0
  84. data/vendor/assets/javascripts/mercury/locales/it.locale.js.coffee +208 -0
  85. data/vendor/assets/javascripts/mercury/locales/ko.local.js.coffee +206 -0
  86. data/vendor/assets/javascripts/mercury/locales/nl.locale.js.coffee +206 -0
  87. data/vendor/assets/javascripts/mercury/locales/pt.locale.js.coffee +211 -0
  88. data/vendor/assets/javascripts/mercury/locales/sv.local.js.coffee +209 -0
  89. data/vendor/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +213 -0
  90. data/vendor/assets/javascripts/mercury/mercury.js.coffee +62 -17
  91. data/vendor/assets/javascripts/mercury/modal.js.coffee +34 -21
  92. data/vendor/assets/javascripts/mercury/modals/htmleditor.js.coffee +1 -2
  93. data/vendor/assets/javascripts/mercury/modals/insertcharacter.js.coffee +3 -3
  94. data/vendor/assets/javascripts/mercury/modals/insertlink.js.coffee +4 -4
  95. data/vendor/assets/javascripts/mercury/modals/insertmedia.js.coffee +10 -9
  96. data/vendor/assets/javascripts/mercury/modals/insertsnippet.js.coffee +1 -1
  97. data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +8 -9
  98. data/vendor/assets/javascripts/mercury/native_extensions.js.coffee +26 -8
  99. data/vendor/assets/javascripts/mercury/page_editor.js.coffee +68 -46
  100. data/vendor/assets/javascripts/mercury/palette.js.coffee +1 -1
  101. data/vendor/assets/javascripts/mercury/panel.js.coffee +25 -7
  102. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +1 -0
  103. data/vendor/assets/javascripts/mercury/region.js.coffee +21 -17
  104. data/vendor/assets/javascripts/mercury/regions/editable.js.coffee +47 -35
  105. data/vendor/assets/javascripts/mercury/regions/markupable.js.coffee +43 -36
  106. data/vendor/assets/javascripts/mercury/regions/snippetable.js.coffee +22 -24
  107. data/vendor/assets/javascripts/mercury/select.js.coffee +3 -2
  108. data/vendor/assets/javascripts/mercury/snippet.js.coffee +2 -1
  109. data/vendor/assets/javascripts/mercury/snippet_toolbar.js.coffee +10 -7
  110. data/vendor/assets/javascripts/mercury/statusbar.js.coffee +4 -4
  111. data/vendor/assets/javascripts/mercury/table_editor.js.coffee +1 -3
  112. data/vendor/assets/javascripts/mercury/toolbar.button.js.coffee +42 -20
  113. data/vendor/assets/javascripts/mercury/toolbar.button_group.js.coffee +3 -3
  114. data/vendor/assets/javascripts/mercury/toolbar.expander.js.coffee +2 -2
  115. data/vendor/assets/javascripts/mercury/toolbar.js.coffee +8 -6
  116. data/vendor/assets/javascripts/mercury/tooltip.js.coffee +13 -9
  117. data/vendor/assets/javascripts/mercury/uploader.js.coffee +22 -16
  118. data/vendor/assets/javascripts/mercury_loader.js +2 -0
  119. data/vendor/assets/javascripts/mercury_overrides.js +6 -0
  120. data/vendor/assets/stylesheets/mercury/all_images.css.erb +89 -0
  121. data/vendor/assets/stylesheets/mercury/dialog.css +13 -4
  122. data/vendor/assets/stylesheets/mercury/lightview.css +66 -15
  123. data/vendor/assets/stylesheets/mercury/mercury.css +12 -7
  124. data/vendor/assets/stylesheets/mercury/modal.css +9 -5
  125. data/vendor/assets/stylesheets/mercury/toolbar.css +3 -29
  126. metadata +266 -144
  127. data/POST_INSTALL +0 -15
  128. data/README.md +0 -299
  129. data/VERSION +0 -1
  130. data/annotated_source.template +0 -57
  131. data/config/routes.rb +0 -15
  132. data/mercury-rails.gemspec +0 -288
  133. data/spec/javascripts/responses/blank.html +0 -1
  134. data/vendor/assets/javascripts/mercury/lightviews/imageprocessor.js.coffee +0 -2
@@ -1,17 +1,17 @@
1
- class ImagesController < MercuryController
1
+ class Mercury::ImagesController < MercuryController
2
2
 
3
3
  respond_to :json
4
4
 
5
5
  # POST /images.json
6
6
  def create
7
- @image = Image.new(params[:image])
7
+ @image = Mercury::Image.new(params[:image])
8
8
  @image.save
9
9
  respond_with @image
10
10
  end
11
11
 
12
12
  # DELETE /images/1.json
13
13
  def destroy
14
- @image = Image.find(params[:id])
14
+ @image = Mercury::Image.find(params[:id])
15
15
  @image.destroy
16
16
  respond_with @image
17
17
  end
@@ -1,24 +1,34 @@
1
1
  class MercuryController < ActionController::Base
2
+ include ::Mercury::Authentication
3
+
2
4
  protect_from_forgery
5
+ before_filter :authenticate, :only => :edit
6
+ layout false
3
7
 
4
8
  def edit
5
9
  render :text => '', :layout => 'mercury'
6
10
  end
7
11
 
8
12
  def resource
9
- render :action => "/#{params[:type]}/#{params[:resource]}", :layout => false
13
+ render :action => "/#{params[:type]}/#{params[:resource]}"
10
14
  end
11
15
 
12
16
  def snippet_options
13
- render :action => "/snippets/#{params[:name]}/options", :layout => false
17
+ @options = params[:options] || {}
18
+ render :action => "/snippets/#{params[:name]}/options"
14
19
  end
15
20
 
16
21
  def snippet_preview
17
- render :action => "/snippets/#{params[:name]}/preview", :layout => false
22
+ render :action => "/snippets/#{params[:name]}/preview"
18
23
  end
19
24
 
20
25
  def test_page
21
26
  render :text => params
22
27
  end
23
28
 
29
+ private
30
+
31
+ def authenticate
32
+ redirect_to "/#{params[:requested_uri]}" unless can_edit?
33
+ end
24
34
  end
@@ -1,4 +1,6 @@
1
- class Image < ActiveRecord::Base
1
+ class Mercury::Image < ActiveRecord::Base
2
+
3
+ self.table_name = :mercury_images
2
4
 
3
5
  has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }
4
6
 
@@ -5,20 +5,28 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <title>Mercury Editor</title>
7
7
  <%= stylesheet_link_tag 'mercury', 'mercury_overrides' %>
8
- <%= javascript_include_tag 'mercury' %>
8
+ <%= javascript_include_tag 'mercury', 'mercury_overrides' %>
9
9
  </head>
10
10
  <body>
11
- <% if Rails.application.config.respond_to?(:mercury_config) %>
12
- <%= javascript_tag("jQuery.extend(Mercury.config, #{Rails.application.config.mercury_config});") %>
13
- <% end -%>
14
-
15
11
  <script type="text/javascript">
16
- var saveUrl = null;
12
+ var saveUrl = null; // Set to the url that you want to save any given page to.
17
13
  var options = {
18
14
  saveStyle: null, // 'form', or 'json' (default json)
19
15
  saveMethod: null, // 'POST', or 'PUT', (create, vs. update -- default POST)
20
16
  visible: null // if the interface should start visible or not (default true)
21
17
  };
18
+
19
+ <!-- Mix in any configurations provided through Rails.application.config.mercury_config -->
20
+ <% if Rails.application.config.respond_to?(:mercury_config) %>
21
+ jQuery.extend(Mercury.config, <%= Rails.application.config.mercury_config.to_json.html_safe %>);
22
+ <% end -%>
23
+
24
+ <!-- Mix in any options for PageEditor provided through Rails.application.config.mercury_page_editor_config -->
25
+ <% if Rails.application.config.respond_to?(:mercury_page_editor_config) %>
26
+ jQuery.extend(options, <%= Rails.application.config.mercury_page_editor_config.to_json.html_safe %>);
27
+ <% end -%>
28
+
29
+ <!-- Instantiate the PageEditor -->
22
30
  new Mercury.PageEditor(saveUrl, options);
23
31
  </script>
24
32
  </body>
@@ -1,7 +1,11 @@
1
- <div class="mercury-about-lightview">
2
- <p>Mercury Editor is an open source project written by <a href="http://twitter.com/jejacks0n" target="_blank">Jeremy Jackson</a> and released under the MIT license. Check the license for more information.</p>
1
+ <div id="mercury_about">
2
+ <p>
3
+ Mercury Editor is an open source HTML5 WYSIWYG editor written in Coffeescript using jQuery. The project has been released under the MIT license.
4
+ <br/><br/>
5
+ Documentation and other useful information can be found on the project pages.
6
+ </p>
3
7
  <ul>
4
8
  <li><a href="http://jejacks0n.github.com/mercury" target="_blank">Project Home</a></li>
5
9
  <li><a href="http://github.com/jejacks0n/mercury" target="_blank">Project Source</a></li>
6
10
  </ul>
7
- </div>
11
+ </div>
@@ -1,7 +1,7 @@
1
1
  <form id="mercury_character" style="width:456px">
2
2
 
3
- <div class="mercury-modal-pane-container">
4
- <div class="mercury-modal-pane">
3
+ <div class="mercury-display-pane-container">
4
+ <div class="mercury-display-pane">
5
5
  <div class="character" data-entity="#34" title="quotation mark (APL quote)">&#34;</div>
6
6
  <div class="character" data-entity="#38" title="ampersand">&#38;</div>
7
7
  <div class="character" data-entity="#60" title="less-than sign">&#60;</div>
@@ -1,8 +1,8 @@
1
1
  <form id="mercury_html_editor" style="width:650px">
2
2
 
3
- <textarea class="mercury-modal-pane-container" rows="5"></textarea>
3
+ <textarea class="mercury-display-pane-container" rows="5" style="width:100%"></textarea>
4
4
 
5
- <div class="mercury-modal-controls">
5
+ <div class="mercury-display-controls">
6
6
  <fieldset class="buttons">
7
7
  <ol>
8
8
  <li class="commit button"><input class="submit" name="commit" type="submit" value="Save and Replace"/></li>
@@ -1,7 +1,7 @@
1
1
  <form id="mercury_link" style="width:600px">
2
2
 
3
- <div class="mercury-modal-pane-container">
4
- <div class="mercury-modal-pane">
3
+ <div class="mercury-display-pane-container">
4
+ <div class="mercury-display-pane">
5
5
 
6
6
  <fieldset class="inputs" id="link_text_container">
7
7
  <ol>
@@ -64,7 +64,7 @@
64
64
  </div>
65
65
  </div>
66
66
 
67
- <div class="mercury-modal-controls">
67
+ <div class="mercury-display-controls">
68
68
  <fieldset class="buttons">
69
69
  <ol>
70
70
  <li class="commit button"><input class="submit" name="commit" type="submit" value="Insert Link"/></li>
@@ -1,7 +1,7 @@
1
1
  <form id="mercury_media" style="width:600px">
2
2
 
3
- <div class="mercury-modal-pane-container">
4
- <div class="mercury-modal-pane">
3
+ <div class="mercury-display-pane-container">
4
+ <div class="mercury-display-pane">
5
5
 
6
6
  <fieldset class="inputs">
7
7
  <legend><span>Images</span></legend>
@@ -71,7 +71,7 @@
71
71
  </div>
72
72
  </div>
73
73
 
74
- <div class="mercury-modal-controls">
74
+ <div class="mercury-display-controls">
75
75
  <fieldset class="buttons">
76
76
  <ol>
77
77
  <li class="commit button"><input class="submit" name="commit" type="submit" value="Insert Media"/></li>
@@ -1,7 +1,7 @@
1
1
  <form id="mercury_table" style="width:700px">
2
2
 
3
- <div class="mercury-modal-pane-container">
4
- <div class="mercury-modal-pane">
3
+ <div class="mercury-display-pane-container">
4
+ <div class="mercury-display-pane">
5
5
 
6
6
  <div id="table_display">
7
7
  <table border="1" cellspacing="0">
@@ -73,7 +73,7 @@
73
73
  </div>
74
74
  </div>
75
75
 
76
- <div class="mercury-modal-controls">
76
+ <div class="mercury-display-controls">
77
77
  <fieldset class="buttons">
78
78
  <ol>
79
79
  <li class="commit button"><input class="submit" name="commit" type="submit" value="Insert Table" /></li>
@@ -6,7 +6,7 @@
6
6
  <li data-filter="example, snippet, favorite, beer">
7
7
  <img alt="Snippet Name" data-snippet="example" src="/assets/mercury/default-snippet.png"/>
8
8
  <h4>Snippet Name</h4>
9
- <div class="description">A one to two line long description of what this snippet does.</div>
9
+ <div class="description">A one or two line long description of what this snippet does.</div>
10
10
  </li>
11
11
  </ul>
12
12
  </div>
@@ -1,11 +1,11 @@
1
1
  <div class="mercury-select-options">
2
- <h1 data-tag="h1">Heading 1 &lt;h1&gt;</h1>
3
- <h2 data-tag="h2">Heading 2 &lt;h2&gt;</h2>
4
- <h3 data-tag="h3">Heading 3 &lt;h3&gt;</h3>
5
- <h4 data-tag="h4">Heading 4 &lt;h4&gt;</h4>
6
- <h5 data-tag="h5">Heading 5 &lt;h5&gt;</h5>
7
- <h6 data-tag="h6">Heading 6 &lt;h6&gt;</h6>
8
- <div data-tag="p">Paragraph &lt;p&gt;</div>
9
- <div data-tag="blockquote">Blockquote &lt;blockquote&gt;</div>
10
- <div data-tag="pre">Formatted &lt;pre&gt;</div>
2
+ <h1 data-tag="h1">Heading 1 <span>&lt;h1&gt;</span></h1>
3
+ <h2 data-tag="h2">Heading 2 <span>&lt;h2&gt;</span></h2>
4
+ <h3 data-tag="h3">Heading 3 <span>&lt;h3&gt;</span></h3>
5
+ <h4 data-tag="h4">Heading 4 <span>&lt;h4&gt;</span></h4>
6
+ <h5 data-tag="h5">Heading 5 <span>&lt;h5&gt;</span></h5>
7
+ <h6 data-tag="h6">Heading 6 <span>&lt;h6&gt;</span></h6>
8
+ <div data-tag="p">Paragraph <span>&lt;p&gt;</span></div>
9
+ <div data-tag="blockquote">Blockquote <span>&lt;blockquote&gt;</span></div>
10
+ <div data-tag="pre">Formatted <span>&lt;pre&gt;</span></div>
11
11
  </div>
@@ -1,23 +1,34 @@
1
- <% @options = params[:options] || {} %>
2
- <%= semantic_form_for 'options', { :html => { :style => 'width:600px' } } do |f| %>
1
+ <%= form_for 'options', { :html => { :style => 'width:600px' } } do |f| %>
3
2
 
4
- <div class="mercury-modal-pane-container">
5
- <div class="mercury-modal-pane">
6
- <%= f.inputs do %>
7
- <%= f.input :first_name, :required => false, :label => 'First Name',
8
- :input_html => {:value => @options[:first_name] || 'First Name'} %>
9
- <% end %>
10
- <%= f.inputs 'Options' do %>
11
- <%= f.input :favorite_beer, :required => false, :label => 'Favorite Beer',
12
- :input_html => {:value => @options[:favorite_beer] || 'PBR'} %>
13
- <% end %>
3
+ <div class="mercury-display-pane-container">
4
+ <div class="mercury-display-pane">
5
+ <fieldset class="inputs">
6
+ <ol>
7
+ <li class="string input optional stringish" id="options_first_name_input">
8
+ <label class="label" for="options_first_name">First Name</label>
9
+ <input id="options_first_name" name="options[first_name]" type="text" value="<%= @options[:first_name] %>"/>
10
+ </li>
11
+ </ol>
12
+ </fieldset>
13
+
14
+ <fieldset class="inputs">
15
+ <legend><span>Options</span></legend>
16
+ <ol>
17
+ <li class="string input optional stringish" id="options_favorite_beer_input">
18
+ <label class="label" for="options_favorite_beer">Favorite Beer</label>
19
+ <input id="options_favorite_beer" name="options[favorite_beer]" type="text" value="<%= @options[:favorite_beer] %>"/>
20
+ </li>
21
+ </ol>
22
+ </fieldset>
14
23
  </div>
15
24
  </div>
16
25
 
17
- <div class="mercury-modal-controls">
18
- <%= f.buttons do %>
19
- <%= f.commit_button 'Insert Snippet' %>
20
- <% end %>
26
+ <div class="mercury-display-controls">
27
+ <fieldset class="buttons">
28
+ <ol>
29
+ <li class="commit button"><input class="submit" name="commit" type="submit" value="Insert Snippet"/></li>
30
+ </ol>
31
+ </fieldset>
21
32
  </div>
22
33
 
23
34
  <% end %>
@@ -2,5 +2,40 @@ require "rails"
2
2
 
3
3
  module Mercury
4
4
  class Engine < Rails::Engine
5
+
6
+ # Additional application configuration to include precompiled assets.
7
+ initializer :assets do |app|
8
+ app.config.assets.precompile += %w( mercury.js mercury.css mercury_overrides.css )
9
+ end
10
+
11
+ # Require mercury authentication module and potentially other aspects later (so they can be overridden).
12
+ initializer 'mercury.add_lib' do |app|
13
+ require 'mercury/authentication'
14
+ end
15
+
16
+ # To load the routes for this Engine, within your main apps routes.rb file include:
17
+ #
18
+ # Mercury::Engine.routes
19
+ #
20
+ def self.routes
21
+ Rails.application.routes.draw do
22
+ match '/editor(/*requested_uri)' => "mercury#edit", :as => :mercury_editor
23
+
24
+ namespace :mercury do
25
+ resources :images
26
+ end
27
+
28
+ scope '/mercury' do
29
+ match ':type/:resource' => "mercury#resource"
30
+ match 'snippets/:name/options' => "mercury#snippet_options"
31
+ match 'snippets/:name/preview' => "mercury#snippet_preview"
32
+ end
33
+
34
+ if defined?(Mercury::Application)
35
+ match 'mercury/test_page' => "mercury#test_page"
36
+ end
37
+ end
38
+ end
39
+
5
40
  end
6
41
  end
@@ -1,6 +1,6 @@
1
- class CreateImages < ActiveRecord::Migration
1
+ class CreateMercuryImages < ActiveRecord::Migration
2
2
  def change
3
- create_table :images do |t|
3
+ create_table :mercury_images do |t|
4
4
  t.string :image_file_name
5
5
  t.string :image_content_type
6
6
  t.integer :image_file_size
@@ -19,4 +19,4 @@ Feature:
19
19
 
20
20
 
21
21
  Scenario: A user can expect to see the status bar
22
- Then I should see "Mercury Editor v0.2.1" within the statusbar
22
+ Then I should see "Mercury Editor v0.3.0" within the statusbar
@@ -5,7 +5,7 @@ Feature:
5
5
  I should be able to expect the editor to not get in the way when I navigate and submit forms
6
6
 
7
7
  Background:
8
- Given I adjust the configuration to have: "{nonHijackableClasses: ['lightview']}"
8
+ Given I adjust the configuration to have: {"nonHijackableClasses": ["lightview"]}
9
9
  And am on an editable page
10
10
 
11
11
 
@@ -12,8 +12,8 @@ Feature:
12
12
 
13
13
  # Scenario: A user can view and close the about dialog
14
14
  When I click on the about the editor link
15
- Then I should see "About Mercury Editor" within the lightview title
16
- And I should see "Mercury Editor is an open source project written by Jeremy Jackson" within the lightview window
15
+ Then I should see "Mercury Editor" within the lightview title
16
+ And I should see "Mercury Editor is an open source HTML5 WYSIWYG editor written in Coffeescript using jQuery. The project has been released under the MIT license." within the lightview window
17
17
  And I should see "Project Home" within the lightview window
18
18
  And I should see "Project Source" within the lightview window
19
19
 
@@ -91,16 +91,16 @@ Feature:
91
91
  And I make a selection
92
92
 
93
93
  When I click on the justify left editor button
94
- Then the contents of the editable region should be "<div>first line</div><br><div align='left'>this is <span>justifiable</span> <b>content</b></div>"
94
+ Then the contents of the editable region should be "<div>first line</div><br><div align='left'>this is <span>justifiable</span><b>content</b></div> "
95
95
 
96
96
  When I click on the justify center editor button
97
- Then the contents of the editable region should be "<div>first line</div><br><div align='center'>this is <span>justifiable</span> <b>content</b></div>"
97
+ Then the contents of the editable region should be "<div>first line</div><br><div align='center'>this is <span>justifiable</span><b>content</b></div> "
98
98
 
99
99
  When I click on the justify right editor button
100
- Then the contents of the editable region should be "<div>first line</div><br><div align='right'>this is <span>justifiable</span> <b>content</b></div>"
100
+ Then the contents of the editable region should be "<div>first line</div><br><div align='right'>this is <span>justifiable</span><b>content</b></div> "
101
101
 
102
102
  When I click on the full justification editor button
103
- Then the contents of the editable region should be "<div>first line</div><br><div align='justify'>this is <span>justifiable</span> <b>content</b></div>"
103
+ Then the contents of the editable region should be "<div>first line</div><br><div align='justify'>this is <span>justifiable</span><b>content</b></div> "
104
104
 
105
105
 
106
106
  # Scenario: A user can make an unordered list
@@ -128,16 +128,16 @@ Feature:
128
128
  And I make a selection
129
129
 
130
130
  When I click on the indent editor button
131
- Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span> <b>content</b></blockquote>"
131
+ Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span><b>content</b></blockquote> "
132
132
 
133
133
  When I click on the indent editor button
134
- Then the contents of the editable region should be "<div>first line</div><br><blockquote><blockquote>this is <span>justifiable</span> <b>content</b></blockquote></blockquote>"
134
+ Then the contents of the editable region should be "<div>first line</div><br><blockquote><blockquote>this is <span>justifiable</span><b>content</b></blockquote></blockquote> "
135
135
 
136
136
  When I click on the outdent editor button
137
- Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span> <b>content</b></blockquote>"
137
+ Then the contents of the editable region should be "<div>first line</div><br><blockquote>this is <span>justifiable</span><b>content</b></blockquote> "
138
138
 
139
139
  When I click on the outdent editor button
140
- Then the contents of the editable region should be "<div>first line</div><br>this is <span>justifiable</span> <b>content</b>"
140
+ Then the contents of the editable region should be "<div>first line</div><br>this is <span>justifiable</span><b>content</b> "
141
141
 
142
142
 
143
143
  # Scenario: A user can insert horizontal rules
@@ -96,8 +96,7 @@ Feature:
96
96
  Then the contents of the editable region should be "<div data-version='4' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jen</strong> likes Miller High Life</div> <b>content</b>"
97
97
 
98
98
 
99
- Scenario: When a user saves, the snippets should be gone from the html, but the options are serialized
100
- Given the options for the example snippet "snippet_42" are first_name: "Hipsters", favorite_beer: "PBR"
101
- And the content of the editable region has that snippet
102
-
103
- When I click on the "Save" button
99
+ # Scenario: When a user saves, the snippets should be gone from the html, but the options are serialized
100
+ # Given the options for the example snippet "snippet_42" are first_name: "Hipsters", favorite_beer: "PBR"
101
+ # And the content of the editable region has that snippet
102
+ # When I click on the "Save" button
@@ -53,7 +53,7 @@ Feature:
53
53
  And fill in "Border" with "2"
54
54
  And fill in "Spacing" with "2"
55
55
  And press "Insert Table"
56
- Then the contents of the editable region should be "this is&nbsp;<table align='right' border='2' cellspacing='2'><tbody><tr><td rowspan='2'>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td colspan='2'>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table> <b>content</b>"
56
+ Then the contents of the editable region should be "this is&nbsp;<table align='right' border='2' cellspacing='2'><tbody><tr><td rowspan='2'><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td colspan='2'><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr></tbody></table> <b>content</b>"
57
57
  And the modal window should not be visible
58
58
 
59
59
 
@@ -63,28 +63,28 @@ Feature:
63
63
 
64
64
  When I click on the add row before editor button
65
65
  Then the table row count should be 3
66
- And the contents of the editable region should be "this is a <table><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
66
+ And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td></tr><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
67
67
 
68
68
  When I click on the add row after editor button
69
69
  Then the table row count should be 4
70
- And the contents of the editable region should be "this is a <table><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
70
+ And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td></tr><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><br></td><td><br></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
71
71
 
72
72
  When I click on the add column before editor button
73
73
  Then the column count should be 3
74
- And the contents of the editable region should be "this is a <table><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><span>1</span></td><td><span>2</span></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
74
+ And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>1</span></td><td><span>2</span></td></tr><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
75
75
 
76
76
  When I click on the add column after editor button
77
77
  Then the column count should be 4
78
- And the contents of the editable region should be "this is a <table><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><span>1</span></td><td>&nbsp;</td><td><span>2</span></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><span>3</span></td><td>&nbsp;</td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
78
+ And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>1</span></td><td><br></td><td><span>2</span></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>3</span></td><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
79
79
 
80
80
  When I click on the delete row editor button
81
81
  Then the table row count should be 3
82
- And the contents of the editable region should be "this is a <table><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><span>3</span></td><td>&nbsp;</td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
82
+ And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>3</span></td><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
83
83
 
84
84
  When I make a selection
85
85
  And click on the delete column editor button
86
86
  Then the table column count should be 3
87
- And the contents of the editable region should be "this is a <table><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
87
+ And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
88
88
 
89
89
 
90
90
  # Scenario: A user can adjust the colspans of a table (in an editable region)
@@ -95,7 +95,7 @@ Feature:
95
95
  Then the contents of the editable region should be "this is a <table><tbody><tr><td colspan='2'><span>1</span></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
96
96
 
97
97
  When I click on the decrease colspan editor button
98
- Then the contents of the editable region should be "this is a <table><tbody><tr><td><span>1</span></td><td>&nbsp;</td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
98
+ Then the contents of the editable region should be "this is a <table><tbody><tr><td><span>1</span></td><td><br></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
99
99
 
100
100
 
101
101
  # Scenario: A user can adjust the rowspans of a table (in an editable region)
@@ -106,4 +106,4 @@ Feature:
106
106
  Then the contents of the editable region should be "this is a <table><tbody><tr><td rowspan='2'><span>1</span></td><td><span>2</span></td></tr><tr><td><span>4</span></td></tr></tbody></table> <b>content</b>"
107
107
 
108
108
  When I click on the decrease rowspan editor button
109
- Then the contents of the editable region should be "this is a <table><tbody><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td>&nbsp;</td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
109
+ Then the contents of the editable region should be "this is a <table><tbody><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"