mercury-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +152 -0
  3. data/VERSION +1 -0
  4. data/app/assets/images/mercury/button.png +0 -0
  5. data/app/assets/images/mercury/clippy.png +0 -0
  6. data/app/assets/images/mercury/default-snippet.png +0 -0
  7. data/app/assets/images/mercury/loading-dark.gif +0 -0
  8. data/app/assets/images/mercury/loading-light.gif +0 -0
  9. data/app/assets/images/mercury/search-icon.png +0 -0
  10. data/app/assets/images/mercury/toolbar/editable/buttons.png +0 -0
  11. data/app/assets/images/mercury/toolbar/markupable/buttons.png +0 -0
  12. data/app/assets/images/mercury/toolbar/primary/_expander.png +0 -0
  13. data/app/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
  14. data/app/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
  15. data/app/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
  16. data/app/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
  17. data/app/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
  18. data/app/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
  19. data/app/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
  20. data/app/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
  21. data/app/assets/images/mercury/toolbar/primary/objectspanel.png +0 -0
  22. data/app/assets/images/mercury/toolbar/primary/preview.png +0 -0
  23. data/app/assets/images/mercury/toolbar/primary/redo.png +0 -0
  24. data/app/assets/images/mercury/toolbar/primary/save.png +0 -0
  25. data/app/assets/images/mercury/toolbar/primary/todospanel.png +0 -0
  26. data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
  27. data/app/assets/images/mercury/toolbar/snippetable/buttons.png +0 -0
  28. data/app/assets/javascripts/mercury.js +30 -0
  29. data/app/assets/javascripts/mercury/dialog.js.coffee +75 -0
  30. data/app/assets/javascripts/mercury/dialogs/backcolor.js.coffee +6 -0
  31. data/app/assets/javascripts/mercury/dialogs/forecolor.js.coffee +6 -0
  32. data/app/assets/javascripts/mercury/dialogs/formatblock.js.coffee +4 -0
  33. data/app/assets/javascripts/mercury/dialogs/objectspanel.js.coffee +10 -0
  34. data/app/assets/javascripts/mercury/dialogs/style.js.coffee +4 -0
  35. data/app/assets/javascripts/mercury/history_buffer.js.coffee +30 -0
  36. data/app/assets/javascripts/mercury/mercury.js.coffee +293 -0
  37. data/app/assets/javascripts/mercury/modal.js.coffee +177 -0
  38. data/app/assets/javascripts/mercury/modals/htmleditor.js.coffee +10 -0
  39. data/app/assets/javascripts/mercury/modals/insertcharacter.js.coffee +4 -0
  40. data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +92 -0
  41. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +72 -0
  42. data/app/assets/javascripts/mercury/modals/insertsnippet.js.coffee +11 -0
  43. data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +56 -0
  44. data/app/assets/javascripts/mercury/native_extensions.js.coffee +47 -0
  45. data/app/assets/javascripts/mercury/page_editor.js.coffee +139 -0
  46. data/app/assets/javascripts/mercury/palette.js.coffee +29 -0
  47. data/app/assets/javascripts/mercury/panel.js.coffee +97 -0
  48. data/app/assets/javascripts/mercury/region.js.coffee +103 -0
  49. data/app/assets/javascripts/mercury/regions/editable.js.coffee +546 -0
  50. data/app/assets/javascripts/mercury/regions/markupable.js.coffee +380 -0
  51. data/app/assets/javascripts/mercury/regions/snippetable.js.coffee +127 -0
  52. data/app/assets/javascripts/mercury/select.js.coffee +40 -0
  53. data/app/assets/javascripts/mercury/snippet.js.coffee +92 -0
  54. data/app/assets/javascripts/mercury/snippet_toolbar.js.coffee +69 -0
  55. data/app/assets/javascripts/mercury/statusbar.js.coffee +25 -0
  56. data/app/assets/javascripts/mercury/table_editor.js.coffee +266 -0
  57. data/app/assets/javascripts/mercury/toolbar.button.js.coffee +152 -0
  58. data/app/assets/javascripts/mercury/toolbar.button_group.js.coffee +42 -0
  59. data/app/assets/javascripts/mercury/toolbar.expander.js.coffee +56 -0
  60. data/app/assets/javascripts/mercury/toolbar.js.coffee +72 -0
  61. data/app/assets/javascripts/mercury/tooltip.js.coffee +67 -0
  62. data/app/assets/javascripts/mercury/uploader.js.coffee +213 -0
  63. data/app/assets/javascripts/mercury/websocket.js.coffee +34 -0
  64. data/app/assets/stylesheets/mercury.css +31 -0
  65. data/app/assets/stylesheets/mercury/dialog.scss +178 -0
  66. data/app/assets/stylesheets/mercury/mercury.scss +119 -0
  67. data/app/assets/stylesheets/mercury/modal.scss +192 -0
  68. data/app/assets/stylesheets/mercury/statusbar.scss +23 -0
  69. data/app/assets/stylesheets/mercury/toolbar.scss +417 -0
  70. data/app/assets/stylesheets/mercury/tooltip.scss +26 -0
  71. data/app/assets/stylesheets/mercury/uploader.scss +109 -0
  72. data/app/controllers/images_controller.rb +19 -0
  73. data/app/controllers/mercury_controller.rb +20 -0
  74. data/app/models/image.rb +14 -0
  75. data/app/views/layouts/mercury.html.haml +12 -0
  76. data/app/views/mercury/modals/character.html.haml +252 -0
  77. data/app/views/mercury/modals/htmleditor.html.haml +8 -0
  78. data/app/views/mercury/modals/link.html.haml +31 -0
  79. data/app/views/mercury/modals/media.html.haml +33 -0
  80. data/app/views/mercury/modals/sanitizer.html.haml +4 -0
  81. data/app/views/mercury/modals/table.html.haml +49 -0
  82. data/app/views/mercury/palettes/backcolor.html.haml +79 -0
  83. data/app/views/mercury/palettes/forecolor.html.haml +79 -0
  84. data/app/views/mercury/panels/history.html.haml +0 -0
  85. data/app/views/mercury/panels/notes.html.haml +0 -0
  86. data/app/views/mercury/panels/snippets.html.haml +10 -0
  87. data/app/views/mercury/selects/formatblock.html.haml +10 -0
  88. data/app/views/mercury/selects/style.html.haml +4 -0
  89. data/app/views/mercury/snippets/example.html.haml +2 -0
  90. data/app/views/mercury/snippets/example_options.html.haml +16 -0
  91. data/config/engine.rb +6 -0
  92. data/config/routes.rb +15 -0
  93. data/db/migrate/20110526035601_create_images.rb +11 -0
  94. data/features/editing/basic.feature +11 -0
  95. data/features/step_definitions/debug_steps.rb +14 -0
  96. data/features/step_definitions/web_steps.rb +211 -0
  97. data/features/support/env.rb +46 -0
  98. data/features/support/paths.rb +35 -0
  99. data/features/support/selectors.rb +42 -0
  100. data/lib/mercury-rails.rb +4 -0
  101. data/log/.gitkeep +0 -0
  102. data/mercury-rails.gemspec +230 -0
  103. data/spec/javascripts/mercury/dialog_spec.js.coffee +258 -0
  104. data/spec/javascripts/mercury/history_buffer_spec.js.coffee +79 -0
  105. data/spec/javascripts/mercury/mercury_spec.js.coffee +52 -0
  106. data/spec/javascripts/mercury/native_extensions_spec.js.coffee +66 -0
  107. data/spec/javascripts/mercury/page_editor_spec.js.coffee +435 -0
  108. data/spec/javascripts/mercury/palette_spec.js.coffee +51 -0
  109. data/spec/javascripts/mercury/panel_spec.js.coffee +147 -0
  110. data/spec/javascripts/mercury/region_spec.js.coffee +261 -0
  111. data/spec/javascripts/mercury/regions/_editable_.js.coffee +0 -0
  112. data/spec/javascripts/mercury/regions/_markupable_.js.coffee +0 -0
  113. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +368 -0
  114. data/spec/javascripts/mercury/select_spec.js.coffee +51 -0
  115. data/spec/javascripts/mercury/snippet_spec.js.coffee +246 -0
  116. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +186 -0
  117. data/spec/javascripts/mercury/statusbar_spec.js.coffee +78 -0
  118. data/spec/javascripts/mercury/table_editor_spec.js.coffee +192 -0
  119. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +92 -0
  120. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +341 -0
  121. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +120 -0
  122. data/spec/javascripts/mercury/toolbar_spec.js.coffee +152 -0
  123. data/spec/javascripts/mercury/tooltip_spec.js.coffee +188 -0
  124. data/spec/javascripts/mercury/uploader_spec.js.coffee +512 -0
  125. data/spec/javascripts/responses/blank.html +1 -0
  126. data/spec/javascripts/spec_helper.js +513 -0
  127. data/spec/javascripts/templates/mercury/dialog.html +2 -0
  128. data/spec/javascripts/templates/mercury/page_editor.html +24 -0
  129. data/spec/javascripts/templates/mercury/palette.html +16 -0
  130. data/spec/javascripts/templates/mercury/panel.html +16 -0
  131. data/spec/javascripts/templates/mercury/region.html +2 -0
  132. data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
  133. data/spec/javascripts/templates/mercury/select.html +16 -0
  134. data/spec/javascripts/templates/mercury/snippet.html +1 -0
  135. data/spec/javascripts/templates/mercury/snippet_toolbar.html +16 -0
  136. data/spec/javascripts/templates/mercury/statusbar.html +7 -0
  137. data/spec/javascripts/templates/mercury/table_editor.html +65 -0
  138. data/spec/javascripts/templates/mercury/toolbar.button.html +64 -0
  139. data/spec/javascripts/templates/mercury/toolbar.button_group.html +9 -0
  140. data/spec/javascripts/templates/mercury/toolbar.expander.html +18 -0
  141. data/spec/javascripts/templates/mercury/toolbar.html +10 -0
  142. data/spec/javascripts/templates/mercury/tooltip.html +12 -0
  143. data/spec/javascripts/templates/mercury/uploader.html +11 -0
  144. data/vendor/assets/javascripts/jquery-1.6.js +8865 -0
  145. data/vendor/assets/javascripts/jquery-ui-1.8.13.custom.min.js +249 -0
  146. data/vendor/assets/javascripts/jquery-ui-1.8.13.sortable.custom.js +1078 -0
  147. data/vendor/assets/javascripts/jquery.easing.js +173 -0
  148. data/vendor/assets/javascripts/jquery.json2.js +178 -0
  149. data/vendor/assets/javascripts/jquery.serialize_object.js +16 -0
  150. data/vendor/assets/javascripts/jquery.ujs.js +289 -0
  151. data/vendor/assets/javascripts/liquidmetal.js +88 -0
  152. data/vendor/assets/javascripts/showdown.js +1362 -0
  153. metadata +364 -0
