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
| @@ -366,11 +366,11 @@ background-color: $input_focus_bg; | |
| 366 366 | 
             
            border-color: $input_border_color;
         | 
| 367 367 | 
             
            }
         | 
| 368 368 |  | 
| 369 | 
            -
            .active-scaffold .draggable-list {
         | 
| 369 | 
            +
            .active-scaffold form .checkbox-list.draggable-list {
         | 
| 370 370 | 
             
            background-color: $draggable_list_bg;
         | 
| 371 371 | 
             
            }
         | 
| 372 372 |  | 
| 373 | 
            -
            .active-scaffold .draggable-list.selected {
         | 
| 373 | 
            +
            .active-scaffold form .checkbox-list.draggable-list.selected {
         | 
| 374 374 | 
             
            background-color: $draggable_list_selected_bg;
         | 
| 375 375 | 
             
            }
         | 
| 376 376 | 
             
            .active-scaffold .ui-droppable-disabled, .active-scaffold .ui-droppable-disabled.selected {
         | 
| @@ -51,7 +51,7 @@ padding: 5px 20px 5px 5px; | |
| 51 51 | 
             
            /* Header
         | 
| 52 52 | 
             
               ======================== */
         | 
| 53 53 |  | 
| 54 | 
            -
            .active-scaffold-header {
         | 
| 54 | 
            +
            .active-scaffold-header, .form-footer + .active-scaffold-footer {
         | 
| 55 55 | 
             
            position: relative;
         | 
| 56 56 | 
             
            }
         | 
| 57 57 |  | 
| @@ -61,8 +61,8 @@ margin: 0; | |
| 61 61 | 
             
            font: bold 160% arial, sans-serif;
         | 
| 62 62 | 
             
            }
         | 
| 63 63 |  | 
| 64 | 
            -
            .active-scaffold | 
| 65 | 
            -
            .active-scaffold | 
| 64 | 
            +
            .active-scaffold div.actions a,
         | 
| 65 | 
            +
            .active-scaffold div.actions {
         | 
| 66 66 | 
             
            float: right;
         | 
| 67 67 | 
             
            font: bold 14px arial;
         | 
| 68 68 | 
             
            letter-spacing: -1px;
         | 
| @@ -74,7 +74,7 @@ background-position: 1px 50%; | |
| 74 74 | 
             
            background-repeat: no-repeat;
         | 
| 75 75 | 
             
            }
         | 
| 76 76 |  | 
| 77 | 
            -
            .active-scaffold | 
| 77 | 
            +
            .active-scaffold div.actions a {
         | 
| 78 78 | 
             
            padding: 5px 5px;
         | 
| 79 79 | 
             
            margin-left: 0px;
         | 
| 80 80 | 
             
            }
         | 
| @@ -84,18 +84,18 @@ margin-left: 0px; | |
| 84 84 | 
             
            padding: 1px 5px;
         | 
| 85 85 | 
             
            }
         | 
| 86 86 |  | 
| 87 | 
            -
            .active-scaffold | 
| 87 | 
            +
            .active-scaffold div.actions div.action_group {
         | 
| 88 88 | 
             
            display: inline;
         | 
| 89 89 | 
             
            float: right;
         | 
| 90 90 | 
             
            }
         | 
| 91 91 |  | 
| 92 | 
            -
            .active-scaffold | 
| 93 | 
            -
            .active-scaffold | 
| 92 | 
            +
            .active-scaffold div.actions div.action_group li a,
         | 
| 93 | 
            +
            .active-scaffold div.actions div.action_group li div {
         | 
| 94 94 | 
             
            float: none;
         | 
| 95 95 | 
             
            margin: 0;
         | 
| 96 96 | 
             
            }
         | 
| 97 97 |  | 
| 98 | 
            -
            .active-scaffold | 
| 98 | 
            +
            .active-scaffold div.actions .action_group ul {
         | 
| 99 99 | 
             
            line-height: 130%;
         | 
| 100 100 | 
             
            top: 19px;
         | 
| 101 101 | 
             
            }
         | 
| @@ -108,7 +108,7 @@ top: 14px; | |
| 108 108 | 
             
            top: -3px;
         | 
| 109 109 | 
             
            }
         | 
| 110 110 |  | 
| 111 | 
            -
            .active-scaffold | 
| 111 | 
            +
            .active-scaffold div.actions a.disabled {
         | 
| 112 112 | 
             
            opacity: 0.5;
         | 
| 113 113 | 
             
            }
         | 
| 114 114 |  | 
| @@ -116,7 +116,7 @@ opacity: 0.5; | |
| 116 116 | 
             
            .active-scaffold-header div.actions a.new_existing,
         | 
| 117 117 | 
             
            .active-scaffold-header div.actions a.show_search,
         | 
| 118 118 | 
             
            .active-scaffold-header div.actions a.show_config_list,
         | 
| 119 | 
            -
            .active-scaffold | 
| 119 | 
            +
            .active-scaffold div.actions div.action_group div {
         | 
| 120 120 | 
             
            margin:0;
         | 
| 121 121 | 
             
            padding: 5px 5px 5px 25px;
         | 
| 122 122 | 
             
            background-position: 5px 50%;
         | 
| @@ -134,7 +134,8 @@ background-position: 1px 50%; | |
| 134 134 | 
             
            background-repeat: no-repeat;
         | 
| 135 135 | 
             
            }
         | 
| 136 136 |  | 
| 137 | 
            -
            .active-scaffold | 
| 137 | 
            +
            .active-scaffold div.actions a.disabled:hover,
         | 
| 138 | 
            +
            .active-scaffold div.actions a.disabled:hover {
         | 
| 138 139 | 
             
            background-color: transparent;
         | 
| 139 140 | 
             
            cursor: default;
         | 
| 140 141 | 
             
            }
         | 
| @@ -666,6 +667,13 @@ font: bold 14px arial, sans-serif; | |
| 666 667 | 
             
            letter-spacing: 0;
         | 
| 667 668 | 
             
            }
         | 
