kiteditor 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
data/POST_INSTALL
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
+============================================================================+
|
|
2
|
+
Congratulations, Mercury was successfully installed in your app. Documentation
|
|
3
|
+
and other useful info can be found at: https://github.com/jejacks0n/mercury
|
|
4
|
+
|
|
5
|
+
Here's a post install checklist:
|
|
6
|
+
|
|
7
|
+
* Adjust your application.js & css files to not `require_tree .`
|
|
8
|
+
|
|
9
|
+
* Learn about, and change configurations in app/assets/javascripts/mercury.js.
|
|
10
|
+
|
|
11
|
+
* If installed, you can make changes to the provided layout and css files too.
|
|
12
|
+
|
|
13
|
+
* If you want image processing and uploading (using paperclip by default):
|
|
14
|
+
|
|
15
|
+
rails g mercury:install:images (use --orm=mongoid for MongoDB)
|
|
16
|
+
bundle
|
|
17
|
+
rake db:migrate (if using ActiveRecord)
|
|
18
|
+
|
|
19
|
+
* For a basic example of authentication for Mercury, install the example:
|
|
20
|
+
|
|
21
|
+
rails g mercury:install:authentication
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/{vendor/assets/javascripts/mercury/dependencies → app/assets/javascripts}/jquery-1.7.js
RENAMED
|
File without changes
|
|
@@ -2,40 +2,14 @@
|
|
|
2
2
|
* Mercury Editor is a CoffeeScript and jQuery based WYSIWYG editor. Documentation and other useful information can be
|
|
3
3
|
* found at https://github.com/jejacks0n/mercury
|
|
4
4
|
*
|
|
5
|
-
* Supported browsers:
|
|
6
|
-
* - Firefox 4+
|
|
7
|
-
* - Chrome 10+
|
|
8
|
-
* - Safari 5+
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2011 Jeremy Jackson
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
-
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
14
|
-
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
15
|
-
* persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
-
*
|
|
17
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
18
|
-
* Software.
|
|
19
|
-
*
|
|
20
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
21
|
-
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
22
|
-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
23
|
-
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*
|
|
25
|
-
*= require_self
|
|
26
|
-
*
|
|
27
5
|
* Minimum jQuery requirements are 1.7
|
|
28
|
-
*=
|
|
6
|
+
*= require_self
|
|
29
7
|
*
|
|
30
8
|
* You can include the Rails jQuery ujs script here to get some nicer behaviors in modals, panels and lightviews when
|
|
31
9
|
* using :remote => true within the contents rendered in them.
|
|
32
10
|
* require jquery_ujs
|
|
33
11
|
*
|
|
34
|
-
*
|
|
35
|
-
* or do so at the end of the current file (mercury.js). There's an example that will help you get started.
|
|
36
|
-
* require mercury_overrides
|
|
37
|
-
*
|
|
38
|
-
* Add all requires for the support libraries that integrate nicely with Mercury Editor.
|
|
12
|
+
* Add any requires for the support libraries that integrate nicely with Mercury Editor.
|
|
39
13
|
* require mercury/support/history
|
|
40
14
|
*
|
|
41
15
|
* Require Mercury Editor itself.
|
|
@@ -43,10 +17,14 @@
|
|
|
43
17
|
*
|
|
44
18
|
* Require any localizations you wish to support
|
|
45
19
|
* Example: es.locale, or fr.locale -- regional dialects are in each language file so never en_US for instance.
|
|
20
|
+
* Make sure you enable the localization feature in the configuration.
|
|
46
21
|
* require mercury/locales/swedish_chef.locale
|
|
47
22
|
*
|
|
48
23
|
* Add all requires for plugins that extend or change the behavior of Mercury Editor.
|
|
49
24
|
* require mercury/plugins/save_as_xml/plugin.js
|
|
25
|
+
*
|
|
26
|
+
* Require any files you want to use that either extend, or change the default Mercury behavior.
|
|
27
|
+
* require mercury_overrides
|
|
50
28
|
*/
|
|
51
29
|
window.Mercury = {
|
|
52
30
|
|
|
@@ -58,16 +36,16 @@ window.Mercury = {
|
|
|
58
36
|
// behaviors. Any top level object put here will create a new toolbar. Buttons are simply nested inside the
|
|
59
37
|
// toolbars, along with button groups.
|
|
60
38
|
//
|
|
61
|
-
// Some toolbars are custom (the
|
|
62
|
-
//
|
|
39
|
+
// Some toolbars are custom (the snippets toolbar for instance), and to denote that use _custom: true. You can then
|
|
40
|
+
// build the toolbar yourself with it's own behavior.
|
|
63
41
|
//
|
|
64
42
|
// Buttons can be grouped, and a button group is simply a way to wrap buttons for styling -- they can also handle
|
|
65
|
-
// enabling or disabling all the buttons within it by using a context. The table button group is a good example
|
|
66
|
-
//
|
|
43
|
+
// enabling or disabling all the buttons within it by using a context. The table button group is a good example of
|
|
44
|
+
// this.
|
|
67
45
|
//
|
|
68
|
-
// It's important to note that each of the button names (keys), in each toolbar object must be unique, regardless
|
|
69
|
-
//
|
|
70
|
-
//
|
|
46
|
+
// It's important to note that each of the button names (keys), in each toolbar object must be unique, regardless of
|
|
47
|
+
// if it's in a button group, or nested, etc. This is because styling is applied to them by name, and because their
|
|
48
|
+
// name is used in the event that's fired when you click on them.
|
|
71
49
|
//
|
|
72
50
|
// Button format: `[label, description, {type: action, type: action, etc}]`
|
|
73
51
|
//
|
|
@@ -97,8 +75,8 @@ window.Mercury = {
|
|
|
97
75
|
// 1. a string, denoting the name of the mode
|
|
98
76
|
// note: it's assumed that when a specific mode is turned on, all other modes will be turned off, which happens
|
|
99
77
|
// automatically, thus putting the editor into a specific "state"
|
|
100
|
-
// - regions: allows buttons to be enabled/disabled based on what region type has focus, expects
|
|
101
|
-
// 1. an array of region types (eg. ['
|
|
78
|
+
// - regions: allows buttons to be enabled/disabled based on what region type has focus, expects:
|
|
79
|
+
// 1. an array of region types (eg. ['full', 'markdown'])
|
|
102
80
|
// - preload: allows some dialog views to be loaded when the button is created instead of on first open, expects:
|
|
103
81
|
// 1. a boolean true / false
|
|
104
82
|
// note: this is only used by panels, selects, and palettes
|
|
@@ -122,10 +100,10 @@ window.Mercury = {
|
|
|
122
100
|
redo: ['Redo', 'Redo your last action'],
|
|
123
101
|
sep: ' '
|
|
124
102
|
},
|
|
125
|
-
insertLink: ['Link', 'Insert Link', { modal: '/mercury/modals/link.html', regions: ['
|
|
126
|
-
insertMedia: ['Media', 'Insert Media (images and videos)', { modal: '/mercury/modals/media.html', regions: ['
|
|
127
|
-
insertTable: ['Table', 'Insert Table', { modal: '/mercury/modals/table.html', regions: ['
|
|
128
|
-
insertCharacter: ['Character', 'Special Characters', { modal: '/mercury/modals/character.html', regions: ['
|
|
103
|
+
insertLink: ['Link', 'Insert Link', { modal: '/mercury/modals/link.html', regions: ['full', 'markdown'] }],
|
|
104
|
+
insertMedia: ['Media', 'Insert Media (images and videos)', { modal: '/mercury/modals/media.html', regions: ['full', 'markdown'] }],
|
|
105
|
+
insertTable: ['Table', 'Insert Table', { modal: '/mercury/modals/table.html', regions: ['full', 'markdown'] }],
|
|
106
|
+
insertCharacter: ['Character', 'Special Characters', { modal: '/mercury/modals/character.html', regions: ['full', 'markdown'] }],
|
|
129
107
|
snippetPanel: ['Snippet', 'Snippet Panel', { panel: '/mercury/panels/snippets.html' }],
|
|
130
108
|
sep2: ' ',
|
|
131
109
|
historyPanel: ['History', 'Page Version History', { panel: '/mercury/panels/history.html' }],
|
|
@@ -134,7 +112,7 @@ window.Mercury = {
|
|
|
134
112
|
},
|
|
135
113
|
|
|
136
114
|
editable: {
|
|
137
|
-
_regions: ['
|
|
115
|
+
_regions: ['full', 'markdown'],
|
|
138
116
|
predefined: {
|
|
139
117
|
style: ['Style', null, { select: '/mercury/selects/style.html', preload: true }],
|
|
140
118
|
sep1: ' ',
|
|
@@ -142,17 +120,17 @@ window.Mercury = {
|
|
|
142
120
|
sep2: '-'
|
|
143
121
|
},
|
|
144
122
|
colors: {
|
|
145
|
-
backColor: ['Background Color', null, { palette: '/mercury/palettes/backcolor.html', context: true, preload: true, regions: ['
|
|
123
|
+
backColor: ['Background Color', null, { palette: '/mercury/palettes/backcolor.html', context: true, preload: true, regions: ['full'] }],
|
|
146
124
|
sep1: ' ',
|
|
147
|
-
foreColor: ['Text Color', null, { palette: '/mercury/palettes/forecolor.html', context: true, preload: true, regions: ['
|
|
125
|
+
foreColor: ['Text Color', null, { palette: '/mercury/palettes/forecolor.html', context: true, preload: true, regions: ['full'] }],
|
|
148
126
|
sep2: '-'
|
|
149
127
|
},
|
|
150
128
|
decoration: {
|
|
151
129
|
bold: ['Bold', null, { context: true }],
|
|
152
130
|
italic: ['Italicize', null, { context: true }],
|
|
153
|
-
overline: ['Overline', null, { context: true, regions: ['
|
|
154
|
-
strikethrough: ['Strikethrough', null, { context: true, regions: ['
|
|
155
|
-
underline: ['Underline', null, { context: true, regions: ['
|
|
131
|
+
overline: ['Overline', null, { context: true, regions: ['full'] }],
|
|
132
|
+
strikethrough: ['Strikethrough', null, { context: true, regions: ['full'] }],
|
|
133
|
+
underline: ['Underline', null, { context: true, regions: ['full'] }],
|
|
156
134
|
sep: '-'
|
|
157
135
|
},
|
|
158
136
|
script: {
|
|
@@ -161,10 +139,10 @@ window.Mercury = {
|
|
|
161
139
|
sep: '-'
|
|
162
140
|
},
|
|
163
141
|
justify: {
|
|
164
|
-
justifyLeft: ['Align Left', null, { context: true, regions: ['
|
|
165
|
-
justifyCenter: ['Center', null, { context: true, regions: ['
|
|
166
|
-
justifyRight: ['Align Right', null, { context: true, regions: ['
|
|
167
|
-
justifyFull: ['Justify Full', null, { context: true, regions: ['
|
|
142
|
+
justifyLeft: ['Align Left', null, { context: true, regions: ['full'] }],
|
|
143
|
+
justifyCenter: ['Center', null, { context: true, regions: ['full'] }],
|
|
144
|
+
justifyRight: ['Align Right', null, { context: true, regions: ['full'] }],
|
|
145
|
+
justifyFull: ['Justify Full', null, { context: true, regions: ['full'] }],
|
|
168
146
|
sep: '-'
|
|
169
147
|
},
|
|
170
148
|
list: {
|
|
@@ -179,12 +157,12 @@ window.Mercury = {
|
|
|
179
157
|
},
|
|
180
158
|
table: {
|
|
181
159
|
_context: true,
|
|
182
|
-
insertRowBefore: ['Insert Table Row', 'Insert a table row before the cursor', { regions: ['
|
|
183
|
-
insertRowAfter: ['Insert Table Row', 'Insert a table row after the cursor', { regions: ['
|
|
184
|
-
deleteRow: ['Delete Table Row', 'Delete this table row', { regions: ['
|
|
185
|
-
insertColumnBefore: ['Insert Table Column', 'Insert a table column before the cursor', { regions: ['
|
|
186
|
-
insertColumnAfter: ['Insert Table Column', 'Insert a table column after the cursor', { regions: ['
|
|
187
|
-
deleteColumn: ['Delete Table Column', 'Delete this table column', { regions: ['
|
|
160
|
+
insertRowBefore: ['Insert Table Row', 'Insert a table row before the cursor', { regions: ['full'] }],
|
|
161
|
+
insertRowAfter: ['Insert Table Row', 'Insert a table row after the cursor', { regions: ['full'] }],
|
|
162
|
+
deleteRow: ['Delete Table Row', 'Delete this table row', { regions: ['full'] }],
|
|
163
|
+
insertColumnBefore: ['Insert Table Column', 'Insert a table column before the cursor', { regions: ['full'] }],
|
|
164
|
+
insertColumnAfter: ['Insert Table Column', 'Insert a table column after the cursor', { regions: ['full'] }],
|
|
165
|
+
deleteColumn: ['Delete Table Column', 'Delete this table column', { regions: ['full'] }],
|
|
188
166
|
sep1: ' ',
|
|
189
167
|
increaseColspan: ['Increase Cell Columns', 'Increase the cells colspan'],
|
|
190
168
|
decreaseColspan: ['Decrease Cell Columns', 'Decrease the cells colspan and add a new cell'],
|
|
@@ -197,15 +175,15 @@ window.Mercury = {
|
|
|
197
175
|
sep1: '-'
|
|
198
176
|
},
|
|
199
177
|
formatting: {
|
|
200
|
-
removeFormatting: ['Remove Formatting', 'Remove formatting for the selection', { regions: ['
|
|
178
|
+
removeFormatting: ['Remove Formatting', 'Remove formatting for the selection', { regions: ['full'] }],
|
|
201
179
|
sep2: ' '
|
|
202
180
|
},
|
|
203
181
|
editors: {
|
|
204
|
-
htmlEditor: ['Edit HTML', 'Edit the HTML content', { regions: ['
|
|
182
|
+
htmlEditor: ['Edit HTML', 'Edit the HTML content', { regions: ['full'] }]
|
|
205
183
|
}
|
|
206
184
|
},
|
|
207
185
|
|
|
208
|
-
|
|
186
|
+
snippets: {
|
|
209
187
|
_custom: true,
|
|
210
188
|
actions: {
|
|
211
189
|
editSnippet: ['Edit Snippet Settings'],
|
|
@@ -220,28 +198,27 @@ window.Mercury = {
|
|
|
220
198
|
//
|
|
221
199
|
// You can customize some aspects of how regions are found, identified, and saved.
|
|
222
200
|
//
|
|
223
|
-
//
|
|
224
|
-
// advance, and is the only real code/naming exposed in the implementation of Mercury. To allow this
|
|
225
|
-
// configurable as possible, you can set the name of
|
|
226
|
-
//
|
|
227
|
-
// by default it would be mercury-region-preview)
|
|
201
|
+
// attribute: Mercury identifies editable regions by a data-mercury attribute. This attribute has to be added in
|
|
202
|
+
// your HTML in advance, and is the only real code/naming exposed in the implementation of Mercury. To allow this
|
|
203
|
+
// to be as configurable as possible, you can set the name of this attribute. If you change this, you should adjust
|
|
204
|
+
// the injected styles as well.
|
|
228
205
|
//
|
|
229
206
|
// identifier: This is used as a unique identifier for any given region (and thus should be unique to the page).
|
|
230
207
|
// By default this is the id attribute but can be changed to a data attribute should you want to use something
|
|
231
208
|
// custom instead.
|
|
232
209
|
//
|
|
233
|
-
// determineType: This function is called after checking the data-type attribute for the correct field type. Use
|
|
234
|
-
// it if you want to programatically set the type based on inspection of the region.
|
|
235
|
-
//
|
|
236
210
|
// dataAttributes: The dataAttributes is an array of data attributes that will be serialized and returned to the
|
|
237
211
|
// server upon saving. These attributes, when applied to a Mercury region element, will be automatically serialized
|
|
238
212
|
// and submitted with the AJAX request sent when a page is saved. These are expected to be HTML5 data attributes,
|
|
239
213
|
// and 'data-' will automatically be prepended to each item in this directive. (ex. ['scope', 'version'])
|
|
214
|
+
//
|
|
215
|
+
// determineType: This function is called after checking the data-type attribute for the correct field type. Use
|
|
216
|
+
// it if you want to dynamically set the type based on inspection of the region.
|
|
240
217
|
regions: {
|
|
241
|
-
|
|
218
|
+
attribute: 'data-mercury',
|
|
242
219
|
identifier: 'id',
|
|
243
|
-
// determineType: function(region){},
|
|
244
220
|
dataAttributes: []
|
|
221
|
+
// determineType: function(region){},
|
|
245
222
|
},
|
|
246
223
|
|
|
247
224
|
|
|
@@ -329,7 +306,7 @@ window.Mercury = {
|
|
|
329
306
|
// If you want to add behaviors to specific region types, you can mix them into the actions property of any region
|
|
330
307
|
// type.
|
|
331
308
|
//
|
|
332
|
-
// Mercury.Regions.
|
|
309
|
+
// Mercury.Regions.Full.actions.htmlEditor = function() {}
|
|
333
310
|
//
|
|
334
311
|
// You can see how the behavior matches up directly with the button names. It's also important to note that the
|
|
335
312
|
// callback functions are executed within the scope of the given region, so you have access to all it's methods.
|
|
@@ -370,12 +347,14 @@ window.Mercury = {
|
|
|
370
347
|
csrfSelector: 'meta[name="csrf-token"]',
|
|
371
348
|
csrfHeader: 'X-CSRF-Token',
|
|
372
349
|
|
|
350
|
+
|
|
373
351
|
// ## Editor URLs
|
|
374
352
|
//
|
|
375
353
|
// When loading a given page, you may want to tweak this regex. It's to allow the url to differ from the page
|
|
376
354
|
// you're editing, and the url at which you access it.
|
|
377
355
|
editorUrlRegEx: /([http|https]:\/\/.[^\/]*)\/editor\/?(.*)/i,
|
|
378
356
|
|
|
357
|
+
|
|
379
358
|
// ## Hijacking Links & Forms
|
|
380
359
|
//
|
|
381
360
|
// Mercury will hijack links and forms that don't have a target set, or the target is set to _self and will set it
|
|
@@ -448,15 +427,16 @@ window.Mercury = {
|
|
|
448
427
|
// Mercury tries to stay as much out of your code as possible, but because regions appear within your document we
|
|
449
428
|
// need to include a few styles to indicate regions, as well as the different states of them (eg. focused). These
|
|
450
429
|
// styles are injected into your document, and as simple as they might be, you may want to change them.
|
|
451
|
-
//
|
|
452
|
-
// {{regionClass}} will be automatically replaced with whatever you have set in the regions.class config directive.
|
|
453
430
|
injectedStyles: '' +
|
|
454
|
-
'
|
|
455
|
-
'
|
|
456
|
-
'.
|
|
457
|
-
'
|
|
458
|
-
'
|
|
459
|
-
'
|
|
431
|
+
'[data-mercury] { min-height: 10px; outline: 1px dotted #09F } ' +
|
|
432
|
+
'[data-mercury]:focus { outline: none; -webkit-box-shadow: 0 0 10px #09F, 0 0 1px #045; box-shadow: 0 0 10px #09F, 0 0 1px #045 }' +
|
|
433
|
+
'[data-mercury].focus { outline: none; -webkit-box-shadow: 0 0 10px #09F, 0 0 1px #045; box-shadow: 0 0 10px #09F, 0 0 1px #045 }' +
|
|
434
|
+
'[data-mercury]:after { content: "."; display: block; visibility: hidden; clear: both; height: 0; overflow: hidden; }' +
|
|
435
|
+
'[data-mercury] table { border: 1px dotted red; min-width: 6px; }' +
|
|
436
|
+
'[data-mercury] th { border: 1px dotted red; min-width: 6px; }' +
|
|
437
|
+
'[data-mercury] td { border: 1px dotted red; min-width: 6px; }' +
|
|
438
|
+
'[data-mercury] .mercury-textarea { border: 0; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; resize: none; }' +
|
|
439
|
+
'[data-mercury] .mercury-textarea:focus { outline: none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; }'
|
|
460
440
|
},
|
|
461
441
|
|
|
462
442
|
// ## Silent Mode
|
|
@@ -467,13 +447,6 @@ window.Mercury = {
|
|
|
467
447
|
// ## Debug Mode
|
|
468
448
|
//
|
|
469
449
|
// Turning debug mode on will log events and other various things (using console.debug if available).
|
|
470
|
-
debug: false
|
|
471
|
-
|
|
472
|
-
// The onload method is provided as a callback in case you want to override default Mercury Editor behavior. It will
|
|
473
|
-
// be called directly after the Mercury scripts have loaded, but before anything has been initialized. It's a good
|
|
474
|
-
// place to add or change functionality.
|
|
475
|
-
onload: function() {
|
|
476
|
-
//Mercury.PageEditor.prototype.iframeSrc = function(url) { return '/testing'; }
|
|
477
|
-
},
|
|
450
|
+
debug: false
|
|
478
451
|
|
|
479
452
|
};
|
|
File without changes
|
|
@@ -1,23 +1,113 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jQuery serializeObject Plugin
|
|
2
|
+
* jQuery serializeObject Plugin: https://github.com/fojas/jQuery-serializeObject
|
|
3
3
|
*
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
$.
|
|
7
|
-
var o =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
!function($){
|
|
6
|
+
$.serializeObject = function(obj){
|
|
7
|
+
var o={},lookup=o,a = obj;
|
|
8
|
+
$.each(a,function(){
|
|
9
|
+
var named = this.name.replace(/\[([^\]]+)?\]/g,',$1').split(','),
|
|
10
|
+
cap = named.length - 1,
|
|
11
|
+
i = 0;
|
|
12
|
+
for(;i<cap;i++) {
|
|
13
|
+
// move down the tree - create objects or array if necessary
|
|
14
|
+
if(lookup.push){ // this is an array, add values instead of setting them
|
|
15
|
+
// push an object if this is an empty array or we are about to overwrite a value
|
|
16
|
+
if( !lookup[lookup.length -1] // this is an empty array
|
|
17
|
+
|| lookup[lookup.length -1].constructor !== Object //current value is not a hash
|
|
18
|
+
|| lookup[lookup.length -1][named[i+1]] !== undefined //current item is already set
|
|
19
|
+
){
|
|
20
|
+
lookup.push({});
|
|
21
|
+
}
|
|
22
|
+
lookup = lookup[lookup.length -1];
|
|
23
|
+
} else {
|
|
24
|
+
lookup = lookup[named[i]] = lookup[named[i]] || (named[i+1]==""?[]:{});
|
|
25
|
+
}
|
|
15
26
|
}
|
|
27
|
+
if(lookup.push){
|
|
28
|
+
lookup.push(this.value);
|
|
29
|
+
}else{
|
|
30
|
+
lookup[named[cap]]=this.value;
|
|
31
|
+
}
|
|
32
|
+
lookup = o;
|
|
16
33
|
});
|
|
17
34
|
return o;
|
|
18
35
|
};
|
|
19
|
-
})(jQuery);
|
|
20
36
|
|
|
37
|
+
$.deserializeObject = function deserializeObject(json,arr,prefix){
|
|
38
|
+
var i,j,thisPrefix,objType;
|
|
39
|
+
arr = arr || [];
|
|
40
|
+
if(Object.prototype.toString.call(json) ==='[object Object]'){
|
|
41
|
+
for(i in json){
|
|
42
|
+
thisPrefix = prefix ? [prefix,'[',i,']'].join('') : i;
|
|
43
|
+
if(json.hasOwnProperty(i)){
|
|
44
|
+
objType = Object.prototype.toString.call(json[i])
|
|
45
|
+
if(objType === '[object Array]'){
|
|
46
|
+
for(j = 0,jsonLen = json[i].length;j<jsonLen;j++){
|
|
47
|
+
deserializeObject(json[i][j],arr,thisPrefix+'[]');
|
|
48
|
+
}
|
|
49
|
+
}else if(objType === '[object Object]'){
|
|
50
|
+
deserializeObject(json[i],arr,thisPrefix);
|
|
51
|
+
}else {
|
|
52
|
+
arr.push({
|
|
53
|
+
name : thisPrefix,
|
|
54
|
+
value : json[i]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
arr.push({
|
|
61
|
+
name : prefix,
|
|
62
|
+
value : json
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return arr;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var check = function(){
|
|
69
|
+
// older versions of jQuery do not have prop
|
|
70
|
+
var propExists = !!$.fn.prop;
|
|
71
|
+
return function(obj,checked){
|
|
72
|
+
if(propExists) obj.prop('checked',checked);
|
|
73
|
+
else obj.attr('checked', (checked ? 'checked' : null ));
|
|
74
|
+
};
|
|
75
|
+
}();
|
|
76
|
+
|
|
77
|
+
$.applySerializedArray = function(form,obj){
|
|
78
|
+
var $form = $(form).find('input,select,textarea'), el;
|
|
79
|
+
check($form.filter(':checked'),false)
|
|
80
|
+
for(var i = obj.length;i--;){
|
|
81
|
+
el = $form.filter("[name='"+obj[i].name+"']");
|
|
82
|
+
if(el.filter(':checkbox').length){
|
|
83
|
+
if(el.val() == obj[i].value) check(el.filter(':checkbox'),true);
|
|
84
|
+
}else if(el.filter(':radio').length){
|
|
85
|
+
check(el.filter("[value='"+obj[i].value+"']"),true)
|
|
86
|
+
} else {
|
|
87
|
+
el.val(obj[i].value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
$.applySerializedObject = function(form, obj){
|
|
93
|
+
$.applySerializedArray(form,$.deserializeObject(obj));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
$.fn.serializeObject = $.fn.serializeObject || function(){
|
|
97
|
+
return $.serializeObject(this.serializeArray());
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
$.fn.applySerializedObject = function(obj){
|
|
101
|
+
$.applySerializedObject(this,obj);
|
|
102
|
+
return this;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
$.fn.applySerializedArray = function(obj){
|
|
106
|
+
$.applySerializedArray(this,obj);
|
|
107
|
+
return this;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
}(jQuery);
|
|
21
111
|
/*
|
|
22
112
|
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
|
23
113
|
*
|
|
@@ -203,4 +293,4 @@ jQuery.extend(jQuery.easing, {
|
|
|
203
293
|
return this;
|
|
204
294
|
});
|
|
205
295
|
};
|
|
206
|
-
})(jQuery);
|
|
296
|
+
})(jQuery);
|