bullet_train 1.0.8 → 1.0.12

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: 7c456427f05a6de4ee6550f5b6e0b0631e196774e03375bbf59c5d35a9420755
4
- data.tar.gz: c472262b19400507b36cdbad3699136464d2cdec48e1b24c5a5c011a8f5b337c
3
+ metadata.gz: '086758c1f9cac00d402ebe997e4ff73623d5ea12580cfad21278c8da8bef8ae5'
4
+ data.tar.gz: b4c4d63aa36fa9afc64c18e70b5d99f8cc022101242f5c0fd43dcf1969238e62
5
5
  SHA512:
6
- metadata.gz: 8197df1a2ad180566d7a998dc0ba290c1c67a660c4c755f0aa6ef11ec8e2f60c97481a102d590b5a4b623e1257536b93c2007f72f0a3143829f5ab5f928fe4e9
7
- data.tar.gz: 72ecd65e81e5d69605381baa864370cb003abd6ff7fff44708eefa351f33b7108b9fa9547e9ac1c88ca324a1aef702879dde9a5cd4c83a10f55fe896d36ff75d
6
+ metadata.gz: 4a38b41f6424f60d6d7870d090e9fc6323392d19f3d723c3f3fb452512916a653bd4cd8e0fd13bf71ecd7dd83d8e3c8c6ab1ceb671d91ed93b471c804fdfe3f0
7
+ data.tar.gz: 72fabc14a5b3ea62f6490659ed84631d709dcd859e9711f6e93906d22f959960ef40c9822ed2330f706a1b95b76dbfb15a963f3b7f0e5d0a9f2812cb56f21862
@@ -1,3 +1,3 @@
1
1
  class Account::InvitationsController < Account::ApplicationController
2
- include Invitations::ControllerBase
2
+ include Account::Invitations::ControllerBase
3
3
  end
@@ -1,3 +1,22 @@
1
1
  class Account::MembershipsController < Account::ApplicationController
2
2
  include Account::Memberships::ControllerBase
3
+
4
+ private
5
+
6
+ def permitted_fields
7
+ [
8
+ # 🚅 super scaffolding will insert new fields above this line.
9
+ ]
10
+ end
11
+
12
+ def permitted_arrays
13
+ {
14
+ # 🚅 super scaffolding will insert new arrays above this line.
15
+ }
16
+ end
17
+
18
+ def process_params(strong_params)
19
+ # 🚅 super scaffolding will insert processing for new fields above this line.
20
+ strong_params
21
+ end
3
22
  end
@@ -1,3 +1,22 @@
1
1
  class Account::TeamsController < Account::ApplicationController
2
2
  include Account::Teams::ControllerBase
3
+
4
+ private
5
+
6
+ def permitted_fields
7
+ [
8
+ # 🚅 super scaffolding will insert new fields above this line.
9
+ ]
10
+ end
11
+
12
+ def permitted_arrays
13
+ {
14
+ # 🚅 super scaffolding will insert new arrays above this line.
15
+ }
16
+ end
17
+
18
+ def process_params(strong_params)
19
+ # 🚅 super scaffolding will insert processing for new fields above this line.
20
+ strong_params
21
+ end
3
22
  end
@@ -1,3 +1,22 @@
1
1
  class Account::UsersController < Account::ApplicationController
2
2
  include Account::Users::ControllerBase
3
+
4
+ private
5
+
6
+ def permitted_fields
7
+ [
8
+ # 🚅 super scaffolding will insert new fields above this line.
9
+ ]
10
+ end
11
+
12
+ def permitted_arrays
13
+ {
14
+ # 🚅 super scaffolding will insert new arrays above this line.
15
+ }
16
+ end
17
+
18
+ def process_params(strong_params)
19
+ # 🚅 super scaffolding will insert processing for new fields above this line.
20
+ strong_params
21
+ end
3
22
  end
@@ -112,6 +112,18 @@ module Account::Invitations::ControllerBase
112
112
 
113
113
  private
114
114
 
