rails_base 0.51.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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +32 -0
- data/Rakefile +32 -0
- data/app/assets/config/rails_base/manifest.js +3 -0
- data/app/assets/images/rails_base/favicon.ico +0 -0
- data/app/assets/javascripts/rails_base/admin.js +2 -0
- data/app/assets/javascripts/rails_base/application.js +22 -0
- data/app/assets/javascripts/rails_base/cable.js +13 -0
- data/app/assets/javascripts/rails_base/mfa_auth.coffee +3 -0
- data/app/assets/javascripts/rails_base/secondary_authentication.coffee +3 -0
- data/app/assets/javascripts/rails_base/sessions.js +152 -0
- data/app/assets/javascripts/rails_base/user_settings.coffee +3 -0
- data/app/assets/stylesheets/rails_base/admin.css +4 -0
- data/app/assets/stylesheets/rails_base/application.scss +15 -0
- data/app/assets/stylesheets/rails_base/mfa_auth.scss +3 -0
- data/app/assets/stylesheets/rails_base/scaffolds.scss +84 -0
- data/app/assets/stylesheets/rails_base/secondary_authentication.scss +3 -0
- data/app/assets/stylesheets/rails_base/user_settings.scss +3 -0
- data/app/controllers/rails_base/admin_controller.rb +315 -0
- data/app/controllers/rails_base/application_controller.rb +153 -0
- data/app/controllers/rails_base/errors_controller.rb +29 -0
- data/app/controllers/rails_base/mfa_auth_controller.rb +50 -0
- data/app/controllers/rails_base/secondary_authentication_controller.rb +224 -0
- data/app/controllers/rails_base/switch_user_controller.rb +29 -0
- data/app/controllers/rails_base/user_settings_controller.rb +81 -0
- data/app/controllers/rails_base/users/passwords_controller.rb +19 -0
- data/app/controllers/rails_base/users/registrations_controller.rb +80 -0
- data/app/controllers/rails_base/users/sessions_controller.rb +108 -0
- data/app/helpers/rails_base/admin_helper.rb +107 -0
- data/app/helpers/rails_base/appearance_helper.rb +58 -0
- data/app/helpers/rails_base/application_helper.rb +26 -0
- data/app/helpers/rails_base/capture_reference_helper.rb +57 -0
- data/app/helpers/rails_base/mfa_auth_helper.rb +2 -0
- data/app/helpers/rails_base/secondary_authentication_helper.rb +2 -0
- data/app/helpers/rails_base/user_field_validators.rb +108 -0
- data/app/helpers/rails_base/user_settings_helper.rb +22 -0
- data/app/jobs/rails_base/application_job.rb +10 -0
- data/app/jobs/twilio_job.rb +9 -0
- data/app/mailers/rails_base/application_mailer.rb +9 -0
- data/app/mailers/rails_base/email_verification_mailer.rb +22 -0
- data/app/mailers/rails_base/event_mailer.rb +16 -0
- data/app/models/admin_action.rb +119 -0
- data/app/models/rails_base/application_record.rb +22 -0
- data/app/models/rails_base/user_constants.rb +28 -0
- data/app/models/secret.rb +37 -0
- data/app/models/short_lived_data.rb +132 -0
- data/app/models/user.rb +143 -0
- data/app/services/rails_base/admin_risky_mfa_send.rb +80 -0
- data/app/services/rails_base/admin_update_attribute.rb +100 -0
- data/app/services/rails_base/authentication/authenticate_user.rb +28 -0
- data/app/services/rails_base/authentication/constants.rb +60 -0
- data/app/services/rails_base/authentication/decision_twofa_type.rb +76 -0
- data/app/services/rails_base/authentication/destroy_user.rb +45 -0
- data/app/services/rails_base/authentication/mfa_set_encrypt_token.rb +32 -0
- data/app/services/rails_base/authentication/mfa_validator.rb +88 -0
- data/app/services/rails_base/authentication/modify_password.rb +67 -0
- data/app/services/rails_base/authentication/send_forgot_password.rb +26 -0
- data/app/services/rails_base/authentication/send_login_mfa_to_user.rb +77 -0
- data/app/services/rails_base/authentication/send_verification_email.rb +103 -0
- data/app/services/rails_base/authentication/session_token_verifier.rb +31 -0
- data/app/services/rails_base/authentication/single_sign_on_create.rb +44 -0
- data/app/services/rails_base/authentication/single_sign_on_send.rb +101 -0
- data/app/services/rails_base/authentication/single_sign_on_verify.rb +42 -0
- data/app/services/rails_base/authentication/sso_verify_email.rb +43 -0
- data/app/services/rails_base/authentication/update_phone_send_verification.rb +46 -0
- data/app/services/rails_base/authentication/verify_forgot_password.rb +46 -0
- data/app/services/rails_base/email_change.rb +20 -0
- data/app/services/rails_base/encryption.rb +87 -0
- data/app/services/rails_base/name_change.rb +71 -0
- data/app/services/rails_base/service_base.rb +65 -0
- data/app/services/rails_base/service_logging.rb +23 -0
- data/app/views/layouts/rails_base/application.html.erb +185 -0
- data/app/views/layouts/rails_base/mailer.html.erb +13 -0
- data/app/views/layouts/rails_base/mailer.text.erb +1 -0
- data/app/views/new.html.erb +4 -0
- data/app/views/rails_base/admin/history.html.erb +26 -0
- data/app/views/rails_base/admin/index.html.erb +149 -0
- data/app/views/rails_base/admin/show_config.html.erb +18 -0
- data/app/views/rails_base/devise/confirmations/new.html.erb +16 -0
- data/app/views/rails_base/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/rails_base/devise/mailer/email_changed.html.erb +7 -0
- data/app/views/rails_base/devise/mailer/password_change.html.erb +3 -0
- data/app/views/rails_base/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/rails_base/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/rails_base/devise/passwords/edit.html.erb +25 -0
- data/app/views/rails_base/devise/passwords/new.html.erb +27 -0
- data/app/views/rails_base/devise/registrations/edit.html.erb +43 -0
- data/app/views/rails_base/devise/registrations/new.html.erb +123 -0
- data/app/views/rails_base/devise/sessions/new.html.erb +4 -0
- data/app/views/rails_base/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/rails_base/devise/shared/_links.html.erb +25 -0
- data/app/views/rails_base/devise/unlocks/new.html.erb +16 -0
- data/app/views/rails_base/email_verification_mailer/email_verification.html.erb +25 -0
- data/app/views/rails_base/email_verification_mailer/event.html.erb +20 -0
- data/app/views/rails_base/email_verification_mailer/forgot_password.html.erb +22 -0
- data/app/views/rails_base/errors/internal_error.html.erb +1 -0
- data/app/views/rails_base/errors/not_found.html.erb +1 -0
- data/app/views/rails_base/errors/unacceptable.html.erb +1 -0
- data/app/views/rails_base/event_mailer/event.html.erb +10 -0
- data/app/views/rails_base/mfa_auth/mfa_code.html.erb +10 -0
- data/app/views/rails_base/secondary_authentication/after_email_login_session_new.html.erb +3 -0
- data/app/views/rails_base/secondary_authentication/forgot_password.html.erb +9 -0
- data/app/views/rails_base/secondary_authentication/remove_me.html.erb +1 -0
- data/app/views/rails_base/secondary_authentication/static.html.erb +5 -0
- data/app/views/rails_base/shared/_admin_actions_modal.html.erb +65 -0
- data/app/views/rails_base/shared/_admin_config_class.html.erb +52 -0
- data/app/views/rails_base/shared/_admin_history.html.erb +86 -0
- data/app/views/rails_base/shared/_admin_modify_email.html.erb +78 -0
- data/app/views/rails_base/shared/_admin_modify_name.html.erb +107 -0
- data/app/views/rails_base/shared/_admin_modify_phone.html.erb +87 -0
- data/app/views/rails_base/shared/_admin_modify_text.html.erb +35 -0
- data/app/views/rails_base/shared/_admin_risky_change.html.erb +57 -0
- data/app/views/rails_base/shared/_admin_risky_mfa.html.erb +74 -0
- data/app/views/rails_base/shared/_admin_selector_dropdown.html.erb +70 -0
- data/app/views/rails_base/shared/_admin_toggle_button.html.erb +72 -0
- data/app/views/rails_base/shared/_admin_warning_alert.html.erb +7 -0
- data/app/views/rails_base/shared/_appearance_mode_selector.html.erb +183 -0
- data/app/views/rails_base/shared/_custom_form_validation_javascript.html.erb +129 -0
- data/app/views/rails_base/shared/_enable_mfa_auth_modal.html.erb +105 -0
- data/app/views/rails_base/shared/_error_pages.html.erb +123 -0
- data/app/views/rails_base/shared/_logged_in_header.html.erb +123 -0
- data/app/views/rails_base/shared/_logged_out_header.html.erb +14 -0
- data/app/views/rails_base/shared/_mfa_input_layout.html.erb +5 -0
- data/app/views/rails_base/shared/_mfa_input_layout_default.html.erb +97 -0
- data/app/views/rails_base/shared/_mfa_input_layout_fallback.html.erb +55 -0
- data/app/views/rails_base/shared/_modify_mfa_auth_modal.html.erb +20 -0
- data/app/views/rails_base/shared/_password_confirm_javascript.html.erb +71 -0
- data/app/views/rails_base/shared/_reset_password_form.html.erb +111 -0
- data/app/views/rails_base/shared/_session_create_form.html.erb +32 -0
- data/app/views/rails_base/shared/_session_timeout_modal.html.erb +76 -0
- data/app/views/rails_base/switch_user/_widget.html.erb +5 -0
- data/app/views/rails_base/user_settings/_confirm_destroy_user.html.erb +42 -0
- data/app/views/rails_base/user_settings/_destroy_user.html.erb +106 -0
- data/app/views/rails_base/user_settings/_modify_name.html.erb +71 -0
- data/app/views/rails_base/user_settings/_modify_password.html.erb +101 -0
- data/app/views/rails_base/user_settings/_modify_password_update_password.html.erb +2 -0
- data/app/views/rails_base/user_settings/index.html.erb +54 -0
- data/config/initializers/01_rails_config.rb +19 -0
- data/config/initializers/admin_action_helper.rb +88 -0
- data/config/initializers/browser.rb +4 -0
- data/config/initializers/default_logged_in_headers.rb +23 -0
- data/config/initializers/devise.rb +314 -0
- data/config/initializers/encryption.rb +2 -0
- data/config/initializers/switch_user.rb +58 -0
- data/config/initializers/switch_user_helper.rb +29 -0
- data/config/locales/devise.en.yml +65 -0
- data/config/locales/en.yml +58 -0
- data/config/routes.rb +114 -0
- data/db/migrate/20210212175453_devise_create_rails_base_users.rb +56 -0
- data/db/migrate/20210212190537_create_rails_base_short_lived_data.rb +19 -0
- data/db/migrate/20210212192645_create_rails_base_secrets.rb +11 -0
- data/db/migrate/20210406015744_create_rails_base_admin_actions.rb +17 -0
- data/db/seeds.rb +23 -0
- data/lib/link_decision_helper.rb +71 -0
- data/lib/rails_base.rb +50 -0
- data/lib/rails_base/admin/action_cache.rb +99 -0
- data/lib/rails_base/admin/action_helper.rb +134 -0
- data/lib/rails_base/admin/default_index_tile.rb +176 -0
- data/lib/rails_base/admin/index_tile.rb +186 -0
- data/lib/rails_base/config.rb +52 -0
- data/lib/rails_base/configuration/active_job.rb +38 -0
- data/lib/rails_base/configuration/admin.rb +231 -0
- data/lib/rails_base/configuration/app.rb +52 -0
- data/lib/rails_base/configuration/appearance.rb +131 -0
- data/lib/rails_base/configuration/authentication.rb +37 -0
- data/lib/rails_base/configuration/base.rb +209 -0
- data/lib/rails_base/configuration/display/background_color.rb +25 -0
- data/lib/rails_base/configuration/display/btn_danger.rb +25 -0
- data/lib/rails_base/configuration/display/btn_dark.rb +25 -0
- data/lib/rails_base/configuration/display/btn_info.rb +25 -0
- data/lib/rails_base/configuration/display/btn_light.rb +25 -0
- data/lib/rails_base/configuration/display/btn_primary.rb +25 -0
- data/lib/rails_base/configuration/display/btn_secondary.rb +25 -0
- data/lib/rails_base/configuration/display/btn_success.rb +25 -0
- data/lib/rails_base/configuration/display/btn_warning.rb +25 -0
- data/lib/rails_base/configuration/display/footer.rb +54 -0
- data/lib/rails_base/configuration/display/navbar.rb +25 -0
- data/lib/rails_base/configuration/display/table_body.rb +25 -0
- data/lib/rails_base/configuration/display/table_header.rb +25 -0
- data/lib/rails_base/configuration/display/text.rb +26 -0
- data/lib/rails_base/configuration/exceptions_app.rb +25 -0
- data/lib/rails_base/configuration/login_behavior.rb +17 -0
- data/lib/rails_base/configuration/mailer.rb +116 -0
- data/lib/rails_base/configuration/mfa.rb +84 -0
- data/lib/rails_base/configuration/owner.rb +17 -0
- data/lib/rails_base/configuration/redis.rb +29 -0
- data/lib/rails_base/configuration/user.rb +43 -0
- data/lib/rails_base/engine.rb +51 -0
- data/lib/rails_base/version.rb +10 -0
- data/lib/tasks/rails_base_tasks.rake +4 -0
- data/lib/twilio_helper.rb +26 -0
- data/lib/velocity_limiter.rb +91 -0
- metadata +619 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnDanger < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-danger',
|
12
|
+
description: 'Button danger to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-danger',
|
17
|
+
description: 'Button danger to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnDark < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-dark',
|
12
|
+
description: 'Button dark to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-dark',
|
17
|
+
description: 'Button dark to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnInfo < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-info',
|
12
|
+
description: 'Button info to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-info',
|
17
|
+
description: 'Button info to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnLight < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-light',
|
12
|
+
description: 'Button light to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-light',
|
17
|
+
description: 'Button light to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnPrimary < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-primary',
|
12
|
+
description: 'Button primary to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-primary',
|
17
|
+
description: 'Button primary to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnSecondary < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-light',
|
12
|
+
description: 'Button secondary to use in Dark mode. Please use btn_secondary as primary attribute instead of btn-secondary'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-secondary',
|
17
|
+
description: 'Button secondary to use in light mode. Please use btn_secondary as primary attribute instead of btn-secondary'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnSuccess < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-success',
|
12
|
+
description: 'Button success to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-success',
|
17
|
+
description: 'Button success to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class BtnWarning < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'btn-warning',
|
12
|
+
description: 'Button warning to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'btn-warning',
|
17
|
+
description: 'Button warning to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class Footer < Base
|
7
|
+
DEFAULT_PAGES = {
|
8
|
+
'RailsBase::Users::SessionsController' => [:new, :create],
|
9
|
+
'RailsBase::Users::PasswordsController' => [:new],
|
10
|
+
'RailsBase::Users::RegistrationsController' => [:new],
|
11
|
+
'RailsBase::UserSettingsController' => [:index],
|
12
|
+
'RailsBase::MfaAuthController' => [:mfa_code],
|
13
|
+
'RailsBase::SecondaryAuthenticationController' => [:static, :after_email_login_session_new, :forgot_password],
|
14
|
+
}
|
15
|
+
DEFAULT_FOOTER_HTML = "© 2021 Year of the Rona: Bad Ass Rails Starter <a href='https://github.com/matt-taylor/' target='_blank'>@matt-taylor</a>"
|
16
|
+
|
17
|
+
DEFAULT_VALUES = {
|
18
|
+
enable: {
|
19
|
+
type: :boolean,
|
20
|
+
default: true,
|
21
|
+
description: 'Enable footer for the site',
|
22
|
+
},
|
23
|
+
sticky: {
|
24
|
+
type: :boolean,
|
25
|
+
default: true,
|
26
|
+
dependents: [ -> (i) { i.enable? } ],
|
27
|
+
description: 'Stick footer to the bottom of screen',
|
28
|
+
},
|
29
|
+
sticky_pages: {
|
30
|
+
type: :hash,
|
31
|
+
default: DEFAULT_PAGES,
|
32
|
+
popover: true,
|
33
|
+
decipher: ->(thing) { thing.map { |k, v| v.map { |a| "#{k}.#{a}" } }.flatten },
|
34
|
+
description: 'Pages that use sticky pages. All others wil append footer to end of body. NOTE: Action can be forced by calling `force_sticky_mode!` anytime.',
|
35
|
+
},
|
36
|
+
html: {
|
37
|
+
type: :string,
|
38
|
+
default: DEFAULT_FOOTER_HTML,
|
39
|
+
description: 'HTML text to be placed at footer'
|
40
|
+
},
|
41
|
+
content_bottom_or_sticky: {
|
42
|
+
type: :boolean,
|
43
|
+
default: true,
|
44
|
+
dependents: [ -> (i) { i.enable? } ],
|
45
|
+
description: 'When enabled, footer will stick to bottom or stick to bottom of content -- whichever is greater. Takes precendence over `sticky`',
|
46
|
+
},
|
47
|
+
|
48
|
+
}
|
49
|
+
|
50
|
+
attr_accessor *DEFAULT_VALUES.keys
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class Navbar < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'navbar-dark bg-dark',
|
12
|
+
description: 'Background to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'navbar-light bg-light',
|
17
|
+
description: 'Background to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class TableBody < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'table-dark',
|
12
|
+
description: 'Table Body to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: '',
|
17
|
+
description: 'Table Body to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class TableHeader < Base
|
7
|
+
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'thead-dark',
|
12
|
+
description: 'Table header to use in Dark mode'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'thead-dark',
|
17
|
+
description: 'Table header to use in light mode'
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
attr_accessor *DEFAULT_VALUES.keys
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
module Display
|
6
|
+
class Text < Base
|
7
|
+
APPEARANCE_TEXT_CLASS = 'color-text-class'
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
dark_mode: {
|
10
|
+
type: :string_nil,
|
11
|
+
default: 'text-white',
|
12
|
+
description: 'Color of text for dark mode. Text that is outside of standard elems (tables, navbars): https://getbootstrap.com/docs/4.0/utilities/colors/'
|
13
|
+
},
|
14
|
+
light_mode: {
|
15
|
+
type: :string_nil,
|
16
|
+
default: 'text-dark',
|
17
|
+
description: 'Color of text for light mode. Text that is outside of standard elems (tables, navbars): https://getbootstrap.com/docs/4.0/utilities/colors/'
|
18
|
+
|
19
|
+
},
|
20
|
+
}
|
21
|
+
|
22
|
+
attr_accessor *DEFAULT_VALUES.keys
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
class ExceptionsApp < Base
|
6
|
+
|
7
|
+
EXCEPTIONS_PROC = Proc.new do |val, _instance|
|
8
|
+
Rails.configuration.exceptions_app = val
|
9
|
+
end
|
10
|
+
|
11
|
+
DEFAULT_VALUES = {
|
12
|
+
exceptions_app: {
|
13
|
+
type: :klass,
|
14
|
+
klass_type: [ActionDispatch::Routing::RouteSet],
|
15
|
+
default: nil,
|
16
|
+
default_assign_on_boot: -> { Rails.application.routes },
|
17
|
+
on_assignment: EXCEPTIONS_PROC,
|
18
|
+
description: 'What route set to find the exceptions on.'
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
attr_accessor *DEFAULT_VALUES.keys
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
class LoginBehavior < Base
|
6
|
+
|
7
|
+
DEFAULT_VALUES = {
|
8
|
+
fallback_to_referred: {
|
9
|
+
type: :boolean,
|
10
|
+
default: true,
|
11
|
+
description: 'Enable capturing requests context when login fails. Upon login, redirect user to page they tried to go to.',
|
12
|
+
}
|
13
|
+
}
|
14
|
+
attr_accessor *DEFAULT_VALUES.keys
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
require 'rails_base/admin/index_tile'
|
3
|
+
require 'rails_base/admin/default_index_tile'
|
4
|
+
|
5
|
+
module RailsBase
|
6
|
+
module Configuration
|
7
|
+
class Mailer < Base
|
8
|
+
CUSTOM_MAILER_METHOD = :deliver_me
|
9
|
+
|
10
|
+
FROM_PROC = Proc.new do |val, _instance|
|
11
|
+
hash = Rails.configuration.action_mailer.default_options || {}
|
12
|
+
ACTION_MAILER_PROC.call(:default_options, hash.merge(from: val))
|
13
|
+
end
|
14
|
+
|
15
|
+
SMTP_OPTIONS_PROC = Proc.new do |field, val|
|
16
|
+
hash = Rails.configuration.action_mailer.smtp_settings || {}
|
17
|
+
ACTION_MAILER_PROC.call(:smtp_settings, hash.merge(field.to_sym => val))
|
18
|
+
end
|
19
|
+
|
20
|
+
MAIL_FROM_PROC = Proc.new do |val, _instance|
|
21
|
+
Rails.configuration.mail_from = val
|
22
|
+
end
|
23
|
+
|
24
|
+
ACTION_MAILER_PROC = Proc.new do |name, val|
|
25
|
+
Rails.configuration.action_mailer.public_send(:"#{name}=", val)
|
26
|
+
end
|
27
|
+
|
28
|
+
MAILER_METHOD = Proc.new do |val, instance|
|
29
|
+
unless ActionMailer::MessageDelivery.instance_methods.include?(val.to_sym)
|
30
|
+
raise ArgumentError, "config.mailer.delivery = :#{val} is not a defined method on ActionMailer::MessageDelivery"
|
31
|
+
end
|
32
|
+
ActionMailer::MessageDelivery.define_method(CUSTOM_MAILER_METHOD) do
|
33
|
+
public_send(val)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
DEFAULT_VALUES = {
|
38
|
+
from: {
|
39
|
+
type: :string,
|
40
|
+
default: ENV.fetch('GMAIL_USER_NAME', nil),
|
41
|
+
on_assignment: [FROM_PROC, ->(val, _instance) { SMTP_OPTIONS_PROC.call(:user_name, val)}, MAIL_FROM_PROC],
|
42
|
+
description: 'UserName for emails'
|
43
|
+
},
|
44
|
+
password: {
|
45
|
+
type: :string,
|
46
|
+
default: ENV.fetch('GMAIL_PASSWORD', nil),
|
47
|
+
secret: true,
|
48
|
+
on_assignment: ->(val, _instance) { SMTP_OPTIONS_PROC.call(:password, val) },
|
49
|
+
description: 'Password for emails: Often times is an app password: https://support.google.com/accounts/answer/185833?hl=en'
|
50
|
+
},
|
51
|
+
address: {
|
52
|
+
type: :string,
|
53
|
+
default: 'smtp.gmail.com',
|
54
|
+
on_assignment: ->(val, _instance) { SMTP_OPTIONS_PROC.call(:address, val) },
|
55
|
+
description: 'Value is dependent on email provider'
|
56
|
+
},
|
57
|
+
port: {
|
58
|
+
type: :integer,
|
59
|
+
default: 587,
|
60
|
+
on_assignment: ->(val, _instance) { SMTP_OPTIONS_PROC.call(:port, val) },
|
61
|
+
description: 'Port to send emails from'
|
62
|
+
},
|
63
|
+
authentication: {
|
64
|
+
type: :string,
|
65
|
+
default: 'plain',
|
66
|
+
on_assignment: ->(val, _instance) { SMTP_OPTIONS_PROC.call(:authentication, val) },
|
67
|
+
description: 'Authentication type for emails'
|
68
|
+
},
|
69
|
+
enable_starttls_auto: {
|
70
|
+
type: :boolean,
|
71
|
+
default: true,
|
72
|
+
on_assignment: ->(val, _instance) { SMTP_OPTIONS_PROC.call(:enable_starttls_auto, val) },
|
73
|
+
description: 'Enable encryption for emails'
|
74
|
+
},
|
75
|
+
delivery_method: {
|
76
|
+
type: :symbol,
|
77
|
+
default: Rails.env.test? ? :test : :smtp,
|
78
|
+
on_assignment: ->(val, _instance) { ACTION_MAILER_PROC.call(:delivery_method, val) },
|
79
|
+
description: 'Delivery method. Test default is :test. Everything else default is :smtp'
|
80
|
+
},
|
81
|
+
perform_deliveries: {
|
82
|
+
type: :boolean,
|
83
|
+
default: true,
|
84
|
+
on_assignment: ->(val, _instance) { ACTION_MAILER_PROC.call(:perform_deliveries, val) },
|
85
|
+
description: 'When false, mail does not get delivered'
|
86
|
+
},
|
87
|
+
raise_delivery_errors: {
|
88
|
+
type: :boolean,
|
89
|
+
default: true,
|
90
|
+
on_assignment: ->(val, _instance) { ACTION_MAILER_PROC.call(:raise_delivery_errors, val) },
|
91
|
+
description: 'Raise when mail cannot be delivered'
|
92
|
+
},
|
93
|
+
preview_path: {
|
94
|
+
type: :path,
|
95
|
+
default: RailsBase::Engine.root.join('spec','mailers','previews'),
|
96
|
+
on_assignment: ->(val, _instance) { ACTION_MAILER_PROC.call(:preview_path, val) },
|
97
|
+
description: 'Path for mailer previews'
|
98
|
+
},
|
99
|
+
delivery: {
|
100
|
+
type: :symbol,
|
101
|
+
default: ENV['USE_SIDEKIQ'] ? :deliver_later : :deliver_now,
|
102
|
+
on_assignment: MAILER_METHOD,
|
103
|
+
description: "Mailers have a custom delivery method of #{CUSTOM_MAILER_METHOD}. Override this to deliver_later if you have the active_job_adapter running"
|
104
|
+
},
|
105
|
+
active_job_queue: {
|
106
|
+
type: :string,
|
107
|
+
default: 'mailers',
|
108
|
+
on_assignment: ->(val, _instance) { ACTION_MAILER_PROC.call(:deliver_later_queue_name, val) },
|
109
|
+
description: 'The active job queue to send twilio messages from. Ensure that adapter is bound to the queue',
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
attr_accessor *DEFAULT_VALUES.keys
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|