kiteditor 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/POST_INSTALL +21 -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/tools.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/user.png +0 -0
- data/app/assets/images/mercury/toolbar/snippets/buttons.png +0 -0
- data/{vendor/assets/javascripts/mercury/dependencies → app/assets/javascripts}/jquery-1.7.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury.js +60 -87
- 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 +103 -13
- 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 +1 -1
- data/{vendor → app}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +1 -1
- 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 +38 -17
- data/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +201 -0
- data/app/assets/javascripts/mercury/locales/da.locale.js.coffee +208 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/de.locale.js.coffee +4 -10
- data/{vendor → app}/assets/javascripts/mercury/locales/es.locale.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/example.local.js.coffee +3 -5
- data/{vendor → app}/assets/javascripts/mercury/locales/fr.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/hu.locale.js.coffee +209 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/it.locale.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/ko.local.js.coffee +4 -10
- data/{vendor → app}/assets/javascripts/mercury/locales/nl.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/pl.locale.js.coffee +213 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/pt.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/ru.locale.js.coffee +200 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/sv.local.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/uk.locale.js.coffee +200 -0
- data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +203 -0
- data/app/assets/javascripts/mercury/mercury-compiled.js +10720 -0
- data/{vendor → app}/assets/javascripts/mercury/mercury.js.coffee +10 -1
- data/{vendor → app}/assets/javascripts/mercury/modal.js.coffee +62 -40
- data/{vendor → app}/assets/javascripts/mercury/modals/htmleditor.js.coffee +1 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +1 -0
- data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +152 -0
- data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +132 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +2 -0
- data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +68 -0
- data/{vendor → app}/assets/javascripts/mercury/native_extensions.js.coffee +0 -6
- data/{vendor → app}/assets/javascripts/mercury/page_editor.js.coffee +84 -50
- data/{vendor → app}/assets/javascripts/mercury/palette.js.coffee +1 -1
- data/{vendor → app}/assets/javascripts/mercury/panel.js.coffee +3 -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 +18 -17
- data/{vendor/assets/javascripts/mercury/regions/editable.js.coffee → app/assets/javascripts/mercury/regions/full.js.coffee} +41 -31
- data/app/assets/javascripts/mercury/regions/image.js.coffee +93 -0
- data/{vendor/assets/javascripts/mercury/regions/markupable.js.coffee → app/assets/javascripts/mercury/regions/markdown.js.coffee} +29 -24
- data/{vendor → app}/assets/javascripts/mercury/regions/simple.js.coffee +11 -54
- data/{vendor/assets/javascripts/mercury/regions/snippetable.js.coffee → app/assets/javascripts/mercury/regions/snippets.js.coffee} +10 -9
- data/{vendor → app}/assets/javascripts/mercury/select.js.coffee +1 -1
- data/app/assets/javascripts/mercury/snippet.js.coffee +136 -0
- data/{vendor → app}/assets/javascripts/mercury/snippet_toolbar.js.coffee +19 -6
- 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 +16 -0
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button.js.coffee +45 -30
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
- data/{vendor → app}/assets/javascripts/mercury/toolbar.expander.js.coffee +4 -4
- data/{vendor → app}/assets/javascripts/mercury/toolbar.js.coffee +10 -6
- data/{vendor → app}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/uploader.js.coffee +37 -19
- data/app/assets/stylesheets/_mercury-bootstrap-overrides.scss +61 -0
- data/app/assets/stylesheets/_mercury-sass.scss +33 -0
- data/{vendor → app}/assets/stylesheets/mercury.css +1 -5
- data/{vendor → app}/assets/stylesheets/mercury/all_images.css.erb +6 -2
- data/app/assets/stylesheets/mercury/bootstrap-ish.css +1367 -0
- data/app/assets/stylesheets/mercury/bootstrap-overrides.css +61 -0
- data/{vendor → app}/assets/stylesheets/mercury/dialog.css +21 -8
- data/{vendor → app}/assets/stylesheets/mercury/lightview.css +6 -56
- data/app/assets/stylesheets/mercury/mercury.css +43 -0
- data/{vendor → app}/assets/stylesheets/mercury/modal.css +15 -32
- data/{vendor → app}/assets/stylesheets/mercury/statusbar.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/toolbar.css +4 -1
- data/{vendor → app}/assets/stylesheets/mercury/tooltip.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/uploader.css +4 -4
- data/app/helpers/mercury_helper.rb +7 -0
- data/app/views/layouts/mercury.html.erb +10 -20
- data/app/views/layouts/mercury.html.haml +19 -0
- data/app/views/layouts/mercury.html.slim +19 -0
- data/app/views/mercury/modals/character.html +1 -1
- data/app/views/mercury/modals/htmleditor.html +3 -7
- data/app/views/mercury/modals/link.html +37 -51
- data/app/views/mercury/modals/media.html +102 -0
- data/app/views/mercury/modals/table.html +79 -73
- data/app/views/mercury/panels/snippets.html +6 -1
- data/app/views/mercury/snippets/example/options.html.erb +23 -27
- data/app/views/mercury/snippets/no_options/preview.html.erb +1 -0
- data/config/routes.rb +9 -0
- 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 +5 -2
- data/features/loading/user_interface.feature +9 -7
- data/features/regions/{editable → full}/advanced_editing.feature +0 -0
- data/features/regions/full/basic_editing.feature +198 -0
- data/features/regions/{editable → full}/inserting_links.feature +20 -19
- data/features/regions/{editable → full}/inserting_media.feature +36 -18
- data/features/regions/{editable → full}/inserting_snippets.feature +28 -18
- data/features/regions/{editable → full}/inserting_special_characters.feature +2 -2
- data/features/regions/full/inserting_tables.feature +109 -0
- data/features/regions/{editable → full}/pasting.feature +0 -0
- data/features/regions/{editable → full}/uploading_images.feature +0 -0
- data/features/regions/{markupable → image}/uploading_images.feature +0 -0
- data/features/regions/{markupable → markdown}/advanced_editing.feature +0 -0
- data/features/regions/{markupable → markdown}/basic_editing.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_links.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_media.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_snippets.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_special_characters.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_tables.feature +0 -0
- data/features/regions/{snippetable/advanced_editing.feature → markdown/uploading_images.feature} +0 -0
- data/features/regions/simple/basic_editing.feature +5 -0
- data/features/regions/{snippetable/basic_editing.feature → snippets/advanced_editing.feature} +0 -0
- data/features/regions/{snippetable/inserting_snippets.feature → snippets/basic_editing.feature} +0 -0
- data/{vendor/assets/javascripts/mercury/locales/da.locale.js.coffee → features/regions/snippets/inserting_snippets.feature} +0 -0
- data/features/saving/saving.feature +8 -8
- data/features/step_definitions/custom_web_steps.rb +22 -0
- data/features/step_definitions/generator_steps.rb +23 -0
- data/features/step_definitions/mercury_steps.rb +1 -438
- data/features/support/aruba.rb +28 -0
- data/features/support/env.rb +11 -1
- data/features/support/selectors.rb +23 -0
- data/lib/generators/mercury/install/authentication/authentication_generator.rb +17 -0
- data/lib/generators/mercury/install/images/images_generator.rb +47 -0
- data/{app/models/mercury/image.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image.rb} +7 -0
- 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 +12 -23
- data/lib/mercury-rails.rb +1 -2
- data/lib/mercury/authentication.rb +1 -0
- data/lib/mercury/cucumber/step_definitions.rb +13 -0
- data/lib/mercury/cucumber/step_definitions/mercury_steps.rb +408 -0
- data/{features → lib/mercury/cucumber}/support/mercury_contents.rb +3 -3
- data/{features → lib/mercury/cucumber}/support/mercury_selectors.rb +0 -20
- data/lib/mercury/engine.rb +19 -0
- data/lib/mercury/rails.rb +5 -0
- data/lib/mercury/version.rb +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/app/assets/javascripts/prototype.js +6082 -0
- data/spec/dummy/app/assets/stylesheets/application.css.scss +110 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mercury.html.erb +28 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +58 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +10 -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/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/teabag.rb +9 -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/db/.gitkeep +0 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/blank.html +1 -0
- data/spec/dummy/public/favicon.ico +0 -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 +279 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialog.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/backcolor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/forecolor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/formatblock.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/snippetpanel.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/style.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/lightview.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modal.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/htmleditor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/insertcharacter.html +0 -0
- data/spec/javascripts/fixtures/mercury/modals/insertlink.html +67 -0
- data/spec/javascripts/fixtures/mercury/modals/insertmedia.html +87 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/insertsnippet.html +0 -0
- data/spec/javascripts/fixtures/mercury/modals/inserttable.html +73 -0
- data/spec/javascripts/{templates → fixtures}/mercury/page_editor.html +4 -4
- data/spec/javascripts/{templates → fixtures}/mercury/palette.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/panel.html +0 -0
- data/spec/javascripts/fixtures/mercury/region.html +6 -0
- data/spec/javascripts/fixtures/mercury/regions/full.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/image.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/markdown.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/simple.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/snippets.html +4 -0
- data/spec/javascripts/{templates → fixtures}/mercury/select.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/snippet.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/snippet_toolbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/statusbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/table_editor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button_group.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.expander.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/tooltip.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/uploader.html +0 -0
- data/spec/javascripts/mercury/{dialog_spec.js.coffee → dialog_spec.coffee} +11 -12
- data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +3 -4
- data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/lightview_spec.js.coffee +180 -142
- data/spec/javascripts/mercury/mercury_spec.js.coffee +19 -13
- data/spec/javascripts/mercury/modal_spec.js.coffee +192 -148
- data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +107 -34
- data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +106 -26
- data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +50 -40
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +124 -80
- data/spec/javascripts/mercury/palette_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/panel_spec.js.coffee +9 -12
- data/spec/javascripts/mercury/region_spec.js.coffee +22 -17
- data/spec/javascripts/mercury/regions/{editable_spec.js.coffee → full_spec.js.coffee} +26 -28
- data/spec/javascripts/mercury/regions/image_spec.js.coffee +33 -0
- data/spec/javascripts/mercury/regions/{markupable_spec.js.coffee → markdown_spec.js.coffee} +32 -34
- data/spec/javascripts/mercury/regions/simple_spec.js.coffee +32 -0
- data/spec/javascripts/mercury/regions/{snippetable_spec.js.coffee → snippets_spec.js.coffee} +54 -55
- data/spec/javascripts/mercury/select_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/snippet_spec.js.coffee +92 -16
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +31 -16
- data/spec/javascripts/mercury/statusbar_spec.js.coffee +9 -10
- data/spec/javascripts/mercury/table_editor_spec.js.coffee +1 -2
- data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +7 -9
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +55 -26
- data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +13 -13
- data/spec/javascripts/mercury/toolbar_spec.js.coffee +43 -14
- data/spec/javascripts/mercury/tooltip_spec.js.coffee +1 -2
- data/spec/javascripts/mercury/uploader_spec.js.coffee +47 -33
- data/spec/javascripts/spec_helper.coffee +4 -0
- data/spec/javascripts/{spec_helper.js → support/event_simulation.js} +0 -2
- data/spec/teabag_env.rb +32 -0
- metadata +366 -196
- data/features/regions/editable/basic_editing.feature +0 -195
- data/features/regions/editable/inserting_tables.feature +0 -109
- data/spec/javascripts/templates/mercury/modals/insertlink.html +0 -30
- data/spec/javascripts/templates/mercury/modals/insertmedia.html +0 -35
- data/spec/javascripts/templates/mercury/modals/inserttable.html +0 -27
- data/spec/javascripts/templates/mercury/region.html +0 -2
- data/spec/javascripts/templates/mercury/regions/editable.html +0 -3
- data/spec/javascripts/templates/mercury/regions/snippetable.html +0 -4
- data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -54
- data/vendor/assets/javascripts/mercury_loader.js +0 -193
- data/vendor/assets/javascripts/mercury_overrides.js +0 -6
- data/vendor/assets/stylesheets/mercury/mercury.css +0 -151
- data/vendor/assets/stylesheets/mercury_overrides.css +0 -17
@@ -34,7 +34,7 @@
|
|
34
34
|
#
|
35
35
|
@Mercury ||= {}
|
36
36
|
jQuery.extend @Mercury,
|
37
|
-
version: '0.
|
37
|
+
version: '0.9.0'
|
38
38
|
|
39
39
|
# Mercury object namespaces
|
40
40
|
Regions: Mercury.Regions || {}
|
@@ -55,6 +55,14 @@ jQuery.extend @Mercury,
|
|
55
55
|
jQuery(window).on("mercury:#{eventName}", callback)
|
56
56
|
|
57
57
|
|
58
|
+
off: (eventName, callback) ->
|
59
|
+
jQuery(window).off("mercury:#{eventName}", callback)
|
60
|
+
|
61
|
+
|
62
|
+
one: (eventName, callback) ->
|
63
|
+
jQuery(window).one("mercury:#{eventName}", callback)
|
64
|
+
|
65
|
+
|
58
66
|
trigger: (eventName, options) ->
|
59
67
|
Mercury.log(eventName, options)
|
60
68
|
jQuery(window).trigger("mercury:#{eventName}", options)
|
@@ -92,6 +100,7 @@ jQuery.extend @Mercury,
|
|
92
100
|
locale: ->
|
93
101
|
return Mercury.determinedLocale if Mercury.determinedLocale
|
94
102
|
if Mercury.config.localization.enabled
|
103
|
+
debugger
|
95
104
|
locale = []
|
96
105
|
if navigator.language && (locale = navigator.language.toString().split('-')).length
|
97
106
|
topLocale = Mercury.I18n[locale[0]] || {}
|
@@ -1,19 +1,27 @@
|
|
1
1
|
@Mercury.modal = (url, options = {}) ->
|
2
|
-
Mercury.
|
3
|
-
|
2
|
+
instance = new Mercury.Modal(url, options)
|
3
|
+
instance.show()
|
4
|
+
return instance
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
class @Mercury.Modal
|
7
|
+
|
8
|
+
constructor: (@url, @options = {}) ->
|
9
|
+
|
10
|
+
|
11
|
+
show: (url = null, options = null) ->
|
12
|
+
@url = url || @url
|
13
|
+
@options = options || @options
|
14
|
+
@options.minWidth ||= 400
|
15
|
+
@options.ujsHandling = true unless @options.ujsHandling == false
|
7
16
|
|
8
|
-
show: (@url, @options = {}) ->
|
9
17
|
Mercury.trigger('focus:window')
|
10
|
-
@
|
18
|
+
@initializeModal()
|
11
19
|
if @visible then @update() else @appear()
|
12
20
|
if @options.content
|
13
|
-
setTimeout
|
21
|
+
setTimeout((=> @loadContent(@options.content)), 500)
|
14
22
|
|
15
23
|
|
16
|
-
|
24
|
+
initializeModal: ->
|
17
25
|
return if @initialized
|
18
26
|
@build()
|
19
27
|
@bindEvents()
|
@@ -21,20 +29,23 @@ jQuery.extend Mercury.modal,
|
|
21
29
|
|
22
30
|
|
23
31
|
build: ->
|
24
|
-
@element = jQuery('
|
25
|
-
@
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
@element = jQuery('.mercury-modal')
|
33
|
+
@overlay = jQuery('.mercury-modal-overlay')
|
34
|
+
|
35
|
+
unless @element.get(0) && @overlay.get(0)
|
36
|
+
@element = jQuery('<div>', {class: 'mercury-modal loading'})
|
37
|
+
@element.html('<h1 class="mercury-modal-title"><span></span><a>×</a></h1>')
|
38
|
+
@element.append('<div class="mercury-modal-content-container"><div class="mercury-modal-content"></div></div>')
|
39
|
+
|
40
|
+
@overlay = jQuery('<div>', {class: 'mercury-modal-overlay'})
|
41
|
+
|
42
|
+
@element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
43
|
+
@overlay.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
44
|
+
|
30
45
|
@titleElement = @element.find('.mercury-modal-title')
|
31
46
|
@contentContainerElement = @element.find('.mercury-modal-content-container')
|
32
|
-
|
33
47
|
@contentElement = @element.find('.mercury-modal-content')
|
34
48
|
|
35
|
-
@element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
36
|
-
@overlay.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
|
37
|
-
|
38
49
|
|
39
50
|
bindEvents: ->
|
40
51
|
Mercury.on 'refresh', => @resize(true)
|
@@ -46,12 +57,13 @@ jQuery.extend Mercury.modal,
|
|
46
57
|
@titleElement.find('a').on 'click', =>
|
47
58
|
@hide()
|
48
59
|
|
49
|
-
@
|
50
|
-
|
51
|
-
|
60
|
+
if @options.ujsHandling
|
61
|
+
@element.on 'ajax:beforeSend', (event, xhr, options) =>
|
62
|
+
options.success = (content) =>
|
63
|
+
@loadContent(content)
|
52
64
|
|
53
65
|
jQuery(document).on 'keydown', (event) =>
|
54
|
-
|
66
|
+
@hide() if event.keyCode == 27 && @visible
|
55
67
|
|
56
68
|
|
57
69
|
appear: ->
|
@@ -85,18 +97,16 @@ jQuery.extend Mercury.modal,
|
|
85
97
|
|
86
98
|
height = @contentElement.outerHeight() + titleHeight
|
87
99
|
|
88
|
-
width = @minWidth if width < @minWidth
|
89
|
-
height = Mercury.displayRect.fullHeight -
|
90
|
-
if @fix_height
|
91
|
-
height = @fix_height
|
100
|
+
width = @options.minWidth if width < @options.minWidth
|
101
|
+
height = Mercury.displayRect.fullHeight -20 if height > Mercury.displayRect.fullHeight - 20 || @options.fullHeight
|
92
102
|
|
93
103
|
@element.stop().animate {left: (Mercury.displayRect.width - width) / 2, width: width, height: height}, 200, 'easeInOutSine', =>
|
94
104
|
@contentElement.css({visibility: 'visible', display: 'block'})
|
95
105
|
if @contentPane.length
|
96
106
|
@contentElement.css({height: height - titleHeight, overflow: 'visible'})
|
97
|
-
controlHeight = if @contentControl.length then @contentControl.outerHeight() else 0
|
98
|
-
@contentPane.css({height: height - titleHeight - controlHeight -
|
99
|
-
@contentPane.find('.mercury-display-pane').css({width: width -
|
107
|
+
controlHeight = if @contentControl.length then @contentControl.outerHeight() + 10 else 0
|
108
|
+
@contentPane.css({height: height - titleHeight - controlHeight - 20})
|
109
|
+
@contentPane.find('.mercury-display-pane').css({width: width - 20})
|
100
110
|
else
|
101
111
|
@contentElement.css({height: height - titleHeight, overflow: 'auto'})
|
102
112
|
|
@@ -111,15 +121,15 @@ jQuery.extend Mercury.modal,
|
|
111
121
|
width = @element.width()
|
112
122
|
height = @element.height()
|
113
123
|
|
114
|
-
width = @minWidth if width < @minWidth
|
115
|
-
height = Mercury.displayRect.fullHeight
|
124
|
+
width = @options.minWidth if width < @options.minWidth
|
125
|
+
height = Mercury.displayRect.fullHeight if height > Mercury.displayRect.fullHeight || @options.fullHeight
|
116
126
|
|
117
127
|
titleHeight = @titleElement.outerHeight()
|
118
128
|
if @contentPane && @contentPane.length
|
119
129
|
@contentElement.css({height: height - titleHeight, overflow: 'visible'})
|
120
|
-
controlHeight = if @contentControl.length then @contentControl.outerHeight() else 0
|
121
|
-
@contentPane.css({height: height - titleHeight - controlHeight -
|
122
|
-
@contentPane.find('.mercury-display-pane').css({width: width -
|
130
|
+
controlHeight = if @contentControl.length then @contentControl.outerHeight() + 10 else 0
|
131
|
+
@contentPane.css({height: height - titleHeight - controlHeight - 20})
|
132
|
+
@contentPane.find('.mercury-display-pane').css({width: width - 20})
|
123
133
|
else
|
124
134
|
@contentElement.css({height: height - titleHeight, overflow: 'auto'})
|
125
135
|
|
@@ -143,7 +153,7 @@ jQuery.extend Mercury.modal,
|
|
143
153
|
return unless @url
|
144
154
|
@element.addClass('loading')
|
145
155
|
if Mercury.preloadedViews[@url]
|
146
|
-
setTimeout(
|
156
|
+
setTimeout((=> @loadContent(Mercury.preloadedViews[@url])), 10)
|
147
157
|
else
|
148
158
|
jQuery.ajax @url, {
|
149
159
|
headers: Mercury.ajaxHeaders()
|
@@ -157,7 +167,7 @@ jQuery.extend Mercury.modal,
|
|
157
167
|
|
158
168
|
|
159
169
|
loadContent: (data, options = null) ->
|
160
|
-
@
|
170
|
+
@initializeModal()
|
161
171
|
@options = options || @options
|
162
172
|
@setTitle()
|
163
173
|
@loaded = true
|
@@ -172,11 +182,20 @@ jQuery.extend Mercury.modal,
|
|
172
182
|
@options.afterLoad.call(@) if @options.afterLoad
|
173
183
|
if @options.handler
|
174
184
|
if Mercury.modalHandlers[@options.handler]
|
175
|
-
Mercury.modalHandlers[@options.handler]
|
185
|
+
if typeof(Mercury.modalHandlers[@options.handler]) == 'function'
|
186
|
+
Mercury.modalHandlers[@options.handler].call(@)
|
187
|
+
else
|
188
|
+
jQuery.extend(@, Mercury.modalHandlers[@options.handler])
|
189
|
+
@initialize()
|
176
190
|
else if Mercury.lightviewHandlers[@options.handler]
|
177
|
-
Mercury.lightviewHandlers[@options.handler]
|
191
|
+
if typeof(Mercury.lightviewHandlers[@options.handler]) == 'function'
|
192
|
+
Mercury.lightviewHandlers[@options.handler].call(@)
|
193
|
+
else
|
194
|
+
jQuery.extend(@, Mercury.lightviewHandlers[@options.handler])
|
195
|
+
@initialize()
|
178
196
|
|
179
197
|
@element.localize(Mercury.locale()) if Mercury.config.localization.enabled
|
198
|
+
@element.find('.modal-close').on('click', @hide)
|
180
199
|
@resize()
|
181
200
|
|
182
201
|
|
@@ -186,15 +205,18 @@ jQuery.extend Mercury.modal,
|
|
186
205
|
if @options.closeButton == false then closeButton.hide() else closeButton.show()
|
187
206
|
|
188
207
|
|
208
|
+
serializeForm: ->
|
209
|
+
return @element.find('form').serializeObject() || {}
|
210
|
+
|
211
|
+
|
189
212
|
reset: ->
|
190
213
|
@titleElement.find('span').html('')
|
191
214
|
@contentElement.html('')
|
192
215
|
|
193
216
|
|
194
|
-
hide:
|
217
|
+
hide: =>
|
195
218
|
return if @showing
|
196
219
|
@options = {}
|
197
|
-
@initialized = false
|
198
220
|
|
199
221
|
Mercury.trigger('focus:frame')
|
200
222
|
@element.hide()
|
@@ -0,0 +1,152 @@
|
|
1
|
+
@Mercury.modalHandlers.insertLink = {
|
2
|
+
|
3
|
+
initialize: ->
|
4
|
+
@editing = false
|
5
|
+
@content = null
|
6
|
+
|
7
|
+
# make the inputs work with the radio buttons
|
8
|
+
@element.find('.control-label input').on('click', @onLabelChecked)
|
9
|
+
@element.find('.controls .optional, .controls .required').on('focus', @onInputFocused)
|
10
|
+
|
11
|
+
# show/hide the link target options on target change
|
12
|
+
@element.find('#link_target').on('change', => @onChangeTarget())
|
13
|
+
|
14
|
+
@initializeForm()
|
15
|
+
|
16
|
+
# build the link on form submission
|
17
|
+
@element.find('form').on 'submit', (event) =>
|
18
|
+
event.preventDefault()
|
19
|
+
@validateForm()
|
20
|
+
unless @valid
|
21
|
+
@resize()
|
22
|
+
return
|
23
|
+
@submitForm()
|
24
|
+
@hide()
|
25
|
+
|
26
|
+
|
27
|
+
initializeForm: ->
|
28
|
+
@fillExistingBookmarks()
|
29
|
+
|
30
|
+
# get the selection and initialize its information into the form
|
31
|
+
return unless Mercury.region && Mercury.region.selection
|
32
|
+
selection = Mercury.region.selection()
|
33
|
+
|
34
|
+
# set the text content
|
35
|
+
@element.find('#link_text').val(selection.textContent()) if selection.textContent
|
36
|
+
|
37
|
+
# if we're editing a link prefill the information
|
38
|
+
|
39
|
+
a = selection.commonAncestor(true).closest('a') if selection && selection.commonAncestor
|
40
|
+
img = /<img/.test(selection.htmlContent()) if selection.htmlContent
|
41
|
+
return false unless img || a && a.length
|
42
|
+
|
43
|
+
# don't allow changing the content on edit
|
44
|
+
@element.find('#link_text_container').hide()
|
45
|
+
|
46
|
+
@content = selection.htmlContent() if img
|
47
|
+
|
48
|
+
return false unless a && a.length
|
49
|
+
@editing = a
|
50
|
+
|
51
|
+
# fill in the external url or bookmark select based on what it looks like
|
52
|
+
if a.attr('href') && a.attr('href').indexOf('#') == 0
|
53
|
+
bookmarkSelect = @element.find('#link_existing_bookmark')
|
54
|
+
bookmarkSelect.val(a.attr('href').replace(/[^#]*#/, ''))
|
55
|
+
bookmarkSelect.closest('.control-group').find('input[type=radio]').prop('checked', true)
|
56
|
+
else
|
57
|
+
@element.find('#link_external_url').val(a.attr('href'))
|
58
|
+
|
59
|
+
# if it has a name, assume it's a bookmark target
|
60
|
+
if a.attr('name')
|
61
|
+
newBookmarkInput = @element.find('#link_new_bookmark')
|
62
|
+
newBookmarkInput.val(a.attr('name'))
|
63
|
+
newBookmarkInput.closest('.control-group').find('input[type=radio]').prop('checked', true)
|
64
|
+
|
65
|
+
# if it has a target, select it, and try to pull options out
|
66
|
+
if a.attr('target')
|
67
|
+
@element.find('#link_target').val(a.attr('target'))
|
68
|
+
|
69
|
+
# if it's a popup window
|
70
|
+
if a.attr('href') && a.attr('href').indexOf('javascript:void') == 0
|
71
|
+
href = a.attr('href')
|
72
|
+
@element.find('#link_external_url').val(href.match(/window.open\('([^']+)',/)[1])
|
73
|
+
@element.find('#link_target').val('popup')
|
74
|
+
@element.find('#link_popup_width').val(href.match(/width=(\d+),/)[1])
|
75
|
+
@element.find('#link_popup_height').val(href.match(/height=(\d+),/)[1])
|
76
|
+
@element.find('#popup_options').show()
|
77
|
+
|
78
|
+
|
79
|
+
fillExistingBookmarks: ->
|
80
|
+
bookmarkSelect = @element.find('#link_existing_bookmark')
|
81
|
+
for tag in jQuery('a[name]', window.mercuryInstance.document)
|
82
|
+
bookmarkSelect.append(jQuery('<option>', {value: jQuery(tag).attr('name')}).text(jQuery(tag).text()))
|
83
|
+
|
84
|
+
|
85
|
+
onLabelChecked: ->
|
86
|
+
forInput = jQuery(@).closest('.control-label').attr('for')
|
87
|
+
jQuery(@).closest('.control-group').find("##{forInput}").focus()
|
88
|
+
|
89
|
+
|
90
|
+
onInputFocused: ->
|
91
|
+
jQuery(@).closest('.control-group').find('input[type=radio]').prop('checked', true)
|
92
|
+
|
93
|
+
|
94
|
+
onChangeTarget: ->
|
95
|
+
@element.find(".link-target-options").hide()
|
96
|
+
@element.find("##{@element.find('#link_target').val()}_options").show()
|
97
|
+
@resize(true)
|
98
|
+
|
99
|
+
|
100
|
+
addInputError: (input, message) ->
|
101
|
+
input.after('<span class="help-inline error-message">' + Mercury.I18n(message) + '</span>').closest('.control-group').addClass('error')
|
102
|
+
@valid = false
|
103
|
+
|
104
|
+
|
105
|
+
clearInputErrors: ->
|
106
|
+
@element.find('.control-group.error').removeClass('error').find('.error-message').remove()
|
107
|
+
@valid = true
|
108
|
+
|
109
|
+
|
110
|
+
validateForm: ->
|
111
|
+
@clearInputErrors()
|
112
|
+
|
113
|
+
type = @element.find('input[name=link_type]:checked').val()
|
114
|
+
|
115
|
+
el = @element.find("#link_#{type}")
|
116
|
+
@addInputError(el, "can't be blank") unless el.val()
|
117
|
+
|
118
|
+
if !@editing && !@content
|
119
|
+
el = @element.find('#link_text')
|
120
|
+
@addInputError(el, "can't be blank") unless el.val()
|
121
|
+
|
122
|
+
|
123
|
+
submitForm: ->
|
124
|
+
content = @element.find('#link_text').val()
|
125
|
+
target = @element.find('#link_target').val()
|
126
|
+
type = @element.find('input[name=link_type]:checked').val()
|
127
|
+
|
128
|
+
switch type
|
129
|
+
when 'existing_bookmark' then attrs = {href: "##{@element.find('#link_existing_bookmark').val()}"}
|
130
|
+
when 'new_bookmark' then attrs = {name: "#{@element.find('#link_new_bookmark').val()}"}
|
131
|
+
else attrs = {href: @element.find("#link_#{type}").val()}
|
132
|
+
|
133
|
+
switch target
|
134
|
+
when 'popup'
|
135
|
+
args = {
|
136
|
+
width: parseInt(@element.find('#link_popup_width').val()) || 500,
|
137
|
+
height: parseInt(@element.find('#link_popup_height').val()) || 500,
|
138
|
+
menubar: 'no',
|
139
|
+
toolbar: 'no'
|
140
|
+
}
|
141
|
+
attrs['href'] = "javascript:void(window.open('#{attrs['href']}', 'popup_window', '#{jQuery.param(args).replace(/&/g, ',')}'))"
|
142
|
+
else
|
143
|
+
attrs['target'] = target if target
|
144
|
+
|
145
|
+
value = {tagName: 'a', attrs: attrs, content: @content || content}
|
146
|
+
|
147
|
+
if @editing
|
148
|
+
Mercury.trigger('action', {action: 'replaceLink', value: value, node: @editing.get(0)})
|
149
|
+
else
|
150
|
+
Mercury.trigger('action', {action: 'insertLink', value: value})
|
151
|
+
|
152
|
+
}
|
@@ -0,0 +1,132 @@
|
|
1
|
+
@Mercury.modalHandlers.insertMedia = {
|
2
|
+
|
3
|
+
initialize: ->
|
4
|
+
@element.find('.control-label input').on('click', @onLabelChecked)
|
5
|
+
@element.find('.controls .optional, .controls .required').on('focus', (event) => @onInputFocused($(event.target)))
|
6
|
+
|
7
|
+
@focus('#media_image_url')
|
8
|
+
@initializeForm()
|
9
|
+
|
10
|
+
# build the image or embed/iframe on form submission
|
11
|
+
@element.find('form').on 'submit', (event) =>
|
12
|
+
event.preventDefault()
|
13
|
+
@validateForm()
|
14
|
+
unless @valid
|
15
|
+
@resize()
|
16
|
+
return
|
17
|
+
@submitForm()
|
18
|
+
@hide()
|
19
|
+
|
20
|
+
|
21
|
+
initializeForm: ->
|
22
|
+
# get the selection and initialize its information into the form
|
23
|
+
return unless Mercury.region && Mercury.region.selection
|
24
|
+
selection = Mercury.region.selection()
|
25
|
+
|
26
|
+
# if we're editing an image prefill the information
|
27
|
+
if image = selection.is?('img')
|
28
|
+
@element.find('#media_image_url').val(image.attr('src'))
|
29
|
+
@element.find('#media_image_alignment').val(image.attr('align'))
|
30
|
+
@element.find('#media_image_float').val(if image.attr('style')? then image.css('float') else '')
|
31
|
+
@focus('#media_image_url')
|
32
|
+
|
33
|
+
# if we're editing an iframe (assume it's a video for now)
|
34
|
+
if iframe = selection.is?('iframe')
|
35
|
+
src = iframe.attr('src')
|
36
|
+
if /^https?:\/\/www.youtube.com\//i.test(src)
|
37
|
+
# it's a youtube video
|
38
|
+
@element.find('#media_youtube_url').val("#{src.match(/^https?/)[0]}://youtu.be/#{src.match(/\/embed\/(\w+)/)[1]}")
|
39
|
+
@element.find('#media_youtube_width').val(iframe.width())
|
40
|
+
@element.find('#media_youtube_height').val(iframe.height())
|
41
|
+
@focus('#media_youtube_url')
|
42
|
+
else if /^https?:\/\/player.vimeo.com\//i.test(src)
|
43
|
+
# it's a vimeo video
|
44
|
+
@element.find('#media_vimeo_url').val("#{src.match(/^https?/)[0]}://vimeo.com/#{src.match(/\/video\/(\w+)/)[1]}")
|
45
|
+
@element.find('#media_vimeo_width').val(iframe.width())
|
46
|
+
@element.find('#media_vimeo_height').val(iframe.height())
|
47
|
+
@focus('#media_vimeo_url')
|
48
|
+
|
49
|
+
|
50
|
+
focus: (selector) ->
|
51
|
+
setTimeout((=> @element.find(selector).focus()), 300)
|
52
|
+
|
53
|
+
|
54
|
+
onLabelChecked: ->
|
55
|
+
forInput = jQuery(@).closest('.control-label').attr('for')
|
56
|
+
jQuery(@).closest('.control-group').find("##{forInput}").focus()
|
57
|
+
|
58
|
+
|
59
|
+
onInputFocused: (input) ->
|
60
|
+
input.closest('.control-group').find('input[type=radio]').prop('checked', true)
|
61
|
+
|
62
|
+
return if input.closest('.media-options').length
|
63
|
+
@element.find(".media-options").hide()
|
64
|
+
@element.find("##{input.attr('id').replace('media_', '')}_options").show()
|
65
|
+
@resize(true)
|
66
|
+
|
67
|
+
|
68
|
+
addInputError: (input, message) ->
|
69
|
+
input.after('<span class="help-inline error-message">' + Mercury.I18n(message) + '</span>').closest('.control-group').addClass('error')
|
70
|
+
@valid = false
|
71
|
+
|
72
|
+
|
73
|
+
clearInputErrors: ->
|
74
|
+
@element.find('.control-group.error').removeClass('error').find('.error-message').remove()
|
75
|
+
@valid = true
|
76
|
+
|
77
|
+
|
78
|
+
validateForm: ->
|
79
|
+
@clearInputErrors()
|
80
|
+
|
81
|
+
type = @element.find('input[name=media_type]:checked').val()
|
82
|
+
el = @element.find("#media_#{type}")
|
83
|
+
|
84
|
+
switch type
|
85
|
+
when 'youtube_url'
|
86
|
+
url = @element.find('#media_youtube_url').val()
|
87
|
+
@addInputError(el, "is invalid") unless /^https?:\/\/youtu.be\//.test(url)
|
88
|
+
when 'vimeo_url'
|
89
|
+
url = @element.find('#media_vimeo_url').val()
|
90
|
+
@addInputError(el, "is invalid") unless /^https?:\/\/vimeo.com\//.test(url)
|
91
|
+
else
|
92
|
+
@addInputError(el, "can't be blank") unless el.val()
|
93
|
+
|
94
|
+
|
95
|
+
submitForm: ->
|
96
|
+
type = @element.find('input[name=media_type]:checked').val()
|
97
|
+
|
98
|
+
switch type
|
99
|
+
when 'image_url'
|
100
|
+
attrs = {src: @element.find('#media_image_url').val()}
|
101
|
+
attrs['align'] = alignment if alignment = @element.find('#media_image_alignment').val()
|
102
|
+
attrs['style'] = 'float: ' + float + ';' if float = @element.find('#media_image_float').val()
|
103
|
+
Mercury.trigger('action', {action: 'insertImage', value: attrs})
|
104
|
+
|
105
|
+
when 'youtube_url'
|
106
|
+
url = @element.find('#media_youtube_url').val()
|
107
|
+
code = url.replace(/https?:\/\/youtu.be\//, '')
|
108
|
+
protocol = 'http'
|
109
|
+
protocol = 'https' if /^https:/.test(url)
|
110
|
+
value = jQuery('<iframe>', {
|
111
|
+
width: parseInt(@element.find('#media_youtube_width').val(), 10) || 560,
|
112
|
+
height: parseInt(@element.find('#media_youtube_height').val(), 10) || 349,
|
113
|
+
src: "#{protocol}://www.youtube.com/embed/#{code}?wmode=transparent",
|
114
|
+
frameborder: 0,
|
115
|
+
allowfullscreen: 'true'
|
116
|
+
})
|
117
|
+
Mercury.trigger('action', {action: 'insertHTML', value: value})
|
118
|
+
|
119
|
+
when 'vimeo_url'
|
120
|
+
url = @element.find('#media_vimeo_url').val()
|
121
|
+
code = url.replace(/^https?:\/\/vimeo.com\//, '')
|
122
|
+
protocol = 'http'
|
123
|
+
protocol = 'https' if /^https:/.test(url)
|
124
|
+
value = jQuery('<iframe>', {
|
125
|
+
width: parseInt(@element.find('#media_vimeo_width').val(), 10) || 400,
|
126
|
+
height: parseInt(@element.find('#media_vimeo_height').val(), 10) || 225,
|
127
|
+
src: "#{protocol}://player.vimeo.com/video/#{code}?title=1&byline=1&portrait=0&color=ffffff",
|
128
|
+
frameborder: 0
|
129
|
+
})
|
130
|
+
Mercury.trigger('action', {action: 'insertHTML', value: value})
|
131
|
+
|
132
|
+
}
|