active_scaffold 3.4.43 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +39 -0
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +27 -19
- data/app/assets/javascripts/active_scaffold.js.erb +1 -1
- data/app/assets/javascripts/jquery/active_scaffold.js +95 -43
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +30 -6
- data/app/assets/javascripts/prototype/tiny_mce_bridge.js +11 -1
- data/app/assets/stylesheets/active_scaffold_colors.scss +2 -2
- data/app/assets/stylesheets/active_scaffold_layout.css +36 -28
- data/app/views/active_scaffold_overrides/_base_form.html.erb +2 -3
- data/app/views/active_scaffold_overrides/_field_search.html.erb +8 -7
- data/app/views/active_scaffold_overrides/_form_association.html.erb +9 -9
- data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +6 -6
- data/app/views/active_scaffold_overrides/_form_association_record.html.erb +52 -50
- data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_human_conditions.html.erb +3 -1
- data/app/views/active_scaffold_overrides/_list_calculations.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_list_column_headings.html.erb +2 -0
- data/app/views/active_scaffold_overrides/_list_messages.html.erb +5 -3
- data/app/views/active_scaffold_overrides/_list_record.html.erb +3 -1
- data/app/views/active_scaffold_overrides/_list_with_header.html.erb +9 -9
- data/app/views/active_scaffold_overrides/_messages.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_refresh_list.js.erb +18 -10
- data/app/views/active_scaffold_overrides/_render_field.js.erb +3 -3
- data/app/views/active_scaffold_overrides/_search.html.erb +7 -6
- data/app/views/active_scaffold_overrides/_show_actions.html.erb +14 -0
- data/app/views/active_scaffold_overrides/_show_association.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_actions.html.erb +6 -2
- data/app/views/active_scaffold_overrides/_update_column.js.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_form.html.erb +1 -1
- data/app/views/active_scaffold_overrides/destroy.js.erb +2 -3
- data/app/views/active_scaffold_overrides/edit_associated.js.erb +4 -3
- data/app/views/active_scaffold_overrides/on_action_update.js.erb +5 -3
- data/app/views/active_scaffold_overrides/on_create.js.erb +4 -4
- data/app/views/active_scaffold_overrides/on_update.js.erb +6 -6
- data/app/views/active_scaffold_overrides/show.html.erb +6 -0
- data/app/views/active_scaffold_overrides/update.html.erb +1 -1
- data/app/views/active_scaffold_overrides/update_column.js.erb +1 -1
- data/config/brakeman.ignore +26 -0
- data/config/brakeman.yml +3 -0
- data/config/i18n-tasks.yml +121 -0
- data/config/locales/de.yml +81 -70
- data/config/locales/en.yml +83 -74
- data/config/locales/es.yml +82 -73
- data/config/locales/fr.yml +86 -75
- data/config/locales/hu.yml +81 -70
- data/config/locales/ja.yml +71 -60
- data/config/locales/ru.yml +85 -74
- data/lib/active_scaffold.rb +3 -0
- data/lib/active_scaffold/actions/common_search.rb +11 -7
- data/lib/active_scaffold/actions/core.rb +119 -47
- data/lib/active_scaffold/actions/create.rb +1 -1
- data/lib/active_scaffold/actions/delete.rb +11 -8
- data/lib/active_scaffold/actions/field_search.rb +104 -6
- data/lib/active_scaffold/actions/list.rb +25 -21
- data/lib/active_scaffold/actions/mark.rb +12 -4
- data/lib/active_scaffold/actions/nested.rb +26 -26
- data/lib/active_scaffold/actions/search.rb +2 -2
- data/lib/active_scaffold/actions/show.rb +4 -5
- data/lib/active_scaffold/actions/subform.rb +9 -7
- data/lib/active_scaffold/actions/update.rb +20 -13
- data/lib/active_scaffold/active_record_permissions.rb +24 -5
- data/lib/active_scaffold/attribute_params.rb +68 -49
- data/lib/active_scaffold/bridges.rb +1 -1
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +15 -19
- data/lib/active_scaffold/bridges/bitfields.rb +1 -1
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +10 -14
- data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -7
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +19 -22
- data/lib/active_scaffold/bridges/cancan.rb +4 -3
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +11 -21
- data/lib/active_scaffold/bridges/carrierwave.rb +2 -1
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +2 -6
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +6 -39
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/chosen.rb +4 -1
- data/lib/active_scaffold/bridges/chosen/helpers.rb +3 -2
- data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +2 -2
- data/lib/active_scaffold/bridges/date_picker.rb +3 -0
- data/lib/active_scaffold/bridges/date_picker/ext.rb +43 -38
- data/lib/active_scaffold/bridges/date_picker/helper.rb +24 -23
- data/lib/active_scaffold/bridges/dragonfly.rb +1 -1
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +3 -25
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +2 -2
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +6 -8
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +1 -1
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -2
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +2 -1
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/actions.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/helper.rb +1 -2
- data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/paperclip.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +3 -28
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/record_select.rb +2 -0
- data/lib/active_scaffold/bridges/record_select/helpers.rb +14 -18
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +4 -8
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -20
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +7 -22
- data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +14 -14
- data/lib/active_scaffold/config/base.rb +9 -6
- data/lib/active_scaffold/config/core.rb +30 -21
- data/lib/active_scaffold/config/create.rb +2 -1
- data/lib/active_scaffold/config/delete.rb +2 -2
- data/lib/active_scaffold/config/field_search.rb +9 -3
- data/lib/active_scaffold/config/form.rb +4 -4
- data/lib/active_scaffold/config/list.rb +27 -23
- data/lib/active_scaffold/config/nested.rb +4 -4
- data/lib/active_scaffold/config/search.rb +6 -6
- data/lib/active_scaffold/config/show.rb +11 -1
- data/lib/active_scaffold/config/subform.rb +1 -1
- data/lib/active_scaffold/config/update.rb +4 -2
- data/lib/active_scaffold/constraints.rb +39 -36
- data/lib/active_scaffold/core.rb +36 -15
- data/lib/active_scaffold/data_structures/action_columns.rb +14 -9
- data/lib/active_scaffold/data_structures/action_link.rb +4 -5
- data/lib/active_scaffold/data_structures/action_links.rb +5 -4
- data/lib/active_scaffold/data_structures/actions.rb +2 -2
- data/lib/active_scaffold/data_structures/association.rb +8 -0
- data/lib/active_scaffold/data_structures/association/abstract.rb +147 -0
- data/lib/active_scaffold/data_structures/association/active_mongoid.rb +42 -0
- data/lib/active_scaffold/data_structures/association/active_record.rb +94 -0
- data/lib/active_scaffold/data_structures/association/mongoid.rb +45 -0
- data/lib/active_scaffold/data_structures/bridge.rb +3 -6
- data/lib/active_scaffold/data_structures/column.rb +100 -82
- data/lib/active_scaffold/data_structures/columns.rb +21 -3
- data/lib/active_scaffold/data_structures/nested_info.rb +22 -37
- data/lib/active_scaffold/data_structures/set.rb +4 -4
- data/lib/active_scaffold/data_structures/sorting.rb +29 -15
- data/lib/active_scaffold/engine.rb +3 -1
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +10 -5
- data/lib/active_scaffold/extensions/action_view_rendering.rb +65 -59
- data/lib/active_scaffold/extensions/left_outer_joins.rb +48 -53
- data/lib/active_scaffold/extensions/localize.rb +3 -4
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +7 -11
- data/lib/active_scaffold/extensions/paginator_extensions.rb +20 -18
- data/lib/active_scaffold/extensions/routing_mapper.rb +104 -40
- data/lib/active_scaffold/extensions/to_label.rb +1 -1
- data/lib/active_scaffold/extensions/unsaved_associated.rb +4 -13
- data/lib/active_scaffold/extensions/unsaved_record.rb +12 -1
- data/lib/active_scaffold/finder.rb +200 -134
- data/lib/active_scaffold/helpers/action_link_helpers.rb +398 -0
- data/lib/active_scaffold/helpers/association_helpers.rb +12 -30
- data/lib/active_scaffold/helpers/controller_helpers.rb +74 -24
- data/lib/active_scaffold/helpers/form_column_helpers.rb +205 -112
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +21 -11
- data/lib/active_scaffold/helpers/id_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/list_column_helpers.rb +117 -39
- data/lib/active_scaffold/helpers/pagination_helpers.rb +11 -14
- data/lib/active_scaffold/helpers/search_column_helpers.rb +69 -32
- data/lib/active_scaffold/helpers/show_column_helpers.rb +9 -3
- data/lib/active_scaffold/helpers/view_helpers.rb +41 -426
- data/lib/active_scaffold/orm_checks.rb +109 -0
- data/lib/active_scaffold/paginator.rb +1 -1
- data/lib/active_scaffold/responds_to_parent.rb +12 -10
- data/lib/active_scaffold/tableless.rb +81 -43
- data/lib/active_scaffold/version.rb +2 -2
- data/lib/generators/active_scaffold/controller_generator.rb +49 -0
- data/lib/generators/active_scaffold/install_generator.rb +45 -0
- data/lib/generators/active_scaffold/resource_generator.rb +56 -0
- data/lib/generators/{active_scaffold_controller/templates → templates}/controller.rb +0 -0
- data/lib/generators/{active_scaffold_controller/templates → templates}/helper.rb +0 -0
- data/shoulda_macros/macros.rb +3 -3
- data/test/active_scaffold_config_mock.rb +33 -0
- data/test/bridges/bridge_test.rb +9 -9
- data/test/bridges/date_picker_test.rb +3 -1
- data/test/bridges/paper_trail_test.rb +2 -3
- data/test/bridges/paperclip_test.rb +21 -10
- data/test/bridges/tiny_mce_test.rb +20 -21
- data/test/class_with_finder.rb +42 -0
- data/test/company.rb +6 -4
- data/test/config/core_test.rb +1 -1
- data/test/config/create_test.rb +1 -1
- data/test/config/list_test.rb +3 -3
- data/test/config/update_test.rb +3 -3
- data/test/data_structures/action_columns_test.rb +3 -3
- data/test/data_structures/association_column_test.rb +5 -5
- data/test/data_structures/column_test.rb +14 -14
- data/test/data_structures/columns_test.rb +2 -2
- data/test/data_structures/set_test.rb +2 -2
- data/test/data_structures/sorting_test.rb +6 -4
- data/test/extensions/active_record_test.rb +1 -1
- data/test/extensions/routing_mapper_test.rb +64 -13
- data/test/helpers/form_column_helpers_test.rb +6 -6
- data/test/helpers/list_column_helpers_test.rb +9 -5
- data/test/helpers/pagination_helpers_test.rb +1 -0
- data/test/misc/active_record_permissions_test.rb +18 -1
- data/test/misc/attribute_params_test.rb +26 -17
- data/test/misc/calculation_test.rb +8 -31
- data/test/misc/configurable_test.rb +3 -2
- data/test/misc/constraints_test.rb +33 -22
- data/test/misc/convert_numbers_format_test.rb +28 -10
- data/test/misc/finder_test.rb +6 -29
- data/test/misc/parse_datetime_test.rb +160 -0
- data/test/misc/render_test.rb +1 -1
- data/test/misc/tableless_test.rb +24 -0
- data/test/mock_app/app/models/building.rb +2 -1
- data/test/mock_app/config.ru +1 -1
- data/test/mock_app/config/environments/test.rb +1 -1
- data/test/mock_app/config/routes.rb +11 -3
- data/test/model_stub.rb +11 -6
- data/test/run_all.rb +1 -1
- data/test/test_helper.rb +19 -4
- metadata +42 -23
- data/lib/active_scaffold/data_structures/error_message.rb +0 -22
- data/lib/active_scaffold/extensions/reverse_associations.rb +0 -119
- data/lib/generators/active_scaffold/USAGE +0 -29
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
- data/lib/generators/active_scaffold_controller/USAGE +0 -19
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
- data/test/data_structures/error_message_test.rb +0 -25
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0a7eb8fad2b071936f60422993e7edd163d60f7b
         | 
