rails_base 0.73.1 → 0.75.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 +4 -4
- data/README.md +1 -4
- data/app/models/rails_base/application_record.rb +3 -0
- data/app/views/layouts/rails_base/application.html.erb +6 -0
- data/app/views/rails_base/shared/_admin_actions_modal.html.erb +1 -1
- data/lib/rails_base/configuration/appearance.rb +4 -1
- data/lib/rails_base/configuration/display/footer.rb +0 -1
- data/lib/rails_base/configuration/display/header.rb +20 -0
- data/lib/rails_base/engine.rb +2 -6
- data/lib/rails_base/version.rb +2 -2
- data/lib/rails_base.rb +25 -8
- metadata +49 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b7cc4c99a8861e23a405fee9f95898fb74a1e38a441f5b9dc9a84206d56230c
|
4
|
+
data.tar.gz: 4b8a5e9aed889ca066714baf9cec49dd3b46799abfbd9ec7e8d6a4bb04e6fcea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8413635e485186527c947d21a2cc9cf82e07952fd48c21508c7b17a6ccfb8a839b82e4af9621d2a5590c621e634d5179b7eb8ac3c268f12864d259c3afec36b
|
7
|
+
data.tar.gz: a24bb797c8f39f9b4b2ed4ceab735fdd0f4cd47d892dfdfa026ba553868119d0a0dea49d44b8934f30bb5f1723c02eeb533949638c501d27b5092936219ced4f
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# RailsBase
|
2
2
|
Authentication is hard. Admin capabilties are hard. Two Factor Authentication is hard. Why rebuild that for every app that you make?
|
3
3
|
|
4
|
-
The intent of RailsBase is to centralize
|
4
|
+
The intent of RailsBase is to centralize all of this data so that you can focus on what actually matters -- Shipping your Rails Applicaion.
|
5
5
|
|
6
6
|
## Usage
|
7
7
|
Take a look at the [RailsBase Wiki](https://github.com/matt-taylor/rails_base/wiki/Basic-Setup).
|
@@ -25,8 +25,5 @@ Or install it yourself as:
|
|
25
25
|
$ gem install rails_base
|
26
26
|
```
|
27
27
|
|
28
|
-
## Contributing
|
29
|
-
Contribution directions go here.
|
30
|
-
|
31
28
|
## License
|
32
29
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -109,6 +109,12 @@
|
|
109
109
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
110
110
|
<span aria-hidden="true">×</span>
|
111
111
|
</button>
|
112
|
+
</div>
|
113
|
+
<% if partial = RailsBase.config.appearance.header.partial %>
|
114
|
+
<%= render partial: partial %>
|
115
|
+
<% end %>
|
116
|
+
<div >
|
117
|
+
|
112
118
|
</div>
|
113
119
|
<div class="p-1">
|
114
120
|
<%= yield %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
</button>
|
10
10
|
</div>
|
11
11
|
<div class="modal-body">
|
12
|
-
<h5> Admins have made actions recently on your account.
|
12
|
+
<h5> Admins have made actions recently on your account. Acknowledge to clear alert. </h5>
|
13
13
|
</br>
|
14
14
|
<% @__admin_actions_array.reverse.each do |action, time| %>
|
15
15
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
@@ -10,6 +10,7 @@ require 'rails_base/configuration/display/btn_secondary'
|
|
10
10
|
require 'rails_base/configuration/display/btn_success'
|
11
11
|
require 'rails_base/configuration/display/btn_warning'
|
12
12
|
require 'rails_base/configuration/display/footer'
|
13
|
+
require 'rails_base/configuration/display/header'
|
13
14
|
require 'rails_base/configuration/display/navbar'
|
14
15
|
require 'rails_base/configuration/display/table_body'
|
15
16
|
require 'rails_base/configuration/display/table_header'
|
@@ -42,10 +43,11 @@ module RailsBase
|
|
42
43
|
:text,
|
43
44
|
:card,
|
44
45
|
:footer,
|
46
|
+
:header,
|
45
47
|
:back_to_top,
|
46
48
|
] + BUTTONS
|
47
49
|
|
48
|
-
SKIP_DOWNSTREAM_CLASSES = [:footer, :back_to_top]
|
50
|
+
SKIP_DOWNSTREAM_CLASSES = [:footer, :header, :back_to_top]
|
49
51
|
DARK_MODE = :dark
|
50
52
|
LIGHT_MODE = :light
|
51
53
|
MATCH_OS = :match_os
|
@@ -92,6 +94,7 @@ module RailsBase
|
|
92
94
|
@text = Configuration::Display::Text.new
|
93
95
|
@card = Configuration::Display::Card.new
|
94
96
|
@footer = Configuration::Display::Footer.new
|
97
|
+
@header = Configuration::Display::Header.new
|
95
98
|
@back_to_top = Configuration::Display::BackTotop.new
|
96
99
|
@bg_light = Configuration::Display::BgLight.new
|
97
100
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class Header < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
partial: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: nil,
|
12
|
+
description: "Rails partial to render at the header."
|
13
|
+
},
|
14
|
+
}
|
15
|
+
|
16
|
+
attr_accessor *DEFAULT_VALUES.keys
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/rails_base/engine.rb
CHANGED
@@ -23,15 +23,11 @@ module RailsBase
|
|
23
23
|
RailsBase::Configuration::Base._unset_allow_write! if RailsBase.___execute_initializer___?
|
24
24
|
end
|
25
25
|
|
26
|
-
initializer 'rails_base.magic_convenience_methods.model',
|
26
|
+
initializer 'rails_base.magic_convenience_methods.model', before: 'after_initialize' do |app|
|
27
27
|
if RailsBase.___execute_initializer___?
|
28
|
-
# need to eager load Models
|
29
|
-
Rails.application.eager_load!
|
30
|
-
|
31
|
-
# create a connection
|
32
28
|
ActiveRecord::Base.retrieve_connection
|
33
29
|
|
34
|
-
#explicitly load engine routes
|
30
|
+
# explicitly load engine routes
|
35
31
|
RailsBase::ApplicationRecord.descendants.each do |model|
|
36
32
|
model._magically_defined_time_objects
|
37
33
|
end
|
data/lib/rails_base/version.rb
CHANGED
data/lib/rails_base.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rails_base/engine"
|
2
2
|
|
3
3
|
# explicitly require gems that provide assets
|
4
|
-
# when engine loads, this adds assets to Main apps
|
4
|
+
# when engine loads, this adds assets to Main apps assets pipeline
|
5
5
|
# (Only a problem for lazy loaded non prod ENVs)
|
6
6
|
require 'jquery_mask_rails'
|
7
7
|
require 'allow_numeric'
|
@@ -19,7 +19,7 @@ require 'rails_base/config'
|
|
19
19
|
module RailsBase
|
20
20
|
|
21
21
|
def self.___execute_initializer___?
|
22
|
-
# Fixes rails 6 changes to ARGV's -- dont
|
22
|
+
# Fixes rails 6 changes to ARGV's -- dont rerun initializers during rake tasks
|
23
23
|
return false if Rake.application.top_level_tasks.any? { |task| task.include?(":") } rescue nil
|
24
24
|
|
25
25
|
# Only execute when not doing DB actions
|
@@ -27,7 +27,7 @@ module RailsBase
|
|
27
27
|
boolean = false if boolean && ARGV[0]&.include?('db') # when its the DB rake tasks
|
28
28
|
boolean = false if boolean && ARGV[0]&.include?('asset') # when its an asset
|
29
29
|
boolean = false if boolean && ARGV[0]&.include?(':') # else this delim should never be included
|
30
|
-
boolean = false if ENV['SKIP_CUSTOM_INIT']=='true' # explicitly set the variable to skip shit
|
30
|
+
boolean = false if ENV['SKIP_CUSTOM_INIT'] == 'true' # explicitly set the variable to skip shit
|
31
31
|
|
32
32
|
boolean
|
33
33
|
end
|
@@ -41,11 +41,7 @@ module RailsBase
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.default_app_name
|
44
|
-
|
45
|
-
::Rails.application.class.module_parent_name
|
46
|
-
else
|
47
|
-
::Rails.application.class.parent_name
|
48
|
-
end
|
44
|
+
::Rails.application.class.module_parent_name
|
49
45
|
end
|
50
46
|
|
51
47
|
def self.route_exist?(path)
|
@@ -73,5 +69,26 @@ module RailsBase
|
|
73
69
|
config.reset_config!
|
74
70
|
end
|
75
71
|
|
72
|
+
# This method allows the downstream service to explicitly set the paths to reload
|
73
|
+
# This can be very useful if you want to add new methods to already defined classes from RailsBase
|
74
|
+
# EG: You want to add a new method to the User Model
|
75
|
+
# EG: You want to overload a method for the services/rails_base/name_change.rb
|
76
|
+
def self.reloadable_paths!(relative_path:, skip_files: [])
|
77
|
+
unless Array === skip_files
|
78
|
+
raise ArgumentError, "When `skip_files` provided, it is expected to be an array"
|
79
|
+
end
|
80
|
+
|
81
|
+
overrides = Rails.root.join(relative_path)
|
82
|
+
Rails.autoloaders.main.ignore(overrides)
|
83
|
+
|
84
|
+
Rails.configuration.to_prepare do
|
85
|
+
Dir.glob("#{overrides}/**/*.rb").sort.each do |override|
|
86
|
+
next if skip_files.any? { override.include?(_1) }
|
87
|
+
|
88
|
+
load override
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
76
93
|
AdminStruct = Struct.new(:original_attribute, :new_attribute, :user)
|
77
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.75.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: zeitwerk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.6.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.6.5
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: mysql2
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,20 +226,6 @@ dependencies:
|
|
212
226
|
- - ">="
|
213
227
|
- !ruby/object:Gem::Version
|
214
228
|
version: '0'
|
215
|
-
- !ruby/object:Gem::Dependency
|
216
|
-
name: dalli
|
217
|
-
requirement: !ruby/object:Gem::Requirement
|
218
|
-
requirements:
|
219
|
-
- - ">="
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
version: '0'
|
222
|
-
type: :runtime
|
223
|
-
prerelease: false
|
224
|
-
version_requirements: !ruby/object:Gem::Requirement
|
225
|
-
requirements:
|
226
|
-
- - ">="
|
227
|
-
- !ruby/object:Gem::Version
|
228
|
-
version: '0'
|
229
229
|
- !ruby/object:Gem::Dependency
|
230
230
|
name: browser
|
231
231
|
requirement: !ruby/object:Gem::Requirement
|
@@ -367,7 +367,35 @@ dependencies:
|
|
367
367
|
- !ruby/object:Gem::Version
|
368
368
|
version: '0'
|
369
369
|
- !ruby/object:Gem::Dependency
|
370
|
-
name:
|
370
|
+
name: pry
|
371
|
+
requirement: !ruby/object:Gem::Requirement
|
372
|
+
requirements:
|
373
|
+
- - ">="
|
374
|
+
- !ruby/object:Gem::Version
|
375
|
+
version: '0'
|
376
|
+
type: :development
|
377
|
+
prerelease: false
|
378
|
+
version_requirements: !ruby/object:Gem::Requirement
|
379
|
+
requirements:
|
380
|
+
- - ">="
|
381
|
+
- !ruby/object:Gem::Version
|
382
|
+
version: '0'
|
383
|
+
- !ruby/object:Gem::Dependency
|
384
|
+
name: pry-nav
|
385
|
+
requirement: !ruby/object:Gem::Requirement
|
386
|
+
requirements:
|
387
|
+
- - ">="
|
388
|
+
- !ruby/object:Gem::Version
|
389
|
+
version: '0'
|
390
|
+
type: :development
|
391
|
+
prerelease: false
|
392
|
+
version_requirements: !ruby/object:Gem::Requirement
|
393
|
+
requirements:
|
394
|
+
- - ">="
|
395
|
+
- !ruby/object:Gem::Version
|
396
|
+
version: '0'
|
397
|
+
- !ruby/object:Gem::Dependency
|
398
|
+
name: pry-stack_explorer
|
371
399
|
requirement: !ruby/object:Gem::Requirement
|
372
400
|
requirements:
|
373
401
|
- - ">="
|
@@ -580,6 +608,7 @@ files:
|
|
580
608
|
- lib/rails_base/configuration/display/btn_warning.rb
|
581
609
|
- lib/rails_base/configuration/display/card.rb
|
582
610
|
- lib/rails_base/configuration/display/footer.rb
|
611
|
+
- lib/rails_base/configuration/display/header.rb
|
583
612
|
- lib/rails_base/configuration/display/navbar.rb
|
584
613
|
- lib/rails_base/configuration/display/table_body.rb
|
585
614
|
- lib/rails_base/configuration/display/table_header.rb
|
@@ -617,7 +646,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
617
646
|
- !ruby/object:Gem::Version
|
618
647
|
version: '0'
|
619
648
|
requirements: []
|
620
|
-
rubygems_version: 3.
|
649
|
+
rubygems_version: 3.4.19
|
621
650
|
signing_key:
|
622
651
|
specification_version: 4
|
623
652
|
summary: Rails engine that takes care of the stuff you dont want to!
|