| 668 669 |  | 
| 670 | 
            +
            .active-scaffold .active-scaffold-footer div.actions {
         | 
| 671 | 
            +
              margin-top: -20px;
         | 
| 672 | 
            +
            }
         | 
| 673 | 
            +
            .active-scaffold .active-scaffold-footer div.actions a {
         | 
| 674 | 
            +
              margin: 0;
         | 
| 675 | 
            +
            }
         | 
| 676 | 
            +
             | 
| 669 677 | 
             
            /* Form :: Fields
         | 
| 670 678 | 
             
               ============================== */
         | 
| 671 679 |  | 
| @@ -927,36 +935,36 @@ font-size: 20px; | |
| 927 935 | 
             
            padding: 3px 10px;
         | 
| 928 936 | 
             
            }
         | 
| 929 937 |  | 
| 930 | 
            -
            .as_touch  | 
| 938 | 
            +
            .as_touch div.actions a {
         | 
| 931 939 | 
             
            padding: 7px 5px;
         | 
| 932 940 | 
             
            }
         | 
| 933 941 |  | 
| 934 | 
            -
            .as_touch .active-scaffold  | 
| 942 | 
            +
            .as_touch .active-scaffold div.actions a {
         | 
| 935 943 | 
             
            padding: 7px 5px;
         | 
| 936 944 | 
             
            }
         | 
| 937 945 |  | 
| 938 | 
            -
            .as_touch  | 
| 946 | 
            +
            .as_touch div.actions .action_group ul {
         | 
| 939 947 | 
             
            line-height: 130%;
         | 
| 940 948 | 
             
            top: 23px;
         | 
| 941 949 | 
             
            }
         | 
| 942 950 |  | 
| 943 | 
            -
            .as_touch .active-scaffold  | 
