alchemy_cms 2.0.7 → 2.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -4
- data/.travis.yml +1 -1
- data/Gemfile +7 -2
- data/README.md +6 -6
- data/Rakefile +26 -18
- data/alchemy_cms.gemspec +14 -14
- data/{assets/stylesheets → app/assets/images/alchemy}/Jcrop.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/ajax_loader.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/alchemy-logo.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/flags.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/gui/navi-tab.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/gui/shading_90.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/gui/toggle.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/icons.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/image_loader.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow_bg.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow_bg_hover.gif +0 -0
- data/{assets/images → app/assets/images/alchemy}/placeholder.png +0 -0
- data/{assets/images/gui → app/assets/images/alchemy}/shading.png +0 -0
- data/{assets/images → app/assets/images/alchemy}/swfupload/browse_button.png +0 -0
- data/{assets/stylesheets/default/img → app/assets/images/alchemy}/tabs.gif +0 -0
- data/{assets/images/jquery-ui → app/assets/images/alchemy}/ui-icons_666666_256x240.png +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +212 -0
- data/app/assets/javascripts/alchemy/alchemy.buttons.js +36 -0
- data/app/assets/javascripts/alchemy/alchemy.dirty.js +91 -0
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +114 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.element_editor_selector.js +0 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.growler.js +0 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.image_cropper.js +0 -0
- data/app/assets/javascripts/alchemy/alchemy.js +26 -0
- data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +17 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.link_overlay.js +1 -1
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.page_sorter.js +0 -0
- data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.preview.js +0 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js +438 -0
- data/app/assets/stylesheets/alchemy/_defaults.scss +160 -0
- data/app/assets/stylesheets/alchemy/alchemy.css +9 -0
- data/{assets/stylesheets/alchemy.css → app/assets/stylesheets/alchemy/base.css.scss} +216 -353
- data/{assets/stylesheets/elements.css → app/assets/stylesheets/alchemy/elements.css.scss} +41 -70
- data/{assets/stylesheets/flags.css → app/assets/stylesheets/alchemy/flags.css.scss} +1 -1
- data/{assets/stylesheets/jquery-ui-1.8.7.alchemy.css → app/assets/stylesheets/alchemy/jquery-ui.alchemy.css} +15 -15
- data/{assets/stylesheets/jquery.Jcrop.css → app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss} +3 -3
- data/{assets/stylesheets/jquery.sb.css → app/assets/stylesheets/alchemy/jquery.sb.css.scss} +19 -29
- data/{assets/stylesheets → app/assets/stylesheets/alchemy}/print.css +6 -1
- data/{assets/stylesheets → app/assets/stylesheets/alchemy}/standard_set.css +0 -0
- data/{assets/stylesheets/alchemy_tinymce_content.css → app/assets/stylesheets/alchemy/tinymce_content.css} +0 -0
- data/{assets/stylesheets/alchemy_tinymce_dialog.css → app/assets/stylesheets/alchemy/tinymce_dialog.css} +2 -2
- data/app/controllers/admin/attachments_controller.rb +2 -8
- data/app/controllers/admin/clipboard_controller.rb +2 -2
- data/app/controllers/admin/contents_controller.rb +4 -16
- data/app/controllers/admin/elements_controller.rb +2 -2
- data/app/controllers/admin/essence_audios_controller.rb +0 -3
- data/app/controllers/admin/essence_files_controller.rb +0 -11
- data/app/controllers/admin/essence_flashes_controller.rb +0 -3
- data/app/controllers/admin/essence_pictures_controller.rb +2 -7
- data/app/controllers/admin/essence_videos_controller.rb +0 -3
- data/app/controllers/admin/languages_controller.rb +4 -10
- data/app/controllers/admin/pages_controller.rb +6 -4
- data/app/controllers/admin/pictures_controller.rb +13 -18
- data/app/controllers/admin/trash_controller.rb +0 -5
- data/app/controllers/admin/users_controller.rb +2 -3
- data/app/controllers/alchemy_controller.rb +18 -30
- data/app/controllers/pages_controller.rb +21 -24
- data/app/helpers/admin/elements_helper.rb +5 -0
- data/app/helpers/admin/pages_helper.rb +36 -1
- data/app/helpers/alchemy_helper.rb +39 -17
- data/app/models/attachment.rb +2 -2
- data/app/models/essence_file.rb +1 -1
- data/app/models/page.rb +1 -1
- data/app/sweepers/pages_sweeper.rb +10 -0
- data/app/views/admin/attachments/destroy.js.erb +4 -0
- data/app/views/admin/clipboard/insert.js.erb +12 -19
- data/app/views/admin/contents/create.js.erb +1 -1
- data/app/views/admin/contents/destroy.js.erb +7 -0
- data/app/views/admin/contents/order.js.erb +6 -0
- data/app/views/admin/elements/_element.html.erb +4 -2
- data/app/views/admin/elements/create.js.erb +19 -26
- data/app/views/admin/elements/fold.js.erb +1 -1
- data/app/views/admin/elements/index.html.erb +1 -1
- data/app/views/admin/essence_files/assign.js.erb +8 -0
- data/app/views/admin/essence_pictures/save_link.js.erb +3 -0
- data/app/views/admin/index.html.erb +37 -27
- data/app/views/admin/languages/destroy.js.erb +1 -0
- data/app/views/admin/pages/_page.html.erb +1 -1
- data/app/views/admin/pages/_sitemap.html.erb +1 -1
- data/app/views/admin/pages/edit.html.erb +2 -2
- data/app/views/admin/pages/update.js.erb +1 -1
- data/app/views/admin/partials/_upload_form.html.erb +11 -11
- data/app/views/admin/pictures/archive_overlay.js.erb +1 -0
- data/app/views/admin/pictures/flush.js.erb +2 -0
- data/app/views/admin/pictures/update.js.erb +1 -0
- data/app/views/admin/trash/clear.js.erb +3 -0
- data/app/views/alchemy/error_notice.js.erb +1 -0
- data/app/views/alchemy/permission_denied.js.erb +2 -0
- data/app/views/alchemy/redirect.js.erb +1 -0
- data/app/views/alchemy/remote_errors.js.erb +3 -0
- data/app/views/alchemy/update.js.erb +5 -0
- data/app/views/essences/_essence_file_editor.html.erb +0 -1
- data/app/views/essences/_essence_file_view.html.erb +1 -5
- data/app/views/essences/_essence_picture_tools.html.erb +1 -1
- data/app/views/layouts/alchemy.html.erb +22 -9
- data/app/views/pages/show.rss.builder +1 -1
- data/config/alchemy/elements.yml +0 -5
- data/config/alchemy/page_layouts.yml +1 -1
- data/config/asset_packages.yml +17 -19
- data/config/authorization_rules.rb +1 -0
- data/config/locales/de.yml +0 -1
- data/config/routes.rb +1 -1
- data/lib/alchemy/tinymce.rb +51 -0
- data/lib/alchemy/version.rb +3 -3
- data/lib/alchemy_cms.rb +4 -2
- data/script/rails +6 -0
- data/spec/controllers/admin/clipboard_controller_spec.rb +15 -13
- data/spec/controllers/admin/contents_controller_spec.rb +4 -4
- data/spec/controllers/admin/trash_controller_spec.rb +6 -9
- data/spec/controllers/pages_controller_spec.rb +9 -8
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +3 -3
- data/spec/dummy/config/application.rb +12 -6
- data/spec/dummy/config/database.yml +3 -0
- data/spec/dummy/config/environments/development.rb +7 -3
- data/spec/dummy/config/environments/production.rb +23 -12
- data/spec/dummy/config/environments/test.rb +5 -1
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +1 -1
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/factories.rb +8 -8
- data/spec/helpers/admin/elements_helper_spec.rb +2 -2
- data/spec/helpers/contents_helper_spec.rb +1 -1
- data/spec/helpers/elements_helper_spec.rb +6 -6
- data/spec/helpers/essences_helper_spec.rb +1 -1
- data/spec/helpers/pages_helper_spec.rb +37 -37
- data/spec/integration/pages_controller_spec.rb +29 -26
- data/spec/integration/security_spec.rb +2 -1
- data/spec/models/content_spec.rb +1 -1
- data/spec/models/element_spec.rb +11 -11
- data/spec/models/language_spec.rb +5 -5
- data/spec/models/page_spec.rb +54 -54
- data/spec/models/user_spec.rb +2 -1
- data/spec/routing_spec.rb +1 -1
- data/{assets/javascripts/jquery.js → vendor/assets/javascripts/jquery-1.6.2.min.js} +0 -0
- data/{assets/javascripts/jquery-ui.js → vendor/assets/javascripts/jquery-ui-custom-1.8.16.min.js} +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.Jcrop.min.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.dialogextend.min.js +7 -7
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.in-place-edit.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.sb.min.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.scrollTo-1.4.2-min.js +10 -10
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.ui.nestedSortable.js +0 -0
- data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.ui.tabspaging.js +0 -0
- data/{assets → vendor/assets}/javascripts/swfupload/fileprogress.js +202 -202
- data/{assets → vendor/assets}/javascripts/swfupload/handlers.js +171 -171
- data/{assets → vendor/assets}/javascripts/swfupload/queue.js +97 -97
- data/{assets → vendor/assets}/javascripts/swfupload/swfupload.js +980 -980
- data/{assets → vendor/assets}/javascripts/swfupload/swfupload.swf +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/jquery.tinymce.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/langs/de.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/langs/en.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/license.txt +504 -504
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/langs/de.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/langs/en.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +110 -110
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -0
- data/{assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css → vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.erb} +8 -8
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -387
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -36
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -51
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/langs/de_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/pastetext.htm +26 -26
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -21
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/cell.htm +180 -180
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/cell.css +16 -16
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/row.css +25 -25
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/table.css +13 -13
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/editor_plugin.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/cell.js +319 -319
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -27
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/row.js +237 -237
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/table.js +450 -450
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/langs/de_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -32
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/row.htm +158 -158
- data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/table.htm +188 -188
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/about.htm +52 -52
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -26
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/charmap.htm +51 -51
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/color_picker.htm +74 -74
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/editor_template.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/image.htm +80 -80
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/flash.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/iframe.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/pagebreak.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/realmedia.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/trans.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/video.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/windowsmedia.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/about.js +73 -73
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/anchor.js +43 -43
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/charmap.js +355 -355
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/color_picker.js +329 -329
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/image.js +251 -251
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/link.js +153 -153
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/source_editor.js +56 -56
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/de.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/de_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/en.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/link.htm +57 -57
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/shortcuts.htm +47 -47
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/content.css +50 -50
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -117
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +214 -214
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +48 -48
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +117 -117
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +217 -217
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +7 -7
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -5
- data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/source_editor.htm +25 -25
- data/{assets → vendor/assets}/javascripts/tiny_mce/tiny_mce.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/tiny_mce_popup.js +0 -0
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/editable_selects.js +70 -70
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/form_utils.js +210 -210
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/mctabs.js +161 -161
- data/{assets → vendor/assets}/javascripts/tiny_mce/utils/validate.js +252 -252
- metadata +338 -369
- data/app/views/elements/_download_editor.html.erb +0 -1
- data/app/views/elements/_download_view.html.erb +0 -3
- data/assets/javascripts/alchemy.js +0 -903
- data/assets/javascripts/jquery.rails.js +0 -315
- data/assets/stylesheets/ie6.css +0 -18
- data/config/initializers/tinymce_hammer.rb +0 -31
@@ -1,315 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Unobtrusive scripting adapter for jQuery
|
3
|
-
*
|
4
|
-
* Requires jQuery 1.4.4 or later.
|
5
|
-
* https://github.com/rails/jquery-ujs
|
6
|
-
|
7
|
-
* Uploading file using rails.js
|
8
|
-
* =============================
|
9
|
-
*
|
10
|
-
* By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
|
11
|
-
* in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
|
12
|
-
*
|
13
|
-
* The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
|
14
|
-
*
|
15
|
-
* Ex:
|
16
|
-
* $('form').live('ajax:aborted:file', function(event, elements){
|
17
|
-
* // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
|
18
|
-
* // Returning false in this handler tells rails.js to disallow standard form submission
|
19
|
-
* return false;
|
20
|
-
* });
|
21
|
-
*
|
22
|
-
* The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
|
23
|
-
*
|
24
|
-
* Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
|
25
|
-
* techniques like the iframe method to upload the file instead.
|
26
|
-
*
|
27
|
-
* Required fields in rails.js
|
28
|
-
* ===========================
|
29
|
-
*
|
30
|
-
* If any blank required inputs (required="required") are detected in the remote form, the whole form submission
|
31
|
-
* is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
|
32
|
-
*
|
33
|
-
* The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
|
34
|
-
*
|
35
|
-
* !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
|
36
|
-
* get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
|
37
|
-
*
|
38
|
-
* Ex:
|
39
|
-
* $('form').live('ajax:aborted:required', function(event, elements){
|
40
|
-
* // Returning false in this handler tells rails.js to submit the form anyway.
|
41
|
-
* // The blank required inputs are passed to this function in `elements`.
|
42
|
-
* return ! confirm("Would you like to submit the form with missing info?");
|
43
|
-
* });
|
44
|
-
*/
|
45
|
-
|
46
|
-
(function($) {
|
47
|
-
// Shorthand to make it a little easier to call public rails functions from within rails.js
|
48
|
-
var rails;
|
49
|
-
|
50
|
-
$.rails = rails = {
|
51
|
-
// Link elements bound by jquery-ujs
|
52
|
-
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]',
|
53
|
-
|
54
|
-
// Form elements bound by jquery-ujs
|
55
|
-
formSubmitSelector: 'form',
|
56
|
-
|
57
|
-
// Form input elements bound by jquery-ujs
|
58
|
-
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])',
|
59
|
-
|
60
|
-
// Form input elements disabled during form submission
|
61
|
-
disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
|
62
|
-
|
63
|
-
// Form input elements re-enabled after form submission
|
64
|
-
enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
|
65
|
-
|
66
|
-
// Form required input elements
|
67
|
-
requiredInputSelector: 'input[name][required],textarea[name][required]',
|
68
|
-
|
69
|
-
// Form file input elements
|
70
|
-
fileInputSelector: 'input:file',
|
71
|
-
|
72
|
-
// Make sure that every Ajax request sends the CSRF token
|
73
|
-
CSRFProtection: function(xhr) {
|
74
|
-
var token = $('meta[name="csrf-token"]').attr('content');
|
75
|
-
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
76
|
-
},
|
77
|
-
|
78
|
-
// Triggers an event on an element and returns false if the event result is false
|
79
|
-
fire: function(obj, name, data) {
|
80
|
-
var event = $.Event(name);
|
81
|
-
obj.trigger(event, data);
|
82
|
-
return event.result !== false;
|
83
|
-
},
|
84
|
-
|
85
|
-
// Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
|
86
|
-
confirm: function(message) {
|
87
|
-
return confirm(message);
|
88
|
-
},
|
89
|
-
|
90
|
-
// Default ajax function, may be overridden with custom function in $.rails.ajax
|
91
|
-
ajax: function(options) {
|
92
|
-
return $.ajax(options);
|
93
|
-
},
|
94
|
-
|
95
|
-
// Submits "remote" forms and links with ajax
|
96
|
-
handleRemote: function(element) {
|
97
|
-
var method, url, data,
|
98
|
-
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
99
|
-
|
100
|
-
if (rails.fire(element, 'ajax:before')) {
|
101
|
-
|
102
|
-
if (element.is('form')) {
|
103
|
-
method = element.attr('method');
|
104
|
-
url = element.attr('action');
|
105
|
-
data = element.serializeArray();
|
106
|
-
// memoized value from clicked submit button
|
107
|
-
var button = element.data('ujs:submit-button');
|
108
|
-
if (button) {
|
109
|
-
data.push(button);
|
110
|
-
element.data('ujs:submit-button', null);
|
111
|
-
}
|
112
|
-
} else {
|
113
|
-
method = element.data('method');
|
114
|
-
url = element.attr('href');
|
115
|
-
data = element.data('params') || null;
|
116
|
-
}
|
117
|
-
|
118
|
-
rails.ajax({
|
119
|
-
url: url, type: method || 'GET', data: data, dataType: dataType,
|
120
|
-
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
121
|
-
beforeSend: function(xhr, settings) {
|
122
|
-
if (settings.dataType === undefined) {
|
123
|
-
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
124
|
-
}
|
125
|
-
return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
|
126
|
-
},
|
127
|
-
success: function(data, status, xhr) {
|
128
|
-
element.trigger('ajax:success', [data, status, xhr]);
|
129
|
-
},
|
130
|
-
complete: function(xhr, status) {
|
131
|
-
element.trigger('ajax:complete', [xhr, status]);
|
132
|
-
},
|
133
|
-
error: function(xhr, status, error) {
|
134
|
-
element.trigger('ajax:error', [xhr, status, error]);
|
135
|
-
}
|
136
|
-
});
|
137
|
-
}
|
138
|
-
},
|
139
|
-
|
140
|
-
// Handles "data-method" on links such as:
|
141
|
-
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
142
|
-
handleMethod: function(link) {
|
143
|
-
var href = link.attr('href'),
|
144
|
-
method = link.data('method'),
|
145
|
-
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
146
|
-
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
147
|
-
form = $('<form method="post" action="' + href + '"></form>'),
|
148
|
-
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
149
|
-
|
150
|
-
if (csrf_param !== undefined && csrf_token !== undefined) {
|
151
|
-
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
152
|
-
}
|
153
|
-
|
154
|
-
form.hide().append(metadata_input).appendTo('body');
|
155
|
-
form.submit();
|
156
|
-
},
|
157
|
-
|
158
|
-
/* Disables form elements:
|
159
|
-
- Caches element value in 'ujs:enable-with' data store
|
160
|
-
- Replaces element text with value of 'data-disable-with' attribute
|
161
|
-
- Adds disabled=disabled attribute
|
162
|
-
*/
|
163
|
-
disableFormElements: function(form) {
|
164
|
-
form.find(rails.disableSelector).each(function() {
|
165
|
-
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
166
|
-
element.data('ujs:enable-with', element[method]());
|
167
|
-
element[method](element.data('disable-with'));
|
168
|
-
element.attr('disabled', 'disabled');
|
169
|
-
});
|
170
|
-
},
|
171
|
-
|
172
|
-
/* Re-enables disabled form elements:
|
173
|
-
- Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
|
174
|
-
- Removes disabled attribute
|
175
|
-
*/
|
176
|
-
enableFormElements: function(form) {
|
177
|
-
form.find(rails.enableSelector).each(function() {
|
178
|
-
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
179
|
-
if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
|
180
|
-
element.removeAttr('disabled');
|
181
|
-
});
|
182
|
-
},
|
183
|
-
|
184
|
-
/* For 'data-confirm' attribute:
|
185
|
-
- Fires `confirm` event
|
186
|
-
- Shows the confirmation dialog
|
187
|
-
- Fires the `confirm:complete` event
|
188
|
-
|
189
|
-
Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
|
190
|
-
Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
|
191
|
-
Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
|
192
|
-
return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
|
193
|
-
*/
|
194
|
-
allowAction: function(element) {
|
195
|
-
var message = element.data('confirm'),
|
196
|
-
answer = false, callback;
|
197
|
-
if (!message) { return true; }
|
198
|
-
|
199
|
-
if (rails.fire(element, 'confirm')) {
|
200
|
-
answer = rails.confirm(message);
|
201
|
-
callback = rails.fire(element, 'confirm:complete', [answer]);
|
202
|
-
}
|
203
|
-
return answer && callback;
|
204
|
-
},
|
205
|
-
|
206
|
-
// Helper function which checks for blank inputs in a form that match the specified CSS selector
|
207
|
-
blankInputs: function(form, specifiedSelector, nonBlank) {
|
208
|
-
var inputs = $(), input,
|
209
|
-
selector = specifiedSelector || 'input,textarea';
|
210
|
-
form.find(selector).each(function() {
|
211
|
-
input = $(this);
|
212
|
-
// Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs
|
213
|
-
if (nonBlank ? input.val() : !input.val()) {
|
214
|
-
inputs = inputs.add(input);
|
215
|
-
}
|
216
|
-
});
|
217
|
-
return inputs.length ? inputs : false;
|
218
|
-
},
|
219
|
-
|
220
|
-
// Helper function which checks for non-blank inputs in a form that match the specified CSS selector
|
221
|
-
nonBlankInputs: function(form, specifiedSelector) {
|
222
|
-
return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
|
223
|
-
},
|
224
|
-
|
225
|
-
// Helper function, needed to provide consistent behavior in IE
|
226
|
-
stopEverything: function(e) {
|
227
|
-
$(e.target).trigger('ujs:everythingStopped');
|
228
|
-
e.stopImmediatePropagation();
|
229
|
-
return false;
|
230
|
-
},
|
231
|
-
|
232
|
-
// find all the submit events directly bound to the form and
|
233
|
-
// manually invoke them. If anyone returns false then stop the loop
|
234
|
-
callFormSubmitBindings: function(form) {
|
235
|
-
var events = form.data('events'), continuePropagation = true;
|
236
|
-
if (events !== undefined && events['submit'] !== undefined) {
|
237
|
-
$.each(events['submit'], function(i, obj){
|
238
|
-
if (typeof obj.handler === 'function') return continuePropagation = obj.handler(obj.data);
|
239
|
-
});
|
240
|
-
}
|
241
|
-
return continuePropagation;
|
242
|
-
}
|
243
|
-
};
|
244
|
-
|
245
|
-
// ajaxPrefilter is a jQuery 1.5 feature
|
246
|
-
if ('ajaxPrefilter' in $) {
|
247
|
-
$.ajaxPrefilter(function(options, originalOptions, xhr){ rails.CSRFProtection(xhr); });
|
248
|
-
} else {
|
249
|
-
$(document).ajaxSend(function(e, xhr){ rails.CSRFProtection(xhr); });
|
250
|
-
}
|
251
|
-
|
252
|
-
$(rails.linkClickSelector).live('click.rails', function(e) {
|
253
|
-
var link = $(this);
|
254
|
-
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
255
|
-
|
256
|
-
if (link.data('remote') !== undefined) {
|
257
|
-
rails.handleRemote(link);
|
258
|
-
return false;
|
259
|
-
} else if (link.data('method')) {
|
260
|
-
rails.handleMethod(link);
|
261
|
-
return false;
|
262
|
-
}
|
263
|
-
});
|
264
|
-
|
265
|
-
$(rails.formSubmitSelector).live('submit.rails', function(e) {
|
266
|
-
var form = $(this),
|
267
|
-
remote = form.data('remote') !== undefined,
|
268
|
-
blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
|
269
|
-
nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
|
270
|
-
|
271
|
-
if (!rails.allowAction(form)) return rails.stopEverything(e);
|
272
|
-
|
273
|
-
// skip other logic when required values are missing or file upload is present
|
274
|
-
if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
|
275
|
-
return rails.stopEverything(e);
|
276
|
-
}
|
277
|
-
|
278
|
-
if (remote) {
|
279
|
-
if (nonBlankFileInputs) {
|
280
|
-
return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
|
281
|
-
}
|
282
|
-
|
283
|
-
// If browser does not support submit bubbling, then this live-binding will be called before direct
|
284
|
-
// bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
|
285
|
-
if (!$.support.submitBubbles && rails.callFormSubmitBindings(form) === false) return rails.stopEverything(e);
|
286
|
-
|
287
|
-
rails.handleRemote(form);
|
288
|
-
return false;
|
289
|
-
} else {
|
290
|
-
// slight timeout so that the submit button gets properly serialized
|
291
|
-
setTimeout(function(){ rails.disableFormElements(form); }, 13);
|
292
|
-
}
|
293
|
-
});
|
294
|
-
|
295
|
-
$(rails.formInputClickSelector).live('click.rails', function(event) {
|
296
|
-
var button = $(this);
|
297
|
-
|
298
|
-
if (!rails.allowAction(button)) return rails.stopEverything(event);
|
299
|
-
|
300
|
-
// register the pressed submit button
|
301
|
-
var name = button.attr('name'),
|
302
|
-
data = name ? {name:name, value:button.val()} : null;
|
303
|
-
|
304
|
-
button.closest('form').data('ujs:submit-button', data);
|
305
|
-
});
|
306
|
-
|
307
|
-
$(rails.formSubmitSelector).live('ajax:beforeSend.rails', function(event) {
|
308
|
-
if (this == event.target) rails.disableFormElements($(this));
|
309
|
-
});
|
310
|
-
|
311
|
-
$(rails.formSubmitSelector).live('ajax:complete.rails', function(event) {
|
312
|
-
if (this == event.target) rails.enableFormElements($(this));
|
313
|
-
});
|
314
|
-
|
315
|
-
})( jQuery );
|
data/assets/stylesheets/ie6.css
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
* html ul#sitemap li .sitemap_row {
|
2
|
-
padding: 0px;
|
3
|
-
margin: -4px;
|
4
|
-
overflow: auto;
|
5
|
-
width: 376px;
|
6
|
-
line-height:14px;
|
7
|
-
font-size:12px;
|
8
|
-
}
|
9
|
-
|
10
|
-
* html #sitemap_for_links .sitemap_row {
|
11
|
-
padding: 0px;
|
12
|
-
margin: -4px;
|
13
|
-
overflow: auto;
|
14
|
-
width: 374px;
|
15
|
-
font-size:12px;
|
16
|
-
height: 28px;
|
17
|
-
line-height:22px
|
18
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
if defined?(Tinymce::Hammer)
|
2
|
-
Tinymce::Hammer.install_path = '/javascripts/alchemy/tiny_mce'
|
3
|
-
Tinymce::Hammer.plugins = %w(autoresize paste fullscreen inlinepopups alchemy_link)
|
4
|
-
Tinymce::Hammer.languages = ['de', 'en']
|
5
|
-
Tinymce::Hammer.init = {
|
6
|
-
:paste_convert_headers_to_strong => true,
|
7
|
-
:paste_convert_middot_lists => true,
|
8
|
-
:paste_remove_spans => true,
|
9
|
-
:paste_remove_styles => true,
|
10
|
-
:paste_strip_class_attributes => true,
|
11
|
-
:theme => 'advanced',
|
12
|
-
:skin => 'o2k7',
|
13
|
-
:skin_variant => 'silver',
|
14
|
-
:inlinepopups_skin => 'alchemy',
|
15
|
-
:popup_css => "/stylesheets/alchemy/alchemy_tinymce_dialog.css",
|
16
|
-
:content_css => "/stylesheets/alchemy/alchemy_tinymce_content.css",
|
17
|
-
:dialog_type => "modal",
|
18
|
-
:width => "100%",
|
19
|
-
:theme_advanced_resizing => true,
|
20
|
-
:theme_advanced_resize_horizontal => false,
|
21
|
-
:theme_advanced_resizing_min_height => '135',
|
22
|
-
:theme_advanced_toolbar_align => 'left',
|
23
|
-
:theme_advanced_toolbar_location => 'top',
|
24
|
-
:theme_advanced_statusbar_location => 'bottom',
|
25
|
-
:theme_advanced_buttons1 => 'bold,italic,underline,strikethrough,sub,sup,|,numlist,bullist,indent,outdent,|,alchemy_link,unlink,|,removeformat,cleanup,|,fullscreen',
|
26
|
-
:theme_advanced_buttons2 => 'pastetext,pasteword,charmap,code,help',
|
27
|
-
:theme_advanced_buttons3 => '',
|
28
|
-
:fix_list_elements => true,
|
29
|
-
:convert_urls => false
|
30
|
-
}
|
31
|
-
end
|