mercury-rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +81 -50
- data/VERSION +1 -1
- data/app/assets/javascripts/mercury/dialog.js.coffee +4 -4
- data/app/assets/javascripts/mercury/dialogs/backcolor.js.coffee +3 -3
- data/app/assets/javascripts/mercury/dialogs/forecolor.js.coffee +3 -3
- data/app/assets/javascripts/mercury/dialogs/formatblock.js.coffee +1 -1
- data/app/assets/javascripts/mercury/dialogs/objectspanel.js.coffee +3 -3
- data/app/assets/javascripts/mercury/dialogs/style.js.coffee +1 -1
- data/app/assets/javascripts/mercury/history_buffer.js.coffee +2 -2
- data/app/assets/javascripts/mercury/mercury.js.coffee +47 -54
- data/app/assets/javascripts/mercury/modal.js.coffee +13 -13
- data/app/assets/javascripts/mercury/modals/htmleditor.js.coffee +2 -2
- data/app/assets/javascripts/mercury/modals/insertcharacter.js.coffee +2 -2
- data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +7 -7
- data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +5 -5
- data/app/assets/javascripts/mercury/modals/insertsnippet.js.coffee +2 -2
- data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +14 -15
- data/app/assets/javascripts/mercury/native_extensions.js.coffee +2 -1
- data/app/assets/javascripts/mercury/page_editor.js.coffee +27 -27
- data/app/assets/javascripts/mercury/palette.js.coffee +6 -6
- data/app/assets/javascripts/mercury/panel.js.coffee +4 -4
- data/app/assets/javascripts/mercury/region.js.coffee +9 -9
- data/app/assets/javascripts/mercury/regions/editable.js.coffee +71 -71
- data/app/assets/javascripts/mercury/regions/markupable.js.coffee +51 -42
- data/app/assets/javascripts/mercury/regions/snippetable.js.coffee +7 -8
- data/app/assets/javascripts/mercury/select.js.coffee +8 -8
- data/app/assets/javascripts/mercury/snippet.js.coffee +6 -6
- data/app/assets/javascripts/mercury/snippet_toolbar.js.coffee +7 -7
- data/app/assets/javascripts/mercury/statusbar.js.coffee +7 -3
- data/app/assets/javascripts/mercury/table_editor.js.coffee +24 -24
- data/app/assets/javascripts/mercury/toolbar.button.js.coffee +20 -21
- data/app/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
- data/app/assets/javascripts/mercury/toolbar.expander.js.coffee +9 -9
- data/app/assets/javascripts/mercury/toolbar.js.coffee +12 -13
- data/app/assets/javascripts/mercury/tooltip.js.coffee +7 -7
- data/app/assets/javascripts/mercury/uploader.js.coffee +12 -13
- data/app/assets/javascripts/mercury_loader.js +98 -0
- data/app/assets/stylesheets/mercury/modal.scss +5 -5
- data/app/assets/stylesheets/mercury/toolbar.scss +62 -64
- data/app/views/layouts/mercury.html.haml +0 -4
- data/app/views/mercury/modals/character.html.haml +1 -1
- data/app/views/mercury/modals/htmleditor.html.haml +1 -1
- data/app/views/mercury/modals/table.html.haml +10 -10
- data/config/routes.rb +2 -2
- data/mercury-rails.gemspec +17 -20
- data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +3 -3
- data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +3 -3
- data/spec/javascripts/mercury/dialogs/objectspanel_spec.js.coffee +3 -3
- data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +4 -4
- data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -2
- data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +10 -10
- data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +7 -7
- data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +4 -4
- data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +17 -17
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +5 -6
- data/spec/javascripts/mercury/region_spec.js.coffee +5 -5
- data/spec/javascripts/mercury/regions/editable_spec.js.coffee +398 -0
- data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +18 -14
- data/spec/javascripts/mercury/snippet_spec.js.coffee +1 -1
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +16 -16
- data/spec/javascripts/templates/mercury/modals/inserttable.html +11 -11
- data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
- data/spec/javascripts/templates/mercury/toolbar.button.html +8 -8
- data/vendor/assets/javascripts/{jquery-ui-1.8.13.sortable.custom.js → jquery-ui-1.8.13.custom.js} +250 -0
- data/vendor/assets/javascripts/jquery.additions.js +151 -0
- data/vendor/assets/javascripts/showdown.js +1254 -1276
- metadata +26 -29
- data/app/assets/javascripts/mercury/websocket.js.coffee +0 -34
- data/spec/javascripts/mercury/regions/_editable_.js.coffee +0 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.13.custom.min.js +0 -249
- data/vendor/assets/javascripts/jquery.easing.js +0 -173
- data/vendor/assets/javascripts/jquery.json2.js +0 -178
- data/vendor/assets/javascripts/jquery.serialize_object.js +0 -16
- data/vendor/assets/javascripts/jquery.ujs.js +0 -289
@@ -5,8 +5,4 @@
|
|
5
5
|
= csrf_meta_tags
|
6
6
|
= stylesheet_link_tag "mercury"
|
7
7
|
= javascript_include_tag "mercury"
|
8
|
-
-#:javascript
|
9
|
-
-# Mercury.Snippet.load({
|
10
|
-
-# 'snippet_1': {name: 'example', options: {'options[favorite_beer]': "miller_lite", 'options[first_name]': "1"}},
|
11
|
-
-# });
|
12
8
|
%body= javascript_tag 'new Mercury.PageEditor()'
|
@@ -19,23 +19,23 @@
|
|
19
19
|
= f.inputs do
|
20
20
|
%li{ class: "select input optional", id: "table_rows_input" }
|
21
21
|
%label{ for: "table_rows" } Rows
|
22
|
-
%input{ type: 'button', name: '
|
23
|
-
%input{ type: 'button', name: '
|
24
|
-
%input{ type: 'button', name: '
|
22
|
+
%input{ type: 'button', name: 'insertRowBefore', class: 'action', value: 'Add Before' }/
|
23
|
+
%input{ type: 'button', name: 'insertRowAfter', class: 'action', value: 'Add After' }/
|
24
|
+
%input{ type: 'button', name: 'deleteRow', class: 'action', value: 'Remove' }/
|
25
25
|
%li{ class: "select input optional", id: "table_columns_input" }
|
26
26
|
%label{ for: "table_columns" } Columns
|
27
|
-
%input{ type: 'button', name: '
|
28
|
-
%input{ type: 'button', name: '
|
29
|
-
%input{ type: 'button', name: '
|
27
|
+
%input{ type: 'button', name: 'insertColumnBefore', class: 'action', value: 'Add Before' }/
|
28
|
+
%input{ type: 'button', name: 'insertColumnAfter', class: 'action', value: 'Add After' }/
|
29
|
+
%input{ type: 'button', name: 'deleteColumn', class: 'action', value: 'Remove' }/
|
30
30
|
%hr
|
31
31
|
%li{ class: "select input optional", id: "table_row_adjust_input" }
|
32
32
|
%label{ for: "table_row_adjust" } Row Span
|
33
|
-
%input{ type: 'button', name: '
|
34
|
-
%input{ type: 'button', name: '
|
33
|
+
%input{ type: 'button', name: 'increaseRowspan', class: 'action', value: '+' }/
|
34
|
+
%input{ type: 'button', name: 'decreaseRowspan', class: 'action', value: '-' }/
|
35
35
|
%li{ class: "select input optional", id: "table_column_adjust_input" }
|
36
36
|
%label{ for: "table_column_adjust" } Column Span
|
37
|
-
%input{ type: 'button', name: '
|
38
|
-
%input{ type: 'button', name: '
|
37
|
+
%input{ type: 'button', name: 'increaseColspan', class: 'action', value: '+' }/
|
38
|
+
%input{ type: 'button', name: 'decreaseColspan', class: 'action', value: '-' }/
|
39
39
|
|
40
40
|
= f.inputs 'Options' do
|
41
41
|
= f.input :alignment, as: :select, required: false, include_blank: 'None',
|
data/config/routes.rb
CHANGED
@@ -2,8 +2,8 @@ Rails.application.routes.draw do
|
|
2
2
|
|
3
3
|
resources :images
|
4
4
|
|
5
|
-
match '/
|
6
|
-
|
5
|
+
match '/editor(/*requested_uri)' => "mercury#edit"
|
6
|
+
scope '/mercury' do
|
7
7
|
match ':type/:resource' => "mercury#resource"
|
8
8
|
match 'snippets/:name/options' => "mercury#snippet_options"
|
9
9
|
match 'snippets/:name/preview' => "mercury#snippet_preview"
|
data/mercury-rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mercury-rails}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeremy Jackson"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-21}
|
13
13
|
s.description = %q{A fully featured and advanced HTML5 WYSIWYG editor written in CoffeeScript on top of Rails 3.1}
|
14
14
|
s.email = %q{jejacks0n@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -79,7 +79,7 @@ Gem::Specification.new do |s|
|
|
79
79
|
"app/assets/javascripts/mercury/toolbar.js.coffee",
|
80
80
|
"app/assets/javascripts/mercury/tooltip.js.coffee",
|
81
81
|
"app/assets/javascripts/mercury/uploader.js.coffee",
|
82
|
-
"app/assets/javascripts/
|
82
|
+
"app/assets/javascripts/mercury_loader.js",
|
83
83
|
"app/assets/stylesheets/mercury.css",
|
84
84
|
"app/assets/stylesheets/mercury/dialog.scss",
|
85
85
|
"app/assets/stylesheets/mercury/mercury.scss",
|
@@ -138,8 +138,8 @@ Gem::Specification.new do |s|
|
|
138
138
|
"spec/javascripts/mercury/palette_spec.js.coffee",
|
139
139
|
"spec/javascripts/mercury/panel_spec.js.coffee",
|
140
140
|
"spec/javascripts/mercury/region_spec.js.coffee",
|
141
|
-
"spec/javascripts/mercury/regions/_editable_.js.coffee",
|
142
141
|
"spec/javascripts/mercury/regions/_markupable_.js.coffee",
|
142
|
+
"spec/javascripts/mercury/regions/editable_spec.js.coffee",
|
143
143
|
"spec/javascripts/mercury/regions/snippetable_spec.js.coffee",
|
144
144
|
"spec/javascripts/mercury/select_spec.js.coffee",
|
145
145
|
"spec/javascripts/mercury/snippet_spec.js.coffee",
|
@@ -170,6 +170,7 @@ Gem::Specification.new do |s|
|
|
170
170
|
"spec/javascripts/templates/mercury/palette.html",
|
171
171
|
"spec/javascripts/templates/mercury/panel.html",
|
172
172
|
"spec/javascripts/templates/mercury/region.html",
|
173
|
+
"spec/javascripts/templates/mercury/regions/editable.html",
|
173
174
|
"spec/javascripts/templates/mercury/regions/snippetable.html",
|
174
175
|
"spec/javascripts/templates/mercury/select.html",
|
175
176
|
"spec/javascripts/templates/mercury/snippet.html",
|
@@ -183,12 +184,8 @@ Gem::Specification.new do |s|
|
|
183
184
|
"spec/javascripts/templates/mercury/tooltip.html",
|
184
185
|
"spec/javascripts/templates/mercury/uploader.html",
|
185
186
|
"vendor/assets/javascripts/jquery-1.6.js",
|
186
|
-
"vendor/assets/javascripts/jquery-ui-1.8.13.custom.
|
187
|
-
"vendor/assets/javascripts/jquery
|
188
|
-
"vendor/assets/javascripts/jquery.easing.js",
|
189
|
-
"vendor/assets/javascripts/jquery.json2.js",
|
190
|
-
"vendor/assets/javascripts/jquery.serialize_object.js",
|
191
|
-
"vendor/assets/javascripts/jquery.ujs.js",
|
187
|
+
"vendor/assets/javascripts/jquery-ui-1.8.13.custom.js",
|
188
|
+
"vendor/assets/javascripts/jquery.additions.js",
|
192
189
|
"vendor/assets/javascripts/liquidmetal.js",
|
193
190
|
"vendor/assets/javascripts/showdown.js"
|
194
191
|
]
|
@@ -203,47 +200,47 @@ Gem::Specification.new do |s|
|
|
203
200
|
|
204
201
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
205
202
|
s.add_runtime_dependency(%q<rails>, ["= 3.1.0.rc4"])
|
206
|
-
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
207
|
-
s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
|
208
203
|
s.add_runtime_dependency(%q<paperclip>, [">= 0"])
|
209
204
|
s.add_runtime_dependency(%q<formtastic>, [">= 0"])
|
210
205
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
211
206
|
s.add_runtime_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
|
212
207
|
s.add_runtime_dependency(%q<coffee-script>, [">= 0"])
|
213
|
-
s.add_runtime_dependency(%q<uglifier>, [">= 0"])
|
214
208
|
s.add_runtime_dependency(%q<haml>, [">= 0"])
|
215
|
-
s.
|
209
|
+
s.add_development_dependency(%q<uglifier>, [">= 0"])
|
210
|
+
s.add_development_dependency(%q<jquery-rails>, [">= 0"])
|
211
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
212
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
216
213
|
s.add_development_dependency(%q<thin>, [">= 0"])
|
217
214
|
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
218
215
|
s.add_development_dependency(%q<evergreen>, [">= 0"])
|
219
216
|
else
|
220
217
|
s.add_dependency(%q<rails>, ["= 3.1.0.rc4"])
|
221
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
222
|
-
s.add_dependency(%q<sqlite3>, [">= 0"])
|
223
218
|
s.add_dependency(%q<paperclip>, [">= 0"])
|
224
219
|
s.add_dependency(%q<formtastic>, [">= 0"])
|
225
220
|
s.add_dependency(%q<json>, [">= 0"])
|
226
221
|
s.add_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
|
227
222
|
s.add_dependency(%q<coffee-script>, [">= 0"])
|
228
|
-
s.add_dependency(%q<uglifier>, [">= 0"])
|
229
223
|
s.add_dependency(%q<haml>, [">= 0"])
|
224
|
+
s.add_dependency(%q<uglifier>, [">= 0"])
|
230
225
|
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
226
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
227
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
231
228
|
s.add_dependency(%q<thin>, [">= 0"])
|
232
229
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
233
230
|
s.add_dependency(%q<evergreen>, [">= 0"])
|
234
231
|
end
|
235
232
|
else
|
236
233
|
s.add_dependency(%q<rails>, ["= 3.1.0.rc4"])
|
237
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
238
|
-
s.add_dependency(%q<sqlite3>, [">= 0"])
|
239
234
|
s.add_dependency(%q<paperclip>, [">= 0"])
|
240
235
|
s.add_dependency(%q<formtastic>, [">= 0"])
|
241
236
|
s.add_dependency(%q<json>, [">= 0"])
|
242
237
|
s.add_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
|
243
238
|
s.add_dependency(%q<coffee-script>, [">= 0"])
|
244
|
-
s.add_dependency(%q<uglifier>, [">= 0"])
|
245
239
|
s.add_dependency(%q<haml>, [">= 0"])
|
240
|
+
s.add_dependency(%q<uglifier>, [">= 0"])
|
246
241
|
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
242
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
243
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
247
244
|
s.add_dependency(%q<thin>, [">= 0"])
|
248
245
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
249
246
|
s.add_dependency(%q<evergreen>, [">= 0"])
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.dialogHandlers.
|
3
|
+
describe "Mercury.dialogHandlers.backColor", ->
|
4
4
|
|
5
5
|
template 'mercury/dialogs/backcolor.html'
|
6
6
|
|
7
7
|
beforeEach ->
|
8
8
|
@dialog = {element: $('#test'), button: $('#button')}
|
9
|
-
Mercury.dialogHandlers.
|
9
|
+
Mercury.dialogHandlers.backColor.call(@dialog)
|
10
10
|
|
11
11
|
describe "when a .picker or .last-picked element is clicked", ->
|
12
12
|
|
@@ -28,7 +28,7 @@ describe "Mercury.dialogHandlers.backcolor", ->
|
|
28
28
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
29
29
|
jasmine.simulate.click($('#white').get(0))
|
30
30
|
expect(spy.callCount).toEqual(1)
|
31
|
-
expect(spy.argsForCall[0]).toEqual(['action', {action: '
|
31
|
+
expect(spy.argsForCall[0]).toEqual(['action', {action: 'backColor', value: 'rgb(255, 255, 255)'}])
|
32
32
|
|
33
33
|
|
34
34
|
describe "when any other element is clicked", ->
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.dialogHandlers.
|
3
|
+
describe "Mercury.dialogHandlers.foreColor", ->
|
4
4
|
|
5
5
|
template 'mercury/dialogs/forecolor.html'
|
6
6
|
|
7
7
|
beforeEach ->
|
8
8
|
@dialog = {element: $('#test'), button: $('#button')}
|
9
|
-
Mercury.dialogHandlers.
|
9
|
+
Mercury.dialogHandlers.foreColor.call(@dialog)
|
10
10
|
|
11
11
|
describe "when a .picker or .last-picked element is clicked", ->
|
12
12
|
|
@@ -28,7 +28,7 @@ describe "Mercury.dialogHandlers.forecolor", ->
|
|
28
28
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
29
29
|
jasmine.simulate.click($('#white').get(0))
|
30
30
|
expect(spy.callCount).toEqual(1)
|
31
|
-
expect(spy.argsForCall[0]).toEqual(['action', {action: '
|
31
|
+
expect(spy.argsForCall[0]).toEqual(['action', {action: 'foreColor', value: 'rgb(255, 255, 255)'}])
|
32
32
|
|
33
33
|
|
34
34
|
describe "when any other element is clicked", ->
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.dialogHandlers.
|
3
|
+
describe "Mercury.dialogHandlers.backColor", ->
|
4
4
|
|
5
5
|
template 'mercury/dialogs/objectspanel.html'
|
6
6
|
|
7
7
|
beforeEach ->
|
8
8
|
@dialog = {element: $('#test'), button: $('#button')}
|
9
|
-
Mercury.dialogHandlers.
|
9
|
+
Mercury.dialogHandlers.objectsPanel.call(@dialog)
|
10
10
|
|
11
11
|
describe "filter", ->
|
12
12
|
|
@@ -29,4 +29,4 @@ describe "Mercury.dialogHandlers.backcolor", ->
|
|
29
29
|
|
30
30
|
describe "dragging an image with a data-snippet attribute", ->
|
31
31
|
|
32
|
-
it "sets the active snippet", ->
|
32
|
+
it "sets the active snippet", ->
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.modalHandlers.
|
3
|
+
describe "Mercury.modalHandlers.htmlEditor", ->
|
4
4
|
|
5
5
|
template 'mercury/modals/htmleditor.html'
|
6
6
|
|
@@ -9,8 +9,8 @@ describe "Mercury.modalHandlers.htmleditor", ->
|
|
9
9
|
element: $('#test')
|
10
10
|
hide: ->
|
11
11
|
Mercury.region =
|
12
|
-
|
13
|
-
Mercury.modalHandlers.
|
12
|
+
content: -> '<span>html \ncontent</span>'
|
13
|
+
Mercury.modalHandlers.htmlEditor.call(@modal)
|
14
14
|
|
15
15
|
describe "loading", ->
|
16
16
|
|
@@ -29,4 +29,4 @@ describe "Mercury.modalHandlers.htmleditor", ->
|
|
29
29
|
it "hides the modal", ->
|
30
30
|
spy = spyOn(@modal, 'hide').andCallFake(=>)
|
31
31
|
jasmine.simulate.click($('#submit').get(0))
|
32
|
-
expect(spy.callCount).toEqual(1)
|
32
|
+
expect(spy.callCount).toEqual(1)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.modalHandlers.
|
3
|
+
describe "Mercury.modalHandlers.insertCharacter", ->
|
4
4
|
|
5
5
|
template 'mercury/modals/insertcharacter.html'
|
6
6
|
|
@@ -8,7 +8,7 @@ describe "Mercury.modalHandlers.insertcharacter", ->
|
|
8
8
|
@modal =
|
9
9
|
element: $('#test')
|
10
10
|
@modalHideSpy = spyOn(Mercury.modal, 'hide').andCallFake(=>)
|
11
|
-
Mercury.modalHandlers.
|
11
|
+
Mercury.modalHandlers.insertCharacter.call(@modal)
|
12
12
|
|
13
13
|
describe "clicking on a character", ->
|
14
14
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.modalHandlers.
|
3
|
+
describe "Mercury.modalHandlers.insertLink", ->
|
4
4
|
|
5
5
|
template 'mercury/modals/insertlink.html'
|
6
6
|
|
@@ -15,7 +15,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
15
15
|
describe "initializing", ->
|
16
16
|
|
17
17
|
beforeEach ->
|
18
|
-
Mercury.modalHandlers.
|
18
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
19
19
|
|
20
20
|
it "loads all links with a name into the existing bookmarks pulldown", ->
|
21
21
|
options = $('#link_existing_bookmark').html()
|
@@ -27,7 +27,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
27
27
|
describe "clicking on a radio button (in a label)", ->
|
28
28
|
|
29
29
|
beforeEach ->
|
30
|
-
Mercury.modalHandlers.
|
30
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
31
31
|
|
32
32
|
it "focuses the next input with a selectable class", ->
|
33
33
|
spy = spyOn($.fn, 'focus').andCallFake(=>)
|
@@ -38,7 +38,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
38
38
|
describe "focusing an input", ->
|
39
39
|
|
40
40
|
beforeEach ->
|
41
|
-
Mercury.modalHandlers.
|
41
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
42
42
|
|
43
43
|
it "checks the corresponding checkbox", ->
|
44
44
|
$('#link_existing_bookmark').focus()
|
@@ -57,7 +57,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
57
57
|
|
58
58
|
beforeEach ->
|
59
59
|
Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo')}
|
60
|
-
Mercury.modalHandlers.
|
60
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
61
61
|
|
62
62
|
it "hides the link text input", ->
|
63
63
|
expect($('#link_text_container').css('display')).toEqual('none')
|
@@ -72,7 +72,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
72
72
|
|
73
73
|
beforeEach ->
|
74
74
|
Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: "javascript:void(window.open('http://cnn.com', 'popup_window', 'width=100,height=42,menubar=no,toolbar=no'))"}).html('foo')}
|
75
|
-
Mercury.modalHandlers.
|
75
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
76
76
|
|
77
77
|
it "hides the link text input", ->
|
78
78
|
expect($('#link_text_container').css('display')).toEqual('none')
|
@@ -91,7 +91,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
91
91
|
|
92
92
|
beforeEach ->
|
93
93
|
Mercury.region = selection: => {commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')}
|
94
|
-
Mercury.modalHandlers.
|
94
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
95
95
|
|
96
96
|
it "hides the link text input", ->
|
97
97
|
expect($('#link_text_container').css('display')).toEqual('none')
|
@@ -106,7 +106,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
106
106
|
|
107
107
|
beforeEach ->
|
108
108
|
Mercury.region = selection: => {commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')}
|
109
|
-
Mercury.modalHandlers.
|
109
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
110
110
|
|
111
111
|
it "hides the link text input", ->
|
112
112
|
expect($('#link_text_container').css('display')).toEqual('none')
|
@@ -123,7 +123,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
123
123
|
describe "a new link", ->
|
124
124
|
|
125
125
|
beforeEach ->
|
126
|
-
Mercury.modalHandlers.
|
126
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
127
127
|
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
128
128
|
$('#link_text').val('foo')
|
129
129
|
|
@@ -191,7 +191,7 @@ describe "Mercury.modalHandlers.insertlink", ->
|
|
191
191
|
beforeEach ->
|
192
192
|
@existingLink = $('<a>', {name: 'link3'}).html('foo')
|
193
193
|
Mercury.region = selection: => {commonAncestor: => @existingLink}
|
194
|
-
Mercury.modalHandlers.
|
194
|
+
Mercury.modalHandlers.insertLink.call(@modal)
|
195
195
|
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
196
196
|
$('#link_text').val('foo')
|
197
197
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.modalHandlers.
|
3
|
+
describe "Mercury.modalHandlers.insertMedia", ->
|
4
4
|
|
5
5
|
template 'mercury/modals/insertmedia.html'
|
6
6
|
|
@@ -14,7 +14,7 @@ describe "Mercury.modalHandlers.insertmedia", ->
|
|
14
14
|
describe "clicking on a radio button (in a label)", ->
|
15
15
|
|
16
16
|
beforeEach ->
|
17
|
-
Mercury.modalHandlers.
|
17
|
+
Mercury.modalHandlers.insertMedia.call(@modal)
|
18
18
|
|
19
19
|
it "focuses the next input with a selectable class", ->
|
20
20
|
spy = spyOn($.fn, 'focus').andCallFake(=>)
|
@@ -24,7 +24,7 @@ describe "Mercury.modalHandlers.insertmedia", ->
|
|
24
24
|
describe "focusing an input", ->
|
25
25
|
|
26
26
|
beforeEach ->
|
27
|
-
Mercury.modalHandlers.
|
27
|
+
Mercury.modalHandlers.insertMedia.call(@modal)
|
28
28
|
|
29
29
|
it "checks the corresponding checkbox", ->
|
30
30
|
$('#media_youtube_url').focus()
|
@@ -53,7 +53,7 @@ describe "Mercury.modalHandlers.insertmedia", ->
|
|
53
53
|
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
|
54
54
|
@selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right'})}
|
55
55
|
Mercury.region = selection: => @selection
|
56
|
-
Mercury.modalHandlers.
|
56
|
+
Mercury.modalHandlers.insertMedia.call(@modal)
|
57
57
|
|
58
58
|
it "pre-fills the image url", ->
|
59
59
|
expect($('#media_image_url').val()).toEqual('/foo.gif')
|
@@ -71,7 +71,7 @@ describe "Mercury.modalHandlers.insertmedia", ->
|
|
71
71
|
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
|
72
72
|
@selection = {is: -> $('<iframe>', {src: 'http://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
|
73
73
|
Mercury.region = selection: => @selection
|
74
|
-
Mercury.modalHandlers.
|
74
|
+
Mercury.modalHandlers.insertMedia.call(@modal)
|
75
75
|
|
76
76
|
it "pre-fills the url", ->
|
77
77
|
expect($('#media_youtube_url').val()).toEqual('http://youtu.be/foo')
|
@@ -91,7 +91,7 @@ describe "Mercury.modalHandlers.insertmedia", ->
|
|
91
91
|
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
|
92
92
|
@selection = {is: -> $('<iframe>', {src: 'http://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff', style: 'width:100px;height:42px'})}
|
93
93
|
Mercury.region = selection: => @selection
|
94
|
-
Mercury.modalHandlers.
|
94
|
+
Mercury.modalHandlers.insertMedia.call(@modal)
|
95
95
|
|
96
96
|
it "pre-fills the url", ->
|
97
97
|
expect($('#media_vimeo_url').val()).toEqual('http://vimeo.com/foo')
|
@@ -109,7 +109,7 @@ describe "Mercury.modalHandlers.insertmedia", ->
|
|
109
109
|
describe "submitting", ->
|
110
110
|
|
111
111
|
beforeEach ->
|
112
|
-
Mercury.modalHandlers.
|
112
|
+
Mercury.modalHandlers.insertMedia.call(@modal)
|
113
113
|
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
114
114
|
|
115
115
|
it "hides the modal", ->
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require '/assets/mercury/mercury.js'
|
2
2
|
|
3
|
-
describe "Mercury.modalHandlers.
|
3
|
+
describe "Mercury.modalHandlers.insertSnippet", ->
|
4
4
|
|
5
5
|
template 'mercury/modals/insertsnippet.html'
|
6
6
|
|
@@ -13,7 +13,7 @@ describe "Mercury.modalHandlers.insertsnippet", ->
|
|
13
13
|
element: $('#test')
|
14
14
|
hide: ->
|
15
15
|
options: {snippetName: 'test'}
|
16
|
-
Mercury.modalHandlers.
|
16
|
+
Mercury.modalHandlers.insertSnippet.call(@modal)
|
17
17
|
|
18
18
|
describe "submitting", ->
|
19
19
|
|
@@ -37,7 +37,7 @@ describe "Mercury.modalHandlers.insertsnippet", ->
|
|
37
37
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
38
38
|
jasmine.simulate.click($('#submit').get(0))
|
39
39
|
expect(spy.callCount).toEqual(1)
|
40
|
-
expect(spy.argsForCall[0]).toEqual(['action', {action: '
|
40
|
+
expect(spy.argsForCall[0]).toEqual(['action', {action: 'insertSnippet', value: Mercury.Snippet.all[0]}])
|
41
41
|
|
42
42
|
describe "if there's no active snippet", ->
|
43
43
|
|
@@ -51,4 +51,4 @@ describe "Mercury.modalHandlers.insertsnippet", ->
|
|
51
51
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
52
52
|
jasmine.simulate.click($('#submit').get(0))
|
53
53
|
expect(spy.callCount).toEqual(1)
|
54
|
-
expect(spy.argsForCall[0]).toEqual(['action', {action: '
|
54
|
+
expect(spy.argsForCall[0]).toEqual(['action', {action: 'insertSnippet', value: Mercury.Snippet.all[1]}])
|