115
+ def permitted_fields
116
+ raise "It looks like you've removed `permitted_fields` from your controller. This will break Super Scaffolding."
117
+ end
118
+
119
+ def permitted_arrays
120
+ raise "It looks like you've removed `permitted_arrays` from your controller. This will break Super Scaffolding."
121
+ end
122
+
123
+ def process_params(strong_params)
124
+ raise "It looks like you've removed `process_params` from your controller. This will break Super Scaffolding."
125
+ end
126
+
115
127
  def manageable_role_keys
116
128
  helpers.current_membership.manageable_roles.map(&:key)
117
129
  end
@@ -143,8 +155,6 @@ module Account::Invitations::ControllerBase
143
155
 
144
156
  end
145
157
 
146
- # 🚅 super scaffolding will insert processing for new fields above this line.
147
-
148
158
  strong_params
149
159
  end
150
160
  end
@@ -2,7 +2,9 @@ module Account::Memberships::ControllerBase
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- account_load_and_authorize_resource :membership, :team, member_actions: [:demote, :promote, :reinvite], collection_actions: [:search]
5
+ account_load_and_authorize_resource :membership, :team,
6
+ member_actions: [:demote, :promote, :reinvite].merge(defined?(MEMBER_ACTIONS) ? MEMBER_ACTIONS : []),
7
+ collection_actions: [:search].merge(defined?(COLLECTION_ACTIONS) ? COLLECTION_ACTIONS : [])
6
8
  end
7
9
 
8
10
  def index
@@ -104,8 +106,8 @@ module Account::Memberships::ControllerBase
104
106
  :user_first_name,
105
107
  :user_last_name,
106
108
  :user_profile_photo_id,
107
- # 🚅 super scaffolding will insert new fields above this line.
108
- # 🚅 super scaffolding will insert new arrays above this line.
109
+ *permitted_fields,
110
+ *permitted_arrays,
109
111
  )
110
112
 
111
113
  # after that, we have to be more careful how we update the roles.
@@ -131,6 +133,6 @@ module Account::Memberships::ControllerBase
131
133
 
132
134
  # 🚅 super scaffolding will insert processing for new fields above this line.
133
135
 
134
- strong_params
136
+ process_params(strong_params)
135
137
  end
136
138
  end
@@ -2,7 +2,9 @@ module Account::Teams::ControllerBase
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- load_and_authorize_resource :team, class: "Team", prepend: true
5
+ load_and_authorize_resource :team, class: "Team", prepend: true,
6
+ member_actions: (defined?(MEMBER_ACTIONS) ? MEMBER_ACTIONS : []),
7
+ collection_actions: (defined?(COLLECTION_ACTIONS) ? COLLECTION_ACTIONS : [])
6
8
 
7
9
  prepend_before_action do
8
10
  if params["action"] == "new"
@@ -111,16 +113,28 @@ module Account::Teams::ControllerBase
111
113
 
112
114
  private
113
115
 
116
+ def permitted_fields
117
+ raise "It looks like you've removed `permitted_fields` from your controller. This will break Super Scaffolding."
118
+ end
119
+
120
+ def permitted_arrays
121
+ raise "It looks like you've removed `permitted_arrays` from your controller. This will break Super Scaffolding."
122
+ end
123
+
124
+ def process_params(strong_params)
125
+ raise "It looks like you've removed `process_params` from your controller. This will break Super Scaffolding."
126
+ end
127
+
114
128
  # Never trust parameters from the scary internet, only allow the white list through.
115
129
  def team_params
