active_scaffold 4.2.3 → 4.3.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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +16 -1
  3. data/README.md +108 -7
  4. data/app/assets/javascripts/{jquery → active_scaffold}/active_scaffold.js +759 -762
  5. data/app/assets/javascripts/{jquery/date_picker_bridge.js.erb → active_scaffold/date_picker_bridge.js} +0 -3
  6. data/app/assets/javascripts/active_scaffold/load.js +102 -0
  7. data/app/assets/javascripts/active_scaffold.js.erb +3 -27
  8. data/app/assets/stylesheets/active_scaffold/_colours.scss +330 -0
  9. data/app/assets/stylesheets/active_scaffold/_images.scss +65 -0
  10. data/app/assets/stylesheets/{active_scaffold_layout.scss → active_scaffold/_layout.scss} +14 -0
  11. data/app/assets/stylesheets/active_scaffold/_variables.scss +194 -0
  12. data/app/assets/stylesheets/active_scaffold/core.scss +15 -0
  13. data/app/assets/stylesheets/active_scaffold.scss.erb +16 -0
  14. data/app/views/active_scaffold_overrides/_field_search_columns.html.erb +8 -0
  15. data/app/views/active_scaffold_overrides/_form.html.erb +8 -0
  16. data/app/views/active_scaffold_overrides/_form_association.html.erb +3 -1
  17. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +4 -2
  18. data/app/views/active_scaffold_overrides/_show_association.html.erb +2 -1
  19. data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +2 -2
  20. data/app/views/active_scaffold_overrides/_show_association_vertical.html.erb +1 -1
  21. data/app/views/active_scaffold_overrides/edit_associated.js.erb +10 -8
  22. data/lib/active_scaffold/actions/core.rb +34 -3
  23. data/lib/active_scaffold/assets/css_deps_generator.rb +42 -0
  24. data/lib/active_scaffold/assets/jquery_ui_manifest.rb +77 -0
  25. data/lib/active_scaffold/assets/jquery_ui_theme_generator.rb +102 -0
  26. data/lib/active_scaffold/assets.rb +109 -0
  27. data/lib/active_scaffold/attribute_params.rb +11 -2
  28. data/lib/active_scaffold/bridges/active_storage/form_ui.rb +1 -1
  29. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +1 -1
  30. data/lib/active_scaffold/bridges/chosen.rb +1 -1
  31. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +1 -1
  32. data/lib/active_scaffold/bridges/file_column/form_ui.rb +1 -1
  33. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +1 -1
  34. data/lib/active_scaffold/bridges/record_select/helpers.rb +1 -1
  35. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +1 -0
  36. data/lib/active_scaffold/bridges/tiny_mce.rb +6 -1
  37. data/lib/active_scaffold/bridges.rb +7 -0
  38. data/lib/active_scaffold/config/core.rb +7 -3
  39. data/lib/active_scaffold/constraints.rb +1 -1
  40. data/lib/active_scaffold/data_structures/action_columns.rb +66 -0
  41. data/lib/active_scaffold/data_structures/bridge.rb +2 -0
  42. data/lib/active_scaffold/data_structures/column.rb +3 -0
  43. data/lib/active_scaffold/engine.rb +40 -0
  44. data/lib/active_scaffold/finder.rb +1 -1
  45. data/lib/active_scaffold/helpers/assets_helpers.rb +39 -0
  46. data/lib/active_scaffold/helpers/controller_helpers.rb +1 -1
  47. data/lib/active_scaffold/helpers/form_column_helpers.rb +57 -532
  48. data/lib/active_scaffold/helpers/form_ui_helpers.rb +530 -0
  49. data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -0
  50. data/lib/active_scaffold/helpers/list_column_helpers.rb +31 -11
  51. data/lib/active_scaffold/helpers/search_column_helpers.rb +5 -12
  52. data/lib/active_scaffold/helpers/show_column_helpers.rb +4 -2
  53. data/lib/active_scaffold/helpers/view_helpers.rb +12 -0
  54. data/lib/active_scaffold/railties/tasks.rake +10 -0
  55. data/lib/active_scaffold/testing/assert_embedded_load.rb +33 -0
  56. data/lib/active_scaffold/version.rb +2 -2
  57. data/lib/active_scaffold.rb +7 -2
  58. data/lib/tasks/active_scaffold/assets.rake +42 -0
  59. data/lib/tasks/bundle.rake +25 -0
  60. data/vendor/assets/stylesheets/{jquery-ui-theme.css.erb → jquery-ui-theme.css} +17 -17
  61. metadata +26 -28
  62. data/app/assets/stylesheets/active_scaffold.scss +0 -424
  63. data/app/assets/stylesheets/active_scaffold_extensions.css.erb +0 -2
  64. data/app/assets/stylesheets/active_scaffold_images.scss +0 -65
  65. data/app/assets/stylesheets/active_scaffold_jquery_ui.css.erb +0 -13
  66. /data/app/assets/javascripts/{jquery → active_scaffold}/active_scaffold_chosen.js +0 -0
  67. /data/app/assets/javascripts/{jquery → active_scaffold}/draggable_lists.js +0 -0
  68. /data/app/assets/javascripts/{jquery → active_scaffold}/jquery.editinplace.js +0 -0
  69. /data/app/assets/javascripts/{jquery → active_scaffold}/tiny_mce_bridge.js +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d279597d030fea168fba4fbcc8cd44c99d02f44b4596c774ec4476db04d53cd1