| 4 | 
            +
              data.tar.gz: b2ed33ac963964127a633ec19547874e350d1c9d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 81f8a0cb3b77d49ed1771b02993a02a470a8bbf697d54c27e70649661148b461b4155c89533728305e738ca1dfe227470709590f46e63a76cd7a8280214f4a3c
         | 
| 7 | 
            +
              data.tar.gz: 3b6b906a0db4738963ff2bf63504928d2348cc42cbe1d9a3227b3d31d4deb7754fb64f5690b8da044fb408514cac196fb41d6fae93d94f144057126fccf55190
         | 
    
        data/CHANGELOG
    CHANGED
    
    | @@ -1,3 +1,42 @@ | |
| 1 | 
            +
            = 3.5.0
         | 
| 2 | 
            +
            - add basic support for Mongoid
         | 
| 3 | 
            +
            - add support for associations between Mongoid and ActiveRecord with ActiveMongoid
         | 
| 4 | 
            +
            - use concerns for routes, deprecate as_routes method
         | 
| 5 | 
            +
            - add install generator
         | 
| 6 | 
            +
            - rails 5.0 support and turbolinks 5.0 support, without jquery.turbolinks
         | 
| 7 | 
            +
            - rename active_scaffold generator as active_scaffold:resource
         | 
| 8 | 
            +
            - rename active_scaffold_controller generator as active_scaffold:controller
         | 