116
- params.require(:team).permit(
117
- :name,
130
+ strong_params = params.require(:team).permit(
131
+ # :name,
118
132
  :time_zone,
119
133
  :locale,
120
- # 🚅 super scaffolding will insert new fields above this line.
121
- # 🚅 super scaffolding will insert new arrays above this line.
134
+ *permitted_fields,
135
+ *permitted_arrays,
122
136
  )
123
137
 
124
- # 🚅 super scaffolding will insert processing for new fields above this line.
138
+ process_params(strong_params)
125
139
  end
126
140
  end
@@ -2,7 +2,9 @@ module Account::Users::ControllerBase
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- load_and_authorize_resource
5
+ load_and_authorize_resource :user, class: "User", prepend: true,
6
+ member_actions: (defined?(MEMBER_ACTIONS) ? MEMBER_ACTIONS : []),
7
+ collection_actions: (defined?(COLLECTION_ACTIONS) ? COLLECTION_ACTIONS : [])
6
8
 
7
9
  before_action do
8
10
  # for magic locales.
@@ -40,24 +42,39 @@ module Account::Users::ControllerBase
40
42
 
41
43
  private
42
44
 
45
+ def permitted_fields
46
+ raise "It looks like you've removed `permitted_fields` from your controller. This will break Super Scaffolding."
47
+ end
48
+
49
+ def permitted_arrays
50
+ raise "It looks like you've removed `permitted_arrays` from your controller. This will break Super Scaffolding."
51
+ end
52
+
53
+ def process_params(strong_params)
54
+ raise "It looks like you've removed `process_params` from your controller. This will break Super Scaffolding."
55
+ end
56
+
43
57
  # Never trust parameters from the scary internet, only allow the white list through.
44
58
  def user_params
45
59
  # TODO enforce permissions on updating the user's team name.
46
- params.require(:user).permit(
47
- :email,
48
- :first_name,
49
- :last_name,
50
- :time_zone,
51
- :current_password,
52
- :password,
53
- :password_confirmation,
54
- :profile_photo_id,
55
- :locale,
56
- # 🚅 super scaffolding will insert new fields above this line.
57
- current_team_attributes: [:name],
58
- # 🚅 super scaffolding will insert new arrays above this line.
60
+ strong_params = params.require(:user).permit(
61
+ *([
62
+ :email,
63
+ :first_name,
64
+ :last_name,
65
+ :time_zone,
66
+ :current_password,
67
+ :password,
68
+ :password_confirmation,
69
+ :profile_photo_id,
70
+ :locale,
71
+ ] + permitted_fields + [
72
+ {
73
+ current_team_attributes: [:name]
74
+ }.merge(permitted_arrays)
75
+ ])
59
76
  )
60
77
 
61
- # 🚅 super scaffolding will insert processing for new fields above this line.
78
+ process_params(strong_params)
62
79
  end
63
80
  end
@@ -0,0 +1,60 @@
1
+ module Records::Base
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ if defined?(Webhooks::Outgoing::IssuingModel)
6
+ include Webhooks::Outgoing::IssuingModel
7
+ end
8
+
9
+ if defined?(ObfuscatesId)
10
+ include ObfuscatesId
11
+ end
12
+
13
+ if defined?(QuestionMethodsFromScopes)
14
+ include QuestionMethodsFromScopes
15
+ end
16
+
17
+ include CableReady::Updatable
18
+ enable_updates
19
+
20
+ extend ActiveHash::Associations::ActiveRecordExtensions
21
+
22
+ # 🏚 i'd like to deprecate these. they're not descriptive enough.
23
+ scope :newest, -> { order("created_at DESC") }
24
+ scope :oldest, -> { order("created_at ASC") }
25
+
26
+ scope :newest_created, -> { order("created_at DESC") }
27
+ scope :oldest_created, -> { order("created_at ASC") }
28
+ scope :newest_updated, -> { order("updated_at DESC") }
29
+ scope :oldest_updated, -> { order("updated_at ASC") }
30
+
31
+ # Microscope adds useful scopes targeting ActiveRecord `boolean`, `date` and `datetime` attributes.
32
+ # https://github.com/mirego/microscope
33
+ acts_as_microscope
34
+ end
35
+
36
+ class_methods do
37
+ # by default we represent methods by their first string attribute.
38
+ def label_attribute
39
+ columns_hash.values.find { |column| column.sql_type_metadata.type == :string }&.name
40
+ end
41
+ end
42
+
43
+ # this is a template method you can override in activerecord models if we shouldn't just use their first string to
44
+ # identify them.
45
+ def label_string
46
+ if (label_attribute = self.class.label_attribute)
47
+ send("#{label_attribute}_was")
48
+ else
49
+ self.class.name.underscore.split("/").last.titleize
50
+ end
51
+ end
52
+
53
+ def parent_collection
54
+ # TODO Try to suggest what the entire method definition should actually be
55
+ # using parent_key below to do so.
56
+ model_name = self.class
57
+ # parent_key = model_name.reflect_on_all_associations(:belongs_to).first.name
58
+ raise "You're trying to use a feature that requires #{model_name} to have a `collection` method defined that returns the Active Record association that this model belongs to within its parent object."
59
+ end
60
+ end
@@ -0,0 +1 @@
1
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
@@ -35,6 +35,7 @@
35
35
  <% end %>
36
36
  <% end %>
37
37
 
38
+ <%= render "account/memberships/fields", membership: membership, form: form %>
38
39
  <%# 🚅 super scaffolding will insert new fields above this line. %>
39
40
 
40
41
  <div class="buttons">
@@ -0,0 +1 @@
1
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
@@ -12,6 +12,7 @@
12
12
  <%= render 'shared/fields/buttons', method: :locale, options: t("locale.locales") %>
13
13
  <% end %>
14
14
 
15
+ <%= render "account/teams/fields", team: team, form: form %>
15
16
  <%# 🚅 super scaffolding will insert new fields above this line. %>
16
17
  <% end %>
17
18
 
@@ -0,0 +1 @@
1
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
@@ -30,6 +30,9 @@
30
30
  <%= render 'shared/fields/buttons', method: :locale, options: {"": t("locale.default")}.merge(t("locale.locales")) %>
31
31
  </div>
32
32
  <% end %>
33
+
34
+ <%= render "account/users/fields", user: user, form: form %>
35
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
33
36
  </div>
34
37
  <% end %>
35
38
 
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.12"
3
3
  end
data/lib/bullet_train.rb CHANGED
@@ -2,5 +2,5 @@ require "bullet_train/version"
2
2
  require "bullet_train/engine"
3
3
 
4
4
  module BulletTrain
5
- # Your code goes here...
5
+ mattr_accessor :routing_concerns, default: []
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-31 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -75,6 +75,7 @@ files:
75
75
  - app/mailers/user_mailer.rb
76
76
  - app/models/concerns/invitations/base.rb
77
77
  - app/models/concerns/memberships/base.rb
78
+ - app/models/concerns/records/base.rb
78
79
  - app/models/concerns/teams/base.rb
79
80
  - app/models/concerns/users/base.rb
80
81
  - app/models/invitation.rb
@@ -93,6 +94,7 @@ files:
93
94
  - app/views/account/invitations/show.html.erb
94
95
  - app/views/account/invitations/show.json.jbuilder
95
96
  - app/views/account/memberships/_breadcrumbs.html.erb
97
+ - app/views/account/memberships/_fields.html.erb
96
98
  - app/views/account/memberships/_form.html.erb
97
99
  - app/views/account/memberships/_index.html.erb
98
100
  - app/views/account/memberships/_menu_item.html.erb
@@ -103,6 +105,7 @@ files:
103
105
  - app/views/account/onboarding/user_details/edit.html.erb
104
106
  - app/views/account/onboarding/user_email/edit.html.erb
105
107
  - app/views/account/teams/_breadcrumbs.html.erb
108
+ - app/views/account/teams/_fields.html.erb
106
109
  - app/views/account/teams/_form.html.erb
107
110
  - app/views/account/teams/_index.html.erb
108
111
  - app/views/account/teams/_menu_item.html.erb
@@ -116,6 +119,7 @@ files:
116
119
  - app/views/account/two_factors/create.js.erb
117
120
  - app/views/account/two_factors/destroy.js.erb
118
121
  - app/views/account/users/_breadcrumbs.html.erb
122
+ - app/views/account/users/_fields.html.erb
119
123
  - app/views/account/users/_form.html.erb
120
124
  - app/views/account/users/edit.html.erb
121
125
  - app/views/account/users/show.html.erb