4
- data.tar.gz: 48fd530b7990ec28454a1b3adebd5da80ca1d833727b22563a85cef1e140747f
3
+ metadata.gz: 861686a739ce56092580a717c8a7e85765f5862389465ec8b86060f0924bdf14
4
+ data.tar.gz: b07820a816aa7652af10cdda2939bc7cfdc2e6307cf76c13ce86d224728e6d51
5
5
  SHA512:
6
- metadata.gz: 1317103cf2e2344d0340f76f020a7df076f7aedff8f07b1c0a19499338d2d7941e762c51b33757cbcf3cd039d0d9f8bc8b57653282098f23fadfc069fd631bf0
7
- data.tar.gz: 1300926c2397ea724f788a2b9899397e6c1e0ec6ca5a55a77677edf93dc98e5ed70e1b742c9a6ee8618067e4c378e58899d18e0fba9514e41cbde943c5589c01
6
+ metadata.gz: ac54f190035ed02602065f953c2e0172649e87893aead48e5895ac5ed07fb859efa5efcf4fca20af3496bcf3334b2eb22bfff286cf609a308aecb5c0c2c9a2bd
7
+ data.tar.gz: f5757a2c4e839f98eb0e65d4c010d1a73eaadb2a0de806671baa21a368e5847d114b9a22669677aa0070ef9d930f97e3c2983e5a183be36ad009441b17a4cd03
data/CHANGELOG.rdoc CHANGED
@@ -1,8 +1,23 @@
1
+ - Support translating enums (or options for :select form_ui on any column) nested in the pluralized name of the column, activerecord.attributes.model_name.pluralized_column.enum_value, defaults to old way activerecord.attributes.model_name.enum_value
2
+ - Support :subform_columns option in column form_ui_options, or column's options, when the column is rendered as subform
3
+ - Use :subform_columns option in :horizontal and :vertical show_ui too
4
+ - Add layout multiple support to ActionColumns, so forms can have columns
5
+ - Better exception handling when error is raised rendering a column, no more empty backtraces
6
+ - Fix render field on subform for polymorphic association, or nested subforms in some cases
7
+ - Add clear_form_column_if, works like hide_form_column_if but sends the column empty, to clear it
8
+ - Add checkboxes form UI, like select form UI in collection associations but supporting DB columns (e.g. columns using serialize)
9
+ - Support draggable form UI in non-association columns, like checkboxes (e.g. columns using serialize)
10
+ - Add list UI for select_multiple, draggable, checkboxes, select and radio. Select and radio were handled by format_column_value, but the list UI works better
11
+ - Support propshaft with dartsass-rails, so it doesn't depend on dartsass-sprockets and one dartsass gem must be added to the Gemfile
12
+
13
+ = 4.2.4
14
+ - Fix creating records with constraints on collection associations (broken on 4.2.2 on some cases)
15
+
1
16
  = 4.2.3
2
17
  - Make simplified searches on LogicalQueryParser bridge working with upstream gem, no need for my fork
