dynamic_scaffold 2.0.1 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 457314cf971c919f920535659152e9062cd0f095c51d3f4626fb12f956bda42e
4
- data.tar.gz: a9fe3e3a6041b2dc15d305f291f63d07447427e673988c5acd68313d8f643351
3
+ metadata.gz: a0b8aa116d98e382f69fad83ba4da489b9fafa4b11233042eb3dbaeca601cf7d
4
+ data.tar.gz: bca369254e5fe5dc9065fd88d8bb9d4250d0364d1c5cb7a95ab4f23dd973d883
5
5
  SHA512:
6
- metadata.gz: 525cf1961b472037098f5d1425ae9177b2b175712c6c353a2f80692fc630dfa93d082d4d95977a3d2e3f7fc0004053e068ee5481dfd65e34802550482662542f
7
- data.tar.gz: 79896456eaaff29d55b69fad3eb63508fe6ceb199f49fdab356f4b76db9373401cb3b4becee9cd682492713c4211616964753ce42df0f6ed9d47eda7ac9e729c
6
+ metadata.gz: c754092afe2dcc9845c4f20a7a8dc558c75091136c823aa686736405d7e8599f3f7fbd707b4873700d09c3c84087bfe7b9b51ec77af7d1c474316644ec83e58c
7
+ data.tar.gz: be082a586b1409a678ca9f22bd08eacd1d86d6e1be6c27bc0e1e2dc9220d3840ba07f2666263a0d90a63040a1e690ad15f2221ea54b681d81272e88915b154d7
data/README.md CHANGED
@@ -10,9 +10,11 @@ The Scaffold system which dynamically generates CRUD and sort functions.
10
10
  * Support image crop.
