rails_admin 0.8.1 → 2.2.1
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 +5 -5
- data/Gemfile +17 -34
- data/LICENSE.md +1 -1
- data/README.md +34 -26
- data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +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/magnifier.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-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/custom/ui.js +1 -0
- data/app/assets/javascripts/rails_admin/jquery-ui.js.erb +8 -0
- data/app/assets/javascripts/rails_admin/jquery.migrate.js +3 -0
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +148 -60
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +31 -26
- data/app/assets/javascripts/rails_admin/ra.filtering-select.js +211 -110
- data/app/assets/javascripts/rails_admin/ra.i18n.js +28 -0
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +59 -0
- data/app/assets/javascripts/rails_admin/ra.sidescroll.js +31 -0
- data/app/assets/javascripts/rails_admin/ra.widgets.js +379 -0
- data/app/assets/javascripts/rails_admin/rails_admin.js +5 -5
- data/app/assets/javascripts/rails_admin/ui.js +135 -0
- data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +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 +5 -5
- data/app/assets/stylesheets/rails_admin/ra.sidescroll.scss +29 -0
- data/app/assets/stylesheets/rails_admin/ra.widgets.scss +9 -1
- data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +2 -1
- data/app/controllers/rails_admin/application_controller.rb +14 -8
- data/app/controllers/rails_admin/main_controller.rb +9 -9
- data/app/helpers/rails_admin/application_helper.rb +26 -11
- data/app/helpers/rails_admin/form_builder.rb +20 -12
- data/app/helpers/rails_admin/main_helper.rb +8 -7
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_gap.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_next_page.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_page.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_paginator.html.haml +0 -0
- data/app/views/kaminari/{twitter-bootstrap → ra-twitter-bootstrap}/_prev_page.html.haml +0 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.haml +4 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.haml +4 -0
- data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.haml +4 -0
- data/app/views/layouts/rails_admin/_head.html.haml +7 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +2 -2
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +2 -1
- data/app/views/layouts/rails_admin/application.html.haml +4 -10
- data/app/views/layouts/rails_admin/pjax.html.haml +1 -5
- data/app/views/rails_admin/main/_delete_notice.html.haml +14 -9
- data/app/views/rails_admin/main/_form_action_text.html.haml +7 -0
- data/app/views/rails_admin/main/_form_colorpicker.html.haml +1 -1
- data/app/views/rails_admin/main/_form_enumeration.html.haml +4 -3
- data/app/views/rails_admin/main/_form_file_upload.html.haml +5 -5
- data/app/views/rails_admin/main/_form_filtering_multiselect.html.haml +7 -6
- data/app/views/rails_admin/main/_form_filtering_select.html.haml +1 -1
- data/app/views/rails_admin/main/_form_multiple_file_upload.html.haml +16 -0
- data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +18 -3
- data/app/views/rails_admin/main/_form_simple_mde.haml +8 -0
- data/app/views/rails_admin/main/dashboard.html.haml +5 -6
- data/app/views/rails_admin/main/export.html.haml +45 -36
- data/app/views/rails_admin/main/history.html.haml +3 -3
- data/app/views/rails_admin/main/index.html.haml +37 -26
- data/app/views/rails_admin/main/show.html.haml +6 -7
- data/config/initializers/active_record_extensions.rb +3 -3
- data/config/initializers/haml.rb +4 -1
- data/config/locales/rails_admin.en.yml +5 -2
- data/lib/generators/rails_admin/templates/initializer.erb +6 -2
- data/lib/rails_admin/abstract_model.rb +9 -10
- data/lib/rails_admin/adapters/active_record/abstract_object.rb +9 -3
- data/lib/rails_admin/adapters/active_record/property.rb +1 -5
- data/lib/rails_admin/adapters/active_record.rb +83 -28
- data/lib/rails_admin/adapters/mongoid/abstract_object.rb +3 -3
- data/lib/rails_admin/adapters/mongoid/association.rb +18 -6
- data/lib/rails_admin/adapters/mongoid/bson.rb +29 -0
- data/lib/rails_admin/adapters/mongoid/extension.rb +4 -2
- data/lib/rails_admin/adapters/mongoid/property.rb +3 -3
- data/lib/rails_admin/adapters/mongoid.rb +40 -26
- data/lib/rails_admin/bootstrap-sass/compass_functions.rb +1 -1
- data/lib/rails_admin/bootstrap-sass/sass_functions.rb +1 -3
- data/lib/rails_admin/bootstrap-sass.rb +8 -6
- data/lib/rails_admin/config/actions/base.rb +20 -5
- data/lib/rails_admin/config/actions/bulk_delete.rb +2 -4
- data/lib/rails_admin/config/actions/dashboard.rb +9 -5
- data/lib/rails_admin/config/actions/edit.rb +1 -3
- data/lib/rails_admin/config/actions/export.rb +1 -1
- data/lib/rails_admin/config/actions/index.rb +5 -3
- data/lib/rails_admin/config/actions/new.rb +4 -5
- data/lib/rails_admin/config/actions.rb +1 -1
- data/lib/rails_admin/config/configurable.rb +25 -18
- data/lib/rails_admin/config/fields/association.rb +11 -3
- data/lib/rails_admin/config/fields/base.rb +20 -27
- data/lib/rails_admin/config/fields/factories/action_text.rb +12 -0
- data/lib/rails_admin/config/fields/factories/active_storage.rb +30 -0
- data/lib/rails_admin/config/fields/factories/carrierwave.rb +4 -2
- data/lib/rails_admin/config/fields/factories/dragonfly.rb +1 -1
- data/lib/rails_admin/config/fields/factories/shrine.rb +27 -0
- data/lib/rails_admin/config/fields/types/action_text.rb +30 -0
- data/lib/rails_admin/config/fields/types/active_record_enum.rb +19 -2
- data/lib/rails_admin/config/fields/types/active_storage.rb +49 -0
- data/lib/rails_admin/config/fields/types/all.rb +7 -1
- data/lib/rails_admin/config/fields/types/belongs_to_association.rb +8 -0
- data/lib/rails_admin/config/fields/types/bson_object_id.rb +1 -15
- data/lib/rails_admin/config/fields/types/ck_editor.rb +7 -7
- data/lib/rails_admin/config/fields/types/code_mirror.rb +10 -12
- data/lib/rails_admin/config/fields/types/color.rb +2 -2
- data/lib/rails_admin/config/fields/types/datetime.rb +6 -3
- data/lib/rails_admin/config/fields/types/file_upload.rb +12 -4
- data/lib/rails_admin/config/fields/types/froala.rb +9 -11
- data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -1
- data/lib/rails_admin/config/fields/types/hidden.rb +2 -2
- data/lib/rails_admin/config/fields/types/json.rb +9 -1
- data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +53 -0
- data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +56 -0
- data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +125 -0
- data/lib/rails_admin/config/fields/types/password.rb +5 -1
- data/lib/rails_admin/config/fields/types/polymorphic_association.rb +12 -1
- data/lib/rails_admin/config/fields/types/serialized.rb +2 -2
- data/lib/rails_admin/config/fields/types/shrine.rb +54 -0
- data/lib/rails_admin/config/fields/types/simple_mde.rb +36 -0
- data/lib/rails_admin/config/fields/types/string.rb +8 -7
- data/lib/rails_admin/config/fields/types/string_like.rb +19 -0
- data/lib/rails_admin/config/fields/types/text.rb +2 -20
- data/lib/rails_admin/config/fields/types/wysihtml5.rb +14 -10
- 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 +1 -1
- data/lib/rails_admin/config/has_groups.rb +1 -1
- data/lib/rails_admin/config/hideable.rb +1 -1
- data/lib/rails_admin/config/inspectable.rb +39 -0
- data/lib/rails_admin/config/lazy_model.rb +48 -8
- data/lib/rails_admin/config/model.rb +10 -22
- data/lib/rails_admin/config/proxyable/proxy.rb +7 -9
- data/lib/rails_admin/config/proxyable.rb +13 -1
- data/lib/rails_admin/config/sections/base.rb +4 -17
- data/lib/rails_admin/config/sections/list.rb +37 -0
- data/lib/rails_admin/config.rb +46 -25
- data/lib/rails_admin/engine.rb +37 -4
- data/lib/rails_admin/extension.rb +16 -4
- data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +23 -7
- data/lib/rails_admin/extensions/cancancan.rb +1 -1
- data/lib/rails_admin/extensions/controller_extension.rb +6 -0
- data/lib/rails_admin/extensions/history/auditing_adapter.rb +2 -2
- data/lib/rails_admin/extensions/history/history.rb +2 -2
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +59 -17
- data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +11 -3
- data/lib/rails_admin/support/csv_converter.rb +20 -14
- data/lib/rails_admin/support/datetime.rb +7 -6
- data/lib/rails_admin/support/i18n.rb +7 -5
- data/lib/rails_admin/version.rb +2 -2
- data/lib/rails_admin.rb +23 -1
- data/lib/tasks/rails_admin.rake +16 -7
- 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 +2671 -0
- 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/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/rails_admin/bootstrap/glyphicons-halflings.png +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/{app → vendor}/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
- data/{app → 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/{app → vendor}/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
- data/{app → vendor}/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
- data/{app → 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/{app → vendor}/assets/images/rails_admin/colorpicker/select2.png +0 -0
- data/vendor/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-affix.js +50 -28
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-alert.js +10 -7
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-button.js +35 -20
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-carousel.js +48 -25
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-collapse.js +70 -28
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-dropdown.js +56 -42
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-modal.js +118 -40
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-popover.js +26 -16
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-scrollspy.js +29 -27
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-tab.js +46 -19
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-tooltip.js +280 -60
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-transition.js +5 -5
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap-typeahead.js +0 -0
- data/{app → vendor}/assets/javascripts/rails_admin/bootstrap/bootstrap.js +0 -0
- data/vendor/assets/javascripts/rails_admin/bootstrap-datetimepicker.js +317 -150
- data/{app → vendor}/assets/javascripts/rails_admin/jquery.colorpicker.js +0 -0
- data/{app → vendor}/assets/javascripts/rails_admin/jquery.pjax.js +316 -161
- data/vendor/assets/javascripts/rails_admin/moment-with-locales.js +16528 -8420
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_alerts.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_badges.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_breadcrumbs.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_button-groups.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_buttons.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_carousel.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_close.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_code.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_component-animations.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_dropdowns.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_forms.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_glyphicons.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_grid.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_input-groups.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_jumbotron.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_labels.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_list-group.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_media.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_mixins.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_modals.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_navbar.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_navs.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_normalize.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_pager.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_pagination.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_panels.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_popovers.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_print.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_progress-bars.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_responsive-embed.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_responsive-utilities.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_scaffolding.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_tables.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_theme.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_thumbnails.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_tooltip.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_type.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_utilities.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_variables.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/_wells.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/bootstrap.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_alerts.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_background-variant.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_border-radius.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_buttons.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_center-block.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_clearfix.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_forms.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_gradients.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_grid-framework.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_grid.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_hide-text.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_image.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_labels.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_list-group.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_nav-divider.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_nav-vertical-align.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_opacity.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_pagination.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_panels.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_progress-bar.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_reset-filter.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_resize.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_responsive-visibility.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_size.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_tab-focus.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_table-row.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_text-emphasis.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_text-overflow.scss +0 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/bootstrap/mixins/_vendor-prefixes.scss +0 -0
- data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +2342 -0
- data/{app → vendor}/assets/stylesheets/rails_admin/jquery.colorpicker.scss +0 -0
- metadata +214 -199
- data/app/assets/images/rails_admin/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/rails_admin/bootstrap/glyphicons-halflings.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
- data/app/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/select.png +0 -0
- data/app/assets/images/rails_admin/colorpicker/slider.png +0 -0
- data/app/assets/javascripts/rails_admin/custom/ui.coffee +0 -1
- data/app/assets/javascripts/rails_admin/jquery.remotipart.fixed.js +0 -72
- data/app/assets/javascripts/rails_admin/ra.i18n.coffee +0 -8
- data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.coffee +0 -52
- data/app/assets/javascripts/rails_admin/ra.widgets.coffee +0 -308
- data/app/assets/javascripts/rails_admin/ui.coffee +0 -102
- data/config/initializers/devise_patch.rb +0 -9
- data/lib/rails_admin/config/fields/factories/refile.rb +0 -25
- data/lib/rails_admin/config/fields/types/refile.rb +0 -27
- data/lib/rails_admin/extensions/cancan/authorization_adapter.rb +0 -57
- data/lib/rails_admin/extensions/cancan.rb +0 -3
@@ -19,13 +19,13 @@
|
|
19
19
|
sortable: false,
|
20
20
|
removable: true,
|
21
21
|
regional: {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
add: 'Add',
|
23
|
+
chooseAll: 'Choose all',
|
24
|
+
clearAll: 'Clear all',
|
25
|
+
down: 'Down',
|
26
|
+
remove: 'Remove',
|
27
|
+
search: 'Search',
|
28
|
+
up: 'Up'
|
29
29
|
},
|
30
30
|
searchDelay: 400,
|
31
31
|
remote_source: null,
|
@@ -118,7 +118,7 @@
|
|
118
118
|
|
119
119
|
/* Add all to selection */
|
120
120
|
this.addAll.click(function(e){
|
121
|
-
widget._select($('option', widget.collection));
|
121
|
+
widget._select($('option:not(:disabled)', widget.collection));
|
122
122
|
e.preventDefault();
|
123
123
|
widget.selection.trigger('change');
|
124
124
|
});
|
@@ -175,22 +175,26 @@
|
|
175
175
|
_queryFilter: function(val) {
|
176
176
|
var widget = this;
|
177
177
|
widget._query(val, function(matches) {
|
178
|
-
|
178
|
+
|
179
179
|
var filtered = [];
|
180
|
-
|
181
|
-
|
180
|
+
var i;
|
181
|
+
|
182
|
+
for (i = 0; i < matches.length; i++) {
|
183
|
+
if (!widget.selected(matches[i].id)) {
|
182
184
|
filtered.push(i);
|
183
185
|
}
|
184
186
|
}
|
185
187
|
if (filtered.length > 0) {
|
186
|
-
widget.collection.
|
187
|
-
for (i
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
widget.collection[0].innerHTML = '';
|
189
|
+
for (i = 0; i < filtered.length; i++) {
|
190
|
+
var newOptions = $('<option></option>')
|
191
|
+
.prop('value', matches[filtered[i]].id)
|
192
|
+
.prop('title', matches[filtered[i]].label)
|
193
|
+
.text(matches[filtered[i]].label);
|
194
|
+
$(widget.collection[0]).append(newOptions);
|
191
195
|
}
|
192
196
|
} else {
|
193
|
-
widget.collection.
|
197
|
+
widget.collection[0].innerHTML = widget.noObjectsPlaceholder;
|
194
198
|
}
|
195
199
|
});
|
196
200
|
},
|
@@ -209,12 +213,11 @@
|
|
209
213
|
var widget = this;
|
210
214
|
|
211
215
|
this.element.find("option").each(function(i, option) {
|
216
|
+
widget._cache['o_' + option.value] = {id: option.value, value: $(option).text()};
|
212
217
|
if (option.selected) {
|
213
|
-
widget.
|
214
|
-
$(option).clone().appendTo(widget.selection).attr("selected", false).attr("title", $(option).text());
|
218
|
+
$(option).clone().appendTo(widget.selection).prop("selected", false).prop("title", $(option).text());
|
215
219
|
} else {
|
216
|
-
widget.
|
217
|
-
$(option).clone().appendTo(widget.collection).attr("selected", false).attr("title", $(option).text());
|
220
|
+
$(option).clone().appendTo(widget.collection).prop("selected", false).prop("title", $(option).text());
|
218
221
|
}
|
219
222
|
});
|
220
223
|
},
|
@@ -224,7 +227,7 @@
|
|
224
227
|
options.each(function(i, option) {
|
225
228
|
widget.element.find('option[value="' + option.value + '"]').removeAttr("selected");
|
226
229
|
});
|
227
|
-
$(options).appendTo(this.collection).
|
230
|
+
$(options).appendTo(this.collection).prop('selected', false);
|
228
231
|
},
|
229
232
|
|
230
233
|
_query: function(query, success) {
|
@@ -279,12 +282,12 @@
|
|
279
282
|
options.each(function(i, option) {
|
280
283
|
var el = widget.element.find('option[value="' + option.value + '"]');
|
281
284
|
if (el.length) {
|
282
|
-
el.
|
285
|
+
el.prop("selected", true);
|
283
286
|
} else {
|
284
|
-
widget.element.append($('<option></option>').
|
287
|
+
widget.element.append($('<option></option>').prop('value', option.value).prop('selected', true));
|
285
288
|
}
|
286
289
|
});
|
287
|
-
$(options).appendTo(this.selection).
|
290
|
+
$(options).appendTo(this.selection).prop('selected', false);
|
288
291
|
},
|
289
292
|
|
290
293
|
_move: function(direction, options) {
|
@@ -314,7 +317,9 @@
|
|
314
317
|
},
|
315
318
|
|
316
319
|
selected: function(value) {
|
317
|
-
|
320
|
+
if (this.selection[0].querySelectorAll('option[value="' + value + '"]')[0]) {
|
321
|
+
return true;
|
322
|
+
}
|
318
323
|
},
|
319
324
|
|
320
325
|
destroy: function() {
|
@@ -14,7 +14,9 @@
|
|
14
14
|
* jquery.ui.autocomplete.js
|
15
15
|
*/
|
16
16
|
(function($) {
|
17
|
-
|
17
|
+
'use strict';
|
18
|
+
|
19
|
+
$.widget('ra.filteringSelect', {
|
18
20
|
options: {
|
19
21
|
createQuery: function(query) {
|
20
22
|
return { query: query };
|
@@ -26,135 +28,90 @@
|
|
26
28
|
xhr: false
|
27
29
|
},
|
28
30
|
|
31
|
+
button: null,
|
32
|
+
input: null,
|
33
|
+
select: null,
|
34
|
+
filtering_select: null,
|
35
|
+
|
29
36
|
_create: function() {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
value = selected.val() ? selected.text() : "";
|
37
|
+
this.filtering_select = this.element.siblings(
|
38
|
+
'[data-input-for="' + this.element.attr('id') + '"]'
|
39
|
+
);
|
34
40
|
|
35
|
-
|
36
|
-
|
41
|
+
// When using the browser back and forward buttons, it is possible that
|
42
|
+
// the autocomplete field will be cached which causes duplicate fields
|
43
|
+
// to be generated.
|
44
|
+
if (this.filtering_select.length > 0) {
|
45
|
+
this.input = this.filtering_select.children('input');
|
46
|
+
this.button = this.filtering_select.children('.input-group-btn');
|
37
47
|
} else {
|
38
|
-
this.
|
39
|
-
|
40
|
-
|
48
|
+
this.element.hide();
|
49
|
+
this.filtering_select = this._inputGroup(this.element.attr('id'));
|
50
|
+
this.input = this._inputField();
|
51
|
+
this.button = this._buttonField();
|
41
52
|
}
|
42
|
-
var filtering_select = $('<div class="input-group filtering-select col-sm-2" style="float:left"></div>')
|
43
|
-
var input = this.input = $('<input type="text">')
|
44
|
-
.val(value)
|
45
|
-
.addClass("form-control ra-filtering-select-input")
|
46
|
-
.attr('style', select.attr('style'))
|
47
|
-
.show()
|
48
|
-
.autocomplete({
|
49
|
-
delay: this.options.searchDelay,
|
50
|
-
minLength: this.options.minLength,
|
51
|
-
source: this._getSourceFunction(this.options.source),
|
52
|
-
select: function(event, ui) {
|
53
|
-
var option = $('<option></option>').attr('value', ui.item.id).attr('selected', 'selected').text(ui.item.value);
|
54
|
-
select.html(option);
|
55
|
-
select.trigger("change", ui.item.id);
|
56
|
-
self._trigger("selected", event, {
|
57
|
-
item: option
|
58
|
-
});
|
59
|
-
$(self.element.parents('.controls')[0]).find('.update').removeClass('disabled');
|
60
|
-
},
|
61
|
-
change: function(event, ui) {
|
62
|
-
if (!ui.item) {
|
63
|
-
var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
|
64
|
-
valid = false;
|
65
|
-
select.children("option").each(function() {
|
66
|
-
if ($(this).text().match(matcher)) {
|
67
|
-
this.selected = valid = true;
|
68
|
-
return false;
|
69
|
-
}
|
70
|
-
});
|
71
|
-
if (!valid || $(this).val() == '') {
|
72
|
-
// remove invalid value, as it didn't match anything
|
73
|
-
$(this).val(null);
|
74
|
-
select.html($('<option value="" selected="selected"></option>'));
|
75
|
-
input.data("ui-autocomplete").term = "";
|
76
|
-
$(self.element.parents('.controls')[0]).find('.update').addClass('disabled');
|
77
|
-
return false;
|
78
|
-
}
|
79
|
-
|
80
|
-
}
|
81
|
-
}
|
82
|
-
})
|
83
|
-
.keyup(function() {
|
84
|
-
/* Clear select options and trigger change if selected item is deleted */
|
85
|
-
if ($(this).val().length == 0) {
|
86
|
-
select.html($('<option value="" selected="selected"></option>'));
|
87
|
-
select.trigger("change");
|
88
|
-
}
|
89
|
-
})
|
90
|
-
|
91
|
-
if(select.attr('placeholder'))
|
92
|
-
input.attr('placeholder', select.attr('placeholder'))
|
93
|
-
|
94
|
-
input.data("ui-autocomplete")._renderItem = function(ul, item) {
|
95
|
-
return $("<li></li>")
|
96
|
-
.data("ui-autocomplete-item", item)
|
97
|
-
.append( $( "<a></a>" ).html( item.html || item.id ) )
|
98
|
-
.appendTo(ul);
|
99
|
-
};
|
100
|
-
|
101
|
-
var button = this.button = $('<span class="input-group-btn"><label class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="Show All Items" role="button"><span class="caret"></span><span class="ui-button-text"> </span></label></span>')
|
102
|
-
.click(function() {
|
103
|
-
// close if already visible
|
104
|
-
if (input.autocomplete("widget").is(":visible")) {
|
105
|
-
input.autocomplete("close");
|
106
|
-
return;
|
107
|
-
}
|
108
|
-
|
109
|
-
// pass empty string as value to search for, displaying all results
|
110
|
-
input.autocomplete("search", "");
|
111
|
-
input.focus();
|
112
|
-
});
|
113
|
-
|
114
|
-
filtering_select.append(input).append(button).insertAfter(select);
|
115
53
|
|
54
|
+
this._setOptionsSource();
|
55
|
+
this._initAutocomplete();
|
56
|
+
this._initKeyEvent();
|
57
|
+
this._overloadRenderItem();
|
58
|
+
this._autocompleteDropdownEvent(this.button);
|
116
59
|
|
60
|
+
return this.filtering_select.append(this.input)
|
61
|
+
.append(this.button)
|
62
|
+
.insertAfter(this.element);
|
117
63
|
},
|
118
64
|
|
119
65
|
_getResultSet: function(request, data, xhr) {
|
120
|
-
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term),
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
return $('<span></span>').text(el).html();
|
125
|
-
}).join($('<strong></strong>').text(word)[0].outerHTML);
|
126
|
-
}else{
|
127
|
-
return $('<span></span>').text(label).html();
|
128
|
-
}
|
66
|
+
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i');
|
67
|
+
|
68
|
+
var spannedContent = function(content) {
|
69
|
+
return $('<span>').text(content).html();
|
129
70
|
};
|
130
71
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
72
|
+
var highlighter = function(label, word) {
|
73
|
+
if(word.length) {
|
74
|
+
return $.map(
|
75
|
+
label.split(word),
|
76
|
+
function(el) {
|
77
|
+
return spannedContent(el);
|
78
|
+
})
|
79
|
+
.join($('<strong>')
|
80
|
+
.text(word)[0]
|
81
|
+
.outerHTML
|
82
|
+
);
|
83
|
+
} else {
|
84
|
+
return spannedContent(label);
|
139
85
|
}
|
86
|
+
};
|
87
|
+
|
88
|
+
return $.map(
|
89
|
+
data,
|
90
|
+
function(el) {
|
91
|
+
var id = el.id || el.value;
|
92
|
+
var value = el.label || el.id;
|
93
|
+
// match regexp only for local requests, remote ones are already
|
94
|
+
// filtered, and label may not contain filtered term.
|
95
|
+
if (id && (xhr || matcher.test(el.label))) {
|
96
|
+
return {
|
97
|
+
html: highlighter(value, request.term),
|
98
|
+
value: value,
|
99
|
+
id: id
|
100
|
+
};
|
101
|
+
}
|
140
102
|
});
|
141
103
|
},
|
142
104
|
|
143
105
|
_getSourceFunction: function(source) {
|
144
|
-
|
145
|
-
var
|
146
|
-
requestIndex = 0;
|
106
|
+
var self = this;
|
107
|
+
var requestIndex = 0;
|
147
108
|
|
148
109
|
if ($.isArray(source)) {
|
149
|
-
|
150
110
|
return function(request, response) {
|
151
111
|
response(self._getResultSet(request, source, false));
|
152
112
|
};
|
153
|
-
|
154
|
-
} else if (typeof source === "string") {
|
155
|
-
|
113
|
+
} else if (typeof source === 'string') {
|
156
114
|
return function(request, response) {
|
157
|
-
|
158
115
|
if (this.xhr) {
|
159
116
|
this.xhr.abort();
|
160
117
|
}
|
@@ -162,7 +119,7 @@
|
|
162
119
|
this.xhr = $.ajax({
|
163
120
|
url: source,
|
164
121
|
data: self.options.createQuery(request.term),
|
165
|
-
dataType:
|
122
|
+
dataType: 'json',
|
166
123
|
autocompleteRequest: ++requestIndex,
|
167
124
|
success: function(data, status) {
|
168
125
|
if (this.autocompleteRequest === requestIndex) {
|
@@ -176,17 +133,161 @@
|
|
176
133
|
}
|
177
134
|
});
|
178
135
|
};
|
136
|
+
} else {
|
137
|
+
return source;
|
138
|
+
}
|
139
|
+
},
|
179
140
|
|
141
|
+
_setOptionsSource: function() {
|
142
|
+
if (this.options.xhr) {
|
143
|
+
this.options.source = this.options.remote_source;
|
180
144
|
} else {
|
145
|
+
this.options.source = this.element.children('option').map(function() {
|
146
|
+
return { label: $(this).text(), value: this.value };
|
147
|
+
}).toArray();
|
148
|
+
}
|
149
|
+
},
|
181
150
|
|
182
|
-
|
151
|
+
_buttonField: function() {
|
152
|
+
return $(
|
153
|
+
'<span class="input-group-btn">' +
|
154
|
+
'<label class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="Show All Items" role="button">' +
|
155
|
+
'<span class="caret"></span>' +
|
156
|
+
'<span class="ui-button-text"> </span>' +
|
157
|
+
'</label>' +
|
158
|
+
'</span>'
|
159
|
+
);
|
160
|
+
},
|
161
|
+
|
162
|
+
_autocompleteDropdownEvent: function(element) {
|
163
|
+
var self = this;
|
164
|
+
|
165
|
+
return element.click(function() {
|
166
|
+
// close if already visible
|
167
|
+
if (self.input.autocomplete('widget').is(':visible')) {
|
168
|
+
self.input.autocomplete('close');
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
|
172
|
+
// pass empty string as value to search for, displaying all results
|
173
|
+
self.input.autocomplete('search', '');
|
174
|
+
self.input.focus();
|
175
|
+
});
|
176
|
+
},
|
177
|
+
|
178
|
+
_inputField: function() {
|
179
|
+
var input;
|
180
|
+
var selected = this.element.children(':selected');
|
181
|
+
var value = selected.val() ? selected.text() : '';
|
182
|
+
|
183
|
+
input = $('<input type="text">')
|
184
|
+
.val(value)
|
185
|
+
.addClass('form-control ra-filtering-select-input')
|
186
|
+
.attr('style', this.element.attr('style'))
|
187
|
+
.show();
|
188
|
+
|
189
|
+
if (this.element.attr('placeholder')) {
|
190
|
+
input.attr('placeholder', this.element.attr('placeholder'));
|
183
191
|
}
|
192
|
+
|
193
|
+
if (this.element.attr('required')) {
|
194
|
+
input.attr('required', this.element.attr('required'));
|
195
|
+
this.element.attr('required', false);
|
196
|
+
}
|
197
|
+
|
198
|
+
return input;
|
199
|
+
},
|
200
|
+
|
201
|
+
_inputGroup: function(inputFor) {
|
202
|
+
return $('<div>')
|
203
|
+
.addClass('input-group filtering-select col-sm-2')
|
204
|
+
.attr('data-input-for', inputFor)
|
205
|
+
.css('float', this.element.css("float"));
|
206
|
+
},
|
207
|
+
|
208
|
+
_initAutocomplete: function() {
|
209
|
+
var self = this;
|
210
|
+
|
211
|
+
return this.input.autocomplete({
|
212
|
+
delay: this.options.searchDelay,
|
213
|
+
minLength: this.options.minLength,
|
214
|
+
source: this._getSourceFunction(this.options.source),
|
215
|
+
select: function(event, ui) {
|
216
|
+
var option = $('<option>')
|
217
|
+
.attr('value', ui.item.id)
|
218
|
+
.attr('selected', 'selected')
|
219
|
+
.text(ui.item.value);
|
220
|
+
self.element.html(option)
|
221
|
+
.trigger('change', ui.item.id);
|
222
|
+
self._trigger('selected', event, {
|
223
|
+
item: option
|
224
|
+
});
|
225
|
+
$(self.element.parents('.controls')[0])
|
226
|
+
.find('.update')
|
227
|
+
.removeClass('disabled');
|
228
|
+
},
|
229
|
+
change: function(event, ui) {
|
230
|
+
if (ui.item) {
|
231
|
+
return;
|
232
|
+
}
|
233
|
+
|
234
|
+
var matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex($(this).val()) + '$', 'i');
|
235
|
+
var valid = false;
|
236
|
+
|
237
|
+
self.element.children('option')
|
238
|
+
.each(function() {
|
239
|
+
if ($(this).text().match(matcher)) {
|
240
|
+
valid = true;
|
241
|
+
return false;
|
242
|
+
}
|
243
|
+
});
|
244
|
+
|
245
|
+
if (valid || $(this).val() !== '') {
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
|
249
|
+
// remove invalid value, as it didn't match anything
|
250
|
+
$(this).val(null);
|
251
|
+
self.element.html($('<option value="" selected="selected"></option>'));
|
252
|
+
self.input.data('ui-autocomplete').term = '';
|
253
|
+
$(self.element.parents('.controls')[0])
|
254
|
+
.find('.update')
|
255
|
+
.addClass('disabled');
|
256
|
+
return false;
|
257
|
+
}
|
258
|
+
});
|
259
|
+
},
|
260
|
+
|
261
|
+
_initKeyEvent: function() {
|
262
|
+
var self = this;
|
263
|
+
|
264
|
+
return this.input.keyup(function() {
|
265
|
+
if ($(this).val().length) {
|
266
|
+
return;
|
267
|
+
}
|
268
|
+
|
269
|
+
/* Clear select options and trigger change if selected item is deleted */
|
270
|
+
return self.element
|
271
|
+
.html($('<option value="" selected="selected"></option>'))
|
272
|
+
.trigger('change');
|
273
|
+
});
|
274
|
+
},
|
275
|
+
|
276
|
+
_overloadRenderItem: function() {
|
277
|
+
this.input.data('ui-autocomplete')._renderItem = function(ul, item) {
|
278
|
+
return $('<li></li>')
|
279
|
+
.data('ui-autocomplete-item', item)
|
280
|
+
.append($('<a></a>')
|
281
|
+
.html(item.html || item.id))
|
282
|
+
.appendTo(ul);
|
283
|
+
};
|
184
284
|
},
|
185
285
|
|
186
286
|
destroy: function() {
|
187
287
|
this.input.remove();
|
188
288
|
this.button.remove();
|
189
289
|
this.element.show();
|
290
|
+
this.filtering_select.remove();
|
190
291
|
$.Widget.prototype.destroy.call(this);
|
191
292
|
}
|
192
293
|
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
(function() {
|
2
|
+
var Locale;
|
3
|
+
|
4
|
+
this.RailsAdmin || (this.RailsAdmin = {});
|
5
|
+
|
6
|
+
this.RailsAdmin.I18n = Locale = (function() {
|
7
|
+
function Locale() {}
|
8
|
+
|
9
|
+
Locale.init = function(locale, translations) {
|
10
|
+
this.locale = locale;
|
11
|
+
this.translations = translations;
|
12
|
+
moment.locale(this.locale);
|
13
|
+
if (typeof this.translations === "string") {
|
14
|
+
this.translations = JSON.parse(this.translations);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
Locale.t = function(key) {
|
19
|
+
var humanize;
|
20
|
+
humanize = key.charAt(0).toUpperCase() + key.replace(/_/g, " ").slice(1);
|
21
|
+
return this.translations[key] || humanize;
|
22
|
+
};
|
23
|
+
|
24
|
+
return Locale;
|
25
|
+
|
26
|
+
})();
|
27
|
+
|
28
|
+
}).call(this);
|
@@ -0,0 +1,59 @@
|
|
1
|
+
(function($) {
|
2
|
+
$(document).ready(function() {
|
3
|
+
return window.nestedFormEvents.insertFields = function(content, assoc, link) {
|
4
|
+
var tab_content;
|
5
|
+
tab_content = $(link).closest(".controls").siblings(".tab-content");
|
6
|
+
tab_content.append(content);
|
7
|
+
return tab_content.children().last();
|
8
|
+
};
|
9
|
+
});
|
10
|
+
|
11
|
+
$(document).on('nested:fieldAdded', 'form', function(content) {
|
12
|
+
var controls, field, nav, new_tab, one_to_one, parent_group, toggler;
|
13
|
+
field = content.field.addClass('tab-pane').attr('id', 'unique-id-' + (new Date().getTime()));
|
14
|
+
new_tab = $('<li></li>').append(
|
15
|
+
$('<a></a>').attr('data-toggle', 'tab').attr('href', '#' + field.attr('id')).text(field.children('.object-infos').data('object-label'))
|
16
|
+
)
|
17
|
+
parent_group = field.closest('.control-group');
|
18
|
+
controls = parent_group.children('.controls');
|
19
|
+
one_to_one = controls.data('nestedone') !== void 0;
|
20
|
+
nav = controls.children('.nav');
|
21
|
+
content = parent_group.children('.tab-content');
|
22
|
+
toggler = controls.find('.toggler');
|
23
|
+
nav.append(new_tab);
|
24
|
+
$(window.document).trigger('rails_admin.dom_ready', [field, parent_group]);
|
25
|
+
new_tab.children('a').tab('show');
|
26
|
+
if (!one_to_one) {
|
27
|
+
nav.filter(':hidden').show('slow');
|
28
|
+
}
|
29
|
+
content.filter(':hidden').show('slow');
|
30
|
+
toggler.addClass('active').removeClass('disabled').children('i').addClass('icon-chevron-down').removeClass('icon-chevron-right');
|
31
|
+
if (one_to_one) {
|
32
|
+
controls.find('.add_nested_fields').removeClass('add_nested_fields').text(field.children('.object-infos').data('object-label'));
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
$(document).on('nested:fieldRemoved', 'form', function(content) {
|
37
|
+
var add_button, controls, current_li, field, nav, one_to_one, parent_group, toggler;
|
38
|
+
field = content.field;
|
39
|
+
nav = field.closest(".control-group").children('.controls').children('.nav');
|
40
|
+
current_li = nav.children('li').has('a[href="#' + field.attr('id') + '"]');
|
41
|
+
parent_group = field.closest(".control-group");
|
42
|
+
controls = parent_group.children('.controls');
|
43
|
+
one_to_one = controls.data('nestedone') !== void 0;
|
44
|
+
toggler = controls.find('.toggler');
|
45
|
+
(current_li.next().length ? current_li.next() : current_li.prev()).children('a:first').tab('show');
|
46
|
+
current_li.remove();
|
47
|
+
if (nav.children().length === 0) {
|
48
|
+
nav.filter(':visible').hide('slow');
|
49
|
+
toggler.removeClass('active').addClass('disabled').children('i').removeClass('icon-chevron-down').addClass('icon-chevron-right');
|
50
|
+
}
|
51
|
+
if (one_to_one) {
|
52
|
+
add_button = toggler.next();
|
53
|
+
add_button.addClass('add_nested_fields').html(add_button.data('add-label'));
|
54
|
+
}
|
55
|
+
field.find('[required]').each(function() {
|
56
|
+
$(this).removeAttr('required');
|
57
|
+
});
|
58
|
+
});
|
59
|
+
}(jQuery));
|
@@ -0,0 +1,31 @@
|
|
1
|
+
(function($) {
|
2
|
+
function setFrozenColPositions() {
|
3
|
+
var $listForm, frozenColumns;
|
4
|
+
|
5
|
+
$listForm = $('#bulk_form');
|
6
|
+
if (!$listForm.is('.ra-sidescroll')) {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
frozenColumns = $listForm.data('ra-sidescroll');
|
10
|
+
|
11
|
+
$listForm.find('table tr').each(function(index, tr) {
|
12
|
+
var firstPosition = 0;
|
13
|
+
|
14
|
+
$(tr).children().slice(0, frozenColumns).each(function(idx, td) {
|
15
|
+
var tdLeft;
|
16
|
+
$(td).addClass('ra-sidescroll-frozen');
|
17
|
+
if (idx === frozenColumns - 1) {
|
18
|
+
$(td).addClass('last-of-frozen');
|
19
|
+
}
|
20
|
+
tdLeft = $(td).position().left;
|
21
|
+
if (idx === 0) {
|
22
|
+
firstPosition = tdLeft;
|
23
|
+
}
|
24
|
+
td.style.left = (tdLeft - firstPosition) + "px";
|
25
|
+
});
|
26
|
+
});
|
27
|
+
};
|
28
|
+
|
29
|
+
$(window).on('load', setFrozenColPositions);
|
30
|
+
$(document).on('rails_admin.dom_ready', setFrozenColPositions);
|
31
|
+
})(jQuery);
|