3
18
  - Styles for radio form_ui
4
19
  - Fix style for checkbox list in subform
5
- - Fix constraints (broken on 4.2.2 on some cases)
20
+ - Fix creating records with constraints on through associations (broken on 4.2.2 on some cases)
6
21
 
7
22
  = 4.2.2
8
23
  - Support setting form_ui_options with nil, for subforms
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
- Overview
3
- ========
2
+ # Overview
4
3
  [![Build status](https://github.com/activescaffold/active_scaffold/actions/workflows/ci.yml/badge.svg)](https://github.com/activescaffold/active_scaffold/actions/workflows/ci.yml)
5
4
  [![Maintainability](https://qlty.sh/gh/activescaffold/projects/active_scaffold/maintainability.svg)](https://qlty.sh/gh/activescaffold/projects/active_scaffold)
6
5
  [![Code Coverage](https://qlty.sh/gh/activescaffold/projects/active_scaffold/coverage.svg)](https://qlty.sh/gh/activescaffold/projects/active_scaffold)
@@ -10,8 +9,8 @@ Overview
10
9
 
11
10
  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 >= 6.1.0 is supported, ruby >= 3.0 required.
12
11
 
13
- Branch Details
14
- --------------
12
+ ## Branch Details
13
+
15
14
  master supports rails >= 7.2.x and ruby >= 3.2.0
16
15
  4-2-stable supports rails >= 7.2.x and ruby >= 3.2.0
17
16
 
@@ -25,8 +24,7 @@ These versions are not supported anymore:
25
24
  3-3-stable supports rails 3.2.x and ruby >= 1.8
26
25
  rails-3.2 supports Rails 3.1 & 3.2, and is the current source of the 3.2.x line of gems.
27
26
 
28
- Quick Start
29
- -----------
27
+ ## Quick Start
30
28
  To get started with a new Rails project
31
29
 
32
30
  Added to Gemfile
@@ -45,6 +43,8 @@ For rails 7.x, install generator will add `active_scaffold` to `config/importmap
45
43
 
46
44
  For rails 6.1, install generator will create `app/assets/javascripts/application.js`, add it, and `active_scaffold/manifest.js`, to `app/assets/config/manifest.js` and add `javascript_include_tag` in the layout, as ActiveScaffold doesn't work with webpack. It will add `jquery` to `app/assets/javascripts/application.js` too if query-rails gem is available, although Jquery may be loaded by packs too and it will work, it won't add `jquery_ujs` or `@rails/ujs` as it's added to `app/javascript/packs/application.js` by default.
47
45
 
46
+ -- TODO: Add notes about dartsass-rails for propshaft or dartsass-sprockets for sprockets.
47
+
48
48
  Run the following commands
49
49
 
50
50
  ```console
@@ -59,6 +59,107 @@ Run the app and visit localhost:3000/<plural_model>
59
59
 
60
60
  It's recommended to call `clear_helpers` in ApplicationController, as some helpers defined by ActiveScaffold, such as active_scaffold_enum_options, options_for_association_conditions, association_klass_scoped, are usually overrided for different controllers, and it may cause issues when all helper modules are available to every controller, specially when models have associations or columns with the same name but need different code for those overrided helper methods.
61
61
 
62
+ ## Stylesheet Loading
63
+
64
+ ActiveScaffold provides flexible stylesheet loading to work with both Sprockets and Propshaft, choose which want you want adding `dartsass-sprockets` or `dartsass-rails` to your Gemfile.
65
+ ActiveScaffold has SASS variables to define the colours, but, from version 4.3, the values are moved to CSS variables. It's still possible to change the colours with the old SASS variables, but they may be removed in the future.
66
+
67
+ ### With Propshaft + dartsass-rails
68
+
69
+ Traditionally, ActiveScaffold loaded all CSS needed, from itself and other ActiveScaffold plugins, and every other library integrated with bridges, such as RecordSelect, Chosen or TinyMCE. It was done using css.erb files, but with propshaft erb is not supported, so a SCSS file is generated when app boots in development and running `rake assets:precompile` on the deployment. There is a task to generate them, `active_scaffold:assets:generate`.
70
+
71
+ Also, when using jquery-ui-rails gem, the CSS is generated from the erb in the gem in the same way.
72
+
73
+ ```scss
74
+ // In application.scss
75
+ @use 'active_scaffold/core' with (
76
+ // set values to variables
77
+ );
78
+ ```
79
+
80
+
81
+ ### With Sprockets + dartsass-sprockets
82
+
83
+ Add `@use` to application.scss, it will load all CSS needed, jQuery UI if jquery-ui-rails gem is installed, and CSS for other ActiveScaffold plugins and bridges.
84
+
85
+ ```scss
86
+ @use 'active_scaffold' with (
87
+ // set values to variables
88
+ );
89
+ ```
90
+
91
+ In this case, if you want more flexibility, you have to use `@use` with each individual CSS file that ActiveScaffold provides:
92
+
93
+ ```scss
94
+ @use 'active_scaffold/variables' with (
95
+ // set values to variables
96
+ );
97
+ @use 'active_scaffold/colours';
98
+ @use 'active_scaffold/layout';
99
+ @use 'active_scaffold/images';
100
+ // load CSS for other ActiveScaffold plugins and bridges
101
+ ```
102
+
103
+ ## Javascript Loading
104
+
105
+ There are 2 options to load JS with propshaft, using importmaps or loading the files individually.
106
+
107
+ ### Propshaft + importmaps
108
+
109
+ When using importmaps, add active_scaffold to importmap, it should have jquery and jquery_ujs or rails_ujs too:
110
+
111
+ ```ruby
112
+ pin 'active_scaffold', to: 'active_scaffold/load.js'
113
+ pin 'jquery'
114
+ pin 'jquery_ujs'
115
+ ```
116
+
117
+ In the app/javascript/application.js, import jquery, jquery_ujs or rails_ujs and active_scaffold:
118
+
119
+ ```js
120
+ import 'jquery'
121
+ import 'jquery_ujs'
122
+ import 'active_scaffold'
123
+ ```
124
+
125
+ In the layout, load the importmap modules and call active_scaffold_javascript_tag, that includes some script tags which was in js.erb when using sprockets, so JS ActiveScaffold dependencies are loaded (jquery UI if using jquery-ui-rails, and JS for other ActiveScaffold plugins and bridges):
126
+
127
+ ```erb
128
+ <%= javascript_importmap_tags %>
129
+ <%= active_scaffold_javascript_tag %>
130
+ ```
131
+
132
+ ### Propshaft
133
+
134
+ If you're not using importmaps, then you can load the JS files individually, but you only need to load jquery and jquery_ujs or rails_ujs, and then call active_scaffold_javascript_tag:
135
+
136
+ ```erb
137
+ <%= javascript_include_tag 'jquery', 'jquery_ujs' %>
138
+ <%= active_scaffold_javascript_tag %>
139
+ ```
140
+
141
+ ### With Sprockets
142
+
143
+ For the JS, you can keep using `//= require active_scaffold` in your application.js
144
+
145
+ It's possible to use importmaps too, add active_scaffold to importmap, that should have jquery and jquery_ujs or rails_ujs too:
146
+
147
+ ```ruby
148
+ pin 'active_scaffold'
149
+ pin 'jquery'
150
+ pin 'jquery_ujs'
151
+ ```
152
+
153
+ In the app/javascript/application.js, import jquery, jquery_ujs or rails_ujs and active_scaffold:
154
+
155
+ ```js
156
+ import 'jquery'
157
+ import 'jquery_ujs'
158
+ import 'active_scaffold'
159
+ ```
160
+
161
+ In the layout, load the importmap modules, in this case we are not using `to` in the importmap, so the js.erb file will be used, that include some generated code, and calling active_scaffold_javascript_tag is not needed.
162
+
62
163
  Threadsafe
63
164
  ----------
64
165
 
@@ -117,4 +218,4 @@ A ruby translation project managed on [Locale](http://www.localeapp.com/) that's
117
218
  Happy translating!
118
219
 
119
220
  ### Powered by
120
- [![RubyMine logo](https://resources.jetbrains.com/storage/products/company/brand/logos/RubyMine.png)](https://jb.gg/OpenSource)
221
+ [![RubyMine logo](https://resources.jetbrains.com/storage/products/company/brand/logos/RubyMine.png)](https://jb.gg/OpenSource)