bullet_train-super_scaffolding 1.2.11 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 175742fbb3b9512721c4250562fc533f6c43cf630f3c277345d59d61538a3364
4
- data.tar.gz: 83933564920e87dc260767af664fcba01894f1484d76ed93c8288742705071f1
3
+ metadata.gz: 2b891afd2ffdfb5c960dc409911d2fce58515ffc2b4a86ca25f848cbb9550489
4
+ data.tar.gz: 39250a644ffabfa4c0095a3cf8276e13822edb5f827a4cfa2ed55ca6a57a5493
5
5
  SHA512:
6
- metadata.gz: 5e9a5613d412175f70bd8cdedd9a2aa91cee42a96fefdf0b16ec5862276ef09f0f0f664062b0968d197a5a1b986b7b7f25e154422736f1c3fd5d4026cafe1784
7
- data.tar.gz: 1d004de2a792cdd6d0d39f65842aa5ef161c4018d681beb5579737c1191b95411bcea4b2adeeb3561c14b34b69b389bcf8dc01025d2f6612b96d6f300445871a
6
+ metadata.gz: dd0c77206a5ff177586b7dc43a158b632e4156e615fca4e5768733c23b8ae0556165c1257421dbb14df91657f95e46feaa55e1c63c62ea31546b02dc7463be6f
7
+ data.tar.gz: c4e23f16581652f1808068b87e28be3affd35aad6f81d1724eaa950b55a845f44266d625557da7972aae0a45ea9550ca7689625339986d186ce644711fd35b84
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.2.11"
3
+ VERSION = "1.2.13"
4
4
  end
5
5
  end
@@ -498,9 +498,20 @@ class Scaffolding::Transformer
498
498
  def add_ability_line_to_roles_yml(class_names = nil)
499
499
  model_names = class_names || [child]
500
500
  role_file = "./config/models/roles.yml"
501
+ roles_hash = YAML.load_file(role_file)
502
+ default_role_placements = [
503
+ [:default, :models],
504
+ [:admin, :models]
505
+ ]
506
+
501
507
  model_names.each do |model_name|
502
- Scaffolding::FileManipulator.add_line_to_yml_file(role_file, "#{model_name}: read", [:default, :models])
503
- Scaffolding::FileManipulator.add_line_to_yml_file(role_file, "#{model_name}: manage", [:admin, :models])
508
+ default_role_placements.each do |role_placement|
509
+ stringified_role_placement = role_placement.map { |placement| placement.to_s }
510
+ if roles_hash.dig(*stringified_role_placement)[model_name].nil?
511
+ role_type = (role_placement.first == :admin) ? "manage" : "read"
512
+ Scaffolding::FileManipulator.add_line_to_yml_file(role_file, "#{model_name}: #{role_type}", role_placement)
513
+ end
514
+ end
504
515
  end
505
516
  end
506
517
 
@@ -711,6 +722,8 @@ class Scaffolding::Transformer
711
722
  "text"
712
723
  when "text_area"
713
724
  "text"
725
+ when "number_field"
726
+ "number"
714
727
  when "file_field"
715
728
  "file"
716
729
  when "password_field"
data/lib/scaffolding.rb CHANGED
@@ -16,6 +16,7 @@ module Scaffolding
16
16
  "email_field",
17
17
  "emoji_field",
18
18
  "file_field",
19
+ "number_field",
19
20
  "options",
20
21
  "password_field",
21
22
  "phone_field",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-super_scaffolding
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.11
4
+ version: 1.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-15 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard