dynamic_scaffold 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/en.yml +11 -1
- data/config/locales/ja.yml +1 -0
- data/lib/dynamic_scaffold/controller.rb +17 -9
- data/lib/dynamic_scaffold/controller_utilities.rb +4 -0
- data/lib/dynamic_scaffold/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 457314cf971c919f920535659152e9062cd0f095c51d3f4626fb12f956bda42e
|
4
|
+
data.tar.gz: a9fe3e3a6041b2dc15d305f291f63d07447427e673988c5acd68313d8f643351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 525cf1961b472037098f5d1425ae9177b2b175712c6c353a2f80692fc630dfa93d082d4d95977a3d2e3f7fc0004053e068ee5481dfd65e34802550482662542f
|
7
|
+
data.tar.gz: 79896456eaaff29d55b69fad3eb63508fe6ceb199f49fdab356f4b76db9373401cb3b4becee9cd682492713c4211616964753ce42df0f6ed9d47eda7ac9e729c
|
data/config/locales/en.yml
CHANGED
@@ -9,12 +9,22 @@ en:
|
|
9
9
|
index: 'List'
|
10
10
|
edit: 'Edit'
|
11
11
|
new: 'Create'
|
12
|
+
button:
|
13
|
+
add: 'Add'
|
14
|
+
edit: 'Edit'
|
15
|
+
save_order: 'Sort'
|
16
|
+
save: 'Save'
|
17
|
+
back: 'Back'
|
12
18
|
message:
|
13
19
|
no_records: '%{model} was not found.'
|
14
20
|
destroy_confirm: 'Are you sure you want to delete this?'
|
15
21
|
confirm_cancel: 'Cancel'
|
16
22
|
confirm_ok: 'OK'
|
23
|
+
sort_error: 'The sort has been failed, because the following record failed to save.'
|
17
24
|
alert:
|
18
25
|
destroy:
|
19
26
|
invalid_foreign_key: 'That item can not be deleted because it has associated record(s).'
|
20
|
-
failed: 'That item can not be deleted'
|
27
|
+
failed: 'That item can not be deleted'
|
28
|
+
views:
|
29
|
+
pagination:
|
30
|
+
truncate: '…'
|
data/config/locales/ja.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module DynamicScaffold
|
4
|
-
module Controller
|
4
|
+
module Controller # rubocop:disable Metrics/ModuleLength
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
include ControllerUtilities
|
7
7
|
|
@@ -137,18 +137,26 @@ module DynamicScaffold
|
|
137
137
|
redirect_to dynamic_scaffold_path(:index, request_queries)
|
138
138
|
end
|
139
139
|
|
140
|
-
def sort
|
140
|
+
def sort # rubocop:disable Metrics/AbcSize
|
141
141
|
pkeys_list = sort_params
|
142
142
|
reset_sequence(pkeys_list.size)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
143
|
+
|
144
|
+
begin
|
145
|
+
dynamic_scaffold.model.transaction do
|
146
|
+
pkeys_list.each do |pkeys|
|
147
|
+
rec = find_record(pkeys.to_hash)
|
148
|
+
next_sec = next_sequence!
|
149
|
+
rec[dynamic_scaffold.list.sorter_attribute] = next_sec
|
150
|
+
yield(rec) if block_given?
|
151
|
+
rec.save!
|
152
|
+
end
|
150
153
|
end
|
154
|
+
rescue ActiveRecord::RecordInvalid => e
|
155
|
+
messages = [I18n.t('dynamic_scaffold.message.sort_error'), '', sort_validation_error_title(e.record)]
|
156
|
+
messages.concat(e.record.errors.full_messages)
|
157
|
+
flash[:dynamic_scaffold_danger] = messages.join('<br>')
|
151
158
|
end
|
159
|
+
|
152
160
|
redirect_to dynamic_scaffold_path(:index, request_queries)
|
153
161
|
end
|
154
162
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masamoto Miyata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: classnames-rails-view
|