bullet_train 1.3.21 → 1.3.23

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: 0bd65c9439489fabb38d86f03b70a4483de90b810664a9e6d6449d5b70197525
4
- data.tar.gz: d736aa3ce04d0631dc266d45ba99d12be8533b424352c0123f9e65b8103d770c
3
+ metadata.gz: 69fb638be13d9c3fbdba294e923647b5fb0829f91310cd6b074392a9cccdb1b9
4
+ data.tar.gz: 5a04389c3d325a38daade6b53ddd76da939c2fd1600d431954c054da346aafc3
5
5
  SHA512:
6
- metadata.gz: 41d6586cfe91972ac76797039864439843b1946df4071c2900e6cfcf1e4ef593dc1423ef1e0274a578553f13e708fd426e1a3855c419a488a7c553f6305a0bdc
7
- data.tar.gz: e3b364be2ae23ac494e8d919b33796b52238d9f4708f06112f5235b017a488f3ef539332492c23d5686dc8a98203fbca8caf3659ced41874201cb8e5d94c359e
6
+ metadata.gz: aa22da5d6f03596473026371eee473ad9607c2424d411b489dd1f292ea569022d0d3c1ea23217b923991f85df9e01b6472bc7a387707645764075496ba8e7d8c
7
+ data.tar.gz: 1c1c1c7f22760d42593f4b156734c59b01c56915b9783672261268d86d596fcd2ec4b2307074a4e207c89758b57824b6868a8ef08945da0a3735ebd979fd3e8b
@@ -0,0 +1,24 @@
1
+ class Address < ApplicationRecord
2
+ extend ActiveHash::Associations::ActiveRecordExtensions
3
+
4
+ include Addresses::Base
5
+ # 🚅 add concerns above.
6
+
7
+ # 🚅 add belongs_to associations above.
8
+
9
+ # 🚅 add has_many associations above.
10
+
11
+ # 🚅 add oauth providers above.
12
+
13
+ # 🚅 add has_one associations above.
14
+
15
+ # 🚅 add scopes above.
16
+
17
+ # 🚅 add validations above.
18
+
19
+ # 🚅 add callbacks above.
20
+
21
+ # 🚅 add delegations above.
22
+
23
+ # 🚅 add methods above.
24
+ end
@@ -0,0 +1,22 @@
1
+ class Addresses::Continent < ApplicationHash
2
+ include Addresses::Continents::Base
3
+ # 🚅 add concerns above.
4
+
5
+ # 🚅 add belongs_to associations above.
6
+
7
+ # 🚅 add has_many associations above.
8
+
9
+ # 🚅 add oauth providers above.
10
+
11
+ # 🚅 add has_one associations above.
12
+
13
+ # 🚅 add scopes above.
14
+
15
+ # 🚅 add validations above.
16
+
17
+ # 🚅 add callbacks above.
18
+
19
+ # 🚅 add delegations above.
20
+
21
+ # 🚅 add methods above.
22
+ end
@@ -0,0 +1,22 @@
1
+ class Addresses::Country < ApplicationHash
2
+ include Addresses::Countries::Base
3
+ # 🚅 add concerns above.
4
+
5
+ # 🚅 add belongs_to associations above.
6
+
7
+ # 🚅 add has_many associations above.
8
+
9
+ # 🚅 add oauth providers above.
10
+
11
+ # 🚅 add has_one associations above.
12
+
13
+ # 🚅 add scopes above.
14
+
15
+ # 🚅 add validations above.
16
+
17
+ # 🚅 add callbacks above.
18
+
19
+ # 🚅 add delegations above.
20
+
21
+ # 🚅 add methods above.
22
+ end
@@ -0,0 +1,22 @@
1
+ class Addresses::Region < ApplicationHash
2
+ include Addresses::Regions::Base
3
+ # 🚅 add concerns above.
4
+
5
+ # 🚅 add belongs_to associations above.
6
+
7
+ # 🚅 add has_many associations above.
8
+
9
+ # 🚅 add oauth providers above.
10
+
11
+ # 🚅 add has_one associations above.
12
+
13
+ # 🚅 add scopes above.
14
+
15
+ # 🚅 add validations above.
16
+
17
+ # 🚅 add callbacks above.
18
+
19
+ # 🚅 add delegations above.
20
+
21
+ # 🚅 add methods above.
22
+ end
@@ -0,0 +1,22 @@
1
+ class Addresses::Subcontinent < ApplicationHash
2
+ include Addresses::Subcontinents::Base
3
+ # 🚅 add concerns above.
4
+
5
+ # 🚅 add belongs_to associations above.
6
+
7
+ # 🚅 add has_many associations above.
8
+
9
+ # 🚅 add oauth providers above.
10
+
11
+ # 🚅 add has_one associations above.
12
+
13
+ # 🚅 add scopes above.
14
+
15
+ # 🚅 add validations above.
16
+
17
+ # 🚅 add callbacks above.
18
+
19
+ # 🚅 add delegations above.
20
+
21
+ # 🚅 add methods above.
22
+ end
@@ -0,0 +1,18 @@
1
+ module Addresses::Base
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ belongs_to :addressable, polymorphic: true
6
+ belongs_to :country, class_name: "Addresses::Country"
7
+ belongs_to :region, class_name: "Addresses::Region"
8
+
9
+ def valid_address?
10
+ address_one? && city? && region_id? && country_id? && postal_code?
11
+ end
12
+
13
+ def all_blank?(attributes = {})
14
+ return super(attributes) unless attributes.empty?
15
+ !(address_one? || address_two? || city? || region_id? || country_id? || postal_code?)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ module Addresses::Continents::Base
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ self.data = JSON.parse(File.read(File.expand_path("../../../../../config/addresses/countries.json", File.dirname(__FILE__)))).map { |row| {id: row["region"], name: row["region"]} }.select { |row| row[:name].present? }.uniq
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Addresses::Countries::Base
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ self.data = JSON.parse(File.read(File.expand_path("../../../../../config/addresses/countries.json", File.dirname(__FILE__))))
6
+
7
+ has_many :regions, class_name: "Addresses::Region"
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module Addresses::Regions::Base
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ self.data = JSON.parse(File.read(File.expand_path("../../../../../config/addresses/states.json", File.dirname(__FILE__))))
6
+
7
+ belongs_to :country, class_name: "Addresses::Country"
8
+
9
+ def modified_state_code
10
+ state_code.scan(/\D/).empty? ? name : state_code
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module Addresses::Subcontinents::Base
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ self.data = JSON.parse(File.read(File.expand_path("../../../../../config/addresses/countries.json", File.dirname(__FILE__)))).map { |row| {id: row["subregion"], name: row["subregion"]} }.select { |row| row[:name].present? }.uniq
6
+ end
7
+ end
@@ -78,5 +78,14 @@ module Records::Base
78
78
  Rake::Task.task_defined?("db:seed") && Rake::Task["db:seed"].already_invoked
79
79
  end
80
80
 
81
+ def all_blank?(attributes = {})
82
+ attributes = self.attributes if attributes.empty?
83
+ attributes.all? do |key, value|
84
+ key == "_destroy" || value.blank? ||
85
+ value.is_a?(Hash) && all_blank?(value) ||
86
+ value.is_a?(Array) && value.all? { |val| all_blank?(val) }
87
+ end
88
+ end
89
+
81
90
  ActiveSupport.run_load_hooks :bullet_train_records_base, self
82
91
  end
@@ -10,11 +10,11 @@
10
10
 
11
11
  <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-2">
12
12
  <div class="sm:col-span-1">
13
- <%= render 'shared/fields/text_field', form: f, method: :first_name, options: {autofocus: true} %>
13
+ <%= render 'shared/fields/text_field', form: f, method: :first_name, other_options: {required: true}, options: {autofocus: true} %>
14
14
  </div>
15
15
 
16
16
  <div class="sm:col-span-1">
17
- <%= render 'shared/fields/text_field', form: f, method: :last_name %>
17
+ <%= render 'shared/fields/text_field', form: f, method: :last_name, other_options: {required: true} %>
18
18
  </div>
19
19
 
20
20
  <% # only edit the team name if this user is an admin and they are the first user. %>
@@ -30,7 +30,7 @@
30
30
  <div class="sm:col-span-2">
31
31
  <%= render 'shared/fields/super_select', form: f, method: :time_zone,
32
32
  choices: time_zone_options_for_select(@user.time_zone, nil, ActiveSupport::TimeZone),
33
- other_options: {search: true} %>
33
+ other_options: {search: true, required: true} %>
34
34
  </div>
35
35
  </div>
36
36
 
@@ -11,8 +11,8 @@
11
11
  <% end %>
12
12
  <% end %>
13
13
 
14
- <%if action_name == 'edit' %>
14
+ <% if (action_name == 'edit' && controller_name == 'teams') %>
15
15
  <%= render 'account/shared/breadcrumb', label: t('.team_settings') %>
16
- <%else %>
16
+ <% else %>
17
17
  <%= render 'account/shared/breadcrumbs/actions', only_for: 'teams' %>
18
18
  <% end %>
@@ -17,7 +17,7 @@
17
17
  <%= render 'shared/fields/password_field', form: f, method: :password, options: {show_strength_indicator: true} %>
18
18
  </div>
19
19
  <div>
20
- <%= render 'shared/fields/password_field', form: f, method: :password_confirmation, other_options: {error: f.object.errors.full_messages_for(:password).first, hide_custom_error: true} %>
20
+ <%= render 'shared/fields/password_field', form: f, method: :password_confirmation, other_options: {required: true, error: f.object.errors.full_messages_for(:password).first, hide_custom_error: true} %>
21
21
  </div>
22
22
  </div>
23
23