mercury-rails 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/POST_INSTALL +15 -0
- data/{vendor → app}/assets/images/mercury/button.png +0 -0
- data/{vendor → app}/assets/images/mercury/close.png +0 -0
- data/app/assets/images/mercury/default-snippet.png +0 -0
- data/{vendor → app}/assets/images/mercury/loading-dark.gif +0 -0
- data/{vendor → app}/assets/images/mercury/loading-light.gif +0 -0
- data/{vendor → app}/assets/images/mercury/missing-image.png +0 -0
- data/{vendor → app}/assets/images/mercury/search-icon.png +0 -0
- data/{vendor → app}/assets/images/mercury/temp-logo.png +0 -0
- data/app/assets/images/mercury/toolbar/editable/buttons.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/_expander.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/action.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/preview.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/redo.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/save.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
- data/app/assets/images/mercury/toolbar/snippetable/buttons.png +0 -0
- data/{vendor → app}/assets/javascripts/mercury.js +4 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery-1.7.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.additions.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/liquidmetal.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/showdown.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialog.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/backcolor.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/forecolor.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/style.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/finalize.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/history_buffer.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/lightview.js.coffee +0 -0
- data/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +207 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/da.locale.js.coffee +7 -7
- data/{vendor → app}/assets/javascripts/mercury/locales/de.locale.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/es.locale.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/example.local.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/fr.locale.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/it.locale.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/ko.local.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/nl.locale.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/pt.locale.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/sv.local.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +0 -0
- data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +209 -0
- data/{vendor → app}/assets/javascripts/mercury/mercury.js.coffee +9 -1
- data/{vendor → app}/assets/javascripts/mercury/modal.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/htmleditor.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertlink.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertmedia.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +1 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/native_extensions.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/page_editor.js.coffee +46 -19
- data/{vendor → app}/assets/javascripts/mercury/palette.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/panel.js.coffee +2 -2
- data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
- data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/region.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/regions/editable.js.coffee +5 -5
- data/app/assets/javascripts/mercury/regions/image.js.coffee +114 -0
- data/{vendor → app}/assets/javascripts/mercury/regions/markupable.js.coffee +0 -0
- data/app/assets/javascripts/mercury/regions/simple.js.coffee +325 -0
- data/{vendor → app}/assets/javascripts/mercury/regions/snippetable.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/select.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/snippet.js.coffee +23 -7
- data/{vendor → app}/assets/javascripts/mercury/snippet_toolbar.js.coffee +16 -4
- data/{vendor → app}/assets/javascripts/mercury/statusbar.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/support/history.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/table_editor.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button.js.coffee +8 -8
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button_group.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/toolbar.expander.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/toolbar.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/uploader.js.coffee +35 -17
- data/{vendor → app}/assets/javascripts/mercury_loader.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury_overrides.js +0 -0
- data/{vendor → app}/assets/stylesheets/mercury.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/all_images.css.erb +0 -0
- data/app/assets/stylesheets/mercury/buttons.css +73 -0
- data/{vendor → app}/assets/stylesheets/mercury/dialog.css +13 -4
- data/app/assets/stylesheets/mercury/form.css +125 -0
- data/{vendor → app}/assets/stylesheets/mercury/lightview.css +0 -0
- data/app/assets/stylesheets/mercury/mercury.css +45 -0
- data/{vendor → app}/assets/stylesheets/mercury/modal.css +1 -1
- data/{vendor → app}/assets/stylesheets/mercury/statusbar.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/toolbar.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/tooltip.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/uploader.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury_overrides.css +0 -0
- data/app/views/mercury/modals/character.html +1 -1
- data/app/views/mercury/modals/htmleditor.html +1 -1
- data/app/views/mercury/modals/link.html +1 -1
- data/app/views/mercury/modals/media.html +1 -1
- data/app/views/mercury/modals/table.html +1 -1
- data/app/views/mercury/snippets/example/options.html.erb +1 -1
- data/features/generators/authentication.feature +10 -0
- data/features/generators/images.feature +41 -0
- data/features/generators/install.feature +21 -0
- data/features/loading/loading.feature +4 -1
- data/features/loading/user_interface.feature +9 -7
- data/features/regions/editable/basic_editing.feature +27 -26
- data/features/regions/editable/inserting_links.feature +8 -7
- data/features/regions/editable/inserting_snippets.feature +7 -7
- data/features/regions/image/uploading_images.feature +0 -0
- data/features/regions/simple/basic_editing.feature +5 -0
- data/features/step_definitions/generator_steps.rb +27 -0
- data/features/step_definitions/mercury_steps.rb +1 -0
- data/features/support/aruba.rb +28 -0
- data/features/support/env.rb +12 -2
- data/features/support/mercury_contents.rb +2 -2
- data/lib/generators/mercury/install/authentication/authentication_generator.rb +15 -0
- data/lib/generators/mercury/install/images/images_generator.rb +44 -0
- data/{app/models/mercury/image.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image.rb} +3 -1
- data/{db/migrate/20110526035601_create_mercury_images.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image_migration.rb} +0 -0
- data/{app/controllers/mercury → lib/generators/mercury/install/images/templates}/images_controller.rb +0 -0
- data/lib/generators/mercury/install/{templates → images/templates}/mongoid_paperclip_image.rb +0 -0
- data/lib/generators/mercury/install/install_generator.rb +3 -20
- data/lib/mercury-rails.rb +1 -2
- data/lib/mercury/authentication.rb +1 -0
- data/lib/mercury/engine.rb +17 -0
- data/lib/mercury/rails.rb +4 -0
- data/lib/mercury/version.rb +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +57 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.example.yml +25 -0
- data/spec/dummy/config/database.travisci.yml +4 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/evergreen.rb +47 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/blank.html +1 -0
- data/spec/dummy/public/canvastest.html +103 -0
- data/spec/dummy/public/distro.html +349 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/frame.html +15 -0
- data/spec/dummy/public/images/bunny.gif +0 -0
- data/spec/dummy/public/images/bunny2.jpg +0 -0
- data/spec/dummy/public/index.html +392 -0
- data/spec/dummy/public/prototype.js +6082 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +55 -16
- data/spec/javascripts/mercury/panel_spec.js.coffee +2 -4
- data/spec/javascripts/mercury/regions/image_spec.js.coffee +34 -0
- data/spec/javascripts/mercury/regions/simple_spec.js.coffee +33 -0
- data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +1 -1
- data/spec/javascripts/mercury/snippet_spec.js.coffee +27 -2
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +20 -4
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +30 -0
- data/spec/javascripts/mercury/uploader_spec.js.coffee +16 -0
- data/spec/javascripts/templates/mercury/regions/image.html +1 -0
- data/spec/javascripts/templates/mercury/regions/simple.html +3 -0
- metadata +310 -158
- data/config/engine.rb +0 -41
- data/vendor/assets/images/mercury/default-snippet.png +0 -0
- data/vendor/assets/images/mercury/toolbar/editable/buttons.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/_expander.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/preview.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/redo.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/save.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/undo.png +0 -0
- data/vendor/assets/images/mercury/toolbar/snippetable/buttons.png +0 -0
- data/vendor/assets/stylesheets/mercury/mercury.css +0 -151
@@ -25,7 +25,7 @@ Feature:
|
|
25
25
|
And fill in "Favorite Beer" with "Stella"
|
26
26
|
And press "Insert Snippet"
|
27
27
|
Then the modal window should not be visible
|
28
|
-
And the contents of the editable region should be "this is <div data-version='1' data-snippet='snippet_14' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div><span>simple</span> <b>content</b>"
|
28
|
+
And the contents of the editable region should be "this is <div data-version='1' data-snippet='snippet_14' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div><span>simple</span> <b>content</b>"
|
29
29
|
|
30
30
|
|
31
31
|
Scenario: A user can use the snippet toolbar to remove a snippet
|
@@ -52,7 +52,7 @@ Feature:
|
|
52
52
|
When I fill in "First Name" with "Jeremy"
|
53
53
|
And fill in "Favorite Beer" with "Stella"
|
54
54
|
And press "Insert Snippet"
|
55
|
-
Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
|
55
|
+
Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
|
56
56
|
|
57
57
|
|
58
58
|
Scenario: A user can make changes to a snippets options, and they'll be versioned for undo and redo
|
@@ -63,7 +63,7 @@ Feature:
|
|
63
63
|
And I fill in "First Name" with "Jeremy"
|
64
64
|
And fill in "Favorite Beer" with "Stella"
|
65
65
|
And press "Insert Snippet"
|
66
|
-
Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
|
66
|
+
Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
|
67
67
|
|
68
68
|
When I edit the snippet
|
69
69
|
Then the "First Name" field should contain "Jeremy"
|
@@ -72,10 +72,10 @@ Feature:
|
|
72
72
|
When fill in "First Name" with "Diesel"
|
73
73
|
And fill in "Favorite Beer" with "Bells Hopslam"
|
74
74
|
And press "Insert Snippet"
|
75
|
-
Then the content of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
|
75
|
+
Then the content of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
|
76
76
|
|
77
77
|
When I click on the "Undo" button
|
78
|
-
Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
|
78
|
+
Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
|
79
79
|
|
80
80
|
When I edit the snippet
|
81
81
|
# todo: this is a bug
|
@@ -84,7 +84,7 @@ Feature:
|
|
84
84
|
|
85
85
|
When I close the modal
|
86
86
|
When I click on the "Redo" button
|
87
|
-
Then the contents of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
|
87
|
+
Then the contents of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
|
88
88
|
|
89
89
|
When I edit the snippet
|
90
90
|
Then the "First Name" field should contain "Diesel"
|
@@ -93,7 +93,7 @@ Feature:
|
|
93
93
|
When I fill in "First Name" with "Jen"
|
94
94
|
And fill in "Favorite Beer" with "Miller High Life"
|
95
95
|
And press "Insert Snippet"
|
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>"
|
96
|
+
Then the contents of the editable region should be "<div data-version='4' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jen</strong> likes Miller High Life</div> <b>content</b>"
|
97
97
|
|
98
98
|
|
99
99
|
# Scenario: When a user saves, the snippets should be gone from the html, but the options are serialized
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
When /^I add Mercury as a gem dependency$/ do
|
2
|
+
append_to_file('Gemfile', %{\ngem "mercury-rails", :path => "#{File.expand_path('../../../', __FILE__)}"\n})
|
3
|
+
end
|
4
|
+
|
5
|
+
When "I have created a new rails application" do
|
6
|
+
step %{I reset Bundler environment variable}
|
7
|
+
step %{I successfully run `bundle exec rails new testapp --skip-bundle`}
|
8
|
+
step %{I cd to "testapp"}
|
9
|
+
step %{I add Mercury as a gem dependency}
|
10
|
+
step %{I run `bundle install --local`}
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^the file "([^"]*)" should contain:$/ do |file, partial_content|
|
14
|
+
check_file_content(file, partial_content, true)
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^should have the migration "([^"]*)"$/ do |migration|
|
18
|
+
in_current_dir do
|
19
|
+
Dir["db/migrate/*_#{migration}"].length.should == 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^should not have the migration "([^"]*)"$/ do |migration|
|
24
|
+
in_current_dir do
|
25
|
+
Dir["db/migrate/*_#{migration}"].length.should == 0
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
BUNDLE_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE)
|
2
|
+
ORIGINAL_BUNDLE_VARS = Hash[ENV.select{ |key,value| BUNDLE_ENV_VARS.include?(key) }]
|
3
|
+
|
4
|
+
Before do
|
5
|
+
if ! ENV['BUNDLE_GEMFILE'].include?(Dir.pwd)
|
6
|
+
ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, ENV['BUNDLE_GEMFILE'])
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
After do
|
11
|
+
ORIGINAL_BUNDLE_VARS.each_pair do |key, value|
|
12
|
+
ENV[key] = value
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
When /^I reset Bundler environment variable$/ do
|
17
|
+
BUNDLE_ENV_VARS.each do |key|
|
18
|
+
ENV[key] = nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Before do
|
23
|
+
@aruba_timeout_seconds = 20
|
24
|
+
end
|
25
|
+
|
26
|
+
Before('@slow') do
|
27
|
+
@aruba_timeout_seconds = 180
|
28
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -4,14 +4,16 @@
|
|
4
4
|
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
5
|
# files.
|
6
6
|
|
7
|
+
ENV["RAILS_ROOT"] = File.expand_path('../../../spec/dummy', __FILE__)
|
7
8
|
require 'cucumber/rails'
|
8
|
-
require 'capybara/firebug'
|
9
|
+
# require 'capybara/firebug'
|
10
|
+
require 'aruba/cucumber'
|
9
11
|
|
10
12
|
# You can enable firebug in your tests by tagging them @firebug.
|
11
13
|
# To change the version of firebug use the FIREBUG_VERSION environment variable.
|
12
14
|
# For firefox 4+ use 1.7.0
|
13
15
|
# For firefox 3 use 1.6.2
|
14
|
-
Selenium::WebDriver::Firefox::Profile.firebug_version = ENV['FIREBUG_VERSION'] || '1.8.3'
|
16
|
+
# Selenium::WebDriver::Firefox::Profile.firebug_version = ENV['FIREBUG_VERSION'] || '1.8.3'
|
15
17
|
|
16
18
|
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
17
19
|
# order to ease the transition to Capybara we set the default here. If you'd
|
@@ -44,3 +46,11 @@ begin
|
|
44
46
|
rescue NameError
|
45
47
|
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
46
48
|
end
|
49
|
+
|
50
|
+
Before('@use_hidden_elements') do
|
51
|
+
Capybara.ignore_hidden_elements = false
|
52
|
+
end
|
53
|
+
|
54
|
+
After('@use_hidden_elements') do
|
55
|
+
Capybara.ignore_hidden_elements = true
|
56
|
+
end
|
@@ -2,7 +2,7 @@ module MercuryContentsHelpers
|
|
2
2
|
def contents_for(name)
|
3
3
|
case name
|
4
4
|
when 'simple content' then "this is <span>simple</span> <b>content</b>"
|
5
|
-
when 'justifiable content' then "<div>first line</div><br/>this is <span>justifiable</span
|
5
|
+
when 'justifiable content' then "<div>first line</div><br/>this is <span>justifiable</span><b>content</b>"
|
6
6
|
when 'wrapped content' then "<span>this <a href='http://google.com'>is</a> <i>wrapped</i> <b>content</b></span>"
|
7
7
|
when 'an image' then "this is <img src='/assets/mercury/temp-logo.png'> <b>content</b>"
|
8
8
|
when 'a table' then "this is a <table><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></table> <b>content</b>"
|
@@ -22,4 +22,4 @@ module MercuryContentsHelpers
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
World(MercuryContentsHelpers)
|
25
|
+
World(MercuryContentsHelpers)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Mercury
|
2
|
+
module Generators
|
3
|
+
module Install
|
4
|
+
class AuthenticationGenerator < Rails::Generators::Base
|
5
|
+
source_root Mercury::Engine.root
|
6
|
+
|
7
|
+
desc "Installs an authentication example so you can restrict access to editing."
|
8
|
+
|
9
|
+
def copy_authentication_overrides
|
10
|
+
copy_file 'lib/mercury/authentication.rb'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
module Mercury
|
3
|
+
module Generators
|
4
|
+
module Install
|
5
|
+
class ImagesGenerator < Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
|
9
|
+
desc "Installs image processing migrations and model."
|
10
|
+
|
11
|
+
class_option :orm, :default => 'active_record', :banner => 'mongoid',
|
12
|
+
:desc => 'ORM for required models -- active_record, or mongoid'
|
13
|
+
|
14
|
+
def copy_models
|
15
|
+
if options[:orm] == 'mongoid'
|
16
|
+
copy_file 'mongoid_paperclip_image.rb', 'app/models/mercury/image.rb'
|
17
|
+
else
|
18
|
+
copy_file 'ar_paperclip_image.rb', 'app/models/mercury/image.rb'
|
19
|
+
migration_template 'ar_paperclip_image_migration.rb', 'db/migrate/create_mercury_images.rb'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def copy_controller
|
24
|
+
copy_file 'images_controller.rb', 'app/controllers/mercury/images_controller.rb'
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_routes
|
28
|
+
route %Q{ namespace :mercury do
|
29
|
+
resources :images
|
30
|
+
end}
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_gemfile_dependencies
|
34
|
+
prepend_to_file "Gemfile", %Q{gem 'paperclip'}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Implement the required interface for Rails::Generators::Migration.
|
38
|
+
def self.next_migration_number(dirname) #:nodoc:
|
39
|
+
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -2,7 +2,9 @@ class Mercury::Image < ActiveRecord::Base
|
|
2
2
|
|
3
3
|
self.table_name = :mercury_images
|
4
4
|
|
5
|
-
has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }
|
5
|
+
has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" },
|
6
|
+
:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
|
7
|
+
:url => "/system/:attachment/:id/:style/:filename"
|
6
8
|
|
7
9
|
delegate :url, :to => :image
|
8
10
|
|
File without changes
|
File without changes
|
data/lib/generators/mercury/install/{templates → images/templates}/mongoid_paperclip_image.rb
RENAMED
File without changes
|
@@ -5,38 +5,21 @@ module Mercury
|
|
5
5
|
|
6
6
|
desc "Installs Mercury into your application by copying the configuration file."
|
7
7
|
|
8
|
-
class_option :orm, :default => 'active_record', :banner => 'mongoid',
|
9
|
-
:desc => 'ORM for required models -- active_record, or mongoid'
|
10
|
-
|
11
8
|
class_option :full, :type => :boolean, :aliases => '-g',
|
12
9
|
:desc => 'Full installation will install the layout and css overrides for easier customization.'
|
13
10
|
|
14
11
|
def copy_config
|
15
|
-
copy_file '
|
12
|
+
copy_file 'app/assets/javascripts/mercury.js', 'app/assets/javascripts/mercury.js'
|
16
13
|
end
|
17
14
|
|
18
15
|
def add_routes
|
19
|
-
route %Q{Mercury::Engine
|
20
|
-
end
|
21
|
-
|
22
|
-
def copy_models
|
23
|
-
if options[:orm] == 'mongoid'
|
24
|
-
copy_file 'lib/generators/mercury/install/templates/mongoid_paperclip_image.rb', 'app/models/mercury/image.rb'
|
25
|
-
else
|
26
|
-
copy_file 'app/models/mercury/image.rb' if options[:full]
|
27
|
-
end
|
16
|
+
route %Q{mount Mercury::Engine => '/'}
|
28
17
|
end
|
29
18
|
|
30
19
|
def copy_layout_and_css_overrides
|
31
20
|
if options[:full] || yes?("Install the layout and CSS overrides files? [yN]")
|
32
21
|
copy_file 'app/views/layouts/mercury.html.erb', 'app/views/layouts/mercury.html.erb'
|
33
|
-
copy_file '
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def copy_authentication_overrides
|
38
|
-
if options[:full] || yes?("Install the authentication file so you can restrict access to editing? [yN]")
|
39
|
-
copy_file 'lib/mercury/authentication.rb'
|
22
|
+
copy_file 'app/assets/stylesheets/mercury_overrides.css', 'app/assets/stylesheets/mercury_overrides.css'
|
40
23
|
end
|
41
24
|
end
|
42
25
|
|
data/lib/mercury-rails.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module Mercury
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
|
6
|
+
# Additional application configuration to include precompiled assets.
|
7
|
+
initializer :assets, :group => :all do |app|
|
8
|
+
app.config.assets.precompile += %w( mercury.js mercury.css mercury_overrides.css mercury_overrides.js )
|
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
|
+
end
|
17
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require
|
6
|
+
require "mercury-rails"
|
7
|
+
require 'evergreen/rails'
|
8
|
+
|
9
|
+
module Dummy
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
+
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
+
|
22
|
+
# Activate observers that should always be running.
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
+
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
+
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
+
# config.i18n.default_locale = :de
|
32
|
+
|
33
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
34
|
+
config.encoding = "utf-8"
|
35
|
+
|
36
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
37
|
+
config.filter_parameters += [:password]
|
38
|
+
|
39
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
40
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
41
|
+
# like if you have constraints or database-specific column types
|
42
|
+
# config.active_record.schema_format = :sql
|
43
|
+
|
44
|
+
# Enforce whitelist mode for mass assignment.
|
45
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
46
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
47
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
48
|
+
config.active_record.whitelist_attributes = true
|
49
|
+
|
50
|
+
# Enable the asset pipeline
|
51
|
+
config.assets.enabled = true
|
52
|
+
|
53
|
+
# Version of your assets, change this if you want to expire all your assets
|
54
|
+
config.assets.version = '1.0'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|