element we wrap around attachments. Otherwise,
12 | * images in galleries will be squished by the max-width: 33%; rule.
13 | */
14 | .trix-content .attachment-gallery > action-text-attachment,
15 | .trix-content .attachment-gallery > .attachment {
16 | flex: 1 0 33%;
17 | padding: 0 0.5em;
18 | max-width: 33%;
19 | }
20 |
21 | .trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
22 | .trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
23 | .trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
24 | flex-basis: 50%;
25 | max-width: 50%;
26 | }
27 |
28 | .trix-content action-text-attachment .attachment {
29 | padding: 0 !important;
30 | max-width: 100% !important;
31 | }
32 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.bootstrap.scss:
--------------------------------------------------------------------------------
1 | @import 'bootstrap/scss/bootstrap';
2 | @import 'actiontext';
3 |
4 |
5 | *{
6 | margin: 0;
7 | padding: 0;
8 | }
9 |
10 | // Masquerade alert shouldn't have a bottom margin
11 | body > .alert {
12 | margin-bottom: 0;
13 | }
14 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6 | * vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
17 |
--------------------------------------------------------------------------------
/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationCable
4 | class Channel < ActionCable::Channel::Base
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationCable
4 | class Connection < ActionCable::Connection::Base
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/app/components/shared/demo.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/app/components/shared/demo.txt
--------------------------------------------------------------------------------
/app/controllers/admin/announcements_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Admin
4 | class AnnouncementsController < Admin::ApplicationController
5 | # Overwrite any of the RESTful controller actions to implement custom behavior
6 | # For example, you may want to send an email after a foo is updated.
7 | #
8 | # def update
9 | # super
10 | # send_foo_updated_email(requested_resource)
11 | # end
12 |
13 | # Override this method to specify custom lookup behavior.
14 | # This will be used to set the resource for the `show`, `edit`, and `update`
15 | # actions.
16 | #
17 | # def find_resource(param)
18 | # Foo.find_by!(slug: param)
19 | # end
20 |
21 | # The result of this lookup will be available as `requested_resource`
22 |
23 | # Override this if you have certain roles that require a subset
24 | # this will be used to set the records shown on the `index` action.
25 | #
26 | # def scoped_resource
27 | # if current_user.super_admin?
28 | # resource_class
29 | # else
30 | # resource_class.with_less_stuff
31 | # end
32 | # end
33 |
34 | # Override `resource_params` if you want to transform the submitted
35 | # data before it's persisted. For example, the following would turn all
36 | # empty values into nil values. It uses other APIs such as `resource_class`
37 | # and `dashboard`:
38 | #
39 | # def resource_params
40 | # params.require(resource_class.model_name.param_key).
41 | # permit(dashboard.permitted_attributes).
42 | # transform_values { |value| value == "" ? nil : value }
43 | # end
44 |
45 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
46 | # for more information
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/app/controllers/admin/application_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # All Administrate controllers inherit from this
4 | # `Administrate::ApplicationController`, making it the ideal place to put
5 | # authentication logic or other before_actions.
6 | #
7 | # If you want to add pagination or other controller-level concerns,
8 | # you're free to overwrite the RESTful controller actions.
9 | module Admin
10 | class ApplicationController < Administrate::ApplicationController
11 | before_action :authenticate_admin
12 |
13 | def authenticate_admin
14 | # TODO: Add authentication logic here.
15 | end
16 |
17 | # Override this value to specify the number of elements to display at a time
18 | # on index pages. Defaults to 20.
19 | # def records_per_page
20 | # params[:per_page] || 20
21 | # end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/controllers/admin/notifications_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Admin
4 | class NotificationsController < Admin::ApplicationController
5 | # Overwrite any of the RESTful controller actions to implement custom behavior
6 | # For example, you may want to send an email after a foo is updated.
7 | #
8 | # def update
9 | # super
10 | # send_foo_updated_email(requested_resource)
11 | # end
12 |
13 | # Override this method to specify custom lookup behavior.
14 | # This will be used to set the resource for the `show`, `edit`, and `update`
15 | # actions.
16 | #
17 | # def find_resource(param)
18 | # Foo.find_by!(slug: param)
19 | # end
20 |
21 | # The result of this lookup will be available as `requested_resource`
22 |
23 | # Override this if you have certain roles that require a subset
24 | # this will be used to set the records shown on the `index` action.
25 | #
26 | # def scoped_resource
27 | # if current_user.super_admin?
28 | # resource_class
29 | # else
30 | # resource_class.with_less_stuff
31 | # end
32 | # end
33 |
34 | # Override `resource_params` if you want to transform the submitted
35 | # data before it's persisted. For example, the following would turn all
36 | # empty values into nil values. It uses other APIs such as `resource_class`
37 | # and `dashboard`:
38 | #
39 | # def resource_params
40 | # params.require(resource_class.model_name.param_key).
41 | # permit(dashboard.permitted_attributes).
42 | # transform_values { |value| value == "" ? nil : value }
43 | # end
44 |
45 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
46 | # for more information
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/app/controllers/admin/services_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Admin
4 | class ServicesController < Admin::ApplicationController
5 | # Overwrite any of the RESTful controller actions to implement custom behavior
6 | # For example, you may want to send an email after a foo is updated.
7 | #
8 | # def update
9 | # super
10 | # send_foo_updated_email(requested_resource)
11 | # end
12 |
13 | # Override this method to specify custom lookup behavior.
14 | # This will be used to set the resource for the `show`, `edit`, and `update`
15 | # actions.
16 | #
17 | # def find_resource(param)
18 | # Foo.find_by!(slug: param)
19 | # end
20 |
21 | # The result of this lookup will be available as `requested_resource`
22 |
23 | # Override this if you have certain roles that require a subset
24 | # this will be used to set the records shown on the `index` action.
25 | #
26 | # def scoped_resource
27 | # if current_user.super_admin?
28 | # resource_class
29 | # else
30 | # resource_class.with_less_stuff
31 | # end
32 | # end
33 |
34 | # Override `resource_params` if you want to transform the submitted
35 | # data before it's persisted. For example, the following would turn all
36 | # empty values into nil values. It uses other APIs such as `resource_class`
37 | # and `dashboard`:
38 | #
39 | # def resource_params
40 | # params.require(resource_class.model_name.param_key).
41 | # permit(dashboard.permitted_attributes).
42 | # transform_values { |value| value == "" ? nil : value }
43 | # end
44 |
45 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
46 | # for more information
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/app/controllers/admin/users_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Admin
4 | class UsersController < Admin::ApplicationController
5 | # Overwrite any of the RESTful controller actions to implement custom behavior
6 | # For example, you may want to send an email after a foo is updated.
7 | #
8 | # def update
9 | # super
10 | # send_foo_updated_email(requested_resource)
11 | # end
12 |
13 | # Override this method to specify custom lookup behavior.
14 | # This will be used to set the resource for the `show`, `edit`, and `update`
15 | # actions.
16 | #
17 | # def find_resource(param)
18 | # Foo.find_by!(slug: param)
19 | # end
20 |
21 | # The result of this lookup will be available as `requested_resource`
22 |
23 | # Override this if you have certain roles that require a subset
24 | # this will be used to set the records shown on the `index` action.
25 | #
26 | # def scoped_resource
27 | # if current_user.super_admin?
28 | # resource_class
29 | # else
30 | # resource_class.with_less_stuff
31 | # end
32 | # end
33 |
34 | # Override `resource_params` if you want to transform the submitted
35 | # data before it's persisted. For example, the following would turn all
36 | # empty values into nil values. It uses other APIs such as `resource_class`
37 | # and `dashboard`:
38 | #
39 | # def resource_params
40 | # params.require(resource_class.model_name.param_key).
41 | # permit(dashboard.permitted_attributes).
42 | # transform_values { |value| value == "" ? nil : value }
43 | # end
44 |
45 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
46 | # for more information
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/app/controllers/announcements_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AnnouncementsController < ApplicationController # rubocop:todo Style/Documentation
4 | before_action :mark_as_read, if: :user_signed_in?
5 |
6 | def index
7 | @announcements = Announcement.order(published_at: :desc)
8 | end
9 |
10 | private
11 |
12 | def mark_as_read
13 | current_user.update(announcements_last_read_at: Time.zone.now)
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationController < ActionController::Base # rubocop:todo Style/Documentation
4 | include Pundit::Authorization
5 |
6 | protect_from_forgery with: :exception
7 |
8 | before_action :configure_permitted_parameters, if: :devise_controller?
9 | before_action :masquerade_user!
10 |
11 | protected
12 |
13 | def configure_permitted_parameters
14 | devise_parameter_sanitizer.permit(:sign_up, keys: %i[name username])
15 | devise_parameter_sanitizer.permit(:account_update, keys: %i[name avatar])
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/app/controllers/home_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class HomeController < ApplicationController # rubocop:todo Style/Documentation
4 | def index; end
5 |
6 | def terms; end
7 |
8 | def privacy; end
9 | end
10 |
--------------------------------------------------------------------------------
/app/controllers/notifications_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class NotificationsController < ApplicationController # rubocop:todo Style/Documentation
4 | before_action :authenticate_user!
5 |
6 | def index
7 | # Convert the database records to Noticed notification instances so we can use helper methods
8 | @notifications = current_user.notifications.map(&:to_notification)
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/app/controllers/turbo_devise_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class TurboDeviseController < ApplicationController
4 | class Responder < ActionController::Responder
5 | def to_turbo_stream
6 | controller.render(options.merge(formats: :html))
7 | rescue ActionView::MissingTemplate => e
8 | raise e if get?
9 |
10 | if has_errors? && default_action
11 | render rendering_options.merge(formats: :html, status: :unprocessable_entity)
12 | else
13 | redirect_to navigation_location
14 | end
15 | end
16 | end
17 |
18 | self.responder = Responder
19 | respond_to :html, :turbo_stream
20 | end
21 |
--------------------------------------------------------------------------------
/app/controllers/users/omniauth_callbacks_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Users
4 | class OmniauthCallbacksController < Devise::OmniauthCallbacksController # rubocop:todo Style/Documentation
5 | before_action :set_service
6 | before_action :set_user
7 | attr_reader :service, :user
8 |
9 | # def show
10 | # @user = User.find(params[:id])
11 | # permitted = auth! @user
12 | # [...]
13 | # end
14 |
15 | def facebook
16 | handle_auth 'Facebook'
17 | end
18 |
19 | def twitter
20 | handle_auth 'Twitter'
21 | end
22 |
23 | def github
24 | handle_auth 'Github'
25 | end
26 |
27 | private
28 |
29 | # rubocop:todo Metrics/MethodLength
30 | def handle_auth(kind) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
31 | if service.present?
32 | service.update(service_attrs)
33 | else
34 | user.services.create(service_attrs)
35 | end
36 |
37 | if user_signed_in?
38 | flash[:notice] = "Your #{kind} account was connected."
39 | redirect_to edit_user_registration_path
40 | else
41 | sign_in_and_redirect user, event: :authentication
42 | set_flash_message :notice, :success, kind: kind
43 | end
44 | end
45 | # rubocop:enable Metrics/MethodLength
46 |
47 | def auth
48 | request.env['omniauth.auth']
49 | end
50 |
51 | def set_service
52 | @service = Service.where(provider: auth.provider, uid: auth.uid).first
53 | end
54 |
55 | def set_user # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
56 | if user_signed_in?
57 | @user = current_user
58 | elsif service.present?
59 | @user = service.user
60 | elsif User.where(email: auth.info.email).any?
61 | # 5. User is logged out and they login to a new account which doesn't match their old one
62 | flash[:alert] =
63 | # rubocop:todo Layout/LineLength
64 | "An account with this email already exists. Please sign in with that account before connecting your #{auth.provider.titleize} account."
65 | # rubocop:enable Layout/LineLength
66 | redirect_to new_user_session_path
67 | else
68 | @user = create_user
69 | end
70 | end
71 |
72 | def service_attrs # rubocop:todo Metrics/AbcSize
73 | expires_at = auth.credentials.expires_at.present? ? Time.at(auth.credentials.expires_at) : nil
74 | {
75 | provider: auth.provider,
76 | uid: auth.uid,
77 | expires_at: expires_at,
78 | access_token: auth.credentials.token,
79 | access_token_secret: auth.credentials.secret
80 | }
81 | end
82 |
83 | def create_user
84 | User.create(
85 | email: auth.info.email,
86 | username: auth.info.username,
87 | password: Devise.friendly_token[0, 20]
88 | )
89 | end
90 | end
91 | end
92 |
--------------------------------------------------------------------------------
/app/dashboards/announcement_dashboard.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'administrate/base_dashboard'
4 |
5 | class AnnouncementDashboard < Administrate::BaseDashboard
6 | # ATTRIBUTE_TYPES
7 | # a hash that describes the type of each of the model's fields.
8 | #
9 | # Each different type represents an Administrate::Field object,
10 | # which determines how the attribute is displayed
11 | # on pages throughout the dashboard.
12 | ATTRIBUTE_TYPES = {
13 | id: Field::Number,
14 | published_at: Field::DateTime,
15 | announcement_type: Field::String,
16 | name: Field::String,
17 | description: Field::Text,
18 | created_at: Field::DateTime,
19 | updated_at: Field::DateTime
20 | }.freeze
21 |
22 | # COLLECTION_ATTRIBUTES
23 | # an array of attributes that will be displayed on the model's index page.
24 | #
25 | # By default, it's limited to four items to reduce clutter on index pages.
26 | # Feel free to add, remove, or rearrange items.
27 | COLLECTION_ATTRIBUTES = %i[
28 | id
29 | published_at
30 | announcement_type
31 | name
32 | ].freeze
33 |
34 | # SHOW_PAGE_ATTRIBUTES
35 | # an array of attributes that will be displayed on the model's show page.
36 | SHOW_PAGE_ATTRIBUTES = %i[
37 | id
38 | published_at
39 | announcement_type
40 | name
41 | description
42 | created_at
43 | updated_at
44 | ].freeze
45 |
46 | # FORM_ATTRIBUTES
47 | # an array of attributes that will be displayed
48 | # on the model's form (`new` and `edit`) pages.
49 | FORM_ATTRIBUTES = %i[
50 | published_at
51 | announcement_type
52 | name
53 | description
54 | ].freeze
55 |
56 | # COLLECTION_FILTERS
57 | # a hash that defines filters that can be used while searching via the search
58 | # field of the dashboard.
59 | #
60 | # For example to add an option to search for open resources by typing "open:"
61 | # in the search field:
62 | #
63 | # COLLECTION_FILTERS = {
64 | # open: ->(resources) { resources.where(open: true) }
65 | # }.freeze
66 | COLLECTION_FILTERS = {}.freeze
67 |
68 | # Overwrite this method to customize how announcements are displayed
69 | # across all pages of the admin dashboard.
70 | #
71 | # def display_resource(announcement)
72 | # "Announcement ##{announcement.id}"
73 | # end
74 | end
75 |
--------------------------------------------------------------------------------
/app/dashboards/notification_dashboard.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'administrate/base_dashboard'
4 |
5 | class NotificationDashboard < Administrate::BaseDashboard
6 | # ATTRIBUTE_TYPES
7 | # a hash that describes the type of each of the model's fields.
8 | #
9 | # Each different type represents an Administrate::Field object,
10 | # which determines how the attribute is displayed
11 | # on pages throughout the dashboard.
12 | ATTRIBUTE_TYPES = {
13 | recipient: Field::Polymorphic,
14 | id: Field::Number,
15 | type: Field::String,
16 | params: Field::String.with_options(searchable: false),
17 | read_at: Field::DateTime,
18 | created_at: Field::DateTime,
19 | updated_at: Field::DateTime
20 | }.freeze
21 |
22 | # COLLECTION_ATTRIBUTES
23 | # an array of attributes that will be displayed on the model's index page.
24 | #
25 | # By default, it's limited to four items to reduce clutter on index pages.
26 | # Feel free to add, remove, or rearrange items.
27 | COLLECTION_ATTRIBUTES = %i[
28 | recipient
29 | id
30 | type
31 | params
32 | ].freeze
33 |
34 | # SHOW_PAGE_ATTRIBUTES
35 | # an array of attributes that will be displayed on the model's show page.
36 | SHOW_PAGE_ATTRIBUTES = %i[
37 | recipient
38 | id
39 | type
40 | params
41 | read_at
42 | created_at
43 | updated_at
44 | ].freeze
45 |
46 | # FORM_ATTRIBUTES
47 | # an array of attributes that will be displayed
48 | # on the model's form (`new` and `edit`) pages.
49 | FORM_ATTRIBUTES = %i[
50 | recipient
51 | type
52 | params
53 | read_at
54 | ].freeze
55 |
56 | # COLLECTION_FILTERS
57 | # a hash that defines filters that can be used while searching via the search
58 | # field of the dashboard.
59 | #
60 | # For example to add an option to search for open resources by typing "open:"
61 | # in the search field:
62 | #
63 | # COLLECTION_FILTERS = {
64 | # open: ->(resources) { resources.where(open: true) }
65 | # }.freeze
66 | COLLECTION_FILTERS = {}.freeze
67 |
68 | # Overwrite this method to customize how notifications are displayed
69 | # across all pages of the admin dashboard.
70 | #
71 | # def display_resource(notification)
72 | # "Notification ##{notification.id}"
73 | # end
74 | end
75 |
--------------------------------------------------------------------------------
/app/dashboards/service_dashboard.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'administrate/base_dashboard'
4 |
5 | class ServiceDashboard < Administrate::BaseDashboard
6 | # ATTRIBUTE_TYPES
7 | # a hash that describes the type of each of the model's fields.
8 | #
9 | # Each different type represents an Administrate::Field object,
10 | # which determines how the attribute is displayed
11 | # on pages throughout the dashboard.
12 | ATTRIBUTE_TYPES = {
13 | user: Field::BelongsTo,
14 | id: Field::Number,
15 | provider: Field::String,
16 | uid: Field::String,
17 | access_token: Field::String,
18 | access_token_secret: Field::String,
19 | refresh_token: Field::String,
20 | expires_at: Field::DateTime,
21 | auth: Field::Text,
22 | created_at: Field::DateTime,
23 | updated_at: Field::DateTime
24 | }.freeze
25 |
26 | # COLLECTION_ATTRIBUTES
27 | # an array of attributes that will be displayed on the model's index page.
28 | #
29 | # By default, it's limited to four items to reduce clutter on index pages.
30 | # Feel free to add, remove, or rearrange items.
31 | COLLECTION_ATTRIBUTES = %i[
32 | user
33 | id
34 | provider
35 | uid
36 | ].freeze
37 |
38 | # SHOW_PAGE_ATTRIBUTES
39 | # an array of attributes that will be displayed on the model's show page.
40 | SHOW_PAGE_ATTRIBUTES = %i[
41 | user
42 | id
43 | provider
44 | uid
45 | access_token
46 | access_token_secret
47 | refresh_token
48 | expires_at
49 | auth
50 | created_at
51 | updated_at
52 | ].freeze
53 |
54 | # FORM_ATTRIBUTES
55 | # an array of attributes that will be displayed
56 | # on the model's form (`new` and `edit`) pages.
57 | FORM_ATTRIBUTES = %i[
58 | user
59 | provider
60 | uid
61 | access_token
62 | access_token_secret
63 | refresh_token
64 | expires_at
65 | auth
66 | ].freeze
67 |
68 | # COLLECTION_FILTERS
69 | # a hash that defines filters that can be used while searching via the search
70 | # field of the dashboard.
71 | #
72 | # For example to add an option to search for open resources by typing "open:"
73 | # in the search field:
74 | #
75 | # COLLECTION_FILTERS = {
76 | # open: ->(resources) { resources.where(open: true) }
77 | # }.freeze
78 | COLLECTION_FILTERS = {}.freeze
79 |
80 | # Overwrite this method to customize how services are displayed
81 | # across all pages of the admin dashboard.
82 | #
83 | # def display_resource(service)
84 | # "Service ##{service.id}"
85 | # end
86 | end
87 |
--------------------------------------------------------------------------------
/app/dashboards/user_dashboard.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'administrate/base_dashboard'
4 |
5 | class UserDashboard < Administrate::BaseDashboard
6 | # ATTRIBUTE_TYPES
7 | # a hash that describes the type of each of the model's fields.
8 | #
9 | # Each different type represents an Administrate::Field object,
10 | # which determines how the attribute is displayed
11 | # on pages throughout the dashboard.
12 | ATTRIBUTE_TYPES = {
13 | avatar_attachment: Field::HasOne,
14 | avatar_blob: Field::HasOne,
15 | notifications: Field::HasMany,
16 | services: Field::HasMany,
17 | id: Field::Number,
18 | email: Field::String,
19 | encrypted_password: Field::String,
20 | reset_password_token: Field::String,
21 | reset_password_sent_at: Field::DateTime,
22 | remember_created_at: Field::DateTime,
23 | sign_in_count: Field::Number,
24 | current_sign_in_at: Field::DateTime,
25 | last_sign_in_at: Field::DateTime,
26 | current_sign_in_ip: Field::String,
27 | last_sign_in_ip: Field::String,
28 | confirmation_token: Field::String,
29 | confirmed_at: Field::DateTime,
30 | confirmation_sent_at: Field::DateTime,
31 | unconfirmed_email: Field::String,
32 | first_name: Field::String,
33 | last_name: Field::String,
34 | announcements_last_read_at: Field::DateTime,
35 | admin: Field::Boolean,
36 | created_at: Field::DateTime,
37 | updated_at: Field::DateTime
38 | }.freeze
39 |
40 | # COLLECTION_ATTRIBUTES
41 | # an array of attributes that will be displayed on the model's index page.
42 | #
43 | # By default, it's limited to four items to reduce clutter on index pages.
44 | # Feel free to add, remove, or rearrange items.
45 | COLLECTION_ATTRIBUTES = %i[
46 | avatar_attachment
47 | avatar_blob
48 | notifications
49 | services
50 | ].freeze
51 |
52 | # SHOW_PAGE_ATTRIBUTES
53 | # an array of attributes that will be displayed on the model's show page.
54 | SHOW_PAGE_ATTRIBUTES = %i[
55 | avatar_attachment
56 | avatar_blob
57 | notifications
58 | services
59 | id
60 | email
61 | encrypted_password
62 | reset_password_token
63 | reset_password_sent_at
64 | remember_created_at
65 | sign_in_count
66 | current_sign_in_at
67 | last_sign_in_at
68 | current_sign_in_ip
69 | last_sign_in_ip
70 | confirmation_token
71 | confirmed_at
72 | confirmation_sent_at
73 | unconfirmed_email
74 | first_name
75 | last_name
76 | announcements_last_read_at
77 | admin
78 | created_at
79 | updated_at
80 | ].freeze
81 |
82 | # FORM_ATTRIBUTES
83 | # an array of attributes that will be displayed
84 | # on the model's form (`new` and `edit`) pages.
85 | FORM_ATTRIBUTES = %i[
86 | avatar_attachment
87 | avatar_blob
88 | notifications
89 | services
90 | email
91 | encrypted_password
92 | reset_password_token
93 | reset_password_sent_at
94 | remember_created_at
95 | sign_in_count
96 | current_sign_in_at
97 | last_sign_in_at
98 | current_sign_in_ip
99 | last_sign_in_ip
100 | confirmation_token
101 | confirmed_at
102 | confirmation_sent_at
103 | unconfirmed_email
104 | first_name
105 | last_name
106 | announcements_last_read_at
107 | admin
108 | ].freeze
109 |
110 | # COLLECTION_FILTERS
111 | # a hash that defines filters that can be used while searching via the search
112 | # field of the dashboard.
113 | #
114 | # For example to add an option to search for open resources by typing "open:"
115 | # in the search field:
116 | #
117 | # COLLECTION_FILTERS = {
118 | # open: ->(resources) { resources.where(open: true) }
119 | # }.freeze
120 | COLLECTION_FILTERS = {}.freeze
121 |
122 | # Overwrite this method to customize how users are displayed
123 | # across all pages of the admin dashboard.
124 | #
125 | # def display_resource(user)
126 | # "User ##{user.id}"
127 | # end
128 | end
129 |
--------------------------------------------------------------------------------
/app/helpers/announcements_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module AnnouncementsHelper # rubocop:todo Style/Documentation
4 | def unread_announcements(user)
5 | last_announcement = Announcement.order(published_at: :desc).first
6 | return if last_announcement.nil?
7 |
8 | # Highlight announcements for anyone not logged in, cuz tempting
9 | # rubocop:todo Style/GuardClause
10 | # rubocop:todo Layout/LineLength
11 | if user.nil? || user.announcements_last_read_at.nil? || user.announcements_last_read_at < last_announcement.published_at
12 | # rubocop:enable Layout/LineLength
13 | # rubocop:enable Style/GuardClause
14 | 'unread-announcements'
15 | end
16 | end
17 |
18 | def announcement_class(type)
19 | {
20 | 'new' => 'text-success',
21 | 'update' => 'text-warning',
22 | 'fix' => 'text-danger'
23 | }.fetch(type, 'text-success')
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationHelper # rubocop:todo Style/Documentation
4 | end
5 |
--------------------------------------------------------------------------------
/app/helpers/avatar_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module AvatarHelper # rubocop:todo Style/Documentation
4 | # rubocop:todo Metrics/PerceivedComplexity
5 | # rubocop:todo Metrics/MethodLength
6 | def avatar_path(object, options = {}) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
7 | size = options[:size] || 180
8 | default_image = options[:default] || 'mp'
9 | base_url = 'https://secure.gravatar.com/avatar'
10 | base_url_params = "?s=#{size}&d=#{default_image}"
11 |
12 | if object.respond_to?(:avatar) && object.avatar.attached? && object.avatar.variable?
13 | object.avatar.variant(resize_to_fill: [size, size, { gravity: 'Center' }])
14 | elsif object.respond_to?(:email) && object.email
15 | gravatar_id = Digest::MD5.hexdigest(object.email.downcase)
16 | "#{base_url}/#{gravatar_id}#{base_url_params}"
17 | else
18 | "#{base_url}/00000000000000000000000000000000#{base_url_params}"
19 | end
20 | end
21 | # rubocop:enable Metrics/MethodLength
22 | # rubocop:enable Metrics/PerceivedComplexity
23 | end
24 |
--------------------------------------------------------------------------------
/app/helpers/bootstrap_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module BootstrapHelper # rubocop:todo Style/Documentation
4 | def bootstrap_class_for(flash_type)
5 | {
6 | success: 'alert-success',
7 | error: 'alert-danger',
8 | alert: 'alert-warning',
9 | notice: 'alert-primary'
10 | }.stringify_keys[flash_type.to_s] || flash_type.to_s
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/app/javascript/application.js:
--------------------------------------------------------------------------------
1 | // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2 | import "bootstrap"
3 | import 'trix'
4 | import '@rails/actiontext'
5 | import "@rails/request.js"
6 | import * as bootstrap from "bootstrap"
7 | import "controllers"
8 | import "@hotwired/turbo-rails"
9 |
--------------------------------------------------------------------------------
/app/javascript/controllers/application.js:
--------------------------------------------------------------------------------
1 | import { Application } from "@hotwired/stimulus"
2 |
3 | const application = Application.start()
4 |
5 | // Configure Stimulus development experience
6 | application.debug = false
7 | window.Stimulus = application
8 |
9 | export { application }
10 |
--------------------------------------------------------------------------------
/app/javascript/controllers/hello_controller.js:
--------------------------------------------------------------------------------
1 | import { Controller } from "@hotwired/stimulus"
2 |
3 | export default class extends Controller {
4 | connect() {
5 | this.element.textContent = "Hello World!"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/app/javascript/controllers/index.js:
--------------------------------------------------------------------------------
1 | // This file is auto-generated by ./bin/rails stimulus:manifest:update
2 | // Run that command whenever you add a new controller or create them with
3 | // ./bin/rails generate stimulus controllerName
4 |
5 | import { application } from "./application"
6 |
7 | import HelloController from "./hello_controller"
8 | application.register("hello", HelloController)
9 |
--------------------------------------------------------------------------------
/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationJob < ActiveJob::Base
4 | # Automatically retry jobs that encountered a deadlock
5 | # retry_on ActiveRecord::Deadlocked
6 |
7 | # Most jobs are safe to ignore if the underlying records are no longer available
8 | # discard_on ActiveJob::DeserializationError
9 | end
10 |
--------------------------------------------------------------------------------
/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationMailer < ActionMailer::Base
4 | default from: 'noreply@rails7saas.com'
5 | layout 'mailer'
6 | end
7 |
--------------------------------------------------------------------------------
/app/models/announcement.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # == Schema Information
4 | #
5 | # Table name: announcements
6 | #
7 | # id :bigint(8) not null, primary key
8 | # announcement_type :string
9 | # description :text
10 | # name :string
11 | # published_at :datetime
12 | # created_at :datetime not null
13 | # updated_at :datetime not null
14 | #
15 | class Announcement < ApplicationRecord # rubocop:todo Style/Documentation
16 | TYPES = %w[new fix update].freeze
17 |
18 | after_initialize :set_defaults
19 |
20 | validates :announcement_type, :description, :name, :published_at, presence: true
21 | validates :announcement_type, inclusion: { in: TYPES }
22 |
23 | def set_defaults
24 | self.published_at ||= Time.zone.now
25 | self.announcement_type ||= TYPES.first
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationRecord < ActiveRecord::Base
4 | primary_abstract_class
5 | end
6 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/app/models/concerns/.keep
--------------------------------------------------------------------------------
/app/models/notification.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # == Schema Information
4 | #
5 | # Table name: notifications
6 | #
7 | # id :bigint(8) not null, primary key
8 | # params :json
9 | # read_at :datetime
10 | # recipient_type :string not null
11 | # type :string not null
12 | # created_at :datetime not null
13 | # updated_at :datetime not null
14 | # recipient_id :bigint(8) not null
15 | #
16 | # Indexes
17 | #
18 | # index_notifications_on_read_at (read_at)
19 | # index_notifications_on_recipient (recipient_type,recipient_id)
20 | #
21 | class Notification < ApplicationRecord
22 | include Noticed::Model
23 | belongs_to :recipient, polymorphic: true
24 | end
25 |
--------------------------------------------------------------------------------
/app/models/service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # == Schema Information
4 | #
5 | # Table name: services
6 | #
7 | # id :bigint(8) not null, primary key
8 | # access_token :string
9 | # access_token_secret :string
10 | # auth :text
11 | # expires_at :datetime
12 | # provider :string
13 | # refresh_token :string
14 | # uid :string
15 | # created_at :datetime not null
16 | # updated_at :datetime not null
17 | # user_id :bigint(8) not null
18 | #
19 | # Indexes
20 | #
21 | # index_services_on_user_id (user_id)
22 | #
23 | # Foreign Keys
24 | #
25 | # fk_rails_... (user_id => users.id)
26 | #
27 | class Service < ApplicationRecord # rubocop:todo Style/Documentation
28 | belongs_to :user
29 |
30 | Devise.omniauth_configs.each_key do |provider|
31 | scope provider, -> { where(provider: provider) }
32 | end
33 |
34 | def client
35 | send("#{provider}_client")
36 | end
37 |
38 | def expired?
39 | expires_at? && expires_at <= Time.zone.now
40 | end
41 |
42 | def access_token
43 | send("#{provider}_refresh_token!", super) if expired?
44 | super
45 | end
46 |
47 | def twitter_client
48 | Twitter::REST::Client.new do |config|
49 | config.consumer_key = Rails.application.secrets.twitter_app_id
50 | config.consumer_secret = Rails.application.secrets.twitter_app_secret
51 | config.access_token = access_token
52 | config.access_token_secret = access_token_secret
53 | end
54 | end
55 |
56 | def twitter_refresh_token!(token); end
57 | end
58 |
--------------------------------------------------------------------------------
/app/models/user.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # == Schema Information
4 | #
5 | # Table name: users
6 | #
7 | # id :bigint(8) not null, primary key
8 | # admin :boolean default(FALSE)
9 | # announcements_last_read_at :datetime
10 | # confirmation_sent_at :datetime
11 | # confirmation_token :string
12 | # confirmed_at :datetime
13 | # current_sign_in_at :datetime
14 | # current_sign_in_ip :string
15 | # email :string default(""), not null
16 | # encrypted_password :string default(""), not null
17 | # first_name :string
18 | # last_name :string
19 | # last_sign_in_at :datetime
20 | # last_sign_in_ip :string
21 | # remember_created_at :datetime
22 | # reset_password_sent_at :datetime
23 | # reset_password_token :string
24 | # role :integer(4) default("user"), not null
25 | # sign_in_count :integer(4) default(0), not null
26 | # unconfirmed_email :string
27 | # created_at :datetime not null
28 | # updated_at :datetime not null
29 | #
30 | # Indexes
31 | #
32 | # index_users_on_confirmation_token (confirmation_token) UNIQUE
33 | # index_users_on_email (email) UNIQUE
34 | # index_users_on_reset_password_token (reset_password_token) UNIQUE
35 | #
36 | class User < ApplicationRecord
37 | devise :masqueradable, :database_authenticatable, :confirmable, :registerable, :trackable, :recoverable,
38 | :rememberable, :validatable, :omniauthable
39 | # Roles, add other roles as required
40 | enum role: {
41 | user: 0,
42 | member: 1
43 | }, _prefix: true
44 |
45 | after_initialize :set_default_role, if: :new_record?
46 | def set_default_role
47 | self.role ||= :user
48 | end
49 |
50 | # Validations, Names, Avatars
51 | validates :email, presence: true
52 | validates :email, uniqueness: true
53 | # validates :username, presence: true
54 | has_one_attached :avatar
55 | has_person_name
56 | # Notifications & Services
57 | has_many :notifications, as: :recipient
58 | has_many :services
59 | # has_many :members
60 |
61 | private
62 |
63 | # Example role set method
64 | def set_alt_role
65 | case role.to_sym
66 | when :member
67 | self.role = :member
68 | end
69 | end
70 | end
71 |
--------------------------------------------------------------------------------
/app/policies/application_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationPolicy < Policy::Base
4 | attr_reader :user, :record
5 |
6 | def initialize(user, record)
7 | @user = user
8 | @record = record
9 | end
10 |
11 | def index?
12 | false
13 | end
14 |
15 | def show?
16 | false
17 | end
18 |
19 | def create?
20 | false
21 | end
22 |
23 | def new?
24 | create?
25 | end
26 |
27 | def update?
28 | false
29 | end
30 |
31 | def edit?
32 | update?
33 | end
34 |
35 | def destroy?
36 | false
37 | end
38 |
39 | class Scope
40 | def initialize(user, scope)
41 | @user = user
42 | @scope = scope
43 | end
44 |
45 | def resolve
46 | raise NotImplementedError, "You must define #resolve in #{self.class}"
47 | end
48 |
49 | private
50 |
51 | attr_reader :user, :scope
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/app/policies/user_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # examples
3 | # class UserPolicy < ApplicationPolicy
4 | # role :regular_user,
5 | # attributes: {
6 | # show: %i(username name avatar is_confirmed created_at)
7 | # },
8 | # associations: {
9 | # show: %i(posts followers following)
10 | # },
11 | # scope: lambda{resource.regular_user_scope}
12 | #
13 | # role :correct_user,
14 | # attributes: {
15 | # show: %i(email phone_number confirmed_at updated_at),
16 | # update: %i(username email password password_confirmation current_password name avatar)
17 | # },
18 | # associations: {
19 | # show: %i(settings),
20 | # save: %i(settings)
21 | # }
22 | # role :guest,
23 | # attributes: {
24 | # show: %i(username first_name last_name avatar),
25 | # create: %i(username email password password_confirmation first_name last_name avatar)
26 | # },
27 | # associations: {}
28 | #
29 | # # in the query methods, define the roles which are allowed for the particular action
30 | # def show?
31 | # allow :guest, :regular_user, :correct_user
32 | # end
33 | #
34 | # # or with the allow helper method:
35 | # def update?
36 | # allow :regular_user, :correct_user
37 | # end
38 | #
39 | # def create?
40 | # allow :guest, :admin
41 | # end
42 | # end
43 |
--------------------------------------------------------------------------------
/app/views/admin/application/_navigation.html.erb:
--------------------------------------------------------------------------------
1 | <%#
2 | # Navigation
3 |
4 | This partial is used to display the navigation in Administrate.
5 | By default, the navigation contains navigation links
6 | for all resources in the admin dashboard,
7 | as defined by the routes in the `admin/` namespace
8 | %>
9 |
10 |
25 |
--------------------------------------------------------------------------------
/app/views/admin/users/show.html.erb:
--------------------------------------------------------------------------------
1 | <%#
2 | # Show
3 |
4 | This view is the template for the show page.
5 | It renders the attributes of a resource,
6 | as well as a link to its edit page.
7 |
8 | ## Local variables:
9 |
10 | - `page`:
11 | An instance of [Administrate::Page::Show][1].
12 | Contains methods for accessing the resource to be displayed on the page,
13 | as well as helpers for describing how each attribute of the resource
14 | should be displayed.
15 |
16 | [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
17 | %>
18 |
19 | <% content_for(:title) { t("administrate.actions.show_resource", {name: page.page_title}) } %>
20 |
21 |
22 |
23 | <%= content_for(:title) %>
24 |
25 |
26 |
27 | <%= link_to "Login As User", masquerade_path(page.resource), class: "button" %>
28 |
29 | <%= link_to(
30 | "#{t("administrate.actions.edit")} #{page.page_title}",
31 | [:edit, namespace, page.resource],
32 | class: "button",
33 | ) if valid_action? :edit %>
34 |
35 |
36 |
37 |
38 |
39 | <% page.attributes.each do |attribute| %>
40 | -
41 | <%= t(
42 | "helpers.label.#{resource_name}.#{attribute.name}",
43 | default: attribute.name.titleize,
44 | ) %>
45 |
46 |
47 | - <%= render_field attribute %>
49 | <% end %>
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/views/announcements/index.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
What's New
3 |
4 |
5 |
6 | <% @announcements.each_with_index do |announcement, index| %>
7 | <% if index != 0 %>
8 |
9 | <% end %>
10 |
11 |
12 |
13 | <%= link_to announcements_path(anchor: dom_id(announcement)) do %>
14 | <%= announcement.published_at.strftime("%b %d") %>
15 | <% end %>
16 |
17 |
18 | <%= announcement.announcement_type.titleize %>:
19 | <%= announcement.name %>
20 | <%= simple_format announcement.description %>
21 |
22 |
23 | <% end %>
24 |
25 | <% if @announcements.empty? %>
26 |
Exciting announcements coming very soon!
27 | <% end %>
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/views/application/_favicon.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Resend confirmation instructions
4 |
5 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
6 | <%= render "devise/shared/error_messages", resource: resource %>
7 |
8 |
9 | <%= f.label :email, class: 'form-label' %>
10 | <%= f.email_field :email, autofocus: true, class: 'form-control', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
11 |
12 |
13 |
14 | <%= f.submit "Resend confirmation instructions", class: 'btn btn-primary btn-lg' %>
15 |
16 | <% end %>
17 |
18 |
19 | <%= render "devise/shared/links" %>
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Welcome <%= @email %>!
2 |
3 | You can confirm your account email through the link below:
4 |
5 | <%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
6 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/email_changed.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @email %>!
2 |
3 | <% if @resource.try(:unconfirmed_email?) %>
4 | We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.
5 | <% else %>
6 | We're contacting you to notify you that your email has been changed to <%= @resource.email %>.
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/password_change.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | We're contacting you to notify you that your password has been changed.
4 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password. You can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 |
5 | Click the link below to unlock your account:
6 |
7 | <%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
8 |
--------------------------------------------------------------------------------
/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Change your password
4 |
5 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
6 | <%= render "devise/shared/error_messages", resource: resource %>
7 | <%= f.hidden_field :reset_password_token %>
8 |
9 |
10 | <%= f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control', placeholder: "Password" %>
11 | <% if @minimum_password_length %>
12 |
<%= @minimum_password_length %> characters minimum
13 | <% end %>
14 |
15 |
16 |
17 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: "Confirm Password" %>
18 |
19 |
20 |
21 | <%= f.submit "Change my password", class: 'btn btn-primary btn-lg' %>
22 |
23 | <% end %>
24 |
25 |
26 | <%= render "devise/shared/links" %>
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Reset your password
4 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
5 | <%= render "devise/shared/error_messages", resource: resource %>
6 |
Enter your email address below and we will send you a link to reset your password.
7 |
8 |
9 | <%= f.email_field :email, autofocus: true, placeholder: 'Email address', class: 'form-control' %>
10 |
11 |
12 |
13 | <%= f.submit "Send password reset email", class: 'btn btn-primary btn-lg' %>
14 |
15 | <% end %>
16 |
17 | <%= render "devise/shared/links" %>
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Account
4 |
5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
6 | <%= render "devise/shared/error_messages", resource: resource %>
7 |
8 |
9 | <%= f.text_field :name, autofocus: false, class: 'form-control', placeholder: "Full name" %>
10 |
11 |
12 |
13 | <%= f.email_field :email, class: 'form-control', placeholder: 'Email Address' %>
14 |
15 |
16 |
17 | <%= f.label :avatar, class: "form-label" %>
18 | <%= f.file_field :avatar, accept:'image/*' %>
19 |
20 |
21 | <%= image_tag avatar_path(f.object), class: "rounded border shadow-sm d-block mx-auto my-3" %>
22 |
23 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
24 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
25 | <% end %>
26 |
27 |
28 | <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %>
29 |
Leave password blank if you don't want to change it
30 |
31 |
32 |
33 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %>
34 |
35 |
36 |
37 | <%= f.password_field :current_password, autocomplete: "off", class: 'form-control', placeholder: 'Current Password' %>
38 |
We need your current password to confirm your changes
39 |
40 |
41 |
42 | <%= f.submit "Save Changes", class: 'btn btn-lg btn-primary' %>
43 |
44 | <% end %>
45 |
46 |
47 |
<%= link_to "Deactivate my account", registration_path(resource_name), data: { confirm: "Are you sure? You cannot undo this." }, method: :delete %>
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Sign Up
4 |
5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
6 | <%= render "devise/shared/error_messages", resource: resource %>
7 |
8 |
9 | <%= f.text_field :name, autofocus: false, class: 'form-control', placeholder: "Full name" %>
10 |
11 |
12 |
13 | <%= f.email_field :email, autofocus: false, class: 'form-control', placeholder: "Email Address" %>
14 |
15 |
16 |
17 | <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %>
18 |
19 |
20 |
21 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %>
22 |
23 |
24 | <%= f.submit "Sign up", class: "btn btn-outline-dark btn-lg" %>
25 |
26 | <% end %>
27 |
28 |
29 | <%= render "devise/shared/links" %>
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Log in
4 |
5 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
6 |
7 | <%= f.email_field :email, autofocus: true, placeholder: 'Email Address', class: 'form-control' %>
8 |
9 |
10 | <%= f.password_field :password, autocomplete: "off", placeholder: 'Password', class: 'form-control' %>
11 |
12 |
13 | <% if devise_mapping.rememberable? -%>
14 |
15 |
19 |
20 | <% end -%>
21 |
22 | <%= f.submit "Log in", class: "btn btn-outline-dark btn-lg" %>
23 |
24 | <% end %>
25 |
26 |
27 | <%= render "devise/shared/links" %>
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/views/devise/shared/_error_messages.html.erb:
--------------------------------------------------------------------------------
1 | <% if resource.errors.any? %>
2 |
3 |
4 | <%= I18n.t("errors.messages.not_saved",
5 | count: resource.errors.count,
6 | resource: resource.class.model_name.human.downcase)
7 | %>
8 |
9 |
10 | <% resource.errors.full_messages.each do |message| %>
11 | - <%= message %>
12 | <% end %>
13 |
14 |
15 | <% end %>
16 |
--------------------------------------------------------------------------------
/app/views/devise/shared/_links.html.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end %>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end %>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end %>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end %>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end %>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %>
24 | <% end %>
25 | <% end %>
26 |
--------------------------------------------------------------------------------
/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Resend unlock instructions
4 |
5 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
6 | <%= render "devise/shared/error_messages", resource: resource %>
7 |
8 |
9 | <%= f.label :email, class: "form-label" %>
10 | <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
11 |
12 |
13 |
14 | <%= f.submit "Resend unlock instructions", class: "btn btn-lg btn-primary" %>
15 |
16 | <% end %>
17 |
18 | <%= render "devise/shared/links" %>
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/views/home/index.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Ruby on Rails 7 App Starter Kit!
6 |
7 |
8 | Built with latest Rails 7, PostgreSQL, Redis Caching, Bootstrap 5, Font Awesome 5, Devise Auth, Email Sends, User Avatars, Notifications, Announcements, Rollup, Importmap, CSS Bundling, JS Bundling, Administrate, Turbo, Stimulus JS, Hotwire, Action Cable, Cable Ready
, Puma Webserver, Request JS, Administrate, Rubocop, Rspec & Limitless Enum Roles on User Model!
9 |
10 |
NO Webpack or Webpacker!
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | <%= link_to image_tag('rails.webp', class: "img-fluid", alt: "Hotwire", :size => '542x337') %>
20 | <%= link_to "Get In Touch!", new_user_registration_path, class: "btn btn-outline-dark btn-rounded btn-lg mt-5" %>
21 |
22 |
23 |
24 |
25 | <%= link_to image_tag('intro.png'), root_path, class: "img-fluid", alt: "Illustration" %>
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/views/home/privacy.html.erb:
--------------------------------------------------------------------------------
1 | Privacy Policy
2 | Use this for your Privacy Policy
3 |
--------------------------------------------------------------------------------
/app/views/home/terms.html.erb:
--------------------------------------------------------------------------------
1 | Terms of Service
2 | Use this for your Terms of Service
3 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <%= render 'shared/head' %>
5 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
6 | <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
7 |
8 |
9 |
10 | <%= render 'shared/navbar' %>
11 | <%= render 'shared/notices' %>
12 |
13 |
14 | <%= yield %>
15 |
16 |
17 | <%= render 'shared/footer' %>
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/app/views/notifications/index.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Notifications
3 |
4 |
5 |
6 | <% @notifications.each do |notification| %>
7 |
8 |
9 |
10 |
11 |
12 | <%= link_to notifications_path(anchor: dom_id(notification)) do %>
13 | <%= notification.published_at.strftime("%b %d") %>
14 | <% end %>
15 |
16 |
17 | <%= notification.notification_type.titleize %>:
18 | <%= notification.name %>
19 | <%= simple_format notification.description %>
20 |
21 |
22 | <% end %>
23 |
24 | <% if @notifications.empty? %>
25 |
Notifications coming very soon!
26 | <% end %>
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/views/shared/_footer.html.erb:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/views/shared/_head.html.erb:
--------------------------------------------------------------------------------
1 | Rails 7 SaaS Jumpstart Octo
2 |
3 |
4 |
5 | <%= csrf_meta_tags %>
6 | <%= csp_meta_tag %>
7 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
8 | <%= javascript_importmap_tags %>
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/views/shared/_navbar.html.erb:
--------------------------------------------------------------------------------
1 | <% if user_masquerade? %>
2 |
3 | You're logged in as <%= current_user.name %> (<%= current_user.email %>)
4 | <%= link_to back_masquerade_path(current_user) do %><%= icon("bi", "bi-x-circle") %> Logout <% end %>
5 |
6 | <% end %>
7 |
8 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/views/shared/_notices.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <% flash.each do |msg_type, message| %>
3 |
4 | <%= message %>
5 |
6 |
7 | <% end %>
8 |
9 |
--------------------------------------------------------------------------------
/app/views/shared/nav-masquerade:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'bundle' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require 'rubygems'
12 |
13 | m = Module.new do
14 | module_function
15 |
16 | def invoked_as_script?
17 | File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
18 | end
19 |
20 | def env_var_version
21 | ENV['BUNDLER_VERSION']
22 | end
23 |
24 | def cli_arg_version
25 | return unless invoked_as_script? # don't want to hijack other binstubs
26 | return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update`
27 |
28 | bundler_version = nil
29 | update_index = nil
30 | ARGV.each_with_index do |a, i|
31 | bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
32 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
33 |
34 | bundler_version = Regexp.last_match(1)
35 | update_index = i
36 | end
37 | bundler_version
38 | end
39 |
40 | def gemfile
41 | gemfile = ENV['BUNDLE_GEMFILE']
42 | return gemfile if gemfile && !gemfile.empty?
43 |
44 | File.expand_path('../Gemfile', __dir__)
45 | end
46 |
47 | def lockfile
48 | lockfile =
49 | case File.basename(gemfile)
50 | when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
51 | else "#{gemfile}.lock"
52 | end
53 | File.expand_path(lockfile)
54 | end
55 |
56 | def lockfile_version
57 | return unless File.file?(lockfile)
58 |
59 | lockfile_contents = File.read(lockfile)
60 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
61 |
62 | Regexp.last_match(1)
63 | end
64 |
65 | def bundler_requirement
66 | @bundler_requirement ||=
67 | env_var_version || cli_arg_version ||
68 | bundler_requirement_for(lockfile_version)
69 | end
70 |
71 | def bundler_requirement_for(version)
72 | return "#{Gem::Requirement.default}.a" unless version
73 |
74 | bundler_gem_version = Gem::Version.new(version)
75 |
76 | requirement = bundler_gem_version.approximate_recommendation
77 |
78 | return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.7.0')
79 |
80 | requirement += '.a' if bundler_gem_version.prerelease?
81 |
82 | requirement
83 | end
84 |
85 | def load_bundler!
86 | ENV['BUNDLE_GEMFILE'] ||= gemfile
87 |
88 | activate_bundler
89 | end
90 |
91 | def activate_bundler
92 | gem_error = activation_error_handling do
93 | gem 'bundler', bundler_requirement
94 | end
95 | return if gem_error.nil?
96 |
97 | require_error = activation_error_handling do
98 | require 'bundler/version'
99 | end
100 | if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
101 | return
102 | end
103 |
104 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
105 | exit 42
106 | end
107 |
108 | def activation_error_handling
109 | yield
110 | nil
111 | rescue StandardError, LoadError => e
112 | e
113 | end
114 | end
115 |
116 | m.load_bundler!
117 |
118 | load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
119 |
--------------------------------------------------------------------------------
/bin/dev:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | if ! command -v foreman &> /dev/null
4 | then
5 | echo "Installing foreman..."
6 | gem install foreman
7 | fi
8 |
9 | foreman start -f Procfile.dev
10 |
--------------------------------------------------------------------------------
/bin/importmap:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require_relative '../config/application'
5 | require 'importmap/commands'
6 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | APP_PATH = File.expand_path('../config/application', __dir__)
5 | require_relative '../config/boot'
6 | require 'rails/commands'
7 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require_relative '../config/boot'
5 | require 'rake'
6 | Rake.application.run
7 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require 'fileutils'
5 |
6 | # path to your application root.
7 | APP_ROOT = File.expand_path('..', __dir__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | FileUtils.chdir APP_ROOT do
14 | # This script is a way to set up or update your development environment automatically.
15 | # This script is idempotent, so that you can run it at any time and get an expectable outcome.
16 | # Add necessary setup steps to this file.
17 |
18 | puts '== Installing dependencies =='
19 | system! 'gem install bundler --conservative'
20 | system('bundle check') || system!('bundle install')
21 |
22 | # puts "\n== Copying sample files =="
23 | # unless File.exist?("config/database.yml")
24 | # FileUtils.cp "config/database.yml.sample", "config/database.yml"
25 | # end
26 |
27 | puts "\n== Preparing database =="
28 | system! 'bin/rails db:prepare'
29 |
30 | puts "\n== Removing old logs and tempfiles =="
31 | system! 'bin/rails log:clear tmp:clear'
32 |
33 | puts "\n== Restarting application server =="
34 | system! 'bin/rails restart'
35 | end
36 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is used by Rack-based servers to start the application.
4 |
5 | require_relative 'config/environment'
6 |
7 | run Rails.application
8 | Rails.application.load_server
9 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Require the gems listed in Gemfile, including any gems
4 | # you've limited to :test, :development, or :production.
5 |
6 | require_relative 'boot'
7 |
8 | require 'rails/all'
9 |
10 | Bundler.require(*Rails.groups)
11 |
12 | module JumpstartOcto
13 | class Application < Rails::Application # rubocop:disable Style/Documentation
14 | # Initialize configuration defaults for originally generated Rails version.
15 | config.load_defaults 7.0
16 | config.assets.initialize_on_precompile = false
17 | # Configuration for the application, engines, and railties goes here.
18 | #
19 | # These settings can be overridden in specific environments using the files
20 | # in config/environments, which are processed later.
21 | #
22 | # config.time_zone = "Central Time (US & Canada)"
23 | # config.eager_load_paths << Rails.root.join("extras")
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4 |
5 | require 'bundler/setup' # Set up gems listed in the Gemfile.
6 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
7 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: redis
3 | url: redis://localhost:6379/1
4 |
5 | test:
6 | adapter: test
7 |
8 | production:
9 | adapter: redis
10 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
11 | channel_prefix: jumpstart_octo_production
12 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | 3MP8YgMMotq2dELJMIW6n0QsHg4DFKO6eYw77H5col4JXfTANGBuKraxQwYvc1R2av5/3kKoqDjtuP1KGE32KIlLzYFSMM2zk+OPphQuu24OBGiGZ3PvZZLtfp6Z1u2OpAXtBlbFYrL8QvT/ZnLdC8o0fitcacaJE9Gdnl/QfeK0wRRgBijcamsFt+/P2GRN1g7tBwKtYEe2gA40rpkfcLz5FMxKse1FamgxOPRZUzOEcsM2zbQzlHDrccYRLchlWy+kwNMV9b+awSNt4YbABZHsEG8EA0sF+L+fOtNJ4rNhSLOPNXIL/AGOPqDpOhZhXqErPC18Ea0B3e4H11H6LNoBVBf6gw/VBkUluUiGTXzC+JGF17QWMdxE9EcoR2DwbguljfIerGNaogn8nJsg1gBvUWr4UIFV+6cx--SQ1mtW9QlfXEBDtf--BMK1JsAJSZBjN53XjFftZw==
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # PostgreSQL. Versions 9.3 and up are supported.
2 | #
3 | # Install the pg driver:
4 | # gem install pg
5 | # On macOS with Homebrew:
6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7 | # On macOS with MacPorts:
8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9 | # On Windows:
10 | # gem install pg
11 | # Choose the win32 build.
12 | # Install PostgreSQL and put its /bin directory on your path.
13 | #
14 | # Configure Using Gemfile
15 | # gem 'pg'
16 | #
17 | default: &default
18 | adapter: postgresql
19 | encoding: unicode
20 | # For details on connection pooling, see Rails configuration guide
21 | # https://guides.rubyonrails.org/configuring.html#database-pooling
22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23 |
24 | # Connect on a TCP socket. Omitted by default since the client uses a
25 | # domain socket that doesn't need configuration. Windows does not have
26 | # domain sockets, so uncomment these lines.
27 | host: <%= ENV['DB_HOST'] %>
28 |
29 | # The specified database role being used to connect to postgres.
30 | # To create additional roles in postgres see `$ createuser --help`.
31 | # When left blank, postgres will use the default role. This is
32 | # the same name as the operating system user that initialized the database.
33 | username: <%= ENV['DB_USER'] %>
34 |
35 | # The password associated with the postgres role (username).
36 | password: <%= ENV['DB_PASSWORD'] %>
37 |
38 | # The TCP port the server listens on. Defaults to 5432.
39 | # If your server runs on a different port number, change accordingly.
40 | #port: 5432
41 | # Schema search path. The server defaults to $user,public
42 | #schema_search_path: myapp,sharedapp,public
43 | # Minimum log levels, in increasing order:
44 | # debug5, debug4, debug3, debug2, debug1,
45 | # log, notice, warning, error, fatal, and panic
46 | # Defaults to warning.
47 | #min_messages: notice
48 |
49 | development:
50 | <<: *default
51 | database: <%= ENV.fetch("DATABASE_NAME", File.basename(Rails.root)) %>_dev
52 |
53 | # Warning: The database defined as "test" will be erased and
54 | # re-generated from your development database when you run "rake".
55 | # Do not set this db to the same as development or production.
56 |
57 | test:
58 | <<: *default
59 | database: <%= ENV.fetch("DATABASE_NAME", File.basename(Rails.root)) %>_test
60 |
61 | # As with config/credentials.yml, you never want to store sensitive information,
62 | # like your database password, in your source code. If your source code is
63 | # ever seen by anyone, they now have access to your database.
64 | #
65 | # Instead, provide the password as a unix environment variable when you boot
66 | # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
67 | # for a full rundown on how to provide these environment variables in a
68 | # production deployment.
69 | #
70 | # On Heroku and other platform providers, you may have a full connection URL
71 | # available as an environment variable. For example:
72 | #
73 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
74 | #
75 | # You can use this database configuration with:
76 | #
77 | # production:
78 | # url: <%= ENV['DATABASE_URL'] %>
79 | #
80 | production:
81 | <<: *default
82 | database: <%= ENV['DATABASE_NAME'] %>_prod
83 |
84 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Load the Rails application.
4 | require_relative 'application'
5 |
6 | # Initialize the Rails application.
7 | Rails.application.initialize!
8 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'active_support/core_ext/integer/time'
4 |
5 | Rails.application.configure do
6 | # Settings specified here will take precedence over those in config/application.rb.
7 |
8 | # In the development environment your application's code is reloaded any time
9 | # it changes. This slows down response time but is perfect for development
10 | # since you don't have to restart the web server when you make code changes.
11 | config.cache_classes = false
12 | config.session_store :cache_store
13 |
14 | # send local mail via smtp
15 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
16 | config.action_mailer.delivery_method = :smtp
17 |
18 | # Do not eager load code on boot.
19 | config.eager_load = false
20 |
21 | # Show full error reports.
22 | config.consider_all_requests_local = true
23 |
24 | # Enable server timing
25 | config.server_timing = true
26 |
27 | # Enable/disable caching. By default caching is disabled.
28 | # Run rails dev:cache to toggle caching.
29 | if Rails.root.join('tmp/caching-dev.txt').exist?
30 | config.action_controller.perform_caching = true
31 | config.action_controller.enable_fragment_cache_logging = true
32 |
33 | # CHANGE the following line; it's :memory_store by default
34 | config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') }
35 | config.public_file_server.headers = {
36 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
37 | }
38 | else
39 | config.action_controller.perform_caching = false
40 |
41 | config.cache_store = :null_store
42 | end
43 |
44 | # Store uploaded files on the local file system (see config/storage.yml for options).
45 | config.active_storage.service = :local
46 |
47 | # Don't care if the mailer can't send.
48 | config.action_mailer.raise_delivery_errors = true
49 |
50 | config.action_mailer.perform_caching = false
51 |
52 | # Print deprecation notices to the Rails logger.
53 | config.active_support.deprecation = :log
54 |
55 | # Raise exceptions for disallowed deprecations.
56 | config.active_support.disallowed_deprecation = :raise
57 |
58 | # Tell Active Support which deprecation messages to disallow.
59 | config.active_support.disallowed_deprecation_warnings = []
60 |
61 | # Raise an error on page load if there are pending migrations.
62 | config.active_record.migration_error = :page_load
63 |
64 | # Highlight code that triggered database queries in logs.
65 | config.active_record.verbose_query_logs = true
66 |
67 | # Suppress logger output for asset requests.
68 | config.assets.quiet = true
69 |
70 | # Raises error for missing translations.
71 | # config.i18n.raise_on_missing_translations = true
72 |
73 | # Annotate rendered view with file names.
74 | # config.action_view.annotate_rendered_view_with_filenames = true
75 |
76 | # Uncomment if you wish to allow Action Cable access from any origin.
77 | # config.action_cable.disable_request_forgery_protection = true
78 | end
79 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'active_support/core_ext/integer/time'
4 |
5 | Rails.application.configure do
6 | # Settings specified here will take precedence over those in config/application.rb.
7 |
8 | # Code is not reloaded between requests.
9 | config.cache_classes = true
10 |
11 | # Eager load code on boot. This eager loads most of Rails and
12 | # your application in memory, allowing both threaded web servers
13 | # and those relying on copy on write to perform better.
14 | # Rake tasks automatically ignore this option for performance.
15 | config.eager_load = true
16 |
17 | # Full error reports are disabled and caching is turned on.
18 | config.consider_all_requests_local = false
19 | config.action_controller.perform_caching = true
20 |
21 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
22 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
23 | # config.require_master_key = true
24 |
25 | # Disable serving static files from the `/public` folder by default since
26 | # Apache or NGINX already handles this.
27 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28 |
29 | # Compress CSS using a preprocessor.
30 | # config.assets.css_compressor = :sass
31 |
32 | # Do not fallback to assets pipeline if a precompiled asset is missed.
33 | config.assets.compile = false
34 |
35 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
36 | # config.asset_host = "http://assets.example.com"
37 |
38 | # Specifies the header that your server uses for sending files.
39 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
40 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
41 |
42 | # Store uploaded files on the local file system (see config/storage.yml for options).
43 | config.active_storage.service = :local
44 |
45 | # Mount Action Cable outside main process or domain.
46 | # config.action_cable.mount_path = nil
47 | # config.action_cable.url = "wss://example.com/cable"
48 | # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
49 |
50 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
51 | # config.force_ssl = true
52 |
53 | # Include generic and useful information about system operation, but avoid logging too much
54 | # information to avoid inadvertent exposure of personally identifiable information (PII).
55 | config.log_level = :info
56 |
57 | # Prepend all log lines with the following tags.
58 | config.log_tags = [:request_id]
59 |
60 | # Use a different cache store in production.
61 | # config.cache_store = :mem_cache_store
62 |
63 | # Use a real queuing backend for Active Job (and separate queues per environment).
64 | # config.active_job.queue_adapter = :resque
65 | # config.active_job.queue_name_prefix = "jumpstart_octo_production"
66 |
67 | config.action_mailer.perform_caching = false
68 |
69 | # Ignore bad email addresses and do not raise email delivery errors.
70 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
71 | # config.action_mailer.raise_delivery_errors = false
72 |
73 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
74 | # the I18n.default_locale when a translation cannot be found).
75 | config.i18n.fallbacks = true
76 |
77 | # Don't log any deprecations.
78 | config.active_support.report_deprecations = false
79 |
80 | # Use default logging formatter so that PID and timestamp are not suppressed.
81 | config.log_formatter = ::Logger::Formatter.new
82 |
83 | # Use a different logger for distributed setups.
84 | # require "syslog/logger"
85 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
86 |
87 | if ENV['RAILS_LOG_TO_STDOUT'].present?
88 | logger = ActiveSupport::Logger.new($stdout)
89 | logger.formatter = config.log_formatter
90 | config.logger = ActiveSupport::TaggedLogging.new(logger)
91 | end
92 |
93 | # Do not dump schema after migrations.
94 | config.active_record.dump_schema_after_migration = false
95 | end
96 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'active_support/core_ext/integer/time'
4 |
5 | # The test environment is used exclusively to run your application's
6 | # test suite. You never need to work with it otherwise. Remember that
7 | # your test database is "scratch space" for the test suite and is wiped
8 | # and recreated between test runs. Don't rely on the data there!
9 |
10 | Rails.application.configure do
11 | # Settings specified here will take precedence over those in config/application.rb.
12 |
13 | # Turn false under Spring and add config.action_view.cache_template_loading = true.
14 | config.cache_classes = true
15 |
16 | # Eager loading loads your whole application. When running a single test locally,
17 | # this probably isn't necessary. It's a good idea to do in a continuous integration
18 | # system, or in some way before deploying your code.
19 | config.eager_load = ENV['CI'].present?
20 |
21 | # Configure public file server for tests with Cache-Control for performance.
22 | config.public_file_server.enabled = true
23 | config.public_file_server.headers = {
24 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
25 | }
26 |
27 | # Show full error reports and disable caching.
28 | config.consider_all_requests_local = true
29 | config.action_controller.perform_caching = false
30 | config.cache_store = :null_store
31 |
32 | # Raise exceptions instead of rendering exception templates.
33 | config.action_dispatch.show_exceptions = false
34 |
35 | # Disable request forgery protection in test environment.
36 | config.action_controller.allow_forgery_protection = false
37 |
38 | # Store uploaded files on the local file system in a temporary directory.
39 | config.active_storage.service = :test
40 |
41 | config.action_mailer.perform_caching = false
42 |
43 | # Tell Action Mailer not to deliver emails to the real world.
44 | # The :test delivery method accumulates sent emails in the
45 | # ActionMailer::Base.deliveries array.
46 | config.action_mailer.delivery_method = :test
47 |
48 | # Print deprecation notices to the stderr.
49 | config.active_support.deprecation = :stderr
50 |
51 | # Raise exceptions for disallowed deprecations.
52 | config.active_support.disallowed_deprecation = :raise
53 |
54 | # Tell Active Support which deprecation messages to disallow.
55 | config.active_support.disallowed_deprecation_warnings = []
56 |
57 | # Raises error for missing translations.
58 | # config.i18n.raise_on_missing_translations = true
59 |
60 | # Annotate rendered view with file names.
61 | # config.action_view.annotate_rendered_view_with_filenames = true
62 | end
63 |
--------------------------------------------------------------------------------
/config/importmap.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Pin npm packages by running ./bin/importmap
4 |
5 | pin 'application', preload: true
6 | pin '@hotwired/turbo-rails', to: 'turbo.min.js', preload: true
7 | pin '@hotwired/stimulus', to: 'stimulus.min.js', preload: true
8 | pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js', preload: true
9 | pin_all_from 'app/javascript/controllers', under: 'controllers'
10 | pin 'bootstrap', to: 'https://ga.jspm.io/npm:bootstrap@5.1.3/dist/js/bootstrap.esm.js'
11 | pin '@popperjs/core', to: 'https://ga.jspm.io/npm:@popperjs/core@2.11.0/lib/index.js'
12 | pin 'trix'
13 | pin '@rails/actiontext', to: 'actiontext.js'
14 | pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
15 | pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
16 | pin_all_from "app/javascript/controllers", under: "controllers"
17 | pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
18 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Version of your assets, change this if you want to expire all your assets.
6 | Rails.application.config.assets.version = '1.0'
7 |
8 | # Add additional assets to the asset load path.
9 | # Rails.application.config.assets.paths << Emoji.images_path
10 | Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font")
11 |
12 | # Precompile additional assets.
13 | # application.js, application.css, and all non-JS/CSS in the app/assets
14 | # folder are already added.
15 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
16 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Be sure to restart your server when you modify this file.
3 |
4 | # Define an application-wide content security policy
5 | # For further information see the following documentation
6 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
7 |
8 | # Rails.application.configure do
9 | # config.content_security_policy do |policy|
10 | # policy.default_src :self, :https
11 | # policy.font_src :self, :https, :data
12 | # policy.img_src :self, :https, :data
13 | # policy.object_src :none
14 | # policy.script_src :self, :https
15 | # policy.style_src :self, :https
16 | # # Specify URI for violation reports
17 | # # policy.report_uri "/csp-violation-report-endpoint"
18 | # end
19 | #
20 | # # Generate session nonces for permitted importmap and inline scripts
21 | # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
22 | # config.content_security_policy_nonce_directives = %w(script-src)
23 | #
24 | # # Report CSP violations to a specified URI. See:
25 | # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
26 | # # config.content_security_policy_report_only = true
27 | # end
28 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Configure sensitive parameters which will be filtered from the log file.
6 | Rails.application.config.filter_parameters += %i[
7 | passw secret token _key crypt salt certificate otp ssn
8 | ]
9 |
--------------------------------------------------------------------------------
/config/initializers/generators.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Rails.application.config.generators do |g|
4 | g.orm :active_record, primary_key_type: :uuid
5 | g.orm :active_record, foreign_key_type: :uuid
6 | end
7 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Be sure to restart your server when you modify this file.
3 |
4 | # Add new inflection rules using the following format. Inflections
5 | # are locale specific, and you may define rules for as many different
6 | # locales as you wish. All of these examples are active by default:
7 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
8 | # inflect.plural /^(ox)$/i, "\\1en"
9 | # inflect.singular /^(ox)en/i, "\\1"
10 | # inflect.irregular "person", "people"
11 | # inflect.uncountable %w( fish sheep )
12 | # end
13 |
14 | # These inflection rules are supported but not enabled by default:
15 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
16 | # inflect.acronym "RESTful"
17 | # end
18 |
--------------------------------------------------------------------------------
/config/initializers/permissions_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Define an application-wide HTTP permissions policy. For further
3 | # information see https://developers.google.com/web/updates/2018/06/feature-policy
4 | #
5 | # Rails.application.config.permissions_policy do |f|
6 | # f.camera :none
7 | # f.gyroscope :none
8 | # f.microphone :none
9 | # f.usb :none
10 | # f.fullscreen :self
11 | # f.payment :self, "https://secure.example.com"
12 | # end
13 |
--------------------------------------------------------------------------------
/config/initializers/setup_mail.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActionMailer::Base.smtp_settings = {
4 | address: 'smtp.gmail.com',
5 | port: 587,
6 | domain: 'gmail.com',
7 | user_name: ENV['SMTP_USER_NAME'],
8 | password: ENV['SMTP_PASSWORD'],
9 | authentication: 'plain',
10 | enable_starttls_auto: true
11 | }
12 | ActionMailer::Base.default_url_options[:host] = 'localhost'
13 |
--------------------------------------------------------------------------------
/config/initializers/splitclient.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | #
3 | # This file should contain code for Splitclient
4 | #
5 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/heartcombo/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
48 | sessions:
49 | signed_in: "Signed in successfully."
50 | signed_out: "Signed out successfully."
51 | already_signed_out: "Signed out successfully."
52 | unlocks:
53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
56 | errors:
57 | messages:
58 | already_confirmed: "was already confirmed, please try signing in"
59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
60 | expired: "has expired, please request a new one"
61 | not_found: "not found"
62 | not_locked: "was not locked"
63 | not_saved:
64 | one: "1 error prohibited this %{resource} from being saved:"
65 | other: "%{count} errors prohibited this %{resource} from being saved:"
66 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t "hello"
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t("hello") %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # "true": "foo"
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at https://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Puma can serve each request in a thread from an internal thread pool.
4 | # The `threads` method setting takes two numbers: a minimum and maximum.
5 | # Any libraries that use thread pools should be configured to match
6 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
7 | # and maximum; this matches the default thread size of Active Record.
8 | #
9 | max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5)
10 | min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
11 | threads min_threads_count, max_threads_count
12 |
13 | # Specifies the `worker_timeout` threshold that Puma will use to wait before
14 | # terminating a worker in development environments.
15 | #
16 | worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
17 |
18 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
19 | #
20 | port ENV.fetch('PORT', 3000)
21 |
22 | # Specifies the `environment` that Puma will run in.
23 | #
24 | environment ENV.fetch('RAILS_ENV', 'development')
25 |
26 | # Specifies the `pidfile` that Puma will use.
27 | pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid')
28 |
29 | # Specifies the number of `workers` to boot in clustered mode.
30 | # Workers are forked web server processes. If using threads and workers together
31 | # the concurrency of the application would be max `threads` * `workers`.
32 | # Workers do not work on JRuby or Windows (both of which do not support
33 | # processes).
34 | #
35 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
36 |
37 | # Use the `preload_app!` method when specifying a `workers` number.
38 | # This directive tells Puma to first boot the application and load code
39 | # before forking the application. This takes advantage of Copy On Write
40 | # process behavior so workers use less memory.
41 | #
42 | # preload_app!
43 |
44 | # Allow puma to be restarted by `bin/rails restart` command.
45 | plugin :tmp_restart
46 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'sidekiq/web'
4 |
5 | Rails.application.routes.draw do
6 | namespace :admin do
7 | resources :users
8 | resources :services
9 | resources :notifications
10 | resources :announcements
11 |
12 | root to: 'users#index'
13 | end
14 | resources :notifications, only: [:index]
15 | resources :announcements, only: [:index]
16 | devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
17 | devise_scope :user do
18 | get 'users' => 'devise/sessions#new'
19 | get '/users/sign_out' => 'devise/sessions#destroy'
20 | end
21 | root to: 'home#index'
22 | end
23 |
--------------------------------------------------------------------------------
/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
9 | # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 | # amazon:
11 | # service: S3
12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 | # region: us-east-1
15 | # bucket: your_own_bucket-<%= Rails.env %>
16 |
17 | # Remember not to checkin your GCS keyfile to a repository
18 | # google:
19 | # service: GCS
20 | # project: your_project
21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 | # bucket: your_own_bucket-<%= Rails.env %>
23 |
24 | # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25 | # microsoft:
26 | # service: AzureStorage
27 | # storage_account_name: your_account_name
28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29 | # container: your_container_name-<%= Rails.env %>
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/db/migrate/20210101185053_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class DeviseCreateUsers < ActiveRecord::Migration[7.0] # rubocop:todo Style/Documentation
4 | def change # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
5 | create_table :users do |t|
6 | ## Database authenticatable
7 | # t.string :username, null: false, default: ''
8 | t.string :email, null: false, default: ''
9 | t.string :encrypted_password, null: false, default: ''
10 |
11 | ## Recoverable
12 | t.string :reset_password_token
13 | t.datetime :reset_password_sent_at
14 |
15 | ## Rememberable
16 | t.datetime :remember_created_at
17 |
18 | ## Trackable
19 | t.integer :sign_in_count, default: 0, null: false
20 | t.datetime :current_sign_in_at
21 | t.datetime :last_sign_in_at
22 | t.string :current_sign_in_ip
23 | t.string :last_sign_in_ip
24 |
25 | ## Confirmable
26 | t.string :confirmation_token
27 | t.datetime :confirmed_at
28 | t.datetime :confirmation_sent_at
29 | t.string :unconfirmed_email # Only if using reconfirmable
30 |
31 | ## Lockable
32 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
33 | # t.string :unlock_token # Only if unlock strategy is :email or :both
34 | # t.datetime :locked_at
35 |
36 | t.integer :role, default: 0, null: false
37 |
38 | t.string :first_name
39 | t.string :last_name
40 | t.datetime :announcements_last_read_at
41 | t.boolean :admin, default: false
42 |
43 | t.timestamps null: false
44 | end
45 | # add_index :users, :username, unique: true
46 | add_index :users, :email, unique: true
47 | add_index :users, :reset_password_token, unique: true
48 | add_index :users, :confirmation_token, unique: true
49 | # add_index :users, :unlock_token, unique: true
50 | end
51 | end
52 |
--------------------------------------------------------------------------------
/db/migrate/20211219170448_create_announcements.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateAnnouncements < ActiveRecord::Migration[7.0] # rubocop:todo Style/Documentation
4 | def change
5 | create_table :announcements do |t|
6 | t.datetime :published_at
7 | t.string :announcement_type
8 | t.string :name
9 | t.text :description
10 |
11 | t.timestamps
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/db/migrate/20211219171100_create_notifications.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateNotifications < ActiveRecord::Migration[7.0] # rubocop:todo Style/Documentation
4 | def change
5 | create_table :notifications do |t|
6 | t.references :recipient, polymorphic: true, null: false
7 | t.string :type, null: false
8 | t.json :params
9 | t.datetime :read_at
10 |
11 | t.timestamps
12 | end
13 | add_index :notifications, :read_at
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/db/migrate/20211219171431_create_services.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateServices < ActiveRecord::Migration[7.0] # rubocop:todo Style/Documentation
4 | def change # rubocop:todo Metrics/MethodLength
5 | create_table :services do |t|
6 | t.references :user, null: false, foreign_key: true, index: true
7 | t.string :provider
8 | t.string :uid
9 | t.string :access_token
10 | t.string :access_token_secret
11 | t.string :refresh_token
12 | t.datetime :expires_at
13 | t.text :auth
14 |
15 | t.timestamps
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/db/migrate/20211219171905_create_friendly_id_slugs.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateFriendlyIdSlugs < ActiveRecord::Migration[7.0] # rubocop:todo Style/Documentation
4 | def change # rubocop:todo Metrics/MethodLength
5 | create_table :friendly_id_slugs do |t|
6 | t.string :slug, null: false
7 | t.integer :sluggable_id, null: false
8 | t.string :sluggable_type, limit: 50
9 | t.string :scope
10 | t.datetime :created_at
11 | end
12 | add_index :friendly_id_slugs, %i[sluggable_type sluggable_id]
13 | add_index :friendly_id_slugs, %i[slug sluggable_type], length: { slug: 140, sluggable_type: 50 }
14 | add_index :friendly_id_slugs, %i[slug sluggable_type scope],
15 | length: { slug: 70, sluggable_type: 50, scope: 70 }, unique: true
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/db/migrate/20211220185807_create_active_storage_tables.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateActiveStorageTables < ActiveRecord::Migration[7.0] # rubocop:todo Style/Documentation
4 | def change # rubocop:todo Metrics/MethodLength
5 | create_table :active_storage_blobs do |t|
6 | t.string :key, null: false
7 | t.string :filename, null: false
8 | t.string :content_type
9 | t.text :metadata
10 | t.string :service_name, null: false
11 | t.bigint :byte_size, null: false
12 | t.string :checksum, null: false
13 | t.datetime :created_at, null: false
14 |
15 | t.index [:key], unique: true
16 | end
17 |
18 | create_table :active_storage_attachments do |t|
19 | t.string :name, null: false
20 | t.references :record, null: false, polymorphic: true, index: false
21 | t.references :blob, null: false
22 |
23 | t.datetime :created_at, null: false
24 |
25 | t.index %i[record_type record_id name blob_id], name: 'index_active_storage_attachments_uniqueness',
26 | unique: true
27 | t.foreign_key :active_storage_blobs, column: :blob_id
28 | end
29 |
30 | create_table :active_storage_variant_records do |t|
31 | t.belongs_to :blob, null: false, index: false
32 | t.string :variation_digest, null: false
33 |
34 | t.index %i[blob_id variation_digest], name: 'index_active_storage_variant_records_uniqueness', unique: true
35 | t.foreign_key :active_storage_blobs, column: :blob_id
36 | end
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # This file is the source Rails uses to define your schema when running `bin/rails
6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7 | # be faster and is potentially less error prone than running all of your
8 | # migrations from scratch. Old migrations may fail to apply correctly if those
9 | # migrations use external dependencies or application code.
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema[7.0].define(version: 2021_12_20_185807) do
14 | # These are extensions that must be enabled in order to support this database
15 | enable_extension "plpgsql"
16 |
17 | create_table "active_storage_attachments", force: :cascade do |t|
18 | t.string "name", null: false
19 | t.string "record_type", null: false
20 | t.bigint "record_id", null: false
21 | t.bigint "blob_id", null: false
22 | t.datetime "created_at", null: false
23 | t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
24 | t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
25 | end
26 |
27 | create_table "active_storage_blobs", force: :cascade do |t|
28 | t.string "key", null: false
29 | t.string "filename", null: false
30 | t.string "content_type"
31 | t.text "metadata"
32 | t.string "service_name", null: false
33 | t.bigint "byte_size", null: false
34 | t.string "checksum", null: false
35 | t.datetime "created_at", null: false
36 | t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
37 | end
38 |
39 | create_table "active_storage_variant_records", force: :cascade do |t|
40 | t.bigint "blob_id", null: false
41 | t.string "variation_digest", null: false
42 | t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
43 | end
44 |
45 | create_table "announcements", force: :cascade do |t|
46 | t.datetime "published_at"
47 | t.string "announcement_type"
48 | t.string "name"
49 | t.text "description"
50 | t.datetime "created_at", null: false
51 | t.datetime "updated_at", null: false
52 | end
53 |
54 | create_table "friendly_id_slugs", force: :cascade do |t|
55 | t.string "slug", null: false
56 | t.integer "sluggable_id", null: false
57 | t.string "sluggable_type", limit: 50
58 | t.string "scope"
59 | t.datetime "created_at"
60 | t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
61 | t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
62 | t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
63 | end
64 |
65 | create_table "notifications", force: :cascade do |t|
66 | t.string "recipient_type", null: false
67 | t.bigint "recipient_id", null: false
68 | t.string "type", null: false
69 | t.json "params"
70 | t.datetime "read_at"
71 | t.datetime "created_at", null: false
72 | t.datetime "updated_at", null: false
73 | t.index ["read_at"], name: "index_notifications_on_read_at"
74 | t.index ["recipient_type", "recipient_id"], name: "index_notifications_on_recipient"
75 | end
76 |
77 | create_table "services", force: :cascade do |t|
78 | t.bigint "user_id", null: false
79 | t.string "provider"
80 | t.string "uid"
81 | t.string "access_token"
82 | t.string "access_token_secret"
83 | t.string "refresh_token"
84 | t.datetime "expires_at"
85 | t.text "auth"
86 | t.datetime "created_at", null: false
87 | t.datetime "updated_at", null: false
88 | t.index ["user_id"], name: "index_services_on_user_id"
89 | end
90 |
91 | create_table "users", force: :cascade do |t|
92 | t.string "email", default: "", null: false
93 | t.string "encrypted_password", default: "", null: false
94 | t.string "reset_password_token"
95 | t.datetime "reset_password_sent_at"
96 | t.datetime "remember_created_at"
97 | t.integer "sign_in_count", default: 0, null: false
98 | t.datetime "current_sign_in_at"
99 | t.datetime "last_sign_in_at"
100 | t.string "current_sign_in_ip"
101 | t.string "last_sign_in_ip"
102 | t.string "confirmation_token"
103 | t.datetime "confirmed_at"
104 | t.datetime "confirmation_sent_at"
105 | t.string "unconfirmed_email"
106 | t.integer "role", default: 0, null: false
107 | t.string "first_name"
108 | t.string "last_name"
109 | t.datetime "announcements_last_read_at"
110 | t.boolean "admin", default: false
111 | t.datetime "created_at", null: false
112 | t.datetime "updated_at", null: false
113 | t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
114 | t.index ["email"], name: "index_users_on_email", unique: true
115 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
116 | end
117 |
118 | add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
119 | add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
120 | add_foreign_key "services", "users"
121 | end
122 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # This file should contain all the record creation needed to seed the database with its default values.
3 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
4 | #
5 | # Examples:
6 | #
7 | # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
8 | # Character.create(name: "Luke", movie: movies.first)
9 |
--------------------------------------------------------------------------------
/env.example:
--------------------------------------------------------------------------------
1 | ## (for Gmail sends or other smtp)
2 | SMTP_USER_NAME=youremail
3 | SMTP_PASSWORD=emailaccpassword
4 |
5 | DATABASE_HOST=127.0.0.1
6 | DATABASE_PORT=5432
7 | DATABASE_USERNAME=anton
8 | DATABASE_PASSWORD=postgres1
9 |
10 | # Port to serve application
11 | # PORT=5000
12 |
13 | # Host name of the application
14 | # HOST=lvh.me
15 |
16 | # Enabled origins
17 | CORS_ORIGINS=127.0.0.1:3000,localhost:3000,lvh.me:3000
18 |
19 | # Current environment
20 | RACK_ENV=development
21 |
22 | # Maximum sign in tries before account lock
23 | MAX_SIGNIN_ATTEMPTS = 5
24 |
25 | # Base secret key
26 | SECRET_KEY_BASE=development_secret
27 |
28 | # Static files serving
29 | RAILS_SERVE_STATIC_FILES=true
30 |
31 | # Specify assets server host name, eg.: d2oek0c5zwe48d.cloudfront.net
32 | # ASSET_HOST=d2oek0c5zwe48d.cloudfront.net
33 |
34 | # Database name prefix
35 | # DATABASE_NAME=paste_database_prefix_here
36 |
37 | # Set Rollbar key for the app
38 | # ROLLBAR_ACCESS_TOKEN=your_key_here
39 |
40 | # We send devise email using this "from" address
41 | MAILER_SENDER_ADDRESS=noreply@example.com
42 |
43 | # Enable basic auth to close the app from unauthorized viewers
44 | # AUTH_BASIC_REALM=your_application_name
45 | # AUTH_BASIC_PASS=your_password_here
46 |
47 | # Set single hostname
48 | # CANONICAL_HOST=paste_single_hostname_here
49 |
50 | # Google analytics
51 | # GA_TRACKER=your_ga_tracker_code_here
52 |
53 | # comma separated list of IP adresses
54 | # IP_WHITELIST=127.0.0.1
55 |
56 |
--------------------------------------------------------------------------------
/ex-lefthook.yml:
--------------------------------------------------------------------------------
1 | pre-push:
2 | parallel: true
3 | commands:
4 | gems-audit:
5 | tags: backend security
6 | run: bundle audit
7 |
8 | pre-commit:
9 | parallel: true
10 | commands:
11 | rspec:
12 | tags: rspec backend
13 | run: bundle exec rspec --fail-fast
14 | brakeman:
15 | tags: brakeman backend
16 | run: bundle exec brakeman --no-pager
17 |
--------------------------------------------------------------------------------
/fonts/bootstrap-icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/fonts/bootstrap-icons.woff
--------------------------------------------------------------------------------
/fonts/bootstrap-icons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/fonts/bootstrap-icons.woff2
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/modules/callable.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Callable
4 | extend ActiveSupport::Concern
5 | class_methods do
6 | def call(*args)
7 | new(*args).call
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/lib/modules/use_cases/use_case.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module UseCase
4 | extend ActiveSupport::Concern
5 | include ActiveModel::Validations
6 |
7 | module ClassMethods
8 | # The perform method of a UseCase should always return itself
9 | def perform(*args)
10 | new(*args).tap(&:perform)
11 | end
12 | end
13 |
14 | # implement all the steps required to complete this use case
15 | def perform
16 | raise NotImplementedError
17 | end
18 |
19 | # inside of perform, add errors if the use case did not succeed
20 | def success?
21 | errors.none?
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/lib/tasks/.keep
--------------------------------------------------------------------------------
/lib/tasks/auto_annotate_models.rake:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # NOTE: only doing this in development as some production environments (Heroku)
4 | # NOTE: are sensitive to local FS writes, and besides -- it's just not proper
5 | # NOTE: to have a dev-mode tool do its thing in production.
6 | if Rails.env.development?
7 | require 'annotate'
8 | task :set_annotation_options do
9 | # You can override any of these by setting an environment variable of the
10 | # same name.
11 | Annotate.set_defaults(
12 | 'active_admin' => 'false',
13 | 'additional_file_patterns' => [],
14 | 'models' => 'true',
15 | 'position_in_class' => 'before',
16 | 'position_in_test' => 'before',
17 | 'position_in_fixture' => 'before',
18 | 'position_in_factory' => 'before',
19 | 'position_in_serializer' => 'before',
20 | 'show_foreign_keys' => 'true',
21 | 'show_complete_foreign_keys' => 'false',
22 | 'show_indexes' => 'true',
23 | 'simple_indexes' => 'false',
24 | 'model_dir' => 'app/models',
25 | 'root_dir' => '',
26 | 'include_version' => 'false',
27 | 'require' => '',
28 | 'exclude_tests' => 'false',
29 | 'exclude_fixtures' => 'false',
30 | 'exclude_factories' => 'false',
31 | 'exclude_serializers' => 'false',
32 | 'exclude_scaffolds' => 'true',
33 | 'exclude_controllers' => 'true',
34 | 'exclude_helpers' => 'true',
35 | 'exclude_sti_subclasses' => 'false',
36 | 'ignore_model_sub_dir' => 'false',
37 | 'ignore_columns' => nil,
38 | 'ignore_routes' => nil,
39 | 'ignore_unknown_models' => 'false',
40 | 'hide_limit_column_types' => '<%= AnnotateModels::NO_LIMIT_COL_TYPES.join(",") %>',
41 | 'hide_default_column_types' => '<%= AnnotateModels::NO_DEFAULT_COL_TYPES.join(",") %>',
42 | 'skip_on_db_migrate' => 'false',
43 | 'format_bare' => 'true',
44 | 'format_rdoc' => 'false',
45 | 'format_markdown' => 'false',
46 | 'sort' => 'false',
47 | 'force' => 'false',
48 | 'frozen' => 'false',
49 | 'classified_sort' => 'true',
50 | 'trace' => 'false',
51 | 'wrapper_open' => nil,
52 | 'wrapper_close' => nil,
53 | 'with_comment' => 'true'
54 | )
55 | end
56 |
57 | Annotate.load_tasks
58 | end
59 |
--------------------------------------------------------------------------------
/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/log/.keep
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jumpstart-octo",
3 | "private": "true",
4 | "license": "(MIT)",
5 | "dependencies": {
6 | "@hotwired/stimulus": "^3.0.1",
7 | "@hotwired/turbo-rails": "^7.1.0",
8 | "@popperjs/core": "^2.11.5",
9 | "@rails/request.js": "^0.0.6",
10 | "@rollup/plugin-node-resolve": "^13.1.1",
11 | "bootstrap": "^5.1.3",
12 | "bootstrap-icons": "^1.8.1",
13 | "rollup": "^2.61.1",
14 | "sass": "^1.50.0"
15 | },
16 | "scripts": {
17 | "build:css": "sass ./app/assets/stylesheets/application.bootstrap.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules",
18 | "build": "rollup -c rollup.config.js"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/public/favicon.ico
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/rails-tasks:
--------------------------------------------------------------------------------
1 | rails about # List versions of all Rails frame...
2 | rails action_mailbox:ingress:exim # Relay an inbound email from Exim...
3 | rails action_mailbox:ingress:postfix # Relay an inbound email from Post...
4 | rails action_mailbox:ingress:qmail # Relay an inbound email from Qmai...
5 | rails action_mailbox:install # Installs Action Mailbox and its ...
6 | rails action_mailbox:install:migrations # Copy migrations from action_mail...
7 | rails action_text:install # Copy over the migration, stylesh...
8 | rails action_text:install:migrations # Copy migrations from action_text...
9 | rails active_storage:install # Copy over the migration needed t...
10 | rails app:template # Applies the template supplied by...
11 | rails app:update # Update configs and some other in...
12 | rails assets:clean[keep] # Remove old compiled assets
13 | rails assets:clobber # Remove compiled assets
14 | rails assets:environment # Load asset compile environment
15 | rails assets:precompile # Compile all the assets named in ...
16 | rails autoprefixer:info # Show selected browsers and prefi...
17 | rails cache_digests:dependencies # Lookup first-level dependencies ...
18 | rails cache_digests:nested_dependencies # Lookup nested dependencies for T...
19 | rails db:create # Creates the database from DATABA...
20 | rails db:drop # Drops the database from DATABASE...
21 | rails db:encryption:init # Generate a set of keys for confi...
22 | rails db:environment:set # Set the environment value for th...
23 | rails db:fixtures:load # Loads fixtures into the current ...
24 | rails db:migrate # Migrate the database (options: V...
25 | rails db:migrate:down # Runs the "down" for a given migr...
26 | rails db:migrate:redo # Rolls back the database one migr...
27 | rails db:migrate:status # Display status of migrations
28 | rails db:migrate:up # Runs the "up" for a given migrat...
29 | rails db:prepare # Runs setup if database does not ...
30 | rails db:reset # Drops and recreates all database...
31 | rails db:rollback # Rolls the schema back to the pre...
32 | rails db:schema:cache:clear # Clears a db/schema_cache.yml file
33 | rails db:schema:cache:dump # Creates a db/schema_cache.yml file
34 | rails db:schema:dump # Creates a database schema file (...
35 | rails db:schema:load # Loads a database schema file (ei...
36 | rails db:seed # Loads the seed data from db/seed...
37 | rails db:seed:replant # Truncates tables of each databas...
38 | rails db:setup # Creates all databases, loads all...
39 | rails db:version # Retrieves the current schema ver...
40 | rails hotwire:install # Install Hotwire into the app
41 | rails importmap:install # Setup Importmap for the app
42 | rails log:clear # Truncates all/specified *.log fi...
43 | rails middleware # Prints out your Rack middleware ...
44 | rails restart # Restart app by touching tmp/rest...
45 | rails secret # Generate a cryptographically sec...
46 | rails stats # Report code statistics (KLOCs, e...
47 | rails stimulus:install # Install Stimulus into the app
48 | rails stimulus:install:importmap # Install Stimulus on an app runni...
49 | rails stimulus:install:node # Install Stimulus on an app runni...
50 | rails test # Runs all tests in test folder ex...
51 | rails test:all # Runs all tests, including system...
52 | rails test:db # Run tests quickly, but also rese...
53 | rails test:system # Run system tests only
54 | rails time:zones[country_or_offset] # List all time zones, list by two...
55 | rails tmp:clear # Clear cache, socket and screensh...
56 | rails tmp:create # Creates tmp directories for cach...
57 | rails turbo:install # Install Turbo into the app
58 | rails turbo:install:importmap # Install Turbo into the app with ...
59 | rails turbo:install:node # Install Turbo into the app with ...
60 | rails turbo:install:redis # Switch on Redis and use it in de...
61 | rails yarn:install # Install all JavaScript dependenc...
62 | rails zeitwerk:check # Checks project structure for Zei...
63 |
64 |
--------------------------------------------------------------------------------
/request.d.ts:
--------------------------------------------------------------------------------
1 | declare module '@rails/request.js';
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import resolve from "@rollup/plugin-node-resolve";
2 |
3 | export default {
4 | input: "app/javascript/application.js",
5 | output: {
6 | file: "app/assets/builds/javascript/application.js",
7 | format: "es",
8 | inlineDynamicImports: true,
9 | sourcemap: true
10 | },
11 | plugins: [
12 | resolve()
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/rubocop-performance.yml:
--------------------------------------------------------------------------------
1 | # You can find all configuration options for rubocop-performance here: https://docs.rubocop.org/rubocop-performance/
2 |
3 | Performance/AncestorsInclude: # (new in 1.7)
4 | Enabled: true
5 |
6 | Performance/BigDecimalWithNumericArgument: # (new in 1.7)
7 | Enabled: true
8 |
9 | Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
10 | Enabled: true
11 |
12 | Performance/CollectionLiteralInLoop: # (new in 1.8)
13 | Enabled: true
14 |
15 | Performance/ConstantRegexp: # (new in 1.9)
16 | Enabled: true
17 |
18 | Performance/MapCompact: # (new in 1.11)
19 | Enabled: true
20 |
21 | Performance/MethodObjectAsBlock: # (new in 1.9)
22 | Enabled: true
23 |
24 | Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
25 | Enabled: true
26 |
27 | Performance/RedundantSortBlock: # (new in 1.7)
28 | Enabled: true
29 |
30 | Performance/RedundantSplitRegexpArgument: # (new in 1.10)
31 | Enabled: true
32 |
33 | Performance/RedundantStringChars: # (new in 1.7)
34 | Enabled: true
35 |
36 | Performance/ReverseFirst: # (new in 1.7)
37 | Enabled: true
38 |
39 | Performance/SortReverse: # (new in 1.7)
40 | Enabled: true
41 |
42 | Performance/Squeeze: # (new in 1.7)
43 | Enabled: true
44 |
45 | Performance/StringInclude: # (new in 1.7)
46 | Enabled: true
47 |
48 | Performance/Sum: # (new in 1.8)
49 | Enabled: true
--------------------------------------------------------------------------------
/rubocop-rails.yml:
--------------------------------------------------------------------------------
1 | # You can find all configuration options for rubocop-rails here: https://docs.rubocop.org/rubocop-rails/cops_rails.html
2 |
3 | Rails/ActiveRecordCallbacksOrder:
4 | Enabled: true
5 |
6 | Rails/AddColumnIndex: # (new in 2.11)
7 | Enabled: true
8 |
9 | Rails/AfterCommitOverride:
10 | Enabled: true
11 |
12 | Rails/AttributeDefaultBlockValue: # (new in 2.9)
13 | Enabled: true
14 |
15 | Rails/DefaultScope:
16 | Enabled: true
17 |
18 | Rails/EagerEvaluationLogMessage: # (new in 2.11)
19 | Enabled: true
20 |
21 | Rails/ExpandedDateRange: # (new in 2.11)
22 | Enabled: true
23 |
24 | Rails/FindById:
25 | Enabled: true
26 |
27 | Rails/I18nLocaleAssignment: # (new in 2.11)
28 | Enabled: true
29 |
30 | Rails/Inquiry:
31 | Enabled: true
32 |
33 | Rails/MailerName:
34 | Enabled: true
35 |
36 | Rails/MatchRoute:
37 | Enabled: true
38 |
39 | Rails/NegateInclude:
40 | Enabled: true
41 |
42 | Rails/OrderById:
43 | Enabled: true
44 |
45 | Rails/Pluck:
46 | Enabled: true
47 |
48 | Rails/PluckId:
49 | Enabled: true
50 |
51 | Rails/PluckInWhere:
52 | Enabled: true
53 |
54 | Rails/RenderInline:
55 | Enabled: true
56 |
57 | Rails/RenderPlainText:
58 | Enabled: true
59 |
60 | Rails/SaveBang:
61 | Enabled: true
62 | AllowImplicitReturn: false
63 |
64 | Rails/ShortI18n:
65 | Enabled: true
66 |
67 | Rails/SquishedSQLHeredocs: # (new in 2.8)
68 | Enabled: true
69 |
70 | Rails/TimeZoneAssignment: # (new in 2.10)
71 | Enabled: true
72 |
73 | Rails/UnusedIgnoredColumns: # (new in 2.11)
74 | Enabled: true
75 |
76 | Rails/WhereEquals: # (new in 2.9)
77 | Enabled: true
78 |
79 | Rails/WhereExists:
80 | Enabled: true
81 |
82 | Rails/WhereNot:
83 | Enabled: true
--------------------------------------------------------------------------------
/rubocop-rspec.yml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/rubocop-rspec.yml
--------------------------------------------------------------------------------
/rubocop.yml:
--------------------------------------------------------------------------------
1 |
2 | # The behavior of RuboCop can be controlled via the .rubocop.yml
3 | # configuration file. It makes it possible to enable/disable
4 | # certain cops (checks) and to alter their behavior if they accept
5 | # any parameters. The file can be placed either in your home
6 | # directory or in some project directory.
7 | #
8 | # RuboCop will start looking for the configuration file in the directory
9 | # where the inspected file is and continue its way up to the root directory.
10 | #
11 |
12 | inherit_from:
13 | - '.rubocop-performance.yml'
14 | - '.rubocop-rails.yml'
15 |
16 | require:
17 | - rubocop-performance
18 | - rubocop-rails
19 |
20 | AllCops:
21 | TargetRubyVersion: 2.7
22 | TargetRailsVersion: 6.0
23 | Exclude:
24 | - '**/db/migrate/*'
25 | - 'db/schema.rb'
26 | - '**/Gemfile.lock'
27 | - '**/Rakefile'
28 | - '**/rails'
29 | - '**/vendor/**/*'
30 | - '**/spec_helper.rb'
31 | - 'node_modules/**/*'
32 | - 'bin/*'
33 |
34 | ###########################################################
35 | ###################### RuboCop ############################
36 | ###########################################################
37 |
38 | # You can find all configuration options for rubocop here: https://docs.rubocop.org/rubocop/cops_bundler.html
39 |
40 | ###########################################################
41 | ####################### Gemspec ###########################
42 | ###########################################################
43 |
44 | Gemspec/DateAssignment: # (new in 1.10)
45 | Enabled: true
46 |
47 | ###########################################################
48 | ######################## Layout ###########################
49 | ###########################################################
50 |
51 | Layout/ClassStructure:
52 | ExpectedOrder:
53 | - module_inclusion
54 | - constants
55 | - association
56 | - public_attribute_macros
57 | - public_delegate
58 | - macros
59 | - initializer
60 | - public_class_methods
61 | - public_methods
62 | - protected_attribute_macros
63 | - protected_methods
64 | - private_attribute_macros
65 | - private_delegate
66 | - private_methods
67 |
68 | Layout/EmptyLineAfterMultilineCondition:
69 | Enabled: true
70 |
71 | Layout/EmptyLinesAroundAttributeAccessor:
72 | Enabled: true
73 |
74 | Layout/FirstArrayElementIndentation:
75 | EnforcedStyle: consistent
76 |
77 | Layout/FirstArrayElementLineBreak:
78 | Enabled: true
79 |
80 | Layout/FirstHashElementIndentation:
81 | EnforcedStyle: consistent
82 |
83 | Layout/FirstHashElementLineBreak:
84 | Enabled: true
85 |
86 | Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
87 | Enabled: true
88 |
89 | Layout/LineLength:
90 | Max: 150
91 | Exclude:
92 | - '**/spec/**/*'
93 |
94 | Layout/MultilineArrayBraceLayout:
95 | EnforcedStyle: new_line
96 |
97 | Layout/MultilineOperationIndentation:
98 | EnforcedStyle: indented
99 |
100 | Layout/MultilineHashBraceLayout:
101 | EnforcedStyle: new_line
102 |
103 | Layout/MultilineHashKeyLineBreaks:
104 | Enabled: true
105 |
106 | Layout/MultilineMethodCallBraceLayout:
107 | EnforcedStyle: new_line
108 |
109 | Layout/MultilineMethodDefinitionBraceLayout:
110 | EnforcedStyle: new_line
111 |
112 | Layout/SpaceAroundMethodCallOperator:
113 | Enabled: true
114 |
115 | Layout/SpaceBeforeBrackets: # (new in 1.7)
116 | Enabled: true
117 |
118 | Layout/SpaceInLambdaLiteral:
119 | EnforcedStyle: require_space
120 |
121 |
122 | ###########################################################
123 | ######################## Lint #############################
124 | ###########################################################
125 |
126 | Lint/AmbiguousAssignment: # (new in 1.7)
127 | Enabled: true
128 |
129 | Lint/AmbiguousBlockAssociation:
130 | Exclude:
131 | - '**/spec/**/*'
132 |
133 | Lint/AssignmentInCondition:
134 | AllowSafeAssignment: false
135 |
136 | Lint/BinaryOperatorWithIdenticalOperands:
137 | Enabled: true
138 |
139 | Lint/DeprecatedConstants: # (new in 1.8)
140 | Enabled: true
141 |
142 | Lint/DeprecatedOpenSSLConstant:
143 | Enabled: true
144 |
145 | Lint/DuplicateBranch: # (new in 1.3)
146 | Enabled: true
147 |
148 | Lint/DuplicateElsifCondition:
149 | Enabled: true
150 |
151 | Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
152 | Enabled: true
153 |
154 | Lint/DuplicateRequire:
155 | Enabled: true
156 |
157 | Lint/DuplicateRescueException:
158 | Enabled: true
159 |
160 | Lint/EmptyBlock: # (new in 1.1)
161 | Enabled: true
162 |
163 | Lint/EmptyClass: # (new in 1.3)
164 | Enabled: true
165 |
166 | Lint/EmptyConditionalBody:
167 | Enabled: true
168 |
169 | Lint/EmptyFile:
170 | Enabled: true
171 |
172 | Lint/EmptyInPattern: # (new in 1.16)
173 | Enabled: true
174 |
175 | Lint/FloatComparison:
176 | Enabled: true
177 |
178 | Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
179 | Enabled: true
180 |
181 | Lint/MissingSuper:
182 | Enabled: true
183 |
184 | Lint/MixedRegexpCaptureTypes:
185 | Enabled: true
186 |
187 | Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
188 | Enabled: true
189 |
190 | Lint/NumberConversion:
191 | Enabled: true
192 |
193 | Lint/NumberedParameterAssignment: # (new in 1.9)
194 | Enabled: true
195 |
196 | Lint/OrAssignmentToConstant: # (new in 1.9)
197 | Enabled: true
198 |
199 | Lint/RaiseException:
200 | Enabled: true
201 |
202 | Lint/RedundantDirGlobSort: # (new in 1.8)
203 | Enabled: true
204 |
205 | Lint/SelfAssignment:
206 | Enabled: true
207 |
208 | Lint/SymbolConversion: # (new in 1.9)
209 | Enabled: true
210 |
211 | Lint/ToEnumArguments: # (new in 1.1)
212 | Enabled: true
213 |
214 | Lint/TrailingCommaInAttributeDeclaration:
215 | Enabled: true
216 |
217 | Lint/TripleQuotes: # (new in 1.9)
218 | Enabled: true
219 |
220 | Lint/UnexpectedBlockArity: # (new in 1.5)
221 | Enabled: true
222 |
223 | Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
224 | Enabled: true
225 |
226 | Lint/UnusedBlockArgument:
227 | IgnoreEmptyBlocks: false
228 |
229 | Lint/UnusedMethodArgument:
230 | IgnoreEmptyMethods: false
231 |
232 | Lint/UselessMethodDefinition:
233 | Enabled: true
234 |
235 | ###########################################################
236 | ######################## Metric ###########################
237 | ###########################################################
238 |
239 | Metrics/AbcSize:
240 | Max: 45
241 |
242 | Metrics/BlockLength:
243 | CountComments: false
244 | Max: 50
245 | Exclude:
246 | - '**/spec/**/*'
247 | - '**/*.rake'
248 | - '**/factories/**/*'
249 | - '**/config/routes.rb'
250 |
251 | Metrics/ClassLength:
252 | CountAsOne: ['array', 'hash']
253 | Max: 150
254 |
255 | Metrics/CyclomaticComplexity:
256 | Max: 10
257 |
258 | Metrics/MethodLength:
259 | CountAsOne: ['array', 'hash']
260 | Max: 30
261 |
262 | Metrics/ModuleLength:
263 | CountAsOne: ['array', 'hash']
264 | Max: 250
265 | Exclude:
266 | - '**/spec/**/*'
267 |
268 | Metrics/PerceivedComplexity:
269 | Max: 10
270 |
271 | ###########################################################
272 | ######################## Naming ###########################
273 | ###########################################################
274 |
275 | Naming/InclusiveLanguage: # (new in 1.18)
276 | Enabled: true
277 |
278 | ###########################################################
279 | ######################## Style ############################
280 | ###########################################################
281 |
282 | Style/AccessorGrouping:
283 | Enabled: true
284 |
285 | Style/ArgumentsForwarding: # (new in 1.1)
286 | Enabled: true
287 |
288 | Style/ArrayCoercion:
289 | Enabled: true
290 |
291 | Style/AutoResourceCleanup:
292 | Enabled: true
293 |
294 | Style/BisectedAttrAccessor:
295 | Enabled: true
296 |
297 | Style/CaseLikeIf:
298 | Enabled: true
299 |
300 | Style/ClassAndModuleChildren:
301 | Enabled: false
302 |
303 | Style/CollectionCompact: # (new in 1.2)
304 | Enabled: true
305 |
306 | Style/CollectionMethods:
307 | Enabled: true
308 |
309 | Style/CombinableLoops:
310 | Enabled: true
311 |
312 | Style/CommandLiteral:
313 | EnforcedStyle: percent_x
314 |
315 | Style/ConstantVisibility:
316 | Enabled: true
317 |
318 | Style/Documentation:
319 | Enabled: false
320 |
321 | Style/DocumentDynamicEvalDefinition: # (new in 1.1)
322 | Enabled: true
323 |
324 | Style/EndlessMethod: # (new in 1.8)
325 | Enabled: true
326 |
327 | Style/ExplicitBlockArgument:
328 | Enabled: true
329 |
330 | Style/GlobalStdStream:
331 | Enabled: true
332 |
333 | Style/HashConversion: # (new in 1.10)
334 | Enabled: true
335 |
336 | Style/HashEachMethods:
337 | Enabled: true
338 |
339 | Style/HashExcept: # (new in 1.7)
340 | Enabled: true
341 |
342 | Style/HashLikeCase:
343 | Enabled: true
344 |
345 | Style/HashTransformKeys:
346 | Enabled: true
347 |
348 | Style/HashTransformValues:
349 | Enabled: true
350 |
351 | Style/IfWithBooleanLiteralBranches: # (new in 1.9)
352 | Enabled: true
353 |
354 | Style/ImplicitRuntimeError:
355 | Enabled: true
356 |
357 | Style/InlineComment:
358 | Enabled: true
359 |
360 | Style/InPatternThen: # (new in 1.16)
361 | Enabled: true
362 |
363 | Style/IpAddresses:
364 | Enabled: true
365 |
366 | Style/KeywordParametersOrder:
367 | Enabled: true
368 |
369 | Style/MethodCallWithArgsParentheses:
370 | Enabled: true
371 |
372 | Style/MissingElse:
373 | Enabled: true
374 |
375 | Style/MultilineInPatternThen: # (new in 1.16)
376 | Enabled: true
377 |
378 | Style/MultilineMethodSignature:
379 | Enabled: true
380 |
381 | Style/NegatedIfElseCondition: # (new in 1.2)
382 | Enabled: true
383 |
384 | Style/NilLambda: # (new in 1.3)
385 | Enabled: true
386 |
387 | Style/OptionalBooleanParameter:
388 | Enabled: true
389 |
390 | Style/QuotedSymbols: # (new in 1.16)
391 | Enabled: true
392 |
393 | Style/RedundantArgument: # (new in 1.4)
394 | Enabled: true
395 |
396 | Style/RedundantAssignment:
397 | Enabled: true
398 |
399 | Style/RedundantBegin:
400 | Enabled: true
401 |
402 | Style/RedundantFetchBlock:
403 | Enabled: true
404 |
405 | Style/RedundantFileExtensionInRequire:
406 | Enabled: true
407 |
408 | Style/RedundantSelfAssignment:
409 | Enabled: true
410 |
411 | Style/SingleArgumentDig:
412 | Enabled: true
413 |
414 | Style/StringChars: # (new in 1.12)
415 | Enabled: true
416 |
417 | Style/StringConcatenation:
418 | Enabled: true
419 |
420 | Style/SwapValues: # (new in 1.1)
421 | Enabled: true
422 |
--------------------------------------------------------------------------------
/screen-confirmation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screen-confirmation.png
--------------------------------------------------------------------------------
/screen-role-test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screen-role-test.png
--------------------------------------------------------------------------------
/screenacc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screenacc.png
--------------------------------------------------------------------------------
/screenadmin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screenadmin.png
--------------------------------------------------------------------------------
/screenannouncement.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screenannouncement.png
--------------------------------------------------------------------------------
/screendeps.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screendeps.png
--------------------------------------------------------------------------------
/screennotice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screennotice.png
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screenshot.png
--------------------------------------------------------------------------------
/screensignout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/screensignout.png
--------------------------------------------------------------------------------
/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is copied to spec/ when you run 'rails generate rspec:install'
4 | require 'spec_helper'
5 | ENV['RAILS_ENV'] ||= 'test'
6 | require File.expand_path('../config/environment', __dir__)
7 | # Prevent database truncation if the environment is production
8 | abort('The Rails environment is running in production mode!') if Rails.env.production?
9 | require 'rspec/rails'
10 | # Add additional requires below this line. Rails is not loaded until this point!
11 |
12 | # Requires supporting ruby files with custom matchers and macros, etc, in
13 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
14 | # run as spec files by default. This means that files in spec/support that end
15 | # in _spec.rb will both be required and run as specs, causing the specs to be
16 | # run twice. It is recommended that you do not name files matching this glob to
17 | # end with _spec.rb. You can configure this pattern with the --pattern
18 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
19 | #
20 | # The following line is provided for convenience purposes. It has the downside
21 | # of increasing the boot-up time by auto-requiring all files in the support
22 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
23 | # require only the support files necessary.
24 | #
25 | # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
26 |
27 | # Checks for pending migrations and applies them before tests are run.
28 | # If you are not using ActiveRecord, you can remove these lines.
29 | begin
30 | ActiveRecord::Migration.maintain_test_schema!
31 | rescue ActiveRecord::PendingMigrationError => e
32 | puts e.to_s.strip
33 | exit 1
34 | end
35 | RSpec.configure do |config|
36 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
37 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
38 |
39 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
40 | # examples within a transaction, remove the following line or assign false
41 | # instead of true.
42 | config.use_transactional_fixtures = true
43 |
44 | # Shoulda Matchers
45 | Shoulda::Matchers.configure do |config|
46 | config.integrate do |with|
47 | with.test_framework :rspec
48 | with.library :rails
49 | end
50 | end
51 |
52 | # You can uncomment this line to turn off ActiveRecord support entirely.
53 | # config.use_active_record = false
54 |
55 | # RSpec Rails can automatically mix in different behaviours to your tests
56 | # based on their file location, for example enabling you to call `get` and
57 | # `post` in specs under `spec/controllers`.
58 | #
59 | # You can disable this behaviour by removing the line below, and instead
60 | # explicitly tag your specs with their type, e.g.:
61 | #
62 | # RSpec.describe UsersController, type: :controller do
63 | # # ...
64 | # end
65 | #
66 | # The different available types are documented in the features, such as in
67 | # https://relishapp.com/rspec/rspec-rails/docs
68 | config.infer_spec_type_from_file_location!
69 |
70 | # Filter lines from Rails gems in backtraces.
71 | config.filter_rails_from_backtrace!
72 | # arbitrary gems may also be filtered via:
73 | # config.filter_gems_from_backtrace("gem name")
74 | end
75 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
4 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5 | # The generated `.rspec` file contains `--require spec_helper` which will cause
6 | # this file to always be loaded, without a need to explicitly require it in any
7 | # files.
8 | #
9 | # Given that it is always loaded, you are encouraged to keep this file as
10 | # light-weight as possible. Requiring heavyweight dependencies from this file
11 | # will add to the boot time of your test suite on EVERY test run, even for an
12 | # individual file that may not need all of that loaded. Instead, consider making
13 | # a separate helper file that requires the additional dependencies and performs
14 | # the additional setup, and require it from the spec files that actually need
15 | # it.
16 | #
17 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18 | RSpec.configure do |config|
19 | # rspec-expectations config goes here. You can use an alternate
20 | # assertion/expectation library such as wrong or the stdlib/minitest
21 | # assertions if you prefer.
22 | config.expect_with :rspec do |expectations|
23 | # This option will default to `true` in RSpec 4. It makes the `description`
24 | # and `failure_message` of custom matchers include text for helper methods
25 | # defined using `chain`, e.g.:
26 | # be_bigger_than(2).and_smaller_than(4).description
27 | # # => "be bigger than 2 and smaller than 4"
28 | # ...rather than:
29 | # # => "be bigger than 2"
30 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31 | end
32 |
33 | # rspec-mocks config goes here. You can use an alternate test double
34 | # library (such as bogus or mocha) by changing the `mock_with` option here.
35 | config.mock_with :rspec do |mocks|
36 | # Prevents you from mocking or stubbing a method that does not exist on
37 | # a real object. This is generally recommended, and will default to
38 | # `true` in RSpec 4.
39 | mocks.verify_partial_doubles = true
40 | end
41 |
42 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43 | # have no way to turn it off -- the option exists only for backwards
44 | # compatibility in RSpec 3). It causes shared context metadata to be
45 | # inherited by the metadata hash of host groups and examples, rather than
46 | # triggering implicit auto-inclusion in groups with matching metadata.
47 | config.shared_context_metadata_behavior = :apply_to_host_groups
48 |
49 | # The settings below are suggested to provide a good initial experience
50 | # with RSpec, but feel free to customize to your heart's content.
51 | # # This allows you to limit a spec run to individual examples or groups
52 | # # you care about by tagging them with `:focus` metadata. When nothing
53 | # # is tagged with `:focus`, all examples get run. RSpec also provides
54 | # # aliases for `it`, `describe`, and `context` that include `:focus`
55 | # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
56 | # config.filter_run_when_matching :focus
57 | #
58 | # # Allows RSpec to persist some state between runs in order to support
59 | # # the `--only-failures` and `--next-failure` CLI options. We recommend
60 | # # you configure your source control system to ignore this file.
61 | # config.example_status_persistence_file_path = "spec/examples.txt"
62 | #
63 | # # Limits the available syntax to the non-monkey patched syntax that is
64 | # # recommended. For more details, see:
65 | # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
66 | # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67 | # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
68 | # config.disable_monkey_patching!
69 | #
70 | # # Many RSpec users commonly either run the entire suite or an individual
71 | # # file, and it's useful to allow more verbose output when running an
72 | # # individual spec file.
73 | # if config.files_to_run.one?
74 | # # Use the documentation formatter for detailed output,
75 | # # unless a formatter has already been configured
76 | # # (e.g. via a command-line flag).
77 | # config.default_formatter = "doc"
78 | # end
79 | #
80 | # # Print the 10 slowest examples and example groups at the
81 | # # end of the spec run, to help surface which specs are running
82 | # # particularly slow.
83 | # config.profile_examples = 10
84 | #
85 | # # Run specs in random order to surface order dependencies. If you find an
86 | # # order dependency and want to debug it, you can fix the order by providing
87 | # # the seed, which is printed after each run.
88 | # # --seed 1234
89 | # config.order = :random
90 | #
91 | # # Seed global randomization in this process using the `--seed` CLI option.
92 | # # Setting this allows you to use `--seed` to deterministically reproduce
93 | # # test failures related to randomization by passing the same `--seed` value
94 | # # as the one that triggered the failure.
95 | # Kernel.srand config.seed
96 | end
97 |
--------------------------------------------------------------------------------
/storage/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/storage/.keep
--------------------------------------------------------------------------------
/tmp/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/tmp/.keep
--------------------------------------------------------------------------------
/tmp/pids/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/tmp/pids/.keep
--------------------------------------------------------------------------------
/tmp/storage/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/tmp/storage/.keep
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/vendor/.keep
--------------------------------------------------------------------------------
/vendor/fonts/bootstrap-icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/vendor/fonts/bootstrap-icons.woff
--------------------------------------------------------------------------------
/vendor/fonts/bootstrap-icons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/vendor/fonts/bootstrap-icons.woff2
--------------------------------------------------------------------------------
/z-schema.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apaciuk/rails-7-saas-jumpstart-octo/8a1b5c6684d6872ac436ed3f935491c979bc8531/z-schema.png
--------------------------------------------------------------------------------