| 951 | 
            +
            .as_touch .active-scaffold div.actions .action_group ul {
         | 
| 944 952 | 
             
            top: 23px;
         | 
| 945 953 | 
             
            }
         | 
| 946 954 |  | 
| 947 | 
            -
            .as_touch  | 
| 948 | 
            -
            .as_touch  | 
| 949 | 
            -
            .as_touch  | 
| 950 | 
            -
            .as_touch  | 
| 951 | 
            -
            .as_touch  | 
| 955 | 
            +
            .as_touch div.actions a.new,
         | 
| 956 | 
            +
            .as_touch div.actions a.new_existing,
         | 
| 957 | 
            +
            .as_touch div.actions a.show_search,
         | 
| 958 | 
            +
            .as_touch div.actions a.show_config_list,
         | 
| 959 | 
            +
            .as_touch div.actions div.action_group div {
         | 
| 952 960 | 
             
            padding: 7px 5px 7px 25px;
         | 
| 953 961 | 
             
            }
         | 
| 954 962 |  | 
| 955 | 
            -
            .as_touch .active-scaffold  | 
| 956 | 
            -
            .as_touch .active-scaffold  | 
| 957 | 
            -
            .as_touch .active-scaffold  | 
| 958 | 
            -
            .as_touch .active-scaffold  | 
| 959 | 
            -
            .as_touch .active-scaffold  | 
| 963 | 
            +
            .as_touch .active-scaffold div.actions > a.new,
         | 
| 964 | 
            +
            .as_touch .active-scaffold div.actions > a.new_existing,
         | 
| 965 | 
            +
            .as_touch .active-scaffold div.actions > a.show_search,
         | 
| 966 | 
            +
            .as_touch .active-scaffold div.actions > a.show_config_list,
         | 
| 967 | 
            +
            .as_touch .active-scaffold div.actions div.action_group > div {
         | 
| 960 968 | 
             
            padding: 7px 5px 7px 25px;
         | 
| 961 969 | 
             
            background-position: 5px 50%;
         | 
| 962 970 | 
             
            }
         | 
| @@ -973,12 +981,12 @@ padding: 7px 5px 7px 25px; | |
| 973 981 | 
             
            padding: 4px 0px;
         | 
| 974 982 | 
             
            }
         | 
| 975 983 |  | 
| 976 | 
            -
            .as_touch .active-scaffold  | 
| 977 | 
            -
            .as_touch .active-scaffold  | 
| 984 | 
            +
            .as_touch .active-scaffold div.actions a,
         | 
| 985 | 
            +
            .as_touch .active-scaffold div.actions div {
         | 
| 978 986 | 
             
              font: bold 14px arial;
         | 
| 979 987 | 
             
            }
         | 
| 980 988 |  | 
| 981 | 
            -
            .as_touch .active-scaffold  | 
| 989 | 
            +
            .as_touch .active-scaffold div.actions {
         | 
| 982 990 | 
             
              right: 15px;
         | 
| 983 991 | 
             
            }
         | 
| 984 992 |  | 
| @@ -20,12 +20,11 @@ | |
| 20 20 | 
             
               form_id = element_form_id(:action => form_action, :id => @record.try(:id))
         | 
| 21 21 | 
             
            %>
         | 
| 22 22 | 
             
            <%=
         | 
| 23 | 
            -
            options = {: | 
| 24 | 
            -
                       :id => form_id,
         | 
| 23 | 
            +
            options = {:id => form_id,
         | 
| 25 24 | 
             
                       :multipart => multipart,
         | 
| 26 25 | 
             
                       :class => "as_form #{form_action.to_s}",
         | 
| 27 26 | 
             
                       :method => method,
         | 
| 28 | 
            -
                       'data-loading' => true}
         | 
| 27 | 
            +
                       'data-loading' => defined?(loading) ? loading : true}
         | 