| 9 | 
            +
            - remove deprecations from 3.4.x (active_scaffold_includes and using @record in helpers)
         | 
| 10 | 
            +
            - check create authorized for create on list (config.list.always_show_create)
         | 
| 11 | 
            +
            - allow to disable inplace_edit for column when update form is enabled
         | 
| 12 | 
            +
            - add support for aggregated lists to field_search (config.field_search.group_options)
         | 
| 13 | 
            +
            - add support for range conditions in url params for date and datetime columns
         | 
| 14 | 
            +
            - add :color form_ui with "No color" checkbox to disable if column may be null
         | 
| 15 | 
            +
            - add inline_links config to show action, display member links in show action loaded in page
         | 
| 16 | 
            +
            - add :telephone list_ui displaying formatted phone number with tel: link
         | 
| 17 | 
            +
            - add global config option to display reason for disabled action, authorized methods must return string with reason, and string is interpreted as not authorized
         | 
| 18 | 
            +
            - stop saving embedded scaffolds info into session, so no more CookieOverflow errors caused by loading many embedded scaffolds
         | 
| 19 | 
            +
            - add add_association_columns method to config.columns, so columns from has_one or belongs_to association can be added as delegated columns (for list, show, field_search and update_column only)
         | 
| 20 | 
            +
            - support has_many through singular associations (belongs_to or has_one) in forms
         | 
| 21 | 
            +
            - remove onsubmit tag in forms and move tinymce related JS to assets
         | 
| 22 | 
            +
            - use html5 history api when listing is refreshed
         | 
| 23 | 
            +
            - use date, datetime-local and time html5 inputs for date, datetime and time columns without form_ui
         | 
| 24 | 
            +
            - add month and week form_ui using html5 inputs
         | 
| 25 | 
            +
            - avoid browser mixes html and xhr cache for listing requests, using vary header
         | 
