rails_admin 2.3.1 → 3.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails_admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +9 -11
- data/README.md +37 -31
- data/Rakefile +2 -2
- data/app/assets/javascripts/rails_admin.js +21 -0
- data/app/assets/stylesheets/rails_admin/custom/mixins.scss +1 -1
- data/app/assets/stylesheets/rails_admin/custom/variables.scss +1 -1
- data/app/assets/stylesheets/rails_admin.scss.erb +76 -0
- data/app/controllers/rails_admin/application_controller.rb +4 -3
- data/app/controllers/rails_admin/main_controller.rb +43 -24
- data/app/helpers/rails_admin/application_helper.rb +69 -52
- data/app/helpers/rails_admin/form_builder.rb +5 -4
- data/app/helpers/rails_admin/main_helper.rb +27 -43
- data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.erb +5 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.erb +13 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.erb +6 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.erb +9 -0
- data/app/views/layouts/rails_admin/_head.html.erb +17 -0
- data/app/views/layouts/rails_admin/_navigation.html.erb +21 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +24 -0
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +9 -0
- data/app/views/layouts/rails_admin/application.html.erb +27 -0
- data/app/views/layouts/rails_admin/modal.js.erb +7 -0
- data/app/views/layouts/rails_admin/pjax.html.erb +20 -0
- data/app/views/rails_admin/main/_dashboard_history.html.erb +45 -0
- data/app/views/rails_admin/main/_delete_notice.html.erb +35 -0
- data/app/views/rails_admin/main/_form_action_text.html.erb +7 -0
- data/app/views/rails_admin/main/_form_boolean.html.erb +16 -0
- data/app/views/rails_admin/main/{_form_ck_editor.html.haml → _form_ck_editor.html.erb} +3 -3
- data/app/views/rails_admin/main/_form_code_mirror.html.erb +9 -0
- data/app/views/rails_admin/main/_form_colorpicker.html.erb +1 -0
- data/app/views/rails_admin/main/_form_datetime.html.erb +9 -0
- data/app/views/rails_admin/main/_form_enumeration.html.erb +21 -0
- data/app/views/rails_admin/main/_form_field.html.erb +1 -0
- data/app/views/rails_admin/main/_form_file_upload.html.erb +17 -0
- data/app/views/rails_admin/main/{_form_filtering_multiselect.html.haml → _form_filtering_multiselect.html.erb} +11 -11
- data/app/views/rails_admin/main/{_form_filtering_select.html.haml → _form_filtering_select.html.erb} +13 -12
- data/app/views/rails_admin/main/_form_froala.html.erb +8 -0
- data/app/views/rails_admin/main/_form_multiple_file_upload.html.erb +20 -0
- data/app/views/rails_admin/main/_form_nested_many.html.erb +21 -0
- data/app/views/rails_admin/main/_form_nested_one.html.erb +21 -0
- data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +27 -0
- data/app/views/rails_admin/main/_form_simple_mde.html.erb +8 -0
- data/app/views/rails_admin/main/_form_text.html.erb +1 -0
- data/app/views/rails_admin/main/_form_wysihtml5.html.erb +8 -0
- data/app/views/rails_admin/main/_submit_buttons.html.erb +25 -0
- data/app/views/rails_admin/main/bulk_delete.html.erb +19 -0
- data/app/views/rails_admin/main/dashboard.html.erb +64 -0
- data/app/views/rails_admin/main/delete.html.erb +21 -0
- data/app/views/rails_admin/main/edit.html.erb +3 -0
- data/app/views/rails_admin/main/export.html.erb +146 -0
- data/app/views/rails_admin/main/history.html.erb +78 -0
- data/app/views/rails_admin/main/index.html.erb +193 -0
- data/app/views/rails_admin/main/new.html.erb +3 -0
- data/app/views/rails_admin/main/show.html.erb +28 -0
- data/config/initializers/active_record_extensions.rb +3 -1
- data/config/initializers/mongoid_extensions.rb +1 -1
- data/config/locales/rails_admin.en.yml +5 -1
- data/lib/generators/rails_admin/install_generator.rb +51 -3
- data/lib/generators/rails_admin/templates/environment.js +6 -0
- data/lib/generators/rails_admin/templates/initializer.erb +2 -1
- data/lib/generators/rails_admin/templates/rails_admin.js.erb +2 -0
- data/lib/generators/rails_admin/templates/rails_admin.scss +1 -0
- data/lib/generators/rails_admin/templates/webpack.config.js +32 -0
- data/lib/rails_admin/abstract_model.rb +24 -10
- data/lib/rails_admin/adapters/active_record/association.rb +20 -1
- data/lib/rails_admin/adapters/active_record/object_extension.rb +29 -0
- data/lib/rails_admin/adapters/active_record/property.rb +1 -1
- data/lib/rails_admin/adapters/active_record.rb +19 -21
- data/lib/rails_admin/adapters/mongoid/association.rb +38 -9
- data/lib/rails_admin/adapters/mongoid/bson.rb +4 -5
- data/lib/rails_admin/adapters/mongoid/extension.rb +3 -1
- data/lib/rails_admin/adapters/mongoid/object_extension.rb +32 -0
- data/lib/rails_admin/adapters/mongoid/property.rb +2 -2
- data/lib/rails_admin/adapters/mongoid.rb +25 -19
- data/lib/rails_admin/config/actions/base.rb +7 -2
- data/lib/rails_admin/config/actions/bulk_delete.rb +2 -2
- data/lib/rails_admin/config/actions/dashboard.rb +4 -3
- data/lib/rails_admin/config/actions/delete.rb +5 -9
- data/lib/rails_admin/config/actions/edit.rb +7 -7
- data/lib/rails_admin/config/actions/export.rb +2 -2
- data/lib/rails_admin/config/actions/history_index.rb +2 -2
- data/lib/rails_admin/config/actions/history_show.rb +2 -2
- data/lib/rails_admin/config/actions/index.rb +5 -7
- data/lib/rails_admin/config/actions/new.rb +9 -9
- data/lib/rails_admin/config/actions/show.rb +1 -1
- data/lib/rails_admin/config/actions/show_in_app.rb +6 -2
- data/lib/rails_admin/config/actions.rb +4 -4
- data/lib/rails_admin/config/configurable.rb +2 -2
- data/lib/rails_admin/config/fields/association.rb +15 -12
- data/lib/rails_admin/config/fields/base.rb +44 -24
- data/lib/rails_admin/config/fields/factories/active_storage.rb +1 -0
- data/lib/rails_admin/config/fields/factories/association.rb +6 -8
- data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -1
- data/lib/rails_admin/config/fields/factories/devise.rb +2 -1
- data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -1
- data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -1
- data/lib/rails_admin/config/fields/factories/shrine.rb +1 -1
- data/lib/rails_admin/config/fields/group.rb +1 -2
- data/lib/rails_admin/config/fields/types/active_record_enum.rb +2 -0
- data/lib/rails_admin/config/fields/types/active_storage.rb +9 -7
- data/lib/rails_admin/config/fields/types/all.rb +1 -0
- data/lib/rails_admin/config/fields/types/belongs_to_association.rb +4 -12
- data/lib/rails_admin/config/fields/types/boolean.rb +32 -8
- data/lib/rails_admin/config/fields/types/carrierwave.rb +1 -0
- data/lib/rails_admin/config/fields/types/citext.rb +13 -0
- data/lib/rails_admin/config/fields/types/color.rb +6 -2
- data/lib/rails_admin/config/fields/types/date.rb +5 -8
- data/lib/rails_admin/config/fields/types/datetime.rb +18 -21
- data/lib/rails_admin/config/fields/types/decimal.rb +9 -2
- data/lib/rails_admin/config/fields/types/dragonfly.rb +3 -1
- data/lib/rails_admin/config/fields/types/enum.rb +1 -1
- data/lib/rails_admin/config/fields/types/file_upload.rb +4 -3
- data/lib/rails_admin/config/fields/types/float.rb +9 -2
- data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -5
- data/lib/rails_admin/config/fields/types/has_one_association.rb +1 -13
- data/lib/rails_admin/config/fields/types/integer.rb +2 -6
- data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +8 -6
- data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +1 -0
- data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +4 -3
- data/lib/rails_admin/config/fields/types/numeric.rb +18 -0
- data/lib/rails_admin/config/fields/types/polymorphic_association.rb +3 -2
- data/lib/rails_admin/config/fields/types/string.rb +1 -1
- data/lib/rails_admin/config/fields/types/time.rb +1 -4
- data/lib/rails_admin/config/fields/types/timestamp.rb +0 -4
- data/lib/rails_admin/config/fields/types.rb +1 -1
- data/lib/rails_admin/config/fields.rb +3 -1
- data/lib/rails_admin/config/has_fields.rb +5 -6
- data/lib/rails_admin/config/hideable.rb +1 -1
- data/lib/rails_admin/config/inspectable.rb +1 -3
- data/lib/rails_admin/config/model.rb +10 -10
- data/lib/rails_admin/config/sections/base.rb +2 -3
- data/lib/rails_admin/config/sections/list.rb +4 -15
- data/lib/rails_admin/config/sections.rb +1 -1
- data/lib/rails_admin/config.rb +73 -38
- data/lib/rails_admin/engine.rb +36 -23
- data/lib/rails_admin/extension.rb +6 -14
- data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +4 -2
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +12 -7
- data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +6 -7
- data/lib/rails_admin/support/csv_converter.rb +12 -13
- data/lib/rails_admin/support/datetime.rb +40 -74
- data/lib/rails_admin/support/esmodule_preprocessor.rb +32 -0
- data/lib/rails_admin/support/hash_helper.rb +6 -5
- data/lib/rails_admin/version.rb +8 -4
- data/lib/rails_admin.rb +1 -4
- data/lib/tasks/rails_admin.rake +3 -3
- data/package.json +28 -0
- data/src/rails_admin/base.js +21 -0
- data/src/rails_admin/filter-box.js +405 -0
- data/src/rails_admin/filtering-multiselect.js +394 -0
- data/src/rails_admin/filtering-select.js +302 -0
- data/src/rails_admin/i18n.js +19 -0
- data/src/rails_admin/nested-form-hooks.js +100 -0
- data/src/rails_admin/remote-form.js +190 -0
- data/src/rails_admin/sidescroll.js +20 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/theming.scss +93 -34
- data/src/rails_admin/styles/base.scss +64 -0
- data/src/rails_admin/styles/filtering-multiselect.scss +53 -0
- data/src/rails_admin/styles/filtering-select.scss +70 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/theming.scss +23 -21
- data/src/rails_admin/styles/themes/cerulean/variables.scss +830 -0
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/mixins.scss +1 -1
- data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/variables.scss +1 -1
- data/src/rails_admin/styles/widgets.scss +35 -0
- data/src/rails_admin/ui.js +172 -0
- data/src/rails_admin/vendor/jquery.pjax.js +899 -0
- data/src/rails_admin/vendor/jquery_nested_form.js +122 -0
- data/src/rails_admin/widgets.js +512 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.eot +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.svg +5034 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.woff +0 -0
- data/vendor/assets/fonts/rails_admin/fa-solid-900.woff2 +0 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/data.js +41 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js +1637 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js +17 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js +47 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/position.js +500 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js +42 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/scroll-parent.js +47 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/unique-id.js +51 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/version.js +17 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widget.js +735 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/autocomplete.js +689 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/menu.js +680 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/mouse.js +230 -0
- data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/sortable.js +1561 -0
- data/vendor/assets/javascripts/rails_admin/jquery3.js +10872 -0
- data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4476 -2216
- metadata +118 -263
- data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/rails_admin/bullet_black.png +0 -0
- data/app/assets/images/rails_admin/bullet_white.png +0 -0
- data/app/assets/images/rails_admin/calendar.png +0 -0
- data/app/assets/images/rails_admin/clock.png +0 -0
- data/app/assets/images/rails_admin/logo.png +0 -0
- data/app/assets/images/rails_admin/magnifier.png +0 -0
- data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
- data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
- data/app/assets/javascripts/rails_admin/jquery-ui.js.erb +0 -8
- data/app/assets/javascripts/rails_admin/jquery.migrate.js +0 -3
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +0 -253
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +0 -331
- data/app/assets/javascripts/rails_admin/ra.filtering-select.js +0 -294
- data/app/assets/javascripts/rails_admin/ra.i18n.js +0 -28
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +0 -59
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +0 -155
- data/app/assets/javascripts/rails_admin/ra.sidescroll.js +0 -31
- data/app/assets/javascripts/rails_admin/ra.widgets.js +0 -379
- data/app/assets/javascripts/rails_admin/rails_admin.js +0 -21
- data/app/assets/javascripts/rails_admin/ui.js +0 -135
- data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +0 -733
- data/app/assets/stylesheets/rails_admin/base/font-awesome-4-compability.scss +0 -153
- data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.scss +0 -88
- data/app/assets/stylesheets/rails_admin/ra.sidescroll.scss +0 -29
- data/app/assets/stylesheets/rails_admin/ra.widgets.scss +0 -17
- data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +0 -110
- data/app/assets/stylesheets/rails_admin/themes/cerulean/variables.scss +0 -857
- data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.haml +0 -2
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.haml +0 -9
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.haml +0 -4
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.haml +0 -4
- data/app/views/layouts/rails_admin/_head.html.haml +0 -7
- data/app/views/layouts/rails_admin/_navigation.html.haml +0 -12
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +0 -10
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +0 -3
- data/app/views/layouts/rails_admin/application.html.haml +0 -16
- data/app/views/layouts/rails_admin/pjax.html.haml +0 -12
- data/app/views/rails_admin/main/_dashboard_history.html.haml +0 -21
- data/app/views/rails_admin/main/_delete_notice.html.haml +0 -24
- data/app/views/rails_admin/main/_form_action_text.html.haml +0 -7
- data/app/views/rails_admin/main/_form_boolean.html.haml +0 -3
- data/app/views/rails_admin/main/_form_code_mirror.html.haml +0 -9
- data/app/views/rails_admin/main/_form_colorpicker.html.haml +0 -1
- data/app/views/rails_admin/main/_form_datetime.html.haml +0 -5
- data/app/views/rails_admin/main/_form_enumeration.html.haml +0 -19
- data/app/views/rails_admin/main/_form_field.html.haml +0 -1
- data/app/views/rails_admin/main/_form_file_upload.html.haml +0 -17
- data/app/views/rails_admin/main/_form_froala.html.haml +0 -8
- data/app/views/rails_admin/main/_form_multiple_file_upload.html.haml +0 -16
- data/app/views/rails_admin/main/_form_nested_many.html.haml +0 -15
- data/app/views/rails_admin/main/_form_nested_one.html.haml +0 -17
- data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +0 -26
- data/app/views/rails_admin/main/_form_simple_mde.haml +0 -8
- data/app/views/rails_admin/main/_form_text.html.haml +0 -1
- data/app/views/rails_admin/main/_form_wysihtml5.html.haml +0 -8
- data/app/views/rails_admin/main/_submit_buttons.html.haml +0 -16
- data/app/views/rails_admin/main/bulk_delete.html.haml +0 -11
- data/app/views/rails_admin/main/dashboard.html.haml +0 -34
- data/app/views/rails_admin/main/delete.html.haml +0 -18
- data/app/views/rails_admin/main/edit.html.haml +0 -2
- data/app/views/rails_admin/main/export.html.haml +0 -92
- data/app/views/rails_admin/main/history.html.haml +0 -51
- data/app/views/rails_admin/main/index.html.haml +0 -126
- data/app/views/rails_admin/main/new.html.haml +0 -2
- data/app/views/rails_admin/main/show.html.haml +0 -15
- data/config/initializers/haml.rb +0 -5
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +0 -38
- data/lib/rails_admin/adapters/active_record.rb.bak +0 -348
- data/lib/rails_admin/adapters/mongoid/abstract_object.rb +0 -42
- data/lib/rails_admin/bootstrap-sass/compass_functions.rb +0 -28
- data/lib/rails_admin/bootstrap-sass/sass_functions.rb +0 -16
- data/lib/rails_admin/bootstrap-sass.rb +0 -49
- data/lib/rails_admin/config/lazy_model.rb +0 -68
- data/lib/rails_admin/extensions/history/auditing_adapter.rb +0 -37
- data/lib/rails_admin/extensions/history/history.rb +0 -44
- data/lib/rails_admin/extensions/history.rb +0 -3
- data/lib/rails_admin/support/i18n.rb +0 -43
- data/vendor/assets/fonts/rails_admin/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.svg +0 -2671
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/select.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/select2.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/vendor/assets/javascripts/rails_admin/jquery.colorpicker.js +0 -484
- data/vendor/assets/stylesheets/rails_admin/jquery.colorpicker.scss +0 -182
- /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/README.txt +0 -0
- /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/mixins.scss +0 -0
- /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/variables.scss +0 -0
- /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/mixins.scss +0 -0
- /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/theming.scss +0 -0
@@ -0,0 +1,122 @@
|
|
1
|
+
import jQuery from 'jquery';
|
2
|
+
|
3
|
+
(function($) {
|
4
|
+
window.NestedFormEvents = function() {
|
5
|
+
this.addFields = $.proxy(this.addFields, this);
|
6
|
+
this.removeFields = $.proxy(this.removeFields, this);
|
7
|
+
};
|
8
|
+
|
9
|
+
NestedFormEvents.prototype = {
|
10
|
+
addFields: function(e) {
|
11
|
+
// Setup
|
12
|
+
var link = e.currentTarget;
|
13
|
+
var assoc = $(link).data('association'); // Name of child
|
14
|
+
var blueprint = $('#' + $(link).data('blueprint-id'));
|
15
|
+
var content = blueprint.data('blueprint'); // Fields template
|
16
|
+
|
17
|
+
// Make the context correct by replacing <parents> with the generated ID
|
18
|
+
// of each of the parent objects
|
19
|
+
var context = ($(link).closest('.fields').closestChild('input, textarea, select').eq(0).attr('name') || '').replace(/\[[a-z_]+\]$/, '');
|
20
|
+
|
21
|
+
// If the parent has no inputs we need to strip off the last pair
|
22
|
+
var current = content.match(new RegExp('\\[([a-z_]+)\\]\\[new_' + assoc + '\\]'));
|
23
|
+
if (current) {
|
24
|
+
context = context.replace(new RegExp('\\[' + current[1] + '\\]\\[(new_)?\\d+\\]$'), '');
|
25
|
+
}
|
26
|
+
|
27
|
+
// context will be something like this for a brand new form:
|
28
|
+
// project[tasks_attributes][1255929127459][assignments_attributes][1255929128105]
|
29
|
+
// or for an edit form:
|
30
|
+
// project[tasks_attributes][0][assignments_attributes][1]
|
31
|
+
if (context) {
|
32
|
+
var parentNames = context.match(/[a-z_]+_attributes(?=\]\[(new_)?\d+\])/g) || [];
|
33
|
+
var parentIds = context.match(/[0-9]+/g) || [];
|
34
|
+
|
35
|
+
for(var i = 0; i < parentNames.length; i++) {
|
36
|
+
if(parentIds[i]) {
|
37
|
+
content = content.replace(
|
38
|
+
new RegExp('(_' + parentNames[i] + ')_.+?_', 'g'),
|
39
|
+
'$1_' + parentIds[i] + '_');
|
40
|
+
|
41
|
+
content = content.replace(
|
42
|
+
new RegExp('(\\[' + parentNames[i] + '\\])\\[.+?\\]', 'g'),
|
43
|
+
'$1[' + parentIds[i] + ']');
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
// Make a unique ID for the new child
|
49
|
+
var regexp = new RegExp('new_' + assoc, 'g');
|
50
|
+
var new_id = this.newId();
|
51
|
+
content = $.trim(content.replace(regexp, new_id));
|
52
|
+
|
53
|
+
var field = this.insertFields(content, assoc, link);
|
54
|
+
// bubble up event upto document (through form)
|
55
|
+
field
|
56
|
+
.trigger({ type: 'nested:fieldAdded', field: field })
|
57
|
+
.trigger({ type: 'nested:fieldAdded:' + assoc, field: field });
|
58
|
+
return false;
|
59
|
+
},
|
60
|
+
newId: function() {
|
61
|
+
return new Date().getTime();
|
62
|
+
},
|
63
|
+
insertFields: function(content, assoc, link) {
|
64
|
+
var target = $(link).data('target');
|
65
|
+
if (target) {
|
66
|
+
return $(content).appendTo($(target));
|
67
|
+
} else {
|
68
|
+
return $(content).insertBefore(link);
|
69
|
+
}
|
70
|
+
},
|
71
|
+
removeFields: function(e) {
|
72
|
+
var $link = $(e.currentTarget),
|
73
|
+
assoc = $link.data('association'); // Name of child to be removed
|
74
|
+
|
75
|
+
var hiddenField = $link.prev('input[type=hidden]');
|
76
|
+
hiddenField.val('1');
|
77
|
+
|
78
|
+
var field = $link.closest('.fields');
|
79
|
+
field.hide();
|
80
|
+
|
81
|
+
field
|
82
|
+
.trigger({ type: 'nested:fieldRemoved', field: field })
|
83
|
+
.trigger({ type: 'nested:fieldRemoved:' + assoc, field: field });
|
84
|
+
return false;
|
85
|
+
}
|
86
|
+
};
|
87
|
+
|
88
|
+
window.nestedFormEvents = new NestedFormEvents();
|
89
|
+
$(document)
|
90
|
+
.delegate('form a.add_nested_fields', 'click', nestedFormEvents.addFields)
|
91
|
+
.delegate('form a.remove_nested_fields', 'click', nestedFormEvents.removeFields);
|
92
|
+
})(jQuery);
|
93
|
+
|
94
|
+
// http://plugins.jquery.com/project/closestChild
|
95
|
+
/*
|
96
|
+
* Copyright 2011, Tobias Lindig
|
97
|
+
*
|
98
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
99
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
100
|
+
*
|
101
|
+
*/
|
102
|
+
(function($) {
|
103
|
+
$.fn.closestChild = function(selector) {
|
104
|
+
// breadth first search for the first matched node
|
105
|
+
if (selector && selector != '') {
|
106
|
+
var queue = [];
|
107
|
+
queue.push(this);
|
108
|
+
while(queue.length > 0) {
|
109
|
+
var node = queue.shift();
|
110
|
+
var children = node.children();
|
111
|
+
for(var i = 0; i < children.length; ++i) {
|
112
|
+
var child = $(children[i]);
|
113
|
+
if (child.is(selector)) {
|
114
|
+
return child; //well, we found one
|
115
|
+
}
|
116
|
+
queue.push(child);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
return $();//nothing found
|
121
|
+
};
|
122
|
+
})(jQuery);
|
@@ -0,0 +1,512 @@
|
|
1
|
+
import jQuery from "jquery";
|
2
|
+
import "jquery-ui/ui/widgets/sortable";
|
3
|
+
import moment from "moment";
|
4
|
+
import I18n from "./i18n";
|
5
|
+
|
6
|
+
(function ($) {
|
7
|
+
document.addEventListener("rails_admin.dom_ready", function (event) {
|
8
|
+
var $editors,
|
9
|
+
array,
|
10
|
+
config_options,
|
11
|
+
goBootstrapWysihtml5s,
|
12
|
+
goCkeditors,
|
13
|
+
goCodeMirrors,
|
14
|
+
goFroalaWysiwygs,
|
15
|
+
goSimpleMDEs,
|
16
|
+
options;
|
17
|
+
var content = event.detail || $("form");
|
18
|
+
if (content.length) {
|
19
|
+
$.fn.datetimepicker.defaults.icons = {
|
20
|
+
time: "fa fa-clock-o",
|
21
|
+
date: "fa fa-calendar",
|
22
|
+
up: "fa fa-chevron-up",
|
23
|
+
down: "fa fa-chevron-down",
|
24
|
+
previous: "fa fa-angle-double-left",
|
25
|
+
next: "fa fa-angle-double-right",
|
26
|
+
today: "fa fa-dot-circle-o",
|
27
|
+
clear: "fa fa-trash",
|
28
|
+
close: "fa fa-times",
|
29
|
+
};
|
30
|
+
content.find("[data-datetimepicker]").each(function () {
|
31
|
+
var options;
|
32
|
+
options = $(this).data("options");
|
33
|
+
$.extend(options, {
|
34
|
+
date: moment($(this).siblings("[type=hidden]").val()),
|
35
|
+
locale: I18n.locale,
|
36
|
+
});
|
37
|
+
$(this).datetimepicker(options);
|
38
|
+
$(this).on("dp.change", function (e) {
|
39
|
+
if (e.date) {
|
40
|
+
$(this)
|
41
|
+
.siblings("[type=hidden]")
|
42
|
+
.val(e.date.format("YYYY-MM-DD[T]HH:mm:ss"));
|
43
|
+
}
|
44
|
+
});
|
45
|
+
});
|
46
|
+
content.find("[data-enumeration]").each(function () {
|
47
|
+
if ($(this).is("[multiple]")) {
|
48
|
+
$(this).filteringMultiselect($(this).data("options"));
|
49
|
+
} else {
|
50
|
+
$(this).filteringSelect($(this).data("options"));
|
51
|
+
}
|
52
|
+
});
|
53
|
+
content.find("[data-fileupload]").each(function () {
|
54
|
+
var parent;
|
55
|
+
parent = $(this).closest(".controls");
|
56
|
+
parent.find(".btn-remove-image").on("click", function () {
|
57
|
+
$(this).siblings("[type=checkbox]").click();
|
58
|
+
parent.find(".toggle").toggle("slow");
|
59
|
+
$(this).toggleClass("btn-danger btn-info");
|
60
|
+
return false;
|
61
|
+
});
|
62
|
+
});
|
63
|
+
content.find("[data-fileupload]").change(function () {
|
64
|
+
var ext, image_container, input, reader;
|
65
|
+
input = this;
|
66
|
+
image_container = $("#" + input.id)
|
67
|
+
.parent()
|
68
|
+
.children(".preview");
|
69
|
+
if (!image_container.length) {
|
70
|
+
image_container = $("#" + input.id)
|
71
|
+
.parent()
|
72
|
+
.prepend($("<img />").addClass("preview").addClass("img-thumbnail"))
|
73
|
+
.find("img.preview");
|
74
|
+
image_container.parent().find("img:not(.preview)").hide();
|
75
|
+
}
|
76
|
+
ext = $("#" + input.id)
|
77
|
+
.val()
|
78
|
+
.split(".")
|
79
|
+
.pop()
|
80
|
+
.toLowerCase();
|
81
|
+
if (
|
82
|
+
input.files &&
|
83
|
+
input.files[0] &&
|
84
|
+
$.inArray(ext, ["gif", "png", "jpg", "jpeg", "bmp"]) !== -1
|
85
|
+
) {
|
86
|
+
reader = new FileReader();
|
87
|
+
reader.onload = function (e) {
|
88
|
+
image_container.attr("src", e.target.result);
|
89
|
+
};
|
90
|
+
reader.readAsDataURL(input.files[0]);
|
91
|
+
image_container.show();
|
92
|
+
} else {
|
93
|
+
image_container.hide();
|
94
|
+
}
|
95
|
+
});
|
96
|
+
content.find("[data-multiple-fileupload]").each(function () {
|
97
|
+
$(this)
|
98
|
+
.closest(".controls")
|
99
|
+
.find(".btn-remove-image")
|
100
|
+
.on("click", function () {
|
101
|
+
$(this).siblings("[type=checkbox]").click();
|
102
|
+
$(this).parent(".toggle").toggle("slow");
|
103
|
+
$(this).toggleClass("btn-danger btn-info");
|
104
|
+
return false;
|
105
|
+
})
|
106
|
+
.end()
|
107
|
+
.sortable({
|
108
|
+
items: ".sortables",
|
109
|
+
});
|
110
|
+
});
|
111
|
+
content.find("[data-multiple-fileupload]").change(function () {
|
112
|
+
var ext, file, i, image_container, input, len, ref, results;
|
113
|
+
input = this;
|
114
|
+
$("#" + input.id)
|
115
|
+
.parent()
|
116
|
+
.children(".preview")
|
117
|
+
.remove();
|
118
|
+
ref = input.files;
|
119
|
+
results = [];
|
120
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
121
|
+
file = ref[i];
|
122
|
+
ext = file.name.split(".").pop().toLowerCase();
|
123
|
+
if ($.inArray(ext, ["gif", "png", "jpg", "jpeg", "bmp"]) === -1) {
|
124
|
+
continue;
|
125
|
+
}
|
126
|
+
image_container = $("<img />")
|
127
|
+
.addClass("preview")
|
128
|
+
.addClass("img-thumbnail");
|
129
|
+
results.push(
|
130
|
+
(function (image_container) {
|
131
|
+
var reader;
|
132
|
+
reader = new FileReader();
|
133
|
+
reader.onload = function (e) {
|
134
|
+
image_container.attr("src", e.target.result);
|
135
|
+
};
|
136
|
+
reader.readAsDataURL(file);
|
137
|
+
return $("#" + input.id)
|
138
|
+
.parent()
|
139
|
+
.append(
|
140
|
+
$("<div></div>").addClass("preview").append(image_container)
|
141
|
+
);
|
142
|
+
})(image_container)
|
143
|
+
);
|
144
|
+
}
|
145
|
+
return results;
|
146
|
+
});
|
147
|
+
content.find("[data-filteringmultiselect]").each(function () {
|
148
|
+
$(this).filteringMultiselect($(this).data("options"));
|
149
|
+
if ($(this).parents("#modal").length) {
|
150
|
+
$(this).siblings(".btn").remove();
|
151
|
+
} else {
|
152
|
+
$(this).parents(".control-group").first().remoteForm();
|
153
|
+
}
|
154
|
+
});
|
155
|
+
content.find("[data-filteringselect]").each(function () {
|
156
|
+
$(this).filteringSelect($(this).data("options"));
|
157
|
+
if ($(this).parents("#modal").length) {
|
158
|
+
$(this).siblings(".btn").remove();
|
159
|
+
} else {
|
160
|
+
$(this).parents(".control-group").first().remoteForm();
|
161
|
+
}
|
162
|
+
});
|
163
|
+
content.find("[data-nestedmany]").each(function () {
|
164
|
+
var field, nav, tab_content, toggler;
|
165
|
+
field = $(this).parents(".control-group").first();
|
166
|
+
nav = field.find("> .controls > .nav");
|
167
|
+
tab_content = field.find("> .tab-content");
|
168
|
+
toggler = field.find("> .controls > .btn-group > .toggler");
|
169
|
+
tab_content
|
170
|
+
.children(".fields:not(.tab-pane)")
|
171
|
+
.addClass("tab-pane")
|
172
|
+
.each(function () {
|
173
|
+
$(this).attr(
|
174
|
+
"id",
|
175
|
+
"unique-id-" +
|
176
|
+
new Date().getTime() +
|
177
|
+
Math.floor(Math.random() * 100000)
|
178
|
+
);
|
179
|
+
nav.append(
|
180
|
+
$("<li></li>").append(
|
181
|
+
$("<a></a>")
|
182
|
+
.attr("data-toggle", "tab")
|
183
|
+
.attr("href", "#" + this.id)
|
184
|
+
.text($(this).children(".object-infos").data("object-label"))
|
185
|
+
)
|
186
|
+
);
|
187
|
+
});
|
188
|
+
if (nav.find("> li.active").length === 0) {
|
189
|
+
nav.find("> li > a[data-toggle='tab']:first").tab("show");
|
190
|
+
}
|
191
|
+
if (nav.children().length === 0) {
|
192
|
+
nav.hide();
|
193
|
+
tab_content.hide();
|
194
|
+
toggler
|
195
|
+
.addClass("disabled")
|
196
|
+
.removeClass("active")
|
197
|
+
.children("i")
|
198
|
+
.addClass("fa-chevron-right");
|
199
|
+
} else {
|
200
|
+
if (toggler.hasClass("active")) {
|
201
|
+
nav.show();
|
202
|
+
tab_content.show();
|
203
|
+
toggler.children("i").addClass("fa-chevron-down");
|
204
|
+
} else {
|
205
|
+
nav.hide();
|
206
|
+
tab_content.hide();
|
207
|
+
toggler.children("i").addClass("fa-chevron-right");
|
208
|
+
}
|
209
|
+
}
|
210
|
+
});
|
211
|
+
content.find("[data-nestedone]").each(function () {
|
212
|
+
var field, first_tab, nav, tab_content, toggler;
|
213
|
+
field = $(this).parents(".control-group").first();
|
214
|
+
nav = field.find("> .controls > .nav");
|
215
|
+
tab_content = field.find("> .tab-content");
|
216
|
+
toggler = field.find("> .controls > .btn-group > .toggler");
|
217
|
+
tab_content
|
218
|
+
.children(".fields:not(.tab-pane)")
|
219
|
+
.addClass("tab-pane active")
|
220
|
+
.each(function () {
|
221
|
+
field
|
222
|
+
.find("> .controls .add_nested_fields")
|
223
|
+
.removeClass("add_nested_fields")
|
224
|
+
.text($(this).children(".object-infos").data("object-label"));
|
225
|
+
nav.append(
|
226
|
+
$("<li></li>").append(
|
227
|
+
$("<a></a>")
|
228
|
+
.attr("data-toggle", "tab")
|
229
|
+
.attr("href", "#" + $(this).id)
|
230
|
+
.text($(this).children(".object-infos").data("object-label"))
|
231
|
+
)
|
232
|
+
);
|
233
|
+
});
|
234
|
+
first_tab = nav.find("> li > a[data-toggle='tab']:first");
|
235
|
+
first_tab.tab("show");
|
236
|
+
field
|
237
|
+
.find("> .controls > [data-target]:first")
|
238
|
+
.html('<i class="fas"></i> ' + first_tab.html());
|
239
|
+
nav.hide();
|
240
|
+
if (nav.children().length === 0) {
|
241
|
+
nav.hide();
|
242
|
+
tab_content.hide();
|
243
|
+
toggler
|
244
|
+
.addClass("disabled")
|
245
|
+
.removeClass("active")
|
246
|
+
.children("i")
|
247
|
+
.addClass("fa-chevron-right");
|
248
|
+
} else {
|
249
|
+
if (toggler.hasClass("active")) {
|
250
|
+
toggler.children("i").addClass("fa-chevron-down");
|
251
|
+
tab_content.show();
|
252
|
+
} else {
|
253
|
+
toggler.children("i").addClass("fa-chevron-right");
|
254
|
+
tab_content.hide();
|
255
|
+
}
|
256
|
+
}
|
257
|
+
});
|
258
|
+
content.find("[data-polymorphic]").each(function () {
|
259
|
+
var field, object_select, type_select, urls;
|
260
|
+
type_select = $(this);
|
261
|
+
field = type_select.parents(".control-group").first();
|
262
|
+
object_select = field.find("select").last();
|
263
|
+
urls = type_select.data("urls");
|
264
|
+
type_select.on("change", function (e) {
|
265
|
+
var selected_data, selected_type;
|
266
|
+
selected_type = type_select.val().toLowerCase().replace(/::/g, "-");
|
267
|
+
selected_data = $("#" + selected_type + "-js-options").data(
|
268
|
+
"options"
|
269
|
+
);
|
270
|
+
object_select.data("options", selected_data);
|
271
|
+
object_select.filteringSelect("destroy");
|
272
|
+
object_select.filteringSelect(selected_data);
|
273
|
+
});
|
274
|
+
});
|
275
|
+
goSimpleMDEs = function () {
|
276
|
+
return content
|
277
|
+
.find("[data-richtext=simplemde]")
|
278
|
+
.not(".simplemded")
|
279
|
+
.each(function (index, domEle) {
|
280
|
+
var instance_config, options;
|
281
|
+
options = $(this).data("options");
|
282
|
+
instance_config = options.instance_config;
|
283
|
+
new window.SimpleMDE(
|
284
|
+
$.extend(
|
285
|
+
true,
|
286
|
+
{
|
287
|
+
element: document.getElementById(this.id),
|
288
|
+
autosave: {
|
289
|
+
uniqueId: this.id,
|
290
|
+
},
|
291
|
+
},
|
292
|
+
instance_config
|
293
|
+
)
|
294
|
+
);
|
295
|
+
$(this).addClass("simplemded");
|
296
|
+
});
|
297
|
+
};
|
298
|
+
$editors = content.find("[data-richtext=simplemde]").not(".simplemded");
|
299
|
+
if ($editors.length) {
|
300
|
+
if (!window.SimpleMDE) {
|
301
|
+
options = $editors.first().data("options");
|
302
|
+
$("head").append(
|
303
|
+
'<link href="' +
|
304
|
+
options["css_location"] +
|
305
|
+
'" rel="stylesheet" media="all" type="text/css">'
|
306
|
+
);
|
307
|
+
$.getScript(
|
308
|
+
options["js_location"],
|
309
|
+
function (script, textStatus, jqXHR) {
|
310
|
+
return goSimpleMDEs();
|
311
|
+
}
|
312
|
+
);
|
313
|
+
} else {
|
314
|
+
goSimpleMDEs();
|
315
|
+
}
|
316
|
+
}
|
317
|
+
goCkeditors = function () {
|
318
|
+
return content
|
319
|
+
.find("[data-richtext=ckeditor]")
|
320
|
+
.not(".ckeditored")
|
321
|
+
.each(function (index, domEle) {
|
322
|
+
var instance;
|
323
|
+
try {
|
324
|
+
if ((instance = window.CKEDITOR.instances[this.id])) {
|
325
|
+
instance.destroy(true);
|
326
|
+
}
|
327
|
+
} catch (error1) {}
|
328
|
+
window.CKEDITOR.replace(this, $(this).data("options").options);
|
329
|
+
$(this).addClass("ckeditored");
|
330
|
+
});
|
331
|
+
};
|
332
|
+
$editors = content.find("[data-richtext=ckeditor]").not(".ckeditored");
|
333
|
+
if ($editors.length) {
|
334
|
+
if (!window.CKEDITOR) {
|
335
|
+
options = $editors.first().data("options");
|
336
|
+
window.CKEDITOR_BASEPATH = options["base_location"];
|
337
|
+
$.getScript(
|
338
|
+
options["jspath"],
|
339
|
+
(function (_this) {
|
340
|
+
return function (script, textStatus, jqXHR) {
|
341
|
+
return goCkeditors();
|
342
|
+
};
|
343
|
+
})(this)
|
344
|
+
);
|
345
|
+
} else {
|
346
|
+
goCkeditors();
|
347
|
+
}
|
348
|
+
}
|
349
|
+
goCodeMirrors = (function (_this) {
|
350
|
+
return function (array) {
|
351
|
+
return array.each(function (index, domEle) {
|
352
|
+
var textarea;
|
353
|
+
options = $(this).data("options");
|
354
|
+
textarea = this;
|
355
|
+
$.getScript(
|
356
|
+
options["locations"]["mode"],
|
357
|
+
function (script, textStatus, jqXHR) {
|
358
|
+
options = $(domEle).data("options");
|
359
|
+
$("head").append(
|
360
|
+
'<link href="' +
|
361
|
+
options["locations"]["theme"] +
|
362
|
+
'" rel="stylesheet" media="all" type="text/css">'
|
363
|
+
);
|
364
|
+
CodeMirror.fromTextArea(textarea, options["options"]);
|
365
|
+
return $(textarea).addClass("codemirrored");
|
366
|
+
}
|
367
|
+
);
|
368
|
+
});
|
369
|
+
};
|
370
|
+
})(this);
|
371
|
+
array = content.find("[data-richtext=codemirror]").not(".codemirrored");
|
372
|
+
if (array.length) {
|
373
|
+
this.array = array;
|
374
|
+
if (!window.CodeMirror) {
|
375
|
+
options = $(array[0]).data("options");
|
376
|
+
$("head").append(
|
377
|
+
'<link href="' +
|
378
|
+
options["csspath"] +
|
379
|
+
'" rel="stylesheet" media="all" type="text/css">'
|
380
|
+
);
|
381
|
+
$.getScript(
|
382
|
+
options["jspath"],
|
383
|
+
(function (_this) {
|
384
|
+
return function (script, textStatus, jqXHR) {
|
385
|
+
return goCodeMirrors(_this.array);
|
386
|
+
};
|
387
|
+
})(this)
|
388
|
+
);
|
389
|
+
} else {
|
390
|
+
goCodeMirrors(this.array);
|
391
|
+
}
|
392
|
+
}
|
393
|
+
goBootstrapWysihtml5s = (function (_this) {
|
394
|
+
return function (array, config_options) {
|
395
|
+
return array.each(function () {
|
396
|
+
$(this).addClass("bootstrap-wysihtml5ed");
|
397
|
+
$(this).closest(".controls").addClass("well");
|
398
|
+
$(this).wysihtml5(config_options);
|
399
|
+
});
|
400
|
+
};
|
401
|
+
})(this);
|
402
|
+
array = content
|
403
|
+
.find("[data-richtext=bootstrap-wysihtml5]")
|
404
|
+
.not(".bootstrap-wysihtml5ed");
|
405
|
+
if (array.length) {
|
406
|
+
this.array = array;
|
407
|
+
options = $(array[0]).data("options");
|
408
|
+
config_options = $.parseJSON(options["config_options"]);
|
409
|
+
if (!window.wysihtml5) {
|
410
|
+
$("head").append(
|
411
|
+
'<link href="' +
|
412
|
+
options["csspath"] +
|
413
|
+
'" rel="stylesheet" media="all" type="text/css">'
|
414
|
+
);
|
415
|
+
$.getScript(
|
416
|
+
options["jspath"],
|
417
|
+
(function (_this) {
|
418
|
+
return function (script, textStatus, jqXHR) {
|
419
|
+
return goBootstrapWysihtml5s(_this.array, config_options);
|
420
|
+
};
|
421
|
+
})(this)
|
422
|
+
);
|
423
|
+
} else {
|
424
|
+
goBootstrapWysihtml5s(this.array, config_options);
|
425
|
+
}
|
426
|
+
}
|
427
|
+
goFroalaWysiwygs = (function (_this) {
|
428
|
+
return function (array) {
|
429
|
+
return array.each(function () {
|
430
|
+
var uploadEnabled;
|
431
|
+
options = $(this).data("options");
|
432
|
+
config_options = $.parseJSON(options["config_options"]);
|
433
|
+
if (config_options) {
|
434
|
+
if (!config_options["inlineMode"]) {
|
435
|
+
config_options["inlineMode"] = false;
|
436
|
+
}
|
437
|
+
} else {
|
438
|
+
config_options = {
|
439
|
+
inlineMode: false,
|
440
|
+
};
|
441
|
+
}
|
442
|
+
uploadEnabled = config_options["imageUploadURL"]
|
443
|
+
? (config_options["imageUploadParams"] = {
|
444
|
+
authenticity_token: $("meta[name=csrf-token]").attr(
|
445
|
+
"content"
|
446
|
+
),
|
447
|
+
})
|
448
|
+
: void 0;
|
449
|
+
$(this).addClass("froala-wysiwyged");
|
450
|
+
$(this).froalaEditor(config_options);
|
451
|
+
if (uploadEnabled) {
|
452
|
+
$(this)
|
453
|
+
.on("froalaEditor.image.error", function (e, editor, error) {
|
454
|
+
alert("error uploading image: " + error.message);
|
455
|
+
})
|
456
|
+
.on("froalaEditor.image.removed", function (e, editor, $img) {
|
457
|
+
editor.options.imageDeleteParams = {
|
458
|
+
src: $img.attr("src"),
|
459
|
+
authenticity_token: $("meta[name=csrf-token]").attr(
|
460
|
+
"content"
|
461
|
+
),
|
462
|
+
};
|
463
|
+
editor.deleteImage($img);
|
464
|
+
})
|
465
|
+
.on(
|
466
|
+
"editable.imageDeleteSuccess",
|
467
|
+
function (e, editor, data) {}
|
468
|
+
)
|
469
|
+
.on("editable.imageDeleteError", function (e, editor, error) {
|
470
|
+
alert("error deleting image: " + error.message);
|
471
|
+
});
|
472
|
+
}
|
473
|
+
});
|
474
|
+
};
|
475
|
+
})(this);
|
476
|
+
array = content
|
477
|
+
.find("[data-richtext=froala-wysiwyg]")
|
478
|
+
.not(".froala-wysiwyged");
|
479
|
+
if (array.length) {
|
480
|
+
options = $(array[0]).data("options");
|
481
|
+
if (!$.isFunction($.fn.editable)) {
|
482
|
+
$("head").append(
|
483
|
+
'<link href="' +
|
484
|
+
options["csspath"] +
|
485
|
+
'" rel="stylesheet" media="all" type="text/css">'
|
486
|
+
);
|
487
|
+
$.getScript(
|
488
|
+
options["jspath"],
|
489
|
+
(function (_this) {
|
490
|
+
return function (script, textStatus, jqXHR) {
|
491
|
+
return goFroalaWysiwygs(array);
|
492
|
+
};
|
493
|
+
})(this)
|
494
|
+
);
|
495
|
+
} else {
|
496
|
+
goFroalaWysiwygs(array);
|
497
|
+
}
|
498
|
+
}
|
499
|
+
return content.find("trix-editor").each(function () {
|
500
|
+
if (!window.Trix) {
|
501
|
+
options = $(this).data("options");
|
502
|
+
$("head").append(
|
503
|
+
'<link href="' +
|
504
|
+
options["csspath"] +
|
505
|
+
'" rel="stylesheet" media="all" type="text/css">'
|
506
|
+
);
|
507
|
+
return $.getScript(options["jspath"]);
|
508
|
+
}
|
509
|
+
});
|
510
|
+
}
|
511
|
+
});
|
512
|
+
})(jQuery);
|
Binary file
|