| 29 28 | 
             
            cancel_options = {:class => 'as_cancel'}
         | 
| 30 29 |  | 
| 31 30 | 
             
            cancel_options[:remote] = true if xhr #cancel link does nt have to care about multipart forms
         | 
| @@ -1,17 +1,18 @@ | |
| 1 1 | 
             
            <%
         | 
| 2 | 
            -
              url_options ||= params_for(: | 
| 2 | 
            +
              url_options ||= params_for(action: :index, id: nil, search: nil)
         | 
| 3 3 | 
             
              submit_text ||= :search
         | 
| 4 | 
            +
              xhr ||= request.xhr?
         | 
| 4 5 | 
             
              options = {
         | 
| 5 | 
            -
                : | 
| 6 | 
            -
                : | 
| 7 | 
            -
                : | 
| 8 | 
            -
                : | 
| 9 | 
            -
                : | 
| 6 | 
            +
                id: element_form_id(action: 'search'),
         | 
| 7 | 
            +
                class: "as_form search",
         | 
| 8 | 
            +
                remote: xhr,
         | 
| 9 | 
            +
                data: {loading: true},
         | 
| 10 | 
            +
                method: :get
         | 
| 10 11 | 
             
              }
         | 
| 11 12 | 
             
            -%>
         | 
| 12 13 | 
             
            <%= form_tag url_options, options %>
         | 
| 13 14 | 
             
              <ol class="form">
         | 
| 14 | 
            -
             | 
| 15 | 
            +
                <% visibles, hiddens = visibles_and_hiddens(active_scaffold_config.field_search) %>
         | 
| 15 16 | 
             
                <% visibles.each do |column| -%>
         | 
| 16 17 | 
             
                  <li class="form-element <%= column.css_class unless column.css_class.is_a?(Proc) %>"><%= search_attribute(column, @record) %></li>
         | 
| 17 18 | 
             
                <% end -%>
         | 
| @@ -1,14 +1,15 @@ | |
| 1 1 | 
             
            <%
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            parent_record ||= @record # TODO: remove when changing @record is removed, save @record, some partial can change @record
         | 
| 4 | 
            -
            associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a
         | 
| 5 | 
            -
            #associated = associated.sort_by {|r| r.new_record? ? 99999999999 : r.id} unless column.association.options.has_key?(:order)
         | 
| 2 | 
            +
            associated = column.association.singular? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a
         | 
| 6 3 | 
             
            if column.show_blank_record?(associated)
         | 
| 7 4 | 
             
              show_blank_record = build_associated(column.association, parent_record)
         | 
| 8 5 | 
             
            end
         | 
| 9 6 | 
             
            disable_required_for_new = @disable_required_for_new
         | 
| 10 | 
            -
            @disable_required_for_new = !!show_blank_record unless (column. | 
| 11 | 
            -
            subform_div_id = "#{sub_form_id(:association => column.name, :id => parent_record.id || generated_id(parent_record) || 99999999999)}-div" | 
| 7 | 
            +
            @disable_required_for_new = !!show_blank_record unless (column.association.singular? && column.required?)
         | 
| 8 | 
            +
            subform_div_id = "#{sub_form_id(:association => column.name, :id => parent_record.id || generated_id(parent_record) || 99999999999)}-div"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            # render footer before rendering associated records, fixes create new on self-associations
         | 
| 11 | 
            +
            # so generated_id for blank associated record is not used in create new button
         | 
| 12 | 
            +
            footer = render(:partial => 'form_association_footer', :locals => {:parent_record => parent_record, :column => column, :associated => associated, :scope => scope})
         | 
| 12 13 | 
             
            -%>
         | 
| 13 14 | 
             
            <h5>
         | 
| 14 15 | 
             
              <%= column.label -%>
         | 
| @@ -16,11 +17,10 @@ subform_div_id = "#{sub_form_id(:association => column.name, :id => parent_recor | |
| 16 17 | 
             
            </h5>
         | 
| 17 18 | 
             
            <div id ="<%= subform_div_id %>" <%= 'style="display: none;"'.html_safe if column.collapsed -%>>
         | 
| 18 19 | 
             
            <%# HACK: to be able to delete all associated records %>
         | 
| 19 | 
            -
              <%= hidden_field_tag "#{active_scaffold_input_options(column, scope, :object => parent_record)[:name]}[0]", '' if column. | 
| 20 | 
            +
              <%= hidden_field_tag "#{(opts = active_scaffold_input_options(column, scope, :object => parent_record))[:name]}[0]", '', :id => "#{opts[:id]}_0" if column.association.collection? %>
         | 
| 20 21 | 
             
              <%= render :partial => subform_partial_for_column(column), :locals => {:column => column, :parent_record => parent_record, :associated => associated, :show_blank_record => show_blank_record, :scope => scope} %>
         | 
| 21 | 
            -
              <%=  | 
| 22 | 
            +
              <%= footer -%>
         | 
| 22 23 | 
             
            </div>
         | 
| 23 24 | 
             
            <%
         | 
| 24 | 
            -
              @record = parent_record # TODO: remove when changing @record is removed, restore @record, some partials can change it
         | 
| 25 25 | 
             
              @disable_required_for_new = disable_required_for_new
         | 
| 26 26 | 
             
            -%>
         | 
| @@ -4,7 +4,6 @@ begin | |
| 4 4 | 
             
            rescue ActiveScaffold::ControllerNotFound
         | 
| 5 5 | 
             
              remote_controller = nil
         | 
| 6 6 | 
             
            end
         | 
| 7 | 
            -
            @record = parent_record
         | 
| 8 7 |  | 
| 9 8 | 
             
            show_add_existing = column_show_add_existing(column, parent_record)
         | 
| 10 9 | 
             
            show_add_new = column_show_add_new(column, associated, parent_record)
         | 
| @@ -13,14 +12,15 @@ return unless show_add_new or show_add_existing | |
| 13 12 |  | 
| 14 13 | 
             
            temporary_id = generated_id(parent_record) if parent_record.new_record?
         | 
| 15 14 | 
             
            controller_path = active_scaffold_controller_for(parent_record.class).controller_path
         | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 15 | 
            +
            parent_controller = (main_form_controller || controller).controller_path
         | 
| 16 | 
            +
            edit_associated_url = params_for(:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :associated_id => '--ID--', :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller) if show_add_existing
         | 
| 17 | 
            +
            add_new_url = params_for(:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller) if show_add_new
         | 
| 18 18 |  | 
| 19 19 | 
             
            -%>
         | 
| 20 20 | 
             
            <div class="footer-wrapper">
         | 
| 21 21 | 
             
              <div class="footer">
         | 
| 22 22 | 
             
                <% if show_add_new -%>
         | 
| 23 | 
            -
                <% if column. | 
| 23 | 
            +
                <% if column.association.collection?
         | 
| 24 24 | 
             
                     add_label = as_(:create_another, :model => column.association.klass.model_name.human)
         | 
| 25 25 | 
             
                     add_class = 'as_create_another'
         | 
| 26 26 | 
             
                   else
         | 
| @@ -39,8 +39,8 @@ add_new_url = params_for(:controller => controller_path, :action => 'edit_associ | |
| 39 39 | 
             
                  <% else -%>
         | 
| 40 40 | 
             
                    <% select_options = options_from_collection_for_select(sorted_association_options_find(column.association, nil, parent_record), :to_param, :to_label)
         | 
| 41 41 | 
             
                       add_existing_id = "#{sub_form_id(:association => column.name, :id => parent_record.id || temporary_id || 99999999999)}-add-existing"
         | 
| 42 | 
            -
                       add_existing_label = column. | 
| 43 | 
            -
                    <%= select_tag 'associated_id',  | 
| 42 | 
            +
                       add_existing_label = column.association.collection? ? :add_existing : :replace_existing %>
         | 
| 43 | 
            +
                    <%= select_tag 'associated_id', content_tag(:option, as_(:_select_), value: '') + select_options %>
         | 
| 44 44 | 
             
                    <%= link_to as_(add_existing_label), edit_associated_url, :id => add_existing_id, :remote => true, :class=> "as-js-button as_#{add_existing_label}", :style => "display: none;" %>
         | 
| 45 45 | 
             
                  <% end -%>
         | 
| 46 46 | 
             
                <% end -%>
         | 
| @@ -1,8 +1,6 @@ | |
| 1 1 | 
             
            <%
         | 
| 2 2 | 
             
              record_column = column
         | 
| 3 | 
            -
               | 
| 4 | 
            -
              record = form_association_record ||= @record # TODO: remove me, backwards compatibility, no :collection neither object in render
         | 
| 5 | 
            -
              @record = record # TODO: remove me, backward compatibility, helpers using @record
         | 
| 3 | 
            +
              record = form_association_record
         | 
| 6 4 | 
             
              readonly = (record.readonly? or not record.authorized_for?(:crud_type => :update))
         | 
| 7 5 | 
             
              crud_type = record.new_record? ? :create : (readonly ? :read : :update)
         | 
| 8 6 | 
             
              show_actions = false
         | 
| @@ -34,57 +32,61 @@ | |
| 34 32 | 
             
              columns_length = 0
         | 
| 35 33 | 
             
              columns_groups = []
         | 
| 36 34 | 
             
            -%>
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            <% unless record.errors.empty? -%>
         | 
| 39 | 
            -
            <%= content_tag error_tag, :class => "association-record-errors", :id => element_messages_id(:action => record.class.name.underscore, :id => "#{parent_record.id}-#{index}") do %>
         | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
            <% end %>
         | 
| 43 | 
            -
            <% end %>
         | 
| 44 | 
            -
            <%= content_tag row_tag, :id => tr_id, :class => "association-record#{' association-record-new' if record.new_record?}#{' locked' if locked}" do %>
         | 
| 45 | 
            -
            <% config.subform.columns.each :for => record.class, :crud_type => :read, :flatten => flatten do |column| %>
         | 
| 46 | 
            -
            <%
         | 
| 47 | 
            -
              if column.respond_to? :each
         | 
| 48 | 
            -
                columns_groups << column
         | 
| 49 | 
            -
                next
         | 
| 50 | 
            -
              end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
              next unless in_subform?(column, parent_record)
         | 
| 53 | 
            -
              columns_length += 1
         | 
| 54 | 
            -
              show_actions = true
         | 
| 55 | 
            -
              if column.association && column.form_ui.nil?
         | 
| 56 | 
            -
                column = column.clone
         | 
| 57 | 
            -
                column.form_ui ||= :select
         | 
| 58 | 
            -
              end
         | 
| 59 | 
            -
              
         | 
| 60 | 
            -
              col_class = default_col_class.clone
         | 
| 61 | 
            -
              col_class << 'required' if column.required?
         | 
| 62 | 
            -
              col_class << column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc)
         | 
| 63 | 
            -
              col_class << 'hidden' if column_renders_as(column) == :hidden
         | 
| 64 | 
            -
            -%>
         | 
| 65 | 
            -
              <%= content_tag column_tag, :class => col_class.join(' ') do %>
         | 
| 66 | 
            -
                <%= active_scaffold_render_subform_column(column, scope, crud_type, readonly, false, record) %>
         | 
| 35 | 
            +
            <%= content_tag record_tag, :class => "sub-form-record" do %>
         | 
| 36 | 
            +
              <% unless record.errors.empty? -%>
         | 
| 37 | 
            +
              <%= content_tag error_tag, :class => "association-record-errors", :id => element_messages_id(:action => record.class.name.underscore, :id => "#{parent_record.id}-#{index}") do %>
         | 
| 38 | 
            +
                <% errors = active_scaffold_error_messages_for(:record, :object => record) %>
         | 
| 39 | 
            +
                <%= error_inner_tag ? content_tag(error_inner_tag, errors, :colspan => (active_scaffold_config_for(record.class).subform.columns.length + 1 if error_inner_tag == :td)) : errors %>
         | 
| 40 | 
            +
              <% end %>
         | 
| 67 41 | 
             
              <% end %>
         | 
| 68 | 
            -
             | 
| 69 | 
            -
            <%  | 
| 70 | 
            -
               | 
| 71 | 
            -
                 | 
| 72 | 
            -
                   | 
| 42 | 
            +
              <%= content_tag row_tag, :id => tr_id, :class => "association-record#{' association-record-new' if record.new_record?}#{' locked' if locked}" do %>
         | 
| 43 | 
            +
              <% config.subform.columns.each :for => record.class, :crud_type => :read, :flatten => flatten do |column| %>
         | 
| 44 | 
            +
              <%
         | 
| 45 | 
            +
                if column.respond_to? :each
         | 
| 46 | 
            +
                  columns_groups << column
         | 
| 47 | 
            +
                  next
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                next unless in_subform?(column, parent_record, record_column)
         | 
| 51 | 
            +
                columns_length += 1
         | 
| 52 | 
            +
                show_actions = true
         | 
| 53 | 
            +
                if column.association && column.form_ui.nil?
         | 
| 54 | 
            +
                  column = column.clone
         | 
| 55 | 
            +
                  column.form_ui ||= :select
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                col_class = default_col_class.clone
         | 
| 59 | 
            +
                col_class << 'required' if column.required?
         | 
| 60 | 
            +
                col_class << column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc)
         | 
| 61 | 
            +
                col_class << 'hidden' if column_renders_as(column) == :hidden
         | 
| 62 | 
            +
              -%>
         | 
| 63 | 
            +
                <%= content_tag column_tag, :class => col_class.join(' ') do %>
         | 
| 64 | 
            +
                  <%= active_scaffold_render_subform_column(column, scope, crud_type, readonly, false, record) %>
         | 
| 73 65 | 
             
                <% end %>
         | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
                 | 
| 66 | 
            +
              <% end -%>
         | 
| 67 | 
            +
              <% if show_actions -%>
         | 
| 68 | 
            +
                <%= content_tag column_tag, :class => "actions" do %>
         | 
| 69 | 
            +
                  <% if record_column.association.collection? && !locked %>
         | 
| 70 | 
            +
                    <%
         | 
| 71 | 
            +
                      auth = [:destroy, :delete_all, :delete].exclude?(record_column.association.dependent)
         | 
| 72 | 
            +
                      auth, reason = record.authorized_for?(:crud_type => :delete, :reason => true) unless auth
         | 
| 73 | 
            +
                    %>
         | 
| 74 | 
            +
                    <%= auth ? link_to(as_(:remove), '#', :class => 'destroy', :id => "#{options[:id]}-destroy" , :data => {:delete_id => tr_id}) : reason %>
         | 
| 75 | 
            +
                  <% end %>
         | 
| 76 | 
            +
                  <% unless record.new_record? %>
         | 
| 77 | 
            +
                    <input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= record.id -%>" />
         | 
| 78 | 
            +
                  <% end -%>
         | 
| 79 | 
            +
                <% end %>
         | 
| 80 | 
            +
              <% end -%>
         | 
| 77 81 | 
             
              <% end %>
         | 
| 78 | 
            -
            <% end -%>
         | 
| 79 | 
            -
            <% end %>
         | 
| 80 82 |  | 
| 81 | 
            -
            <% columns_groups.each do |column| %>
         | 
| 82 | 
            -
            <%= content_tag row_tag, :class => 'associated-record' do %>
         | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 83 | 
            +
              <% columns_groups.each do |column| %>
         | 
| 84 | 
            +
              <%= content_tag row_tag, :class => 'associated-record' do %>
         | 
| 85 | 
            +
                <%= content_tag column_tag, :colspan => (columns_length if column_tag == :td) do %>
         | 
| 86 | 
            +
                <% column.each :for => record.class, :crud_type => :read, :flatten => true do |col| %>
         | 
| 87 | 
            +
                  <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true, record) %>
         | 