@@ -0,0 +1,46 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+ require 'cucumber/rails'
8
+ require 'capybara/firebug'
9
+
10
+ # You can enable firebug in your tests by tagging them @firebug.
11
+ # To change the version of firebug use the FIREBUG_VERSION environment variable.
12
+ # For firefox 4 use 1.7.0
13
+ # For firefox 3 use 1.6.2
14
+ Selenium::WebDriver::Firefox::Profile.firebug_version = ENV['FIREBUG_VERSION'] || '1.7.0'
15
+
16
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
17
+ # order to ease the transition to Capybara we set the default here. If you'd
18
+ # prefer to use XPath just remove this line and adjust any selectors in your
19
+ # steps to use the XPath syntax.
20
+ Capybara.default_selector = :css
21
+
22
+ # By default, any exception happening in your Rails application will bubble up
23
+ # to Cucumber so that your scenario will fail. This is a different from how
24
+ # your application behaves in the production environment, where an error page will
25
+ # be rendered instead.
26
+ #
27
+ # Sometimes we want to override this default behaviour and allow Rails to rescue
28
+ # exceptions and display an error page (just like when the app is running in production).
29
+ # Typical scenarios where you want to do this is when you test your error pages.
30
+ # There are two ways to allow Rails to rescue exceptions:
31
+ #
32
+ # 1) Tag your scenario (or feature) with @allow-rescue
33
+ #
34
+ # 2) Set the value below to true. Beware that doing this globally is not
35
+ # recommended as it will mask a lot of errors for you!
36
+ #
37
+ ActionController::Base.allow_rescue = false
38
+
39
+ # Remove/comment out the lines below if your app doesn't have a database.
40
+ # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
41
+ begin
42
+ DatabaseCleaner.strategy = :transaction
43
+ rescue NameError
44
+ raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
45
+ end
46
+
@@ -0,0 +1,35 @@
1
+ module NavigationHelpers
2
+ # Maps a name to a path. Used by the
3
+ #
4
+ # When /^I go to (.+)$/ do |page_name|
5
+ #
6
+ # step definition in web_steps.rb
7
+ #
8
+ def path_to(page_name)
9
+ case page_name
10
+
11
+ when 'an edit page' then '/edit'
12
+
13
+ when /the home\s?page/ then '/'
14
+ when /the url: "(.*)"/ then url_for($1)
15
+
16
+ # Add more mappings here.
17
+ # Here is an example that pulls values out of the Regexp:
18
+ #
19
+ # when /^(.*)'s profile page$/i
20
+ # user_profile_path(User.find_by_login($1))
21
+
22
+ else
23
+ begin
24
+ page_name =~ /the (.*) page/
25
+ path_components = $1.split(/\s+/)
26
+ self.send(path_components.push('path').join('_').to_sym)
27
+ rescue Object => e
28
+ raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
29
+ "Now, go and add a mapping in #{__FILE__}"
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ World(NavigationHelpers)
@@ -0,0 +1,42 @@
1
+ module HtmlSelectorsHelpers
2
+ # Maps a name to a selector. Used primarily by the
3
+ #
4
+ # When /^(.+) within (.+)$/ do |step, scope|
5
+ #
6
+ # step definitions in web_steps.rb
7
+ #
8
+ def selector_for(locator)
9
+ case locator
10
+
11
+ when 'the toolbar'
12
+ '.mercury-toolbar-container'
13
+
14
+ when /the page/
15
+ "html > body"
16
+
17
+ # Add more mappings here.
18
+ # Here is an example that pulls values out of the Regexp:
19
+ #
20
+ # when /the (notice|error|info) flash/
21
+ # ".flash.#{$1}"
22
+
23
+ # You can also return an array to use a different selector
24
+ # type, like:
25
+ #
26
+ # when /the header/
27
+ # [:xpath, "//header"]
28
+
29
+ # This allows you to provide a quoted selector as the scope
30
+ # for "within" steps as was previously the default for the
31
+ # web steps:
32
+ when /"(.+)"/
33
+ $1
34
+
35
+ else
36
+ raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
37
+ "Now, go and add a mapping in #{__FILE__}"
38
+ end
39
+ end
40
+ end
41
+
42
+ World(HtmlSelectorsHelpers)
@@ -0,0 +1,4 @@
1
+ require 'paperclip'
2
+ require 'formtastic'
3
+
4
+ require File.expand_path('../config/engine', File.dirname(__FILE__))
data/log/.gitkeep ADDED
File without changes
@@ -0,0 +1,230 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{mercury-rails}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jeremy Jackson"]
12
+ s.date = %q{2011-06-17}
13
+ s.description = %q{A fully featured and advanced HTML5 WYSIWYG editor written in CoffeeScript on top of Rails 3.1}
14
+ s.email = %q{jejacks0n@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ "LICENSE",
21
+ "README.rdoc",
22
+ "VERSION",
23
+ "app/assets/images/mercury/button.png",
24
+ "app/assets/images/mercury/clippy.png",
25
+ "app/assets/images/mercury/default-snippet.png",
26
+ "app/assets/images/mercury/loading-dark.gif",
27
+ "app/assets/images/mercury/loading-light.gif",
28
+ "app/assets/images/mercury/search-icon.png",
29
+ "app/assets/images/mercury/toolbar/editable/buttons.png",
30
+ "app/assets/images/mercury/toolbar/markupable/buttons.png",
31
+ "app/assets/images/mercury/toolbar/primary/_expander.png",
32
+ "app/assets/images/mercury/toolbar/primary/_pressed.png",
33
+ "app/assets/images/mercury/toolbar/primary/historypanel.png",
34
+ "app/assets/images/mercury/toolbar/primary/insertcharacter.png",
35
+ "app/assets/images/mercury/toolbar/primary/insertlink.png",
36
+ "app/assets/images/mercury/toolbar/primary/insertmedia.png",
37
+ "app/assets/images/mercury/toolbar/primary/inserttable.png",
38
+ "app/assets/images/mercury/toolbar/primary/inspectorpanel.png",
39
+ "app/assets/images/mercury/toolbar/primary/notespanel.png",
40
+ "app/assets/images/mercury/toolbar/primary/objectspanel.png",
41
+ "app/assets/images/mercury/toolbar/primary/preview.png",
42
+ "app/assets/images/mercury/toolbar/primary/redo.png",
43
+ "app/assets/images/mercury/toolbar/primary/save.png",
44
+ "app/assets/images/mercury/toolbar/primary/todospanel.png",
45
+ "app/assets/images/mercury/toolbar/primary/undo.png",
46
+ "app/assets/images/mercury/toolbar/snippetable/buttons.png",
47
+ "app/assets/javascripts/mercury.js",
48
+ "app/assets/javascripts/mercury/dialog.js.coffee",
49
+ "app/assets/javascripts/mercury/dialogs/backcolor.js.coffee",
50
+ "app/assets/javascripts/mercury/dialogs/forecolor.js.coffee",
51
+ "app/assets/javascripts/mercury/dialogs/formatblock.js.coffee",
52
+ "app/assets/javascripts/mercury/dialogs/objectspanel.js.coffee",
53
+ "app/assets/javascripts/mercury/dialogs/style.js.coffee",
54
+ "app/assets/javascripts/mercury/history_buffer.js.coffee",
55
+ "app/assets/javascripts/mercury/mercury.js.coffee",
56
+ "app/assets/javascripts/mercury/modal.js.coffee",
57
+ "app/assets/javascripts/mercury/modals/htmleditor.js.coffee",
58
+ "app/assets/javascripts/mercury/modals/insertcharacter.js.coffee",
59
+ "app/assets/javascripts/mercury/modals/insertlink.js.coffee",
60
+ "app/assets/javascripts/mercury/modals/insertmedia.js.coffee",
61
+ "app/assets/javascripts/mercury/modals/insertsnippet.js.coffee",
62
+ "app/assets/javascripts/mercury/modals/inserttable.js.coffee",
63
+ "app/assets/javascripts/mercury/native_extensions.js.coffee",
64
+ "app/assets/javascripts/mercury/page_editor.js.coffee",
65
+ "app/assets/javascripts/mercury/palette.js.coffee",
66
+ "app/assets/javascripts/mercury/panel.js.coffee",
67
+ "app/assets/javascripts/mercury/region.js.coffee",
68
+ "app/assets/javascripts/mercury/regions/editable.js.coffee",
69
+ "app/assets/javascripts/mercury/regions/markupable.js.coffee",
70
+ "app/assets/javascripts/mercury/regions/snippetable.js.coffee",
71
+ "app/assets/javascripts/mercury/select.js.coffee",
72
+ "app/assets/javascripts/mercury/snippet.js.coffee",
73
+ "app/assets/javascripts/mercury/snippet_toolbar.js.coffee",
74
+ "app/assets/javascripts/mercury/statusbar.js.coffee",
75
+ "app/assets/javascripts/mercury/table_editor.js.coffee",
76
+ "app/assets/javascripts/mercury/toolbar.button.js.coffee",
77
+ "app/assets/javascripts/mercury/toolbar.button_group.js.coffee",
78
+ "app/assets/javascripts/mercury/toolbar.expander.js.coffee",
79
+ "app/assets/javascripts/mercury/toolbar.js.coffee",
80
+ "app/assets/javascripts/mercury/tooltip.js.coffee",
81
+ "app/assets/javascripts/mercury/uploader.js.coffee",
82
+ "app/assets/javascripts/mercury/websocket.js.coffee",
83
+ "app/assets/stylesheets/mercury.css",
84
+ "app/assets/stylesheets/mercury/dialog.scss",
85
+ "app/assets/stylesheets/mercury/mercury.scss",
86
+ "app/assets/stylesheets/mercury/modal.scss",
87
+ "app/assets/stylesheets/mercury/statusbar.scss",
88
+ "app/assets/stylesheets/mercury/toolbar.scss",
89
+ "app/assets/stylesheets/mercury/tooltip.scss",
90
+ "app/assets/stylesheets/mercury/uploader.scss",
91
+ "app/controllers/images_controller.rb",
92
+ "app/controllers/mercury_controller.rb",
93
+ "app/models/image.rb",
94
+ "app/views/layouts/mercury.html.haml",
95
+ "app/views/mercury/modals/character.html.haml",
96
+ "app/views/mercury/modals/htmleditor.html.haml",
97
+ "app/views/mercury/modals/link.html.haml",
98
+ "app/views/mercury/modals/media.html.haml",
99
+ "app/views/mercury/modals/sanitizer.html.haml",
100
+ "app/views/mercury/modals/table.html.haml",
101
+ "app/views/mercury/palettes/backcolor.html.haml",
102
+ "app/views/mercury/palettes/forecolor.html.haml",
103
+ "app/views/mercury/panels/history.html.haml",
104
+ "app/views/mercury/panels/notes.html.haml",
105
+ "app/views/mercury/panels/snippets.html.haml",
106
+ "app/views/mercury/selects/formatblock.html.haml",
107
+ "app/views/mercury/selects/style.html.haml",
108
+ "app/views/mercury/snippets/example.html.haml",
109
+ "app/views/mercury/snippets/example_options.html.haml",
110
+ "config/engine.rb",
111
+ "config/routes.rb",
112
+ "db/migrate/20110526035601_create_images.rb",
113
+ "features/editing/basic.feature",
114
+ "features/step_definitions/debug_steps.rb",
115
+ "features/step_definitions/web_steps.rb",
116
+ "features/support/env.rb",
117
+ "features/support/paths.rb",
118
+ "features/support/selectors.rb",
119
+ "lib/mercury-rails.rb",
120
+ "log/.gitkeep",
121
+ "mercury-rails.gemspec",
122
+ "spec/javascripts/mercury/dialog_spec.js.coffee",
123
+ "spec/javascripts/mercury/history_buffer_spec.js.coffee",
124
+ "spec/javascripts/mercury/mercury_spec.js.coffee",
125
+ "spec/javascripts/mercury/native_extensions_spec.js.coffee",
126
+ "spec/javascripts/mercury/page_editor_spec.js.coffee",
127
+ "spec/javascripts/mercury/palette_spec.js.coffee",
128
+ "spec/javascripts/mercury/panel_spec.js.coffee",
129
+ "spec/javascripts/mercury/region_spec.js.coffee",
130
+ "spec/javascripts/mercury/regions/_editable_.js.coffee",
131
+ "spec/javascripts/mercury/regions/_markupable_.js.coffee",
132
+ "spec/javascripts/mercury/regions/snippetable_spec.js.coffee",
133
+ "spec/javascripts/mercury/select_spec.js.coffee",
134
+ "spec/javascripts/mercury/snippet_spec.js.coffee",
135
+ "spec/javascripts/mercury/snippet_toolbar_spec.js.coffee",
136
+ "spec/javascripts/mercury/statusbar_spec.js.coffee",
137
+ "spec/javascripts/mercury/table_editor_spec.js.coffee",
138
+ "spec/javascripts/mercury/toolbar.button_group_spec.js.coffee",
139
+ "spec/javascripts/mercury/toolbar.button_spec.js.coffee",
140
+ "spec/javascripts/mercury/toolbar.expander_spec.js.coffee",
141
+ "spec/javascripts/mercury/toolbar_spec.js.coffee",
142
+ "spec/javascripts/mercury/tooltip_spec.js.coffee",
143
+ "spec/javascripts/mercury/uploader_spec.js.coffee",
144
+ "spec/javascripts/responses/blank.html",
145
+ "spec/javascripts/spec_helper.js",
146
+ "spec/javascripts/templates/mercury/dialog.html",
147
+ "spec/javascripts/templates/mercury/page_editor.html",
148
+ "spec/javascripts/templates/mercury/palette.html",
149
+ "spec/javascripts/templates/mercury/panel.html",
150
+ "spec/javascripts/templates/mercury/region.html",
151
+ "spec/javascripts/templates/mercury/regions/snippetable.html",
152
+ "spec/javascripts/templates/mercury/select.html",
153
+ "spec/javascripts/templates/mercury/snippet.html",
154
+ "spec/javascripts/templates/mercury/snippet_toolbar.html",
155
+ "spec/javascripts/templates/mercury/statusbar.html",
156
+ "spec/javascripts/templates/mercury/table_editor.html",
157
+ "spec/javascripts/templates/mercury/toolbar.button.html",
158
+ "spec/javascripts/templates/mercury/toolbar.button_group.html",
159
+ "spec/javascripts/templates/mercury/toolbar.expander.html",
160
+ "spec/javascripts/templates/mercury/toolbar.html",
161
+ "spec/javascripts/templates/mercury/tooltip.html",
162
+ "spec/javascripts/templates/mercury/uploader.html",
163
+ "vendor/assets/javascripts/jquery-1.6.js",
164
+ "vendor/assets/javascripts/jquery-ui-1.8.13.custom.min.js",
165
+ "vendor/assets/javascripts/jquery-ui-1.8.13.sortable.custom.js",
166
+ "vendor/assets/javascripts/jquery.easing.js",
167
+ "vendor/assets/javascripts/jquery.json2.js",
168
+ "vendor/assets/javascripts/jquery.serialize_object.js",
169
+ "vendor/assets/javascripts/jquery.ujs.js",
170
+ "vendor/assets/javascripts/liquidmetal.js",
171
+ "vendor/assets/javascripts/showdown.js"
172
+ ]
173
+ s.homepage = %q{http://github.com/jejacks0n/mercury}
174
+ s.licenses = ["MIT"]
175
+ s.require_paths = ["lib"]
176
+ s.rubygems_version = %q{1.6.2}
177
+ s.summary = %q{A fully featured and advanced HTML5 WYSIWYG editor written in CoffeeScript on top of Rails 3.1}
178
+
179
+ if s.respond_to? :specification_version then
180
+ s.specification_version = 3
181
+
182
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
183
+ s.add_runtime_dependency(%q<rails>, ["= 3.1.0.rc4"])
184
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
185
+ s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
186
+ s.add_runtime_dependency(%q<paperclip>, [">= 0"])
187
+ s.add_runtime_dependency(%q<formtastic>, [">= 0"])
188
+ s.add_runtime_dependency(%q<json>, [">= 0"])
189
+ s.add_runtime_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
190
+ s.add_runtime_dependency(%q<coffee-script>, [">= 0"])
191
+ s.add_runtime_dependency(%q<uglifier>, [">= 0"])
192
+ s.add_runtime_dependency(%q<haml>, [">= 0"])
193
+ s.add_runtime_dependency(%q<jquery-rails>, [">= 0"])
194
+ s.add_development_dependency(%q<thin>, [">= 0"])
195
+ s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
196
+ s.add_development_dependency(%q<evergreen>, [">= 0"])
197
+ else
198
+ s.add_dependency(%q<rails>, ["= 3.1.0.rc4"])
199
+ s.add_dependency(%q<jeweler>, [">= 0"])
200
+ s.add_dependency(%q<sqlite3>, [">= 0"])
201
+ s.add_dependency(%q<paperclip>, [">= 0"])
202
+ s.add_dependency(%q<formtastic>, [">= 0"])
203
+ s.add_dependency(%q<json>, [">= 0"])
204
+ s.add_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
205
+ s.add_dependency(%q<coffee-script>, [">= 0"])
206
+ s.add_dependency(%q<uglifier>, [">= 0"])
207
+ s.add_dependency(%q<haml>, [">= 0"])
208
+ s.add_dependency(%q<jquery-rails>, [">= 0"])
209
+ s.add_dependency(%q<thin>, [">= 0"])
210
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
211
+ s.add_dependency(%q<evergreen>, [">= 0"])
212
+ end
213
+ else
214
+ s.add_dependency(%q<rails>, ["= 3.1.0.rc4"])
215
+ s.add_dependency(%q<jeweler>, [">= 0"])
216
+ s.add_dependency(%q<sqlite3>, [">= 0"])
217
+ s.add_dependency(%q<paperclip>, [">= 0"])
218
+ s.add_dependency(%q<formtastic>, [">= 0"])
219
+ s.add_dependency(%q<json>, [">= 0"])
220
+ s.add_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
221
+ s.add_dependency(%q<coffee-script>, [">= 0"])
222
+ s.add_dependency(%q<uglifier>, [">= 0"])
223
+ s.add_dependency(%q<haml>, [">= 0"])
224
+ s.add_dependency(%q<jquery-rails>, [">= 0"])
225
+ s.add_dependency(%q<thin>, [">= 0"])
226
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
227
+ s.add_dependency(%q<evergreen>, [">= 0"])
228
+ end
229
+ end
230
+
@@ -0,0 +1,258 @@
1
+ require '/assets/mercury/mercury.js'
2
+
3
+ describe "Mercury.Dialog", ->
4
+
5
+ template 'mercury/dialog.html'
6
+
7
+ beforeEach ->
8
+ $.fx.off = true
9
+
10
+ afterEach ->
11
+ @dialog = null
12
+ delete(@dialog)
13
+
14
+ describe "constructor", ->
15
+
16
+ beforeEach ->
17
+ @buildSpy = spyOn(Mercury.Dialog.prototype, 'build').andCallFake(=>)
18
+ @bindEventsSpy = spyOn(Mercury.Dialog.prototype, 'bindEvents').andCallFake(=>)
19
+ @preloadSpy = spyOn(Mercury.Dialog.prototype, 'preload').andCallFake(=>)
20
+
21
+ it "expects a url and name", ->
22
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo')
23
+ expect(@dialog.url).toEqual('/evergreen/responses/blank.html')
24
+ expect(@dialog.name).toEqual('foo')
25
+
26
+ it "accepts options", ->
27
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {for: 'something', foo: 'bar'})
28
+ expect(@dialog.options).toEqual({for: 'something', foo: 'bar'})
29
+
30
+ it "calls build", ->
31
+ @dialog = new Mercury.Dialog()
32
+ expect(@buildSpy.callCount).toEqual(1)
33
+
34
+ it "calls bindEvents", ->
35
+ @dialog = new Mercury.Dialog()
36
+ expect(@bindEventsSpy.callCount).toEqual(1)
37
+
38
+ it "preloads if configured", ->
39
+ @dialog = new Mercury.Dialog()
40
+ expect(@preloadSpy.callCount).toEqual(1)
41
+
42
+
43
+ describe "#build", ->
44
+
45
+ beforeEach ->
46
+ @bindEventsSpy = spyOn(Mercury.Dialog.prototype, 'bindEvents').andCallFake(=>)
47
+ @preloadSpy = spyOn(Mercury.Dialog.prototype, 'preload').andCallFake(=>)
48
+
49
+ it "builds an element", ->
50
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test'})
51
+ html = $('<div>').html(@dialog.element).html()
52
+ expect(html).toContain('class="mercury-dialog mercury-foo-dialog loading"')
53
+ expect(html).toContain('style="display:none"')
54
+
55
+ it "appends to any element", ->
56
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#dialog_container'})
57
+ expect($('#dialog_container .mercury-dialog').length).toEqual(1)
58
+
59
+
60
+ describe "#bindEvents", ->
61
+
62
+ it "only observes mousedown to stop the event"
63
+
64
+
65
+ describe "#preload", ->
66
+
67
+ beforeEach ->
68
+ @loadSpy = spyOn(Mercury.Dialog.prototype, 'load').andCallFake(=>)
69
+
70
+ it "calls load if configured", ->
71
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test', preload: true})
72
+ expect(@loadSpy.callCount).toEqual(1)
73
+
74
+ it "doesn't call load if configured", ->
75
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test', preload: false})
76
+ expect(@loadSpy.callCount).toEqual(0)
77
+
78
+
79
+ describe "#toggle", ->
80
+
81
+ beforeEach ->
82
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test'})
83
+
84
+ it "shows or hides", ->
85
+ expect(@dialog.element.css('display')).toEqual('none')
86
+ @dialog.toggle()
87
+ expect(@dialog.element.css('display')).toEqual('block')
88
+ @dialog.toggle()
89
+ expect(@dialog.element.css('display')).toEqual('none')
90
+
91
+
92
+ describe "#resize", ->
93
+
94
+ beforeEach ->
95
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test'})
96
+
97
+ it "calls show", ->
98
+ spy = spyOn(Mercury.Dialog.prototype, 'show').andCallFake(=>)
99
+ @dialog.resize()
100
+ expect(spy.callCount).toEqual(1)
101
+
102
+
103
+ describe "#show", ->
104
+
105
+ beforeEach ->
106
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test'})
107
+
108
+ it "triggers a custom event to hide all other dialogs", ->
109
+ spy = spyOn(Mercury, 'trigger').andCallFake(=>)
110
+ @dialog.show()
111
+ expect(spy.callCount).toEqual(1)
112
+ expect(spy.argsForCall[0]).toEqual(['hide:dialogs', @dialog])
113
+
114
+ describe "when already loaded", ->
115
+
116
+ beforeEach ->
117
+ @dialog.loaded = true
118
+
119
+ it "sets width and height on the element to auto", ->
120
+ @dialog.element.css({width: 100})
121
+ @dialog.show()
122
+ expect(@dialog.element.get(0).style.width).toEqual('auto')
123
+ expect(@dialog.element.get(0).style.height).toEqual('auto')
124
+
125
+ it "calls position", ->
126
+ spy = spyOn(Mercury.Dialog.prototype, 'position').andCallFake(=>)
127
+ @dialog.show()
128
+ expect(spy.callCount).toEqual(1)
129
+ expect(spy.argsForCall[0]).toEqual([true])
130
+
131
+ it "calls appear", ->
132
+ spy = spyOn(Mercury.Dialog.prototype, 'appear').andCallFake(=>)
133
+ @dialog.show()
134
+ expect(spy.callCount).toEqual(1)
135
+
136
+ describe "when not loaded", ->
137
+
138
+ it "calls position", ->
139
+ spy = spyOn(Mercury.Dialog.prototype, 'position').andCallFake(=>)
140
+ @dialog.show()
141
+ expect(spy.callCount).toEqual(1)
142
+ expect(spy.argsForCall[0]).toEqual([])
143
+
144
+ it "calls appear", ->
145
+ spy = spyOn(Mercury.Dialog.prototype, 'appear').andCallFake(=>)
146
+ @dialog.show()
147
+ expect(spy.callCount).toEqual(1)
148
+
149
+
150
+ describe "#position", ->
151
+
152
+ it "does nothing and is there as an interface method"
153
+
154
+
155
+ describe "#appear", ->
156
+
157
+ beforeEach ->
158
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test'})
159
+
160
+ it "animates the dialog in", ->
161
+ @dialog.appear()
162
+ expect(@dialog.element.css('display')).toEqual('block')
163
+ expect(parseFloat(@dialog.element.css('opacity')).toPrecision(2)).toEqual('0.95')
164
+
165
+ it "calls load if it's not already loaded", ->
166
+
167
+
168
+ describe "#hide", ->
169
+
170
+ beforeEach ->
171
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test'})
172
+
173
+ it "hides the dialog", ->
174
+ @dialog.element.css({display: 'block'})
175
+ @dialog.hide()
176
+ expect(@dialog.element.css('display')).toEqual('none')
177
+ expect(@dialog.visible).toEqual(false)
178
+
179
+
180
+ describe "#load", ->
181
+
182
+ beforeEach ->
183
+ @spyFunction = ->
184
+ Mercury.dialogHandlers.foo = ->
185
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
186
+
187
+ it "makes an ajax request", ->
188
+ spy = spyOn($, 'ajax').andCallFake(=>)
189
+ @dialog.load()
190
+ expect(spy.callCount).toEqual(1)
191
+
192
+ it "does nothing if there's no url", ->
193
+ spy = spyOn($, 'ajax').andCallFake(=>)
194
+ @dialog.url = false
195
+ @dialog.load()
196
+ expect(spy.callCount).toEqual(0)
197
+
198
+ describe "on success", ->
199
+
200
+ beforeEach ->
201
+ @loadContentSpy = spyOn(Mercury.Dialog.prototype, 'loadContent').andCallFake(=>)
202
+ @ajaxSpy = spyOn($, 'ajax').andCallFake (url, options) =>
203
+ options.success('return value') if (options.success)
204
+
205
+ it "calls loadContent with data", ->
206
+ @dialog.load()
207
+ expect(@loadContentSpy.callCount).toEqual(1)
208
+ expect(@loadContentSpy.argsForCall[0]).toEqual(['return value'])
209
+
210
+ it "calls a dialog handler if there's one", ->
211
+ spy = spyOn(Mercury.dialogHandlers, 'foo').andCallFake(=>)
212
+ @dialog.load()
213
+ expect(spy.callCount).toEqual(1)
214
+
215
+ it "calls a callback if one was provided", ->
216
+ spy = spyOn(@, 'spyFunction').andCallFake(=>)
217
+ @dialog.load(@spyFunction)
218
+ expect(spy.callCount).toEqual(1)
219
+
220
+ describe "on failure", ->
221
+
222
+ beforeEach ->
223
+ @alertSpy = spyOn(window, 'alert').andCallFake(=>)
224
+ @ajaxSpy = spyOn($, 'ajax').andCallFake (url, options) =>
225
+ options.error() if (options.error)
226
+
227
+ it "hides", ->
228
+ spy = spyOn(Mercury.Dialog.prototype, 'hide').andCallFake(=>)
229
+ @dialog.load()
230
+ expect(spy.callCount).toEqual(1)
231
+
232
+ it "removes the pressed state for it's button", ->
233
+ $('#button').addClass('pressed')
234
+ @dialog.load()
235
+ expect($('#button').hasClass('pressed')).toEqual(false)
236
+
237
+ it "alerts the user", ->
238
+ @dialog.load()
239
+ expect(@alertSpy.callCount).toEqual(1)
240
+ expect(@alertSpy.argsForCall[0]).toEqual(['Mercury was unable to load /evergreen/responses/blank.html for the foo dialog.'])
241
+
242
+
243
+ describe "#loadContent", ->
244
+
245
+ beforeEach ->
246
+ @dialog = new Mercury.Dialog('/evergreen/responses/blank.html', 'foo', {appendTo: '#test'})
247
+
248
+ it "sets loaded to be true", ->
249
+ @dialog.loadContent()
250
+ expect(@dialog.loaded).toEqual(true)
251
+
252
+ it "removes the loading class from the element", ->
253
+ @dialog.loadContent()
254
+ expect(@dialog.element.hasClass('loading')).toEqual(false)
255
+
256
+ it "sets the element html to be the data passed to it", ->
257
+ @dialog.loadContent('hello world!')
258
+ expect(@dialog.element.html()).toEqual('hello world!')