11
11
  * Support [globalize](https://github.com/globalize/globalize) form fields.
12
12
  * Support [cocoon](https://github.com/nathanvda/cocoon).
13
- * This has the views with the Twitter Bootstrap. Support bootstrap3/4.
13
+ * This has the views with the Twitter Bootstrap. Support Bootstrap 4/5. Bootstrap 3 is no longer supported.
14
14
  * Customizable and flexible.
15
15
 
16
+ Version 3.1.0 adds Rails 8.0/8.1 to the allowed dependency range and has been tested with Rails 8.1.4 on Ruby 3.4.12, using CarrierWave 3.1.4 in the sample application. Bootstrap 4/5 are supported; Bootstrap 3 is no longer a supported target.
17
+
16
18
  <img src="images/list_with_pager.png">
17
19
 
18
20
 
@@ -118,13 +120,13 @@ class Admin::ShopsController < Admin::BaseController
118
120
 
119
121
  ### Prepare CSS and Javascript
120
122
 
121
- You need to load the files for CSS and Javascript. Currently, we support the Bootstrap 3 and Bootstrap 4.
123
+ You need to load the files for CSS and Javascript. Currently, we support Bootstrap 4 and Bootstrap 5.
122
124
 
123
125
  ```sass
124
126
  # app/assets/stylesheets/application.scss
125
- @import 'dynamic_scaffold/bootstrap3'
126
- # or
127
127
  @import 'dynamic_scaffold/bootstrap4'
128
+ # or
129
+ @import 'dynamic_scaffold/bootstrap5'
128
130
  ```
129
131
 
130
132
  ```js
@@ -243,7 +245,7 @@ class ShopController < ApplicationController
243
245
  # You can use form helper methods for type,
244
246
  # text_field, check_box, radio_button, password_field, hidden_field, file_field, text_area, color_field,
245
247
  # collection_check_boxes, collection_radio_buttons, collection_select, grouped_collection_select,
246
- # time_select, date_select, datetime_select, date_field, number_field, telephone_field
248
+ # time_select, date_select, datetime_select, date_field, datetime_local_field, number_field, telephone_field
247
249
 
248
250
 
249
251
  # Default label is I18n model attribute name.
@@ -684,7 +686,7 @@ class ShopController < ApplicationController
684
686
 
685
687
  ### Development hints.
686
688
 
687
- Please support both Bootstrap 3/4. You can change CSS to Bootstrap3 by registering `bootstrap=3` in cookie in the sample page.
689
+ Please support both Bootstrap 4/5. Compare the `/en/controls/master/shops` (Bootstrap 4) and `/en/bootstrap5/shops` (Bootstrap 5) sample pages.
688
690
 
689
691
  ## License
690
692
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -5,8 +5,8 @@ document.addEventListener('dynamic_scaffold:load', function(){
5
5
  function swapAnimation(promises, source, target){
6
6
  promises.push(new Promise(function(resolve){
7
7
  source.dynamicScaffoldSortingResolver = resolve
8
- sourceRect = source.getBoundingClientRect()
9
- targetRect = target.getBoundingClientRect()
8
+ const sourceRect = source.getBoundingClientRect()
9
+ const targetRect = target.getBoundingClientRect()
10
10
 
11
11
 
12
12
  // Find the distance between two points and calculate the animation duration.
@@ -52,4 +52,66 @@ $dynamic_scaffold_danger: #dc3545 !default;
52
52
 
53
53
  .btn-outline-primary.disabled, .btn-outline-primary:disabled{
54
54
  background-color: transparent;
55
- }
55
+ }
56
+
57
+
58
+ .form-select {
59
+ --bs-body-color: #212529;
60
+ --bs-body-bg: #fff;
61
+ --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
62
+ --bs-border-width: 1px;
63
+ --bs-border-color: #dee2e6;
64
+ --bs-border-radius: 0.375rem;
65
+ display: block;
66
+ width: 100%;
67
+ padding: 0.375rem 2.25rem 0.375rem 0.75rem;
68
+ font-size: 1rem;
69
+ font-weight: 400;
70
+ line-height: 1.5;
71
+ color: var(--bs-body-color);
72
+ -webkit-appearance: none;
73
+ -moz-appearance: none;
74
+ appearance: none;
75
+ background-color: var(--bs-body-bg);
76
+ background-image: var(--bs-form-select-bg-img),var(--bs-form-select-bg-icon,none);
77
+ background-repeat: no-repeat;
78
+ background-position: right 0.75rem center;
79
+ background-size: 16px 12px;
80
+ border: var(--bs-border-width) solid var(--bs-border-color);
81
+ border-radius: var(--bs-border-radius);
82
+ transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
83
+ }
84
+
85
+ // Bootstrap 4 does not define form-select, so provide its interactive states too.
86
+ .form-select:focus {
87
+ border-color: #80bdff;
88
+ outline: 0;
89
+ box-shadow: 0 0 0 0.2rem rgba($dynamic_scaffold_primary, 0.25);
90
+ }
91
+
92
+ .form-select:disabled {
93
+ background-color: #e9ecef;
94
+ opacity: 1;
95
+ }
96
+
97
+ .form-select[multiple], .form-select[size]:not([size="1"]) {
98
+ height: auto;
99
+ padding-right: 0.75rem;
100
+ background-image: none;
101
+ }
102
+
103
+ .form-select.is-invalid, .was-validated .form-select:invalid {
104
+ border-color: $dynamic_scaffold_danger;
105
+
106
+ &:focus {
107
+ box-shadow: 0 0 0 0.2rem rgba($dynamic_scaffold_danger, 0.25);
108
+ }
109
+ }
110
+
111
+ .form-select.is-valid, .was-validated .form-select:valid {
112
+ border-color: #28a745;
113
+
114
+ &:focus {
115
+ box-shadow: 0 0 0 0.2rem rgba(#28a745, 0.25);
116
+ }
117
+ }
@@ -0,0 +1,51 @@
1
+ @import 'common';
2
+ @import 'resplist';
3
+
4
+
5
+ .btn-outline-primary, .btn-outline-secondary, .btn-outline-warning, .btn-outline-danger{
6
+ background-color: #fff;
7
+ }
8
+
9
+ .btn-outline-primary path{
10
+ fill: #007bff;
11
+ }
12
+
13
+ .btn-outline-primary:hover path {
14
+ fill: #fff;
15
+ }
16
+
17
+ .btn-outline-secondary path{
18
+ fill: #868e96;
19
+ }
20
+
21
+ .btn-outline-secondary:hover path{
22
+ fill: #fff;
23
+ }
24
+
25
+ .btn-outline-warning path{
26
+ fill: #ffc107;
27
+ }
28
+
29
+ .btn-outline-danger path{
30
+ fill: #dc3545;
31
+ }
32
+
33
+ .btn-outline-warning:hover, .btn-outline-danger:hover{
34
+ path{
35
+ fill: #fff;
36
+ }
37
+
38
+ color: #fff;
39
+ }
40
+
41
+ .page-item .page-link path{
42
+ fill: #007bff;
43
+ }
44
+
45
+ .page-item.disabled .page-link path{
46
+ fill: #868e96;
47
+ }
48
+
49
+ .btn-outline-primary.disabled, .btn-outline-primary:disabled{
50
+ background-color: transparent;
51
+ }
@@ -129,7 +129,7 @@
129
129
  margin-left: 10px;
130
130
  }
131
131
 
132
- // Fixed a problem that font-awesome icon and text link do not match in height.
132
+ /* Fixed a problem that font-awesome icon and text link do not match in height. */
133
133
  .page-link{
134
134
  line-height: 1.6;
135
135
  }
@@ -172,4 +172,16 @@
172
172
 
173
173
  .ds-form .form-group{
174
174
  margin-bottom: 1.5rem;
175
- }
175
+ }
176
+
177
+ .ds-time-sep{
178
+ display: inline-block;
179
+ margin-left: -5px;
180
+ margin-right: 5px;
181
+ }
182
+
183
+ .form-inline .form-select {
184
+ display: inline-block;
185
+ width: auto;
186
+ vertical-align: middle;
187
+ }
@@ -14,4 +14,20 @@ module DynamicScaffoldHelper
14
14
  def dynamic_scaffold_icon(name)
15
15
  instance_exec name, &::Rails.application.config.dynamic_scaffold.icons
16
16
  end
17
+
18
+ def render_check_box(form, field, value, label, input_options = {}, label_options = {}) # rubocop:disable Metrics/ParameterLists, Metrics/LineLength
19
+ id = "#{field.name}_#{value}"
20
+ concat(
21
+ form.check_box(
22
+ field.name, {
23
+ id: id,
24
+ multiple: field.multiple,
25
+ include_hidden: false,
26
+ **input_options
27
+ },
28
+ value
29
+ )
30
+ )
31
+ concat tag.label label, for: id, **label_options
32
+ end
17
33
  end
@@ -5,18 +5,25 @@
5
5
  <%end%>
6
6
  <input type="hidden" class="authenticity_param_name" value="<%= request_forgery_protection_token %>">
7
7
  <%= form_with method: :patch, url: dynamic_scaffold_path(:sort, request_queries(dynamic_scaffold.list.page_param_name)), local: true do%>
8
- <%- if dynamic_scaffold.list.add_button -%>
9
- <div class="ds-row">
10
- <%= link_to dynamic_scaffold_path(:new, request_queries), class: class_names('btn btn-outline-primary btn-primary btn-sm spec-ds-add', 'disabled': dynamic_scaffold.max_count?(@count)) do%>
11
- <%= dynamic_scaffold_icon(:add) %> <%= t('dynamic_scaffold.button.add') %>
12
- <%- unless dynamic_scaffold.max_count.nil? -%>
13
- &nbsp;<span class="badge badge-light">
14
- <%= @count %>&nbsp;/&nbsp;<%= dynamic_scaffold.max_count%>
15
- </span>
16
- <% end %>
17
- <%end%>
8
+ <div class="<%= class_names('ds-row d-flex align-items-center', dynamic_scaffold.list.add_button ? 'justify-content-between' : 'justify-content-end') %>">
9
+ <%- if dynamic_scaffold.list.add_button -%>
10
+ <%= link_to dynamic_scaffold_path(:new, request_queries), class: class_names('btn btn-outline-primary btn-primary btn-sm spec-ds-add', 'disabled': dynamic_scaffold.max_count?(@count)) do%>
11
+ <%= dynamic_scaffold_icon(:add) %> <%= t('dynamic_scaffold.button.add') %>
12
+ <%- unless dynamic_scaffold.max_count.nil? -%>
13
+ &nbsp;<span class="badge badge-light text-bg-light">
14
+ <%= @count %>&nbsp;/&nbsp;<%= dynamic_scaffold.max_count%>
15
+ </span>
16
+ <% end %>
17
+ <%end%>
18
+ <%- end -%>
19
+ <span class="badge badge-light text-bg-light fs-6 border h6 mb-0">
20
+ <% if @records.respond_to?(:total_count) %>
21
+ <%= t('dynamic_scaffold.count', count: @records.total_count) %>
22
+ <%- else -%>
23
+ <%= t('dynamic_scaffold.count', count: @records.count) %>
24
+ <%- end -%>
25
+ </span>
18
26
  </div>
19
- <%- end -%>
20
27
  <%= render 'dynamic_scaffold/bootstrap/pagination' %>
21
28
  <div class="ds-row">
22
29
  <%= render 'dynamic_scaffold/bootstrap/save_order'%>
@@ -48,7 +55,7 @@
48
55
  <%end%>
49
56
  </div>
50
57
  <div class="ds-list-footer clearfix">
51
- <div class="float-right pull-right">
58
+ <div class="float-right pull-right float-end">
52
59
  <%- if dynamic_scaffold.list.edit_buttons(record) -%>
53
60
  <div class="btn-group">
54
61
  <%= link_to dynamic_scaffold_path(:edit, request_queries.merge(id: record[record.class.primary_key])), class: 'btn btn-primary btn-outline-primary btn-sm spec-ds-edit' do %>
@@ -1,5 +1,5 @@
1
1
  <% if dynamic_scaffold.list.sorter %>
2
- <div class="text-right">
2
+ <div class="text-right text-end">
3
3
  <button type="submit" name="submit_sort" class="btn btn-outline-warning btn-warning btn-sm">
4
4
  <%= dynamic_scaffold_icon :save %> <%= t('dynamic_scaffold.button.save_order') %>
5
5
  </button>
@@ -1,5 +1,5 @@
1
1
  <div class="card mb-2 nested-fields">
2
- <div class="card-header text-right p-2">
2
+ <div class="card-header text-right text-end p-2">
3
3
  <%= link_to_remove_association dynamic_scaffold_icon(:delete), f, class: 'btn btn-danger btn-sm' %>
4
4
  </div>
5
5
  <div class="card-body">
@@ -30,8 +30,8 @@
30
30
  <div class="js-ds-image-wrapper">
31
31
  <div class="js-ds-image-preview panel panel-default card mb-1">
32
32
  <% if elem.options[:removable] %>
33
- <div class="text-right panel-heading card-header">
34
- <button type="button" class="btn btn-outline-danger btn-danger btn-sm js-ds-image-remove">
33
+ <div class="text-right text-end panel-heading card-header">
34
+ <button type="button" class="btn btn-danger btn-sm js-ds-image-remove">
35
35
  <%= dynamic_scaffold_icon :times %>
36
36
  </button>
37
37
  </div>
@@ -39,7 +39,7 @@
39
39
  <div class="panel-body card-body">
40
40
  <%- if elem.cropper.present? -%>
41
41
  <%= form.hidden_field "cropper_#{elem.name}", class: "js-ds-image-cropper", data:{options: elem.cropper.to_json} %>
42
- <div class="text-right" style="height: 24px;">
42
+ <div class="text-right text-end" style="height: 24px;">
43
43
  <span class="js-ds-image-cropper-display badge badge-primary"></span>
44
44
  </div>
45
45
  <%- end -%>
@@ -49,7 +49,7 @@
49
49
  </div>
50
50
  </div>
51
51
  <%= form.hidden_field "remove_#{elem.name}", value: "1", disabled:"disabled", class: 'js-ds-image-remove-flag' if elem.options[:removable]%>
52
- <%= elem.render(self, form, 'form-control-file js-ds-image') do |attr|%>
52
+ <%= elem.render(self, form, 'form-control js-ds-image') do |attr|%>
53
53
  <%= form.file_field(elem.name, attr) %>
54
54
  <%end%>
55
55
  <%= form.hidden_field "#{elem.name}_cache" %>
@@ -59,7 +59,7 @@
59
59
  <%- locale_errors = elem.locale_errors(locale, form) -%>
60
60
  <%= form.globalize_fields_for(locale) do |gform|%>
61
61
  <div class="<%= class_names('ds-globalize-group', 'has-error': locale_errors.present?) %>">
62
- <%= tag.span(elem.lang_attributes('ds-globalize-lang')) do%>
62
+ <%= tag.span(**elem.lang_attributes('ds-globalize-lang')) do%>
63
63
  <%= name %>
64
64
  <%end%>
65
65
  <%= elem.render(self, gform, class_names('form-control', {'is-invalid': locale_errors.present?})) %>
@@ -79,11 +79,10 @@
79
79
  partial: 'dynamic_scaffold/bootstrap/form/cocoon',
80
80
  render_options: { locals: { items: elem.form.items, depth: depth } }
81
81
  ) %>
82
- <% elsif elem.type?(:date_select, :datetime_select) %>
82
+ <% elsif elem.type?(:date_select, :datetime_select, :time_select) %>
83
83
  <div class="form-inline">
84
- <%== elem.render(self, form, class_names('form-control mr-2', {'is-invalid': errors.present?}))
85
- .gsub(/ &mdash; /, '<span class="m-2" style="display: inline-block;">&nbsp;</span>')
86
- .gsub(/ : /, '<span class="mr-2" style="display: inline-block;">:</span>')
84
+ <%== elem.render(self, form, class_names('form-select mr-2 me-2 mb-1', {'is-invalid': errors.present?}))
85
+ .gsub(/^(.*) &mdash; (.*) : (.*)/m, '<div class="mr-3 me-3" style="display: inline-block;">\1</div><div style="display: inline-block;">\2<span class="ds-time-sep">:</span>\3</div>')
87
86
  %>
88
87
  </div>
89
88
  <% elsif elem.type?(:json_object) %>
@@ -92,8 +91,10 @@
92
91
  <%= render 'dynamic_scaffold/bootstrap/form/row', form: child_form, elem: child_elem, depth: depth %>
93
92
  <% end %>
94
93
  <% end %>
94
+ <% elsif elem.type?(:collection_select, :grouped_collection_select) %>
95
+ <%= elem.render(self, form, class_names('form-select', {'is-invalid': errors.present?})) %>
95
96
  <% else %>
96
- <%= elem.render(self, form, class_names('form-control', {'is-invalid': errors.present?})) %>
97
+ <%= elem.render(self, form, class_names('form-control', {'is-invalid': errors.present?}), { autocomplete: 'new-password' }) %>
97
98
  <% end %>
98
99
  <%- elem.insert(:after).each do |block| -%>
99
100
  <%= self.instance_exec(@record, &block) %>
@@ -25,6 +25,7 @@ en:
25
25
  destroy:
26
26
  invalid_foreign_key: 'That item can not be deleted because it has associated record(s).'
27
27
  failed: 'That item can not be deleted'
28
+ count: '%{count} items'
28
29
  views:
29
30
  pagination:
30
31
  truncate: '…'
@@ -25,6 +25,7 @@ ja:
25
25
  destroy:
26
26
  invalid_foreign_key: '関連づいたレコードがあるので削除できません。'
27
27
  failed: '削除に失敗しました。'
28
+ count: '%{count} 件'
28
29
  views:
29
30
  pagination:
30
31
  truncate: '…'
@@ -78,6 +78,7 @@ module DynamicScaffold
78
78
  if @record.save
79
79
  redirect_to dynamic_scaffold_path(:index, request_queries)
80
80
  else
81
+ before_render_form_with_errors(@record)
81
82
  render "#{params[:controller]}/new"
82
83
  end
83
84
  end
@@ -111,6 +112,7 @@ module DynamicScaffold
111
112
  if @record.save
112
113
  redirect_to dynamic_scaffold_path(:index, request_queries)
113
114
  else
115
+ before_render_form_with_errors(@record)
114
116
  render "#{params[:controller]}/edit"
115
117
  end
116
118
  end
@@ -151,5 +151,7 @@ module DynamicScaffold
151
151
  def sort_validation_error_title(record)
152
152
  "ID: #{record.id}"
153
153
  end
154
+
155
+ def before_render_form_with_errors(record); end
154
156
  end
155
157
  end
@@ -178,10 +178,11 @@ module DynamicScaffold
178
178
 
179
179
  protected
180
180
 
181
- def build_html_attributes(classnames)
181
+ def build_html_attributes(classnames, html_attributes = {})
182
182
  classnames_list = @classnames_list
183
183
  classnames_list = [*classnames_list, classnames] if classnames
184
- options = @html_attributes.dup
184
+ # Attributes supplied by the view are defaults; explicit field settings take priority.
185
+ options = html_attributes.stringify_keys.merge(@html_attributes.stringify_keys)
185
186
  options[:class] = classnames_list.join(' ') unless classnames_list.empty?
186
187
  options
187
188
  end
@@ -9,7 +9,9 @@ module DynamicScaffold
9
9
  @block = block
10
10
  end
11
11
 
12
- def render(view, form, classnames = nil)
12
+ # The `block` renders the return value of the block, so html_attributes is not relevant,
13
+ # but it is called with `autocomplete="new-password"` because of the `if` statement in _row.html.erb.
14
+ def render(view, form, classnames = nil, _html_attributes = {})
13
15
  view.instance_exec(form, self, classnames, &@block)
14
16
  end
15
17
  end
@@ -28,8 +28,8 @@ module DynamicScaffold
28
28
  end
29
29
  end
30
30
 
31
- def render(_view, _form, classnames = nil)
32
- html_attributes = build_html_attributes(classnames)
31
+ def render(_view, _form, classnames = nil, html_attributes = {})
32
+ html_attributes = build_html_attributes(classnames, html_attributes)
33
33
  yield(html_attributes)
34
34
  end
35
35
 
@@ -11,8 +11,8 @@ module DynamicScaffold
11
11
  super(config, type, name, html_attributes)
12
12
  end
13
13
 
14
- def render(view, form, classnames = nil)
15
- html_attributes = build_html_attributes(classnames)
14
+ def render(view, form, classnames = nil, html_attributes = {})
15
+ html_attributes = build_html_attributes(classnames, html_attributes)
16
16
  # Retain the value of the password field on error.
17
17
  html_attributes[:value] = form.object.public_send(@name) if @type == :password_field
18
18
  form.public_send(@type, @name, *build_args(view, @args), html_attributes)
@@ -20,8 +20,8 @@ module DynamicScaffold
20
20
  super(config, type, name, html_attributes)
21
21
  end
22
22
 
23
- def render(view, form, classnames = nil)
24
- html_attributes = build_html_attributes(classnames)
23
+ def render(view, form, classnames = nil, html_attributes = {})
24
+ html_attributes = build_html_attributes(classnames, html_attributes)
25
25
  form.public_send(@type, @name, *build_args(view, @args), @options, html_attributes)
26
26
  end
27
27
  end
@@ -4,13 +4,13 @@ module DynamicScaffold
4
4
  module Form
5
5
  module Item
6
6
  class TwoOptionsWithBlock < TwoOptions
7
- def render(view, form, classnames = nil)
7
+ def render(view, form, classnames = nil, html_attributes = {})
8
8
  form.public_send(
9
9
  @type,
10
10
  @name,
11
11
  *build_args(view, @args),
12
12
  @options,
13
- build_html_attributes(classnames)
13
+ build_html_attributes(classnames, html_attributes)
14
14
  ) do |builder|
15
15
  yield builder
16
16
  end
@@ -16,6 +16,7 @@ module DynamicScaffold
16
16
  color_field: Form::Item::SingleOption,
17
17
  number_field: Form::Item::SingleOption,
18
18
  telephone_field: Form::Item::SingleOption,
19
+ datetime_local_field: Form::Item::SingleOption,
19
20
 
20
21
  time_select: Form::Item::TwoOptions,
21
22
  date_select: Form::Item::TwoOptions,
@@ -18,7 +18,11 @@ module DynamicScaffold
18
18
  module ClassMethods
19
19
  def json_object_attributte(attribute_name, model)
20
20
  @json_object_attribute_names << attribute_name
21
- serialize attribute_name, model
21
+ if ActiveRecord.gem_version >= Gem::Version.new('7.1')
22
+ serialize attribute_name, coder: model
23
+ else
24
+ serialize attribute_name, model
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -12,7 +12,7 @@ module DynamicScaffold
12
12
  def dynamic_scaffold_for(*resources)
13
13
  options = resources.extract_options!.dup
14
14
  path = resources[0]
15
- resources path, options.merge(except: %i[show]) do
15
+ resources path, **options.merge(except: %i[show]) do
16
16
  collection do
17
17
  patch :sort, controller: options[:controller]
18
18
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ostruct'
4
+
3
5
  module DynamicScaffold
4
6
  class Title
5
7
  attr_writer :name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DynamicScaffold
4
- VERSION = '2.0.1'
4
+ VERSION = '3.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masamoto Miyata
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-01-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: classnames-rails-view
@@ -38,6 +37,20 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '1.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: ostruct
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
41
54
  - !ruby/object:Gem::Dependency
42
55
  name: rails
43
56
  requirement: !ruby/object:Gem::Requirement
@@ -45,9 +58,9 @@ dependencies:
45
58
  - - ">="
46
59
  - !ruby/object:Gem::Version
47
60
  version: '5.0'
48
- - - "<="
61
+ - - "<"
49
62
  - !ruby/object:Gem::Version
50
- version: 6.1.4.4
63
+ version: '8.2'
51
64
  type: :runtime
52
65
  prerelease: false
53
66
  version_requirements: !ruby/object:Gem::Requirement
@@ -55,9 +68,9 @@ dependencies:
55
68
  - - ">="
56
69
  - !ruby/object:Gem::Version
57
70
  version: '5.0'
58
- - - "<="
71
+ - - "<"
59
72
  - !ruby/object:Gem::Version
60
- version: 6.1.4.4
73
+ version: '8.2'
61
74
  - !ruby/object:Gem::Dependency
62
75
  name: capybara
63
76
  requirement: !ruby/object:Gem::Requirement
@@ -188,44 +201,44 @@ dependencies:
188
201
  name: rspec
189
202
  requirement: !ruby/object:Gem::Requirement
190
203
  requirements:
191
- - - '='
204
+ - - "~>"
192
205
  - !ruby/object:Gem::Version
193
- version: '3.10'
206
+ version: '3.13'
194
207
  type: :development
195
208
  prerelease: false
196
209
  version_requirements: !ruby/object:Gem::Requirement
197
210
  requirements:
198
- - - '='
211
+ - - "~>"
199
212
  - !ruby/object:Gem::Version
200
- version: '3.10'
213
+ version: '3.13'
201
214
  - !ruby/object:Gem::Dependency
202
215
  name: rspec-rails
203
216
  requirement: !ruby/object:Gem::Requirement
204
217
  requirements:
205
- - - ">="
218
+ - - "~>"
206
219
  - !ruby/object:Gem::Version
207
- version: '0'
220
+ version: '8.0'
208
221
  type: :development
209
222
  prerelease: false
210
223
  version_requirements: !ruby/object:Gem::Requirement
211
224
  requirements:
212
- - - ">="
225
+ - - "~>"
213
226
  - !ruby/object:Gem::Version
214
- version: '0'
227
+ version: '8.0'
215
228
  - !ruby/object:Gem::Dependency
216
229
  name: rubocop
217
230
  requirement: !ruby/object:Gem::Requirement
218
231
  requirements:
219
232
  - - '='
220
233
  - !ruby/object:Gem::Version
221
- version: 0.75.0
234
+ version: 0.89.1
222
235
  type: :development
223
236
  prerelease: false
224
237
  version_requirements: !ruby/object:Gem::Requirement
225
238
  requirements:
226
239
  - - '='
227
240
  - !ruby/object:Gem::Version
228
- version: 0.75.0
241
+ version: 0.89.1
229
242
  - !ruby/object:Gem::Dependency
230
243
  name: rubocop-rails
231
244
  requirement: !ruby/object:Gem::Requirement
@@ -246,14 +259,14 @@ dependencies:
246
259
  requirements:
247
260
  - - "~>"
248
261
  - !ruby/object:Gem::Version
249
- version: '1.3'
262
+ version: '2.1'
250
263
  type: :development
251
264
  prerelease: false
252
265
  version_requirements: !ruby/object:Gem::Requirement
253
266
  requirements:
254
267
  - - "~>"
255
268
  - !ruby/object:Gem::Version
256
- version: '1.3'
269
+ version: '2.1'
257
270
  description: It is customizable and flexible scaffold who support sort and the pagination.
258
271
  email:
259
272
  - miyata@sincere-co.com
@@ -288,6 +301,7 @@ files:
288
301
  - app/assets/javascripts/dynamic_scaffold/sorter.js
289
302
  - app/assets/stylesheets/dynamic_scaffold/bootstrap3.scss
290
303
  - app/assets/stylesheets/dynamic_scaffold/bootstrap4.scss
304
+ - app/assets/stylesheets/dynamic_scaffold/bootstrap5.scss
291
305
  - app/assets/stylesheets/dynamic_scaffold/common.scss
292
306
  - app/assets/stylesheets/dynamic_scaffold/resplist.scss
293
307
  - app/helpers/dynamic_scaffold_helper.rb
@@ -352,7 +366,6 @@ homepage: https://github.com/gomo/dynamic_scaffold
352
366
  licenses:
353
367
  - MIT
354
368
  metadata: {}
355
- post_install_message:
356
369
  rdoc_options: []
357
370
  require_paths:
358
371
  - lib
@@ -367,8 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
380
  - !ruby/object:Gem::Version
368
381
  version: '0'
369
382
  requirements: []
370
- rubygems_version: 3.2.32
371
- signing_key:
383
+ rubygems_version: 3.6.9
372
384
  specification_version: 4
373
385
  summary: The Scaffold system which dynamically generates CRUD and sort functions.
374
386
  test_files: []