| 88 | 
            +
                <% end %>
         | 
| 89 | 
            +
                <% end %>
         | 
| 86 90 | 
             
              <% end %>
         | 
| 87 91 | 
             
              <% end %>
         | 
| 88 92 | 
             
            <% end %>
         | 
| 89 | 
            -
            <% end %>
         | 
| 90 | 
            -
            </<%= record_tag %>>
         | 
| @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            <%
         | 
| 3 3 | 
             
              header_record_class = (show_blank_record && show_blank_record.class) || column.association.klass
         | 
| 4 4 | 
             
            -%>
         | 
| 5 | 
            -
              <%= render :partial => 'horizontal_subform_header', :locals => {:parent_record => parent_record, :record_class => header_record_class} %>
         | 
| 5 | 
            +
              <%= render :partial => 'horizontal_subform_header', :locals => {:parent_record => parent_record, :record_class => header_record_class, :parent_column => column} %>
         | 
| 6 6 |  | 
| 7 7 | 
             
              <%= render :partial => 'form_association_record', :collection => associated, :locals => {:scope => scope, :parent_record => parent_record, :column => column} %>
         | 
| 8 8 | 
             
              <%= render :partial => 'form_association_record', :object => show_blank_record, :locals => {:scope => scope, :parent_record => parent_record, :column => column, :locked => true, :index => associated.size} if show_blank_record %>
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
                <%
         | 