| 26 | 
            +
            - improve in_subform? check for subforms, so only reverse association is hidden (needed when subform class has multiple associations to main form's class)
         | 
| 27 | 
            +
            - fix select of existing record for nested subform
         | 
| 28 | 
            +
            - fix apply constraints to parent (fix update columns on subform on embedded scaffold)
         | 
| 29 | 
            +
            - fix for override form field and subform partials on AS controllers which are parent class for AS controllers, so they are shared by children classes
         | 
| 30 | 
            +
            - fix translation for ActiveRecord enums
         | 
| 31 | 
            +
            - fix do_refresh_list on actions with GET route, it used :id and :action from request for sorting and pagination links
         | 
| 32 | 
            +
            - fix enabling draggable lists and sliders on new subform records
         | 
| 33 | 
            +
            - fix updating column and changing from :hidden form_ui to different one
         | 
| 34 | 
            +
            - fix searching with :multi_chosen search_ui
         | 
| 35 | 
            +
            - fix human conditions for :chosen and :multi_chosen search_ui
         | 
| 36 | 
            +
            - fix display of association in list when association_limit is nil
         | 
| 37 | 
            +
            - fix conversion of i18n date and datetime value, some abbr day and month may be equal in some languages
         | 
| 38 | 
            +
            - fix hidden form_ui for collection associations (has_many, habtm)
         | 
| 39 | 
            +
             | 
| 1 40 | 
             
            = 3.4.43
         | 
| 2 41 | 
             
            - Fix human conditions for date and datetime columns, not using date picker
         | 
| 3 42 |  | 
    
        data/{LICENSE → LICENSE.md}
    RENAMED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            Copyright © 2006— | 
| 1 | 
            +
            Copyright © 2006—2017 Richard White, Sergio Cambra and contributors
         | 
| 2 2 |  | 
| 3 3 | 
             
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 4 4 | 
             
            a copy of this software and associated documentation files (the
         | 
    
        data/README.md
    CHANGED
    
    | @@ -8,11 +8,13 @@ Overview | |
| 8 8 | 
             
            [](https://inch-ci.org/github/activescaffold/active_scaffold)
         | 
| 9 9 | 
             
            [](https://opensource.org/licenses/MIT)
         | 
| 10 10 |  | 
| 11 | 
            -
            ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control.  Rails  | 
| 11 | 
            +
            ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control.  Rails >= 4.0.5 is supported, ruby >= 2.1 supported, although it should work with ruby >= 2.0.0, it's too old and not tested. Ruby < 2.0.0 won't work.
         | 
| 12 12 |  | 
| 13 13 | 
             
            Branch Details
         | 
| 14 14 | 
             
            --------------
         | 
| 15 | 
            -
             | 
| 15 | 
            +
            3-4-stable supports rails >= 3.2.x and ruby >= 1.9.3  
         | 
| 16 | 
            +
            3-3-stable supports rails >= 3.2.x and ruby >= 1.8  
         | 
| 17 | 
            +
            rails-3.2 supports Rails 3.1 & 3.2, and is the current source of the 3.2.x line of gems.
         | 
| 16 18 |  | 
| 17 19 | 
             
            Quick Start
         | 
| 18 20 | 
             
            -----------
         | 
| @@ -25,32 +27,26 @@ Added to Gemfile | |
| 25 27 | 
             
            Run the following commands
         | 
| 26 28 |  | 
| 27 29 | 
             
                bundle install
         | 
| 30 | 
            +
                rails g active_scaffold:install
         | 
| 28 31 | 
             
                bundle exec rake db:create
         | 
| 29 | 
            -
                rails g active_scaffold User name:string
         | 
| 32 | 
            +
                rails g active_scaffold:resource User name:string
         | 
| 30 33 | 
             
                bundle exec rake db:migrate
         | 
| 34 | 
            +
                
         | 
| 35 | 
            +
            Commands for Rails 5
         | 
| 31 36 |  | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
                 | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
                *= require active_scaffold
         | 
| 37 | 
            +
                bundle install
         | 
| 38 | 
            +
                rails g active_scaffold:install
         | 
| 39 | 
            +
                rails db:create
         | 
| 40 | 
            +
                rails g active_scaffold:resource User name:string
         | 
| 41 | 
            +
                rails db:migrate
         | 
| 42 | 
            +
                
         | 
| 39 43 |  | 
| 40 | 
            -
            Run the app and visit localhost:3000/users | 
| 44 | 
            +
            Run the app and visit localhost:3000/users
         | 
| 41 45 |  | 
| 42 46 | 
             
            Configuration
         | 
| 43 47 | 
             
            -------------
         | 
| 44 48 | 
             
            See Wiki for instructions on customising ActiveScaffold and to find the full API details.
         | 
| 45 49 |  | 
| 46 | 
            -
            Compatibility Issues
         | 
| 47 | 
            -
            --------------------
         | 
| 48 | 
            -
            jQuery 1.9 deprecates some methods that rails-3.2 branch still uses (NB: jQuery 1.9 is supported in 3.3.x, the master branch). You'll therefore need to ensure you use jQuery 1.8. You can do this by fixing version in your Gemfile:
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                gem 'jquery-rails', '2.1.4'
         | 
| 51 | 
            -
             | 
| 52 | 
            -
            active_scaffold_batch plugin gem (versions 3.2.x) require 3.3.x (master branch). Therefore if you wish to try using active_scaffold_batch with this branch, you'll need to fork the project and edit the runtime dependency in the gemspec file (use at your own discretion)
         | 
| 53 | 
            -
             | 
| 54 50 | 
             
            Credits
         | 
| 55 51 | 
             
            -------
         | 
| 56 52 | 
             
            ActiveScaffold grew out of a project named Ajaxscaffold dating back to 2006. It has had numerous contributors including:
         | 
| @@ -73,3 +69,15 @@ http://github.com/scambra/recordselect/ | |
| 73 69 | 
             
            License
         | 
| 74 70 | 
             
            =======
         | 
| 75 71 | 
             
            Released under the MIT license (included)
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            ---
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            A ruby translation project managed on [Locale](http://www.localeapp.com/) that's open to all!
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            ## Contributing to active_scaffold
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            - Edit the translations directly on the [active_scaffold](http://www.localeapp.com/projects/public?search=active_scaffold) project on Locale.
         | 
| 80 | 
            +
            - **That's it!**
         | 
| 81 | 
            +
            - The maintainer will then pull translations from the Locale project and push to Github.
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            Happy translating!
         | 
| @@ -7,7 +7,7 @@ | |
| 7 7 | 
             
                  require_asset "jquery-ui"
         | 
| 8 8 | 
             
                elsif Jquery.const_defined? 'Ui'
         | 
| 9 9 | 
             
                  jquery_ui_prefix = Jquery::Ui::Rails::VERSION < '5.0.0' ? 'jquery.ui.' : 'jquery-ui/'
         | 
| 10 | 
            -
                  jquery_ui_widgets_prefix = Jquery::Ui::Rails::VERSION >= '6.0.0' ? ' | 
| 10 | 
            +
                  jquery_ui_widgets_prefix = Jquery::Ui::Rails::VERSION >= '6.0.0' ? 'widgets/' : ''
         | 
| 11 11 | 
             
                  require_asset "#{jquery_ui_prefix}core"
         | 
| 12 12 | 
             
                  require_asset "#{jquery_ui_prefix}effect"
         | 
| 13 13 | 
             
                  require_asset "#{jquery_ui_prefix}effects/effect-highlight" if Jquery::Ui::Rails::VERSION >= '6.0.0'
         | 
| @@ -57,6 +57,9 @@ jQuery(document).ready(function($) { | |
| 57 57 | 
             
              jQuery(document).on('ajax:complete', 'form.live', function(event) {
         | 
| 58 58 | 
             
                ActiveScaffold.focus_first_element_of_form(jQuery(this).closest("form"));
         | 
| 59 59 | 
             
              });
         | 
| 60 | 
            +
              jQuery(document).on('keyup keypress', 'form.search.live input', function(e) {
         | 
| 61 | 
            +
                if (e.keyCode == 13) e.preventDefault();
         | 
| 62 | 
            +
              });
         | 
| 60 63 | 
             
              jQuery(document).on('ajax:error', 'form.as_form', function(event, xhr, status, error) {
         | 
| 61 64 | 
             
                var as_div = jQuery(this).closest("div.active-scaffold");
         | 
| 62 65 | 
             
                if (as_div.length) {
         | 
| @@ -88,6 +91,7 @@ jQuery(document).ready(function($) { | |
| 88 91 | 
             
                  if (action_link.position) {
         | 
| 89 92 | 
             
                    action_link.insert(response);
         | 
| 90 93 | 
             
                    if (action_link.hide_target) action_link.target.hide();
         | 
| 94 | 
            +
                    if (action_link.hide_content) action_link.content.hide();
         | 
| 91 95 | 
             
                  } else {
         | 
| 92 96 | 
             
                    if (action_link.tag.hasClass('toggle')) {
         | 
| 93 97 | 
             
                      action_link.tag.closest('.action_group,.actions').find('.toggle.active').removeClass('active');
         | 
| @@ -143,8 +147,6 @@ jQuery(document).ready(function($) { | |
| 143 147 | 
             
              });
         | 
| 144 148 | 
             
              jQuery(document).on('ajax:before', 'a.as_sort', function(event) {
         | 
| 145 149 | 
             
                var as_sort = jQuery(this);
         | 
| 146 | 
            -
                var history_controller_id = as_sort.data('page-history');
         | 
| 147 | 
            -
                if (history_controller_id) addActiveScaffoldPageToHistory(as_sort.attr('href'), history_controller_id);
         | 
| 148 150 | 
             
                as_sort.closest('th').addClass('loading');
         | 
| 149 151 | 
             
                return true;
         | 
| 150 152 | 
             
              });
         | 
| @@ -173,8 +175,6 @@ jQuery(document).ready(function($) { | |
| 173 175 | 
             
              });
         | 
| 174 176 | 
             
              jQuery(document).on('ajax:before', 'a.as_paginate',function(event) {
         | 
| 175 177 | 
             
                var as_paginate = jQuery(this);
         | 
| 176 | 
            -
                var history_controller_id = as_paginate.data('page-history');
         | 
| 177 | 
            -
                if (history_controller_id) addActiveScaffoldPageToHistory(as_paginate.attr('href'), history_controller_id);
         | 
| 178 178 | 
             
                as_paginate.prevAll('img.loading-indicator').css('visibility','visible');
         | 
| 179 179 | 
             
                return true;
         | 
| 180 180 | 
             
              });
         | 
| @@ -205,9 +205,10 @@ jQuery(document).ready(function($) { | |
| 205 205 |  | 
| 206 206 | 
             
              jQuery(document).on('change', 'input.update_form:not(.recordselect), textarea.update_form, select.update_form, .checkbox-list.update_form input:checkbox', function(event) {
         | 
| 207 207 | 
             
                var element = jQuery(this);
         | 
| 208 | 
            -
                var form_element | 
| 208 | 
            +
                var form_element;
         | 
| 209 209 | 
             
                var value, additional_params;
         | 
| 210 | 
            -
                if ( | 
| 210 | 
            +
                if (element.is(".checkbox-list input:checkbox")) {
         | 
| 211 | 
            +
                  form_element = element.closest('.checkbox-list')
         | 
| 211 212 | 
             
                  value = form_element.find(':checked').map(function(item){return $(this).val();}).toArray();
         | 
| 212 213 | 
             
                  additional_params = (element.is(':checked') ? '_added=' : '_removed=') + element.val();
         | 
| 213 214 | 
             
                } else {
         | 
| @@ -290,34 +291,51 @@ jQuery(document).ready(function($) { | |
| 290 291 | 
             
                e.preventDefault();
         | 
| 291 292 | 
             
              });
         | 
| 292 293 |  | 
| 293 | 
            -
               | 
| 294 | 
            -
             | 
| 295 | 
            -
             | 
| 296 | 
            -
             | 
| 297 | 
            -
               | 
| 298 | 
            -
             | 
| 299 | 
            -
               | 
| 294 | 
            +
              jQuery(document).on('click', 'form.as_form .no-color', function() {
         | 
| 295 | 
            +
                var color_field = jQuery(this).parent().next(':input');
         | 
| 296 | 
            +
                color_field.attr('type', jQuery(this).prop('checked') ? 'hidden' : 'color');
         | 
| 297 | 
            +
                if (jQuery(this).prop('checked')) color_field.val('');
         | 
| 298 | 
            +
              });
         | 
| 299 | 
            +
             | 
| 300 | 
            +
              jQuery(document).on('turbolinks:before-visit', function() {
         | 
| 301 | 
            +
                if (history.state.active_scaffold) {
         | 
| 302 | 
            +
                  history.replaceState({turbolinks: true, url: document.location.href}, '', document.location.href);
         | 
| 303 | 
            +
                }
         | 
| 304 | 
            +
              });
         | 
| 305 | 
            +
             | 
| 306 | 
            +
              jQuery(window).on('popstate', function(e) {
         | 
| 307 | 
            +
                var state = e.originalEvent.state;
         | 
| 308 | 
            +
                if (!state || !state.active_scaffold) return;
         | 
| 309 | 
            +
                jQuery.ajax({
         | 
| 310 | 
            +
                  url: document.location.href,
         | 
| 311 | 
            +
                  data: jQuery.extend({'_popstate': true}, state.active_scaffold),
         | 
| 312 | 
            +
                  dataType: 'script',
         | 
| 313 | 
            +
                  cache: true
         | 
| 314 | 
            +
                });
         | 
| 315 | 
            +
                jQuery('.active-scaffold:first th .as_sort:first').closest('th').addClass('loading');
         | 
| 316 | 
            +
              });
         | 
| 317 | 
            +
             | 
| 318 | 
            +
              // call setup on document.ready if Turbolinks not enabled
         | 
| 319 | 
            +
              if (typeof(Turbolinks) == 'undefined' || !Turbolinks.supported) {
         | 
| 320 | 
            +
                ActiveScaffold.setup_history_state();
         | 
| 321 | 
            +
                ActiveScaffold.setup(document);
         | 
| 322 | 
            +
              }
         | 
| 300 323 | 
             
              if (ActiveScaffold.config.warn_changes) ActiveScaffold.setup_warn_changes();
         | 
| 301 | 
            -
              jQuery(document).on('as:element_updated', function(e) {
         | 
| 302 | 
            -
             | 
| 303 | 
            -
             | 
| 304 | 
            -
             | 
| 305 | 
            -
                ActiveScaffold. | 
| 306 | 
            -
                ActiveScaffold.sliders(e.target);
         | 
| 324 | 
            +
              jQuery(document).on('as:element_updated as:element_created', function(e, action_link) {
         | 
| 325 | 
            +
                  ActiveScaffold.setup(e.target);
         | 
| 326 | 
            +
              });
         | 
| 327 | 
            +
              jQuery(document).on('as:action_success', 'a.as_action', function(e, action_link) {
         | 
| 328 | 
            +
                ActiveScaffold.setup(action_link.adapter);
         | 
| 307 329 | 
             
              });
         | 
| 308 330 | 
             
              jQuery(document).on('as:element_updated', '.active-scaffold', function(e) {
         | 
| 309 331 | 
             
                if (e.target != this) return;
         | 
| 310 332 | 
             
                var search = $(this).find('form.search');
         | 
| 311 333 | 
             
                if (search.length) ActiveScaffold.focus_first_element_of_form(search);
         | 
| 312 334 | 
             
              });
         | 
| 313 | 
            -
             | 
| 314 | 
            -
             | 
| 315 | 
            -
             | 
| 316 | 
            -
             | 
| 317 | 
            -
                ActiveScaffold.auto_paginate(action_link.adapter);
         | 
| 318 | 
            -
                ActiveScaffold.draggable_lists('.draggable-lists', action_link.adapter);
         | 
| 319 | 
            -
                ActiveScaffold.sliders(action_link.adapter);
         | 
| 320 | 
            -
              });
         | 
| 335 | 
            +
            });
         | 
| 336 | 
            +
             | 
| 337 | 
            +
            jQuery(document).on('turbolinks:load', function($) {
         | 
| 338 | 
            +
              ActiveScaffold.setup(document);
         | 
| 321 339 | 
             
            });
         | 
| 322 340 |  | 
| 323 341 |  | 
| @@ -401,7 +419,7 @@ if (typeof(jQuery.fn.delayedObserver) === 'undefined') { | |
| 401 419 | 
             
                      var el = $(this);
         | 
| 402 420 | 
             
                      var op = options || {};
         | 
| 403 421 | 
             
                      el.data('oldval', el.val())
         | 
| 404 | 
            -
                        .data('delay', delay || 0.5)
         | 
| 422 | 
            +
                        .data('delay', delay === 0 ? delay : (delay || 0.5))
         | 
| 405 423 | 
             
                        .data('condition', op.condition || function() { return ($(this).data('oldval') == $(this).val()); })
         | 
| 406 424 | 
             
                        .data('callback', callback)
         | 
| 407 425 | 
             
                        [(op.event||'keyup')](function(){
         | 
| @@ -428,6 +446,31 @@ if (typeof(jQuery.fn.delayedObserver) === 'undefined') { | |
| 428 446 |  | 
| 429 447 | 
             
            var ActiveScaffold = {
         | 
| 430 448 | 
             
              last_focus: null,
         | 
| 449 | 
            +
              setup: function(container) {
         | 
| 450 | 
            +
                /* setup some elements on page/form load */
         | 
| 451 | 
            +
                ActiveScaffold.load_embedded(container);
         | 
| 452 | 
            +
                ActiveScaffold.enable_js_form_buttons(container);
         | 
| 453 | 
            +
                ActiveScaffold.live_search(container);
         | 
| 454 | 
            +
                ActiveScaffold.auto_paginate(container);
         | 
| 455 | 
            +
                ActiveScaffold.draggable_lists('.draggable-lists', container);
         | 
| 456 | 
            +
                ActiveScaffold.sliders(container);
         | 
| 457 | 
            +
              },
         | 
| 458 | 
            +
              setup_history_state: function() {
         | 
| 459 | 
            +
                var data = {}, current_search_item = jQuery('.active-scaffold .filtered-message[data-search]');
         | 
| 460 | 
            +
                if (current_search_item.length) {
         | 
| 461 | 
            +
                  // store user settings enabled, update state with current page, search and sorting
         | 
| 462 | 
            +
                  var sorted_columns = jQuery('th.sorted');
         | 
| 463 | 
            +
                  data.page = jQuery('.active-scaffold-pagination .current').text();
         | 
| 464 | 
            +
                  data.search = current_search_item.data('search');
         | 
| 465 | 
            +
                  if (sorted_columns.length == 1) {
         | 
| 466 | 
            +
                    data.sort = sorted_columns.attr('class').match(/(.+)-column/)[1];
         | 
| 467 | 
            +
                    data.sort_direction = sorted_columns.hasClass('asc') ? 'asc' : 'desc';
         | 
| 468 | 
            +
                  } else { // default search
         | 
| 469 | 
            +
                    jQuery.extend(data, {sort: '', sort_direction: ''});
         | 
| 470 | 
            +
                  }
         | 
| 471 | 
            +
                }
         | 
| 472 | 
            +
                ActiveScaffold.add_to_history(document.location.href, data, true);
         | 
| 473 | 
            +
              },
         | 
| 431 474 | 
             
              live_search: function(element) {
         | 
| 432 475 | 
             
                jQuery('form.search.live input[type=search]', element).delayedObserver(function() {
         | 
| 433 476 | 
             
                 jQuery(this).parent().trigger("submit");
         | 
| @@ -449,7 +492,7 @@ var ActiveScaffold = { | |
| 449 492 | 
             
              sliders: function(element) {
         | 
| 450 493 | 
             
                jQuery('.as-slider', element).each(function() {
         | 
| 451 494 | 
             
                  var opts = $(this).data('slider');
         | 
| 452 | 
            -
                  jQuery(this).slider(opts); | 
| 495 | 
            +
                  jQuery(this).slider(opts);
         | 
| 453 496 | 
             
                  if (opts.disabled) jQuery(this).find('.ui-slider-handle').hide();
         | 
| 454 497 | 
             
                });
         | 
| 455 498 | 
             
              },
         | 
| @@ -517,6 +560,12 @@ var ActiveScaffold = { | |
| 517 560 | 
             
                  element.removeClass("desc");
         | 
| 518 561 | 
             
                });
         | 
| 519 562 | 
             
              },
         | 
| 563 | 
            +
              add_to_history: function(url, data, replace) {
         | 
| 564 | 
            +
                if (!history || !history.pushState) return;
         | 
| 565 | 
            +
                data = {active_scaffold: data};
         | 
| 566 | 
            +
                if (replace) history.replaceState(data, null, url);
         | 
| 567 | 
            +
                else history.pushState(data, null, url);
         | 
| 568 | 
            +
              },
         | 
| 520 569 | 
             
              decrement_record_count: function(scaffold) {
         | 
| 521 570 | 
             
                // decrement the last record count, firsts record count are in nested lists
         | 
| 522 571 | 
             
                if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
         | 
| @@ -821,6 +870,10 @@ var ActiveScaffold = { | |
| 821 870 |  | 
| 822 871 | 
             
                if (element.length) {
         | 
| 823 872 | 
             
                  if (options.is_subform == false) {
         | 
| 873 | 
            +
                    if (typeof(options.hidden) != 'undefined') {
         | 
| 874 | 
            +
                      var li = element.closest('li');
         | 
| 875 | 
            +
                      li[options.hidden ? 'addClass' : 'removeClass'].call(li, 'hidden')
         | 
| 876 | 
            +
                    }
         | 
| 824 877 | 
             
                    this.replace(element.closest('dl'), content);
         | 
| 825 878 | 
             
                  } else {
         | 
| 826 879 | 
             
                    this.replace_html(element, content);
         | 
| @@ -1029,23 +1082,15 @@ var ActiveScaffold = { | |
| 1029 1082 | 
             
                });
         | 
| 1030 1083 | 
             
                window.onbeforeunload = function() {
         | 
| 1031 1084 | 
             
                  if (jQuery('form.need-confirm').length) return unload_message;
         | 
| 1032 | 
            -
                }
         | 
| 1085 | 
            +
                };
         | 
| 1086 | 
            +
                jQuery(document).on('turbolinks:before-visit', function(e) {
         | 
| 1087 | 
            +
                  if (jQuery('form.need-confirm').length) {
         | 
| 1088 | 
            +
                    if (!window.confirm(unload_message)) e.preventDefault();
         | 
| 1089 | 
            +
                  }
         | 
| 1090 | 
            +
                });
         | 
| 1033 1091 | 
             
              }
         | 
| 1034 1092 | 
             
            }
         | 
| 1035 1093 |  | 
| 1036 | 
            -
            /*
         | 
| 1037 | 
            -
             * DHTML history tie-in
         | 
| 1038 | 
            -
             */
         | 
| 1039 | 
            -
            function addActiveScaffoldPageToHistory(url, active_scaffold_id) {
         | 
| 1040 | 
            -
              if (typeof dhtmlHistory == 'undefined') return; // it may not be loaded
         | 
| 1041 | 
            -
             | 
| 1042 | 
            -
              var array = url.split('?');
         | 
| 1043 | 
            -
              var qs = new Querystring(array[1]);
         | 
| 1044 | 
            -
              var sort = qs.get('sort')
         | 
| 1045 | 
            -
              var dir = qs.get('sort_direction')
         | 
| 1046 | 
            -
              var page = qs.get('page')
         | 
| 1047 | 
            -
              if (sort || dir || page) dhtmlHistory.add(active_scaffold_id+":"+page+":"+sort+":"+dir, url);
         | 
| 1048 | 
            -
            }
         | 
| 1049 1094 |  | 
| 1050 1095 | 
             
            /*
         | 
| 1051 1096 | 
             
             * URL modification support. Incomplete functionality.
         | 
| @@ -1126,6 +1171,7 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({ | |
| 1126 1171 | 
             
                this.url = this.tag.attr('href');
         | 
| 1127 1172 | 
             
                this.method = this.tag.data('method') || 'get';
         | 
| 1128 1173 | 
             
                this.target = target;
         | 
| 1174 | 
            +
                this.content = target.closest('.active-scaffold').find('.as_content:first');
         | 
| 1129 1175 | 
             
                this.loading_indicator = loading_indicator;
         | 
| 1130 1176 | 
             
                this.hide_target = false;
         | 
| 1131 1177 | 
             
                this.position = this.tag.data('position');
         | 
| @@ -1149,6 +1195,7 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({ | |
| 1149 1195 | 
             
                  ActiveScaffold.remove(this.adapter, function() {
         | 
| 1150 1196 | 
             
                    link.enable();
         | 
| 1151 1197 | 
             
                    if (link.hide_target) link.target.show();
         | 
| 1198 | 
            +
                    if (link.hide_content) link.content.show();
         | 
| 1152 1199 | 
             
                    if (ActiveScaffold.config.scroll_on_close) ActiveScaffold.scroll_to(link.target.attr('id'), ActiveScaffold.config.scroll_on_close == 'checkInViewport');
         | 
| 1153 1200 | 
             
                  });
         | 
| 1154 1201 | 
             
                }
         | 
| @@ -1314,6 +1361,11 @@ ActiveScaffold.Actions.Table = ActiveScaffold.Actions.Abstract.extend({ | |
| 1314 1361 |  | 
| 1315 1362 | 
             
            ActiveScaffold.ActionLink.Table = ActiveScaffold.ActionLink.Abstract.extend({
         | 
| 1316 1363 | 
             
              insert: function(content) {
         | 
| 1364 | 
            +
                if (this.position == 'replace') {
         | 
| 1365 | 
            +
                  this.position = 'top';
         | 
| 1366 | 
            +
                  this.hide_content = true;
         | 
| 1367 | 
            +
                }
         | 
| 1368 | 
            +
             | 
| 1317 1369 | 
             
                if (this.position == 'top') {
         | 
| 1318 1370 | 
             
                  this.target.prepend(content);
         | 
| 1319 1371 | 
             
                  this.set_adapter(this.target.children().first());
         | 
| @@ -1,7 +1,31 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            ActiveScaffold.ActionLink.Abstract.prototype.close | 
| 3 | 
            -
               | 
| 4 | 
            -
                 | 
| 1 | 
            +
            (function() {
         | 
| 2 | 
            +
              var action_link_close = ActiveScaffold.ActionLink.Abstract.prototype.close;
         | 
| 3 | 
            +
              ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
         | 
| 4 | 
            +
                jQuery(this.adapter).find('textarea.mceEditor').each(function(index, elem) {
         | 
| 5 | 
            +
                  tinyMCE.remove('#' + jQuery(elem).attr('id'));
         | 
| 6 | 
            +
                });
         | 
| 7 | 
            +
                action_link_close.apply(this);
         | 
| 8 | 
            +
              };
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              function loadTinyMCE() {
         | 
| 11 | 
            +
                var settings = jQuery(this).data('tinymce');
         | 
| 12 | 
            +
                if (settings) tinyMCE.settings = settings;
         | 
| 13 | 
            +
                tinyMCE.execCommand('mceAddEditor', false, jQuery(this).attr('id'));
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              jQuery(document).on('submit', 'form.as_form', function() {
         | 
| 17 | 
            +
                tinymce.triggerSave();
         | 
| 18 | 
            +
                jQuery('textarea.mceEditor', this).each(function() { tinymce.remove('#'+jQuery(this).attr('id')); });
         | 
| 5 19 | 
             
              });
         | 
| 6 | 
            -
               | 
| 7 | 
            -
             | 
| 20 | 
            +
              /* for persistent update forms */
         | 
| 21 | 
            +
              jQuery(document).on('ajax:complete', 'form.as_form', function() {
         | 
| 22 | 
            +
                jQuery('textarea.mceEditor', this).each(loadTinyMCE);
         | 
| 23 | 
            +
              });
         | 
| 24 | 
            +
              /* enable tinymce textarea after form open */
         | 
| 25 | 
            +
              jQuery(document).on('as:action_success', 'a.as_action', function(event) {
         | 
| 26 | 
            +
                var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
         | 
| 27 | 
            +
                if (action_link && action_link.adapter) {
         | 
| 28 | 
            +
                  jQuery(action_link.adapter).find('textarea.mceEditor').each(loadTinyMCE);
         | 
| 29 | 
            +
                }
         | 
| 30 | 
            +
              });
         | 
| 31 | 
            +
            })();
         | 
| @@ -1,7 +1,17 @@ | |
| 1 1 | 
             
            var action_link_close = ActiveScaffold.ActionLink.Abstract.prototype.close;
         | 
| 2 2 | 
             
            ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
         | 
| 3 3 | 
             
              this.adapter.select('textarea.mceEditor').each(function(elem) {
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                tinymce.remove('#'+elem.id);
         | 
| 5 5 | 
             
              }); 
         | 
| 6 6 | 
             
              action_link_close.apply(this);
         | 
| 7 7 | 
             
            };
         | 
| 8 | 
            +
            document.on('submit', 'form.as_form', function() {
         | 
| 9 | 
            +
              tinymce.triggerSave();
         | 
| 10 | 
            +
              this.select('textarea.mceEditor').each(function(elem) { tinymce.remove('#'+elem.id); });
         | 
| 11 | 
            +
            });
         | 
| 12 | 
            +
            /* for persistent update forms */
         | 
| 13 | 
            +
            document.on('ajax:complete', 'form.as_form', function(event) {
         | 
| 14 | 
            +
              this.select('textarea.mceEditor').each(function(elem) {
         | 
| 15 | 
            +
                tinyMCE.execCommand('mceAddEditor', false, elem.id);
         | 
| 16 | 
            +
              });
         | 
| 17 | 
            +
            });
         |