| 4 4 | 
             
                active_scaffold_config_for(record_class).subform.columns.each :for => record_class, :crud_type => :read do |column|
         | 
| 5 5 | 
             
                  next unless column.is_a? ActiveScaffold::DataStructures::Column
         | 
| 6 | 
            -
                  next unless in_subform?(column, parent_record)
         | 
| 6 | 
            +
                  next unless in_subform?(column, parent_record, parent_column)
         | 
| 7 7 | 
             
                  hidden = column_renders_as(column) == :hidden
         | 
| 8 8 | 
             
                  -%>
         | 
| 9 9 | 
             
                  <th class="<%= "#{column.name}-column #{'required' if column.required?} #{'hidden' if hidden}" %>">
         | 
| @@ -1 +1,3 @@ | |
| 1 | 
            -
            <%= columns.collect {|column| active_scaffold_human_condition_for(column)}.compact.to_sentence  %>
         | 
| 1 | 
            +
            <%= columns.collect {|column| active_scaffold_human_condition_for(column)}.compact.to_sentence  %>
         | 
| 2 | 
            +
            <%= tag(:br) if columns.present? && grouped_search? %>
         | 
| 3 | 
            +
            <%= as_(:grouped_by, column: active_scaffold_grouped_by_label) if grouped_search? %>
         | 
| @@ -5,5 +5,7 @@ default_sorting = active_scaffold_config.list.user.default_sorting | |
| 5 5 | 
             
            <% columns.each do |column| -%>
         | 
| 6 6 | 
             
              <%= render_column_heading(column, sorting, sorting.next_sorting_of(column, default_sorting.sorts_on?(column))) %>
         | 
| 7 7 | 
             
            <% end -%>
         | 
| 8 | 
            +
            <% unless grouped_search? -%>
         | 
| 8 9 | 
             
            <th class="actions">
         | 
| 9 10 | 
             
            </th>
         | 
| 11 | 
            +
            <% end -%>
         |