├── log
└── .keep
├── storage
└── .keep
├── tmp
└── .keep
├── vendor
└── .keep
├── lib
├── assets
│ └── .keep
├── tasks
│ └── .keep
└── templates
│ ├── rails
│ └── scaffold_controller
│ │ ├── partial.json.jbuilder
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── api_controller.rb
│ │ └── controller.rb
│ └── erb
│ └── scaffold
│ ├── new.html.erb.tt
│ ├── edit.html.erb.tt
│ ├── show.html.erb.tt
│ ├── index.html.erb.tt
│ └── _form.html.erb.tt
├── public
├── favicon.ico
├── apple-touch-icon.png
├── apple-touch-icon-precomposed.png
├── robots.txt
├── 500.html
├── 422.html
└── 404.html
├── test
├── helpers
│ └── .keep
├── mailers
│ └── .keep
├── models
│ ├── .keep
│ ├── step_test.rb
│ └── user_test.rb
├── system
│ ├── .keep
│ └── steps_test.rb
├── controllers
│ ├── .keep
│ ├── pages_controller_test.rb
│ └── steps_controller_test.rb
├── fixtures
│ ├── .keep
│ ├── files
│ │ └── .keep
│ ├── steps.yml
│ └── users.yml
├── integration
│ └── .keep
├── application_system_test_case.rb
├── channels
│ └── application_cable
│ │ └── connection_test.rb
└── test_helper.rb
├── app
├── assets
│ ├── images
│ │ └── .keep
│ ├── config
│ │ └── manifest.js
│ └── stylesheets
│ │ └── application.css
├── models
│ ├── concerns
│ │ └── .keep
│ ├── application_record.rb
│ ├── abilities
│ │ ├── user_ability.rb
│ │ ├── guest_ability.rb
│ │ ├── admin_ability.rb
│ │ └── ability.rb
│ ├── steps
│ │ └── step.rb
│ └── users
│ │ ├── admin.rb
│ │ └── user.rb
├── controllers
│ ├── concerns
│ │ └── .keep
│ ├── pages_controller.rb
│ ├── errors_controller.rb
│ ├── steps_controller.rb
│ └── application_controller.rb
├── views
│ ├── partials
│ │ ├── _analytics.html.erb
│ │ ├── _styles.html.erb
│ │ ├── _javascripts.html.erb
│ │ ├── breadcrumb
│ │ │ ├── _add.html.erb
│ │ │ ├── _edit.html.erb
│ │ │ ├── _delete.html.erb
│ │ │ └── _search.html.erb
│ │ ├── _more.html.erb
│ │ ├── _footer.html.erb
│ │ ├── _messages.html.erb
│ │ ├── _modal.html.erb
│ │ ├── _navbar.html.erb
│ │ ├── _share.html.erb
│ │ └── _metatags.html.erb
│ ├── layouts
│ │ ├── mailer.text.erb
│ │ ├── mailer.html.erb
│ │ └── application.html.erb
│ ├── steps
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── _step.json.jbuilder
│ │ ├── new.html.erb
│ │ ├── edit.html.erb
│ │ ├── index.html.erb
│ │ ├── show.html.erb
│ │ └── _form.html.erb
│ ├── pages
│ │ └── index.html.erb
│ └── errors
│ │ ├── bad_request.html.erb
│ │ ├── not_acceptable.html.erb
│ │ ├── unknown_error.html.erb
│ │ ├── service_unavailable.html.erb
│ │ ├── unsupported_version.html.erb
│ │ ├── internal_server_error.html.erb
│ │ ├── not_authorized.html.erb
│ │ ├── route_not_found.html.erb
│ │ └── resource_not_found.html.erb
├── javascript
│ ├── routes
│ │ └── index.js.erb
│ ├── stylesheets
│ │ ├── forms.scss
│ │ ├── datetimepicker.scss
│ │ ├── tables.scss
│ │ ├── breadcrumb.scss
│ │ ├── buttons.scss
│ │ ├── navbar.scss
│ │ ├── badges.scss
│ │ ├── index.js.erb
│ │ ├── icons.scss
│ │ ├── cards.scss
│ │ ├── content.scss
│ │ ├── pills.scss
│ │ ├── hr.scss
│ │ ├── bootstrap.scss
│ │ └── sidebar.scss
│ ├── packs
│ │ ├── erb_pack.js.erb
│ │ ├── application.js.erb
│ │ └── vue_pack.js.erb
│ ├── filters
│ │ ├── date.js
│ │ ├── time.js
│ │ ├── date-time.js
│ │ ├── snake-camel.js
│ │ ├── singularize.js
│ │ ├── camel-snake.js
│ │ ├── pluralize.js
│ │ ├── humanize.js
│ │ ├── lower-pluralize.js
│ │ ├── titleize.js
│ │ ├── index.js.erb
│ │ └── title-pluralize.js
│ ├── images
│ │ └── index.js.erb
│ ├── javascripts
│ │ ├── index.js.erb
│ │ └── datetimepicker.js
│ ├── channels
│ │ ├── index.js
│ │ └── consumer.js
│ └── components
│ │ ├── index.js.erb
│ │ ├── alert-messages.vue
│ │ └── step-cards.vue
├── channels
│ └── application_cable
│ │ ├── channel.rb
│ │ └── connection.rb
├── mailers
│ └── application_mailer.rb
├── jobs
│ └── application_job.rb
└── helpers
│ └── application_helper.rb
├── Procfile
├── .DS_Store
├── Procfile.dev
├── db
├── seeds.rb
├── seeds
│ └── 01_steps.rb
├── migrate
│ ├── 20200321022023_create_steps.rb
│ └── 20200321024706_devise_create_users.rb
└── schema.rb
├── .github
├── pull_request_template.md
└── ISSUE_TEMPLATE
│ ├── bug-report.md
│ ├── code-maintenance.md
│ └── feature-request.md
├── config
├── spring.rb
├── webpack
│ ├── loaders
│ │ ├── vue.js
│ │ └── erb.js
│ ├── test.js
│ ├── production.js
│ ├── development.js
│ └── environment.js
├── environment.rb
├── initializers
│ ├── mime_types.rb
│ ├── filter_parameter_logging.rb
│ ├── application_controller_renderer.rb
│ ├── cookies_serializer.rb
│ ├── backtrace_silencers.rb
│ ├── wrap_parameters.rb
│ ├── inflections.rb
│ ├── content_security_policy.rb
│ └── devise.rb
├── boot.rb
├── cable.yml
├── credentials.yml.enc
├── locales
│ ├── en.yml
│ └── devise.en.yml
├── routes.rb
├── application.rb
├── storage.yml
├── puma.rb
├── environments
│ ├── test.rb
│ ├── development.rb
│ └── production.rb
├── webpacker.yml
└── database.yml
├── config.ru
├── Rakefile
├── bin
├── rake
├── rails
├── yarn
├── webpack
├── webpack-dev-server
├── spring
├── setup
└── bundle
├── postcss.config.js
├── LICENSE
├── package.json
├── .gitignore
├── Gemfile
├── .vscode
└── settings.json
├── babel.config.js
├── .rubocop.yml
├── Gemfile.lock
└── README.md
/log/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/storage/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tmp/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/system/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/fixtures/files/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/views/partials/_analytics.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/views/partials/_styles.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/views/partials/_javascripts.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: bundle exec puma -C config/puma.rb
--------------------------------------------------------------------------------
/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/app/javascript/routes/index.js.erb:
--------------------------------------------------------------------------------
1 | <%= JsRoutes.generate() %>
--------------------------------------------------------------------------------
/app/views/steps/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.partial! "steps/step", step: @step
2 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dalezak/rails-webpacker-vue-bootstrap/HEAD/.DS_Store
--------------------------------------------------------------------------------
/Procfile.dev:
--------------------------------------------------------------------------------
1 | web: bundle exec rails s -p 3000 -b lvh.me
2 | webpack: ./bin/webpack-dev-server
--------------------------------------------------------------------------------
/app/views/steps/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array! @steps, partial: "steps/step", as: :step
2 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/forms.scss:
--------------------------------------------------------------------------------
1 | .input-group {
2 | .input-group-append {
3 |
4 | }
5 | }
--------------------------------------------------------------------------------
/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../stylesheets .css
3 |
--------------------------------------------------------------------------------
/app/javascript/packs/erb_pack.js.erb:
--------------------------------------------------------------------------------
1 | <% name = 'Erb' %>
2 |
3 | console.log('Loaded <%= name %>');
4 |
--------------------------------------------------------------------------------
/app/views/pages/index.html.erb:
--------------------------------------------------------------------------------
1 |
Pages#index
2 | Find me in app/views/pages/index.html.erb
3 |
--------------------------------------------------------------------------------
/app/controllers/pages_controller.rb:
--------------------------------------------------------------------------------
1 | class PagesController < ApplicationController
2 | def index
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | class ApplicationRecord < ActiveRecord::Base
2 | self.abstract_class = true
3 | end
4 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | require 'faker'
2 | Dir[Rails.root.join('db', 'seeds', '*.rb')].sort.each do |seed|
3 | load seed
4 | end
5 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/datetimepicker.scss:
--------------------------------------------------------------------------------
1 | @import 'tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css';
--------------------------------------------------------------------------------
/app/javascript/stylesheets/tables.scss:
--------------------------------------------------------------------------------
1 | .table {
2 | &.table-bordered {
3 | background-color: #ffffff;
4 | }
5 |
6 | }
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | #### Code Reviewer
2 |
3 |
4 | #### Related Issue
5 |
6 |
7 | #### Please Review
8 | - [ ]
9 |
--------------------------------------------------------------------------------
/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Channel < ActionCable::Channel::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/config/spring.rb:
--------------------------------------------------------------------------------
1 | Spring.watch(
2 | ".ruby-version",
3 | ".rbenv-vars",
4 | "tmp/restart.txt",
5 | "tmp/caching-dev.txt"
6 | )
7 |
--------------------------------------------------------------------------------
/lib/templates/rails/scaffold_controller/partial.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! <%= singular_table_name %>, <%= full_attributes_list %>
2 |
--------------------------------------------------------------------------------
/config/webpack/loaders/vue.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | test: /\.vue(\.erb)?$/,
3 | use: [{
4 | loader: 'vue-loader'
5 | }]
6 | }
7 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Connection < ActionCable::Connection::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/breadcrumb.scss:
--------------------------------------------------------------------------------
1 | .breadcrumb {
2 | .btn-group {
3 | .btn {
4 | .fa {
5 | color: #777;
6 | }
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | class ApplicationMailer < ActionMailer::Base
2 | default from: 'from@example.com'
3 | layout 'mailer'
4 | end
5 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require_relative 'config/environment'
4 |
5 | run Rails.application
6 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/buttons.scss:
--------------------------------------------------------------------------------
1 | .btn {
2 | &.btn-more {
3 | background-color: #fff;
4 | }
5 | &.btn-add {
6 | background-color: #fff;
7 | }
8 | }
--------------------------------------------------------------------------------
/app/models/abilities/user_ability.rb:
--------------------------------------------------------------------------------
1 | class UserAbility
2 | include CanCan::Ability
3 |
4 | def initialize(user)
5 | can :read, Step
6 | end
7 |
8 | end
9 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/navbar.scss:
--------------------------------------------------------------------------------
1 | #navbar {
2 | .dropdown-item-checked::after {
3 | content: '✓';
4 | float: right;
5 | font-weight: 600;
6 | }
7 | }
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/test/models/step_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class StepTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/models/user_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class UserTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/app/views/steps/_step.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! step, :id, :type, :name, :description, :ordinal, :deleted_at, :created_at, :updated_at
2 | json.url step_url(step, format: :json)
3 |
--------------------------------------------------------------------------------
/lib/templates/rails/scaffold_controller/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.partial! "<%= plural_table_name %>/<%= singular_table_name %>", <%= singular_table_name %>: @<%= singular_table_name %>
2 |
--------------------------------------------------------------------------------
/app/models/steps/step.rb:
--------------------------------------------------------------------------------
1 | class Step < ApplicationRecord
2 | acts_as_paranoid
3 |
4 | scope :for_search, ->(query) { where("name ILIKE ?", "#{query}%") if query.present? }
5 |
6 | end
7 |
--------------------------------------------------------------------------------
/app/javascript/filters/date.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | Vue.filter('date', (string) => {
3 | if (string) {
4 | return moment(String(string)).format('MMM D YYYY');
5 | }
6 | });
--------------------------------------------------------------------------------
/app/javascript/filters/time.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | Vue.filter('time', (string) => {
3 | if (string) {
4 | return moment(String(string)).format('h:mm a');
5 | }
6 | });
--------------------------------------------------------------------------------
/app/models/users/admin.rb:
--------------------------------------------------------------------------------
1 | class Admin < User
2 |
3 | def self.icon
4 | 'fa-user-shield'
5 | end
6 |
7 | def self.model_name
8 | User.model_name
9 | end
10 |
11 | end
--------------------------------------------------------------------------------
/config/webpack/test.js:
--------------------------------------------------------------------------------
1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2 |
3 | const environment = require('./environment')
4 |
5 | module.exports = environment.toWebpackConfig()
6 |
--------------------------------------------------------------------------------
/lib/templates/rails/scaffold_controller/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array! @<%= plural_table_name %>, partial: "<%= plural_table_name %>/<%= singular_table_name %>", as: :<%= singular_table_name %>
2 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/badges.scss:
--------------------------------------------------------------------------------
1 | .badge {
2 | margin-right: 5px;
3 | padding: 0.4em 0.5em !important;
4 | font-weight: 400 !important;
5 | &.badge-light {
6 | color: #777;
7 | }
8 | }
--------------------------------------------------------------------------------
/config/webpack/production.js:
--------------------------------------------------------------------------------
1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2 |
3 | const environment = require('./environment')
4 |
5 | module.exports = environment.toWebpackConfig()
6 |
--------------------------------------------------------------------------------
/app/models/abilities/guest_ability.rb:
--------------------------------------------------------------------------------
1 | class GuestAbility
2 | include CanCan::Ability
3 |
4 | def initialize(user)
5 | can :create, User
6 | can :read, Step
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/config/webpack/development.js:
--------------------------------------------------------------------------------
1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2 |
3 | const environment = require('./environment')
4 |
5 | module.exports = environment.toWebpackConfig()
6 |
--------------------------------------------------------------------------------
/app/models/abilities/admin_ability.rb:
--------------------------------------------------------------------------------
1 | class AdminAbility
2 | include CanCan::Ability
3 |
4 | def initialize(user)
5 | can :manage, User
6 | can :manage, Step
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/test/application_system_test_case.rb:
--------------------------------------------------------------------------------
1 | require "test_helper"
2 |
3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5 | end
6 |
--------------------------------------------------------------------------------
/app/javascript/filters/date-time.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | Vue.filter('dateTime', (string) => {
3 | if (string) {
4 | return moment(String(string)).format('MMM D YYYY, h:mm a');
5 | }
6 | });
--------------------------------------------------------------------------------
/app/javascript/filters/snake-camel.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | Vue.filter('snakeCamel', (string) => {
3 | return string.replace(/(_\w)/g, (m) => {
4 | return m[1].toUpperCase();
5 | });
6 | });
--------------------------------------------------------------------------------
/app/javascript/images/index.js.erb:
--------------------------------------------------------------------------------
1 | <% images = Rails.application.root.join('app', 'javascript', 'images', '**', '*.{png,svg,jpg}') %>
2 | <% Dir.glob(images).each do |image| %>
3 | import '<%= image %>';
4 | <% end %>
--------------------------------------------------------------------------------
/app/views/steps/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= link_to "Steps", steps_path %>
3 | Add
4 |
5 |
6 | <%= render 'form', step: @step %>
--------------------------------------------------------------------------------
/app/javascript/filters/singularize.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | var pluralize = require('pluralize');
3 | Vue.filter('singularize', (string, inclusive=false) => {
4 | return pluralize(string, 1, inclusive);
5 | });
--------------------------------------------------------------------------------
/app/javascript/stylesheets/index.js.erb:
--------------------------------------------------------------------------------
1 | <% stylesheets = Rails.application.root.join('app', 'javascript', 'stylesheets', '**', '*.{css,scss}') %>
2 | <% Dir.glob(stylesheets).each do |file| %>
3 | import '<%= file %>';
4 | <% end %>
--------------------------------------------------------------------------------
/db/seeds/01_steps.rb:
--------------------------------------------------------------------------------
1 | (0..rand(20..25)).each_with_index do |index|
2 | step = Step.create(
3 | ordinal: index,
4 | name: Faker::Hipster.sentence,
5 | description: Faker::Hipster.paragraph)
6 | puts step.inspect
7 | end
--------------------------------------------------------------------------------
/app/javascript/filters/camel-snake.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | Vue.filter('camelSnake', (string) => {
3 | return string.replace(/[\w]([A-Z])/g, (m) => {
4 | return m[0] + "_" + m[1];
5 | }).toLowerCase();
6 | });
--------------------------------------------------------------------------------
/app/javascript/filters/pluralize.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | var pluralize = require('pluralize');
3 | Vue.filter('pluralize', (string, count=0, inclusive=false) => {
4 | return pluralize(string, count, inclusive);
5 | });
--------------------------------------------------------------------------------
/app/javascript/javascripts/index.js.erb:
--------------------------------------------------------------------------------
1 | <% javascripts_glob = Rails.application.root.join('app', 'javascript', 'javascripts', '**', '*.js') %>
2 | <% Dir.glob(javascripts_glob).each do |file| %>
3 | import '<%= file %>';
4 | <% end %>
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
5 |
--------------------------------------------------------------------------------
/app/javascript/filters/humanize.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | Vue.filter('humanize', (string) => {
3 | return string.replace(/[\w]([A-Z])/g, (m) => {
4 | return m[0] + " " + m[1];
5 | }).replace(/-/g, ' ').replace(/_/g, ' ');
6 | });
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: test
6 |
7 | production:
8 | adapter: redis
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 | channel_prefix: starter_production
11 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require_relative 'config/application'
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/test/controllers/pages_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PagesControllerTest < ActionDispatch::IntegrationTest
4 | test "should get index" do
5 | get pages_index_url
6 | assert_response :success
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/app/javascript/channels/index.js:
--------------------------------------------------------------------------------
1 | // Load all the channels within this directory and all subdirectories.
2 | // Channel files must be named *_channel.js.
3 |
4 | const channels = require.context('.', true, /_channel\.js$/)
5 | channels.keys().forEach(channels)
6 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | require_relative '../config/boot'
8 | require 'rake'
9 | Rake.application.run
10 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/icons.scss:
--------------------------------------------------------------------------------
1 | $fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
2 | @import '~@fortawesome/fontawesome-free/scss/fontawesome';
3 | @import '~@fortawesome/fontawesome-free/scss/regular';
4 | @import '~@fortawesome/fontawesome-free/scss/solid';
--------------------------------------------------------------------------------
/app/views/partials/breadcrumb/_add.html.erb:
--------------------------------------------------------------------------------
1 | <% url ||= new_polymorphic_path(model) %>
2 | <%= link_to url, class: "btn btn-outline-secondary btn-sm mr-2", title: "Add #{model.to_s.downcase}" do %>
3 |
4 | <% end if can?(:create, model) %>
--------------------------------------------------------------------------------
/app/views/partials/breadcrumb/_edit.html.erb:
--------------------------------------------------------------------------------
1 | <% url ||= edit_polymorphic_path(model) %>
2 | <%= link_to url, class: "btn btn-outline-secondary btn-sm", title: "Edit #{model.class.to_s.downcase}" do %>
3 |
4 | <% end if can?(:edit, model) %>
--------------------------------------------------------------------------------
/app/views/partials/_more.html.erb:
--------------------------------------------------------------------------------
1 | <%= link_to "Load more...", request.params.merge(limit: @limit, offset: @offset + @limit),
2 | remote: true, data: { more_cards: '#cards' }, id: "more", class: 'btn btn-block btn-outline-secondary mt-4 mb-4', title: "Load more" %>
3 |
--------------------------------------------------------------------------------
/app/javascript/filters/lower-pluralize.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | var pluralize = require('pluralize');
3 | Vue.filter('lowerPluralize', (string) => {
4 | return pluralize(string.replace(/[\w]([A-Z])/g, (m) => {
5 | return m[0] + " " + m[1];
6 | }).toLowerCase());
7 | });
--------------------------------------------------------------------------------
/app/javascript/filters/titleize.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | Vue.filter('titleize', (sentence) => {
3 | let words = sentence.split(' ');
4 | words = words.map((word) => {
5 | return word.charAt(0).toUpperCase() + word.slice(1);
6 | });
7 | return words.join(' ');
8 | });
--------------------------------------------------------------------------------
/app/views/steps/edit.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= link_to "Steps", steps_path %>
3 | <%= link_to @step.id, @step %>
4 | Edit
5 |
6 |
7 | <%= render 'form', step: @step %>
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ActiveSupport::Reloader.to_prepare do
4 | # ApplicationController.renderer.defaults.merge!(
5 | # http_host: 'example.org',
6 | # https: false
7 | # )
8 | # end
9 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: [
3 | require('postcss-import'),
4 | require('postcss-flexbugs-fixes'),
5 | require('postcss-preset-env')({
6 | autoprefixer: {
7 | flexbox: 'no-2009'
8 | },
9 | stage: 3
10 | })
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/cards.scss:
--------------------------------------------------------------------------------
1 | .card {
2 | .card-header {
3 |
4 | }
5 | .card-body {
6 | .card-title {
7 |
8 | }
9 | }
10 | .card-footer {
11 | background-color: #ffffff;
12 | }
13 | .list-group-item:last-child {
14 | border-bottom: none;
15 | }
16 | }
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | APP_PATH = File.expand_path('../config/application', __dir__)
8 | require_relative '../config/boot'
9 | require 'rails/commands'
10 |
--------------------------------------------------------------------------------
/config/webpack/loaders/erb.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | test: /\.erb$/,
3 | enforce: 'pre',
4 | exclude: /node_modules/,
5 | use: [{
6 | loader: 'rails-erb-loader',
7 | options: {
8 | runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'
9 | }
10 | }]
11 | }
12 |
--------------------------------------------------------------------------------
/app/javascript/channels/consumer.js:
--------------------------------------------------------------------------------
1 | // Action Cable provides the framework to deal with WebSockets in Rails.
2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3 |
4 | import { createConsumer } from "@rails/actioncable"
5 |
6 | export default createConsumer()
7 |
--------------------------------------------------------------------------------
/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | class ApplicationJob < ActiveJob::Base
2 | # Automatically retry jobs that encountered a deadlock
3 | # retry_on ActiveRecord::Deadlocked
4 |
5 | # Most jobs are safe to ignore if the underlying records are no longer available
6 | # discard_on ActiveJob::DeserializationError
7 | end
8 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/lib/templates/erb/scaffold/new.html.erb.tt:
--------------------------------------------------------------------------------
1 |
2 | <%%= link_to "<%= plural_table_name.capitalize %>", <%= index_helper %>_path %>
3 | Add
4 |
5 |
6 | <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug-report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug Report
3 | about: Report something that is broken or not working as intended
4 | title: ''
5 |
6 | labels: 'Type: Bug'
7 |
8 | assignees: ''
9 |
10 | ---
11 |
12 | #### Expected Behaviour
13 |
14 | #### Actual Behaviour
15 |
16 | #### Steps to Reproduce
17 | -
18 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/code-maintenance.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Code Maintenance
3 | about: Project cleanup, improve documentation, refactor code
4 | title: ''
5 |
6 | labels: 'Type: Maintenance'
7 |
8 | assignees: ''
9 |
10 | ---
11 |
12 | #### Describe Problem
13 |
14 | #### Suggest Changes
15 |
16 | #### Provide Examples
17 |
--------------------------------------------------------------------------------
/app/javascript/filters/index.js.erb:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | <% filters = Rails.application.root.join('app', 'javascript', 'filters', '**', '*.js') %>
3 | <% Dir.glob(filters).each do |path| %>
4 | <% filter = File.basename(path, ".js") %>
5 | import <%= filter.underscore.camelize %> from "<%= path %>";
6 | <% end %>
--------------------------------------------------------------------------------
/app/views/partials/_footer.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/content.scss:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #f8f9fa;
3 | }
4 | #app {
5 | width: 100%;
6 | min-height: 100%;
7 | background-color: #f8f9fa;
8 | }
9 | #main {
10 | width: 100%;
11 | overflow: auto;
12 | margin-left: 0;
13 | margin-top: 56px;
14 | margin-right: 0;
15 | margin-bottom: 0;
16 | }
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature Request
3 | about: Suggest an idea for a new feature or enhancement to existing features
4 | title: ''
5 |
6 | labels: 'Type: Feature'
7 |
8 | assignees: ''
9 |
10 | ---
11 |
12 | #### Describe Problem
13 |
14 | #### Suggest Solution
15 |
16 | #### Additional Details
17 |
--------------------------------------------------------------------------------
/test/channels/application_cable/connection_test.rb:
--------------------------------------------------------------------------------
1 | require "test_helper"
2 |
3 | class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
4 | # test "connects with cookies" do
5 | # cookies.signed[:user_id] = 42
6 | #
7 | # connect
8 | #
9 | # assert_equal connection.user_id, "42"
10 | # end
11 | end
12 |
--------------------------------------------------------------------------------
/db/migrate/20200321022023_create_steps.rb:
--------------------------------------------------------------------------------
1 | class CreateSteps < ActiveRecord::Migration[6.0]
2 | def change
3 | create_table :steps do |t|
4 | t.string :type
5 | t.string :name
6 | t.text :description
7 | t.integer :ordinal
8 | t.datetime :deleted_at
9 |
10 | t.timestamps
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/app/views/partials/breadcrumb/_delete.html.erb:
--------------------------------------------------------------------------------
1 | <% url ||= polymorphic_path(model) %>
2 | <%= link_to url, method: :delete, data: { confirm: "Delete #{model.class.to_s.downcase}?" }, class: "btn btn-outline-danger btn-sm ml-2", title: "Delete #{model.class.to_s.downcase}" do %>
3 |
4 | <% end if can?(:destroy, model) %>
5 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_ROOT = File.expand_path('..', __dir__)
3 | Dir.chdir(APP_ROOT) do
4 | begin
5 | exec "yarnpkg", *ARGV
6 | rescue Errno::ENOENT
7 | $stderr.puts "Yarn executable was not detected in the system."
8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 | exit 1
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/pills.scss:
--------------------------------------------------------------------------------
1 | .nav-pills {
2 | .nav-item {
3 | .nav-link {
4 | margin-top: 6px;
5 | margin-right: 8px;
6 | background-color: #fff;
7 | border: 1px solid rgba(0, 0, 0, 0.125);
8 | &.active {
9 | background-color: #ccc;
10 | border: 1px solid #ccc;
11 | }
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/test/fixtures/steps.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | one:
4 | type:
5 | name: MyString
6 | description: MyText
7 | ordinal: 1
8 | deleted_at: 2020-03-20 20:27:18
9 |
10 | two:
11 | type:
12 | name: MyString
13 | description: MyText
14 | ordinal: 1
15 | deleted_at: 2020-03-20 20:27:18
16 |
--------------------------------------------------------------------------------
/app/views/steps/index.html.erb:
--------------------------------------------------------------------------------
1 |
2 | Steps
3 | <%= render '/partials/breadcrumb/add', model: Step %>
4 | <%= render '/partials/breadcrumb/search' %>
5 |
6 |
--------------------------------------------------------------------------------
/test/fixtures/users.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/app/javascript/components/index.js.erb:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | <% vues = Rails.application.root.join('app', 'javascript', 'components', '**', '*.vue') %>
3 | <% Dir.glob(vues).each do |path| %>
4 | <% component = File.basename(path, ".vue") %>
5 | import <%= component.underscore.camelize %> from "<%= path %>";
6 | Vue.component("<%= component.underscore.dasherize %>", <%= component.underscore.camelize %>);
7 | <% end %>
--------------------------------------------------------------------------------
/lib/templates/erb/scaffold/edit.html.erb.tt:
--------------------------------------------------------------------------------
1 |
2 | <%%= link_to "<%= plural_table_name.capitalize %>", <%= index_helper %>_path %>
3 | <%%= link_to @<%= singular_table_name %>.id, @<%= singular_table_name %> %>
4 | Edit
5 |
6 |
7 | <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
--------------------------------------------------------------------------------
/app/models/abilities/ability.rb:
--------------------------------------------------------------------------------
1 | class Ability
2 | include CanCan::Ability
3 |
4 | def initialize(user)
5 | alias_action :read, :create, to: :read_create
6 | alias_action :read, :update, to: :read_update
7 | if user.nil?
8 | self.merge(GuestAbility.new(user))
9 | elsif user.is_a?(Admin)
10 | self.merge(AdminAbility.new(user))
11 | else
12 | self.merge(UserAbility.new(user))
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV['RAILS_ENV'] ||= 'test'
2 | require_relative '../config/environment'
3 | require 'rails/test_help'
4 |
5 | class ActiveSupport::TestCase
6 | # Run tests in parallel with specified workers
7 | parallelize(workers: :number_of_processors)
8 |
9 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
10 | fixtures :all
11 |
12 | # Add more helper methods to be used by all tests here...
13 | end
14 |
--------------------------------------------------------------------------------
/app/javascript/filters/title-pluralize.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | var pluralize = require('pluralize');
3 | Vue.filter('titlePluralize', (string) => {
4 | let sentence = pluralize(string.replace(/[\w]([A-Z])/g, (m) => {
5 | return m[0] + " " + m[1];
6 | }));
7 | let words = sentence.split(' ');
8 | words = words.map((word) => {
9 | return word.charAt(0).toUpperCase() + word.slice(1);
10 | });
11 | return words.join(' ');
12 | });
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/hr.scss:
--------------------------------------------------------------------------------
1 | hr {
2 | &.hr-sm {
3 | margin-top: 0.25em;
4 | margin-left: 0.25em;
5 | margin-right: 0.25em;
6 | margin-bottom: 0.25em;
7 | }
8 | &.hr-md {
9 | margin-top: 0.5em;
10 | margin-left: 0.25em;
11 | margin-right: 0.25em;
12 | margin-bottom: 0.5em;
13 | }
14 | &.hr-lg {
15 | margin-top: 1em;
16 | margin-left: 0.25em;
17 | margin-right: 0.25em;
18 | margin-bottom: 1em;
19 | }
20 | }
--------------------------------------------------------------------------------
/app/views/partials/_messages.html.erb:
--------------------------------------------------------------------------------
1 | <% flash.each do |name, msg| %>
2 | <% if msg.is_a?(String) %>
3 |
4 | <%= content_tag :div, msg %>
5 |
6 | ×
7 |
8 |
9 | <% end %>
10 | <% end %>
11 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | BXCLRBJjusjjTusKssC5t0kv7XJGP/Z8rCtwpGo7LHqq56wEnAoXbIEigehgYDJJdQoz+ePtCWTxsJApg17Ld9MF3uuGRT9nvMJk6C7HRhpIZVvCLfJAEo0yv2xNOLvr2cxTOeBZ0vbC2cLw0PUZ1NniWv4PaKMMvVb3MuXmoHSk0TPSr1i759enumu3dlXaMn9W7RHYrclX/8YBm0zKpdVZGNvCps0HFGOj8Rhbqyw1nAHFEDihTUDiiFGUsdQCV1N8xlabrw3+w7lPjrZ/0QjXV2WwElRSCEdhjyruaJap5hqpwlokhYnme7S/CDB6ZbAlDVep9CsK6gSRPsVmWLqNpNrsJTHd5LZUwQTKOOg7IA3sKqPa57vJ2/Anhy6j/K/xgoFgMr1UkO8xjiUCJeOl6yXKwKYb2TUh--AYLfXKNlRu7HFBek--8vYBnXrrwEsbyXdAsBv9Qg==
--------------------------------------------------------------------------------
/bin/webpack:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4 | ENV["NODE_ENV"] ||= "development"
5 |
6 | require "pathname"
7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8 | Pathname.new(__FILE__).realpath)
9 |
10 | require "bundler/setup"
11 |
12 | require "webpacker"
13 | require "webpacker/webpack_runner"
14 |
15 | APP_ROOT = File.expand_path("..", __dir__)
16 | Dir.chdir(APP_ROOT) do
17 | Webpacker::WebpackRunner.run(ARGV)
18 | end
19 |
--------------------------------------------------------------------------------
/bin/webpack-dev-server:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4 | ENV["NODE_ENV"] ||= "development"
5 |
6 | require "pathname"
7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8 | Pathname.new(__FILE__).realpath)
9 |
10 | require "bundler/setup"
11 |
12 | require "webpacker"
13 | require "webpacker/dev_server_runner"
14 |
15 | APP_ROOT = File.expand_path("..", __dir__)
16 | Dir.chdir(APP_ROOT) do
17 | Webpacker::DevServerRunner.run(ARGV)
18 | end
19 |
--------------------------------------------------------------------------------
/app/views/partials/breadcrumb/_search.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_tag current_url, method: :get, enforce_utf8: false, class: "input-group input-group-sm col-sm-12 col-md-2 p-0 mt-1 mt-sm-0 ml-0 ml-sm-2 #{local_assigns[:classes]}" do %>
2 | <%= text_field_tag :search, params[:search], placeholder: "Search...", type: 'text', class: "form-control" %>
3 |
4 | <%= button_tag type: "submit", class: "btn btn-sm btn-outline-dark" do %>
5 |
6 | <% end %>
7 |
8 | <% end %>
--------------------------------------------------------------------------------
/app/views/partials/_modal.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/bootstrap.scss:
--------------------------------------------------------------------------------
1 | $primary: #666666;
2 | $secondary: #4caf50;
3 | $success: #52BE80;
4 | $danger: #C0392B;
5 | $warning: #F4D03F;
6 | $info: #7FB3D5;
7 | $light: #eeeeee;
8 | $dark: #cccccc;
9 |
10 | @import "~bootstrap/scss/bootstrap";
11 |
12 | html, body {
13 | height: 100%;
14 | }
15 | img {
16 | @extend .img-fluid;
17 | margin: 0 auto;
18 | }
19 | .no-gutters {
20 | margin-right: 0;
21 | margin-left: 0;
22 | > .col,
23 | > [class*="col-"] {
24 | padding-right: 0;
25 | padding-left: 0;
26 | }
27 | }
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json]
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads Spring without using Bundler, in order to be fast.
4 | # It gets overwritten when you run the `spring binstub` command.
5 |
6 | unless defined?(Spring)
7 | require 'rubygems'
8 | require 'bundler'
9 |
10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11 | spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12 | if spring
13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14 | gem 'spring', spring.version
15 | require 'spring/binstub'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/app/views/errors/bad_request.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Bad Request" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Bad Request
8 |
Hmm, something doesn't seem right with that request.
9 |
Were you trying to do something bad?
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/not_acceptable.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Not Acceptable" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Not Acceptable
8 |
There was a problem with your data.
9 |
Please double check the data you enter and try again.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/unknown_error.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Unknown Error" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Unknown Error
8 |
We're sorry, but something went wrong.
9 |
We'll investigate and fix the problem as soon as possible.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/service_unavailable.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Service Unavailable" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Service Unavailable
8 |
The service is unavailable at the moment.
9 |
Please wait and try again in a few minutes.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/unsupported_version.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Unsupported Version" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Unsupported Version
8 |
Doesn't look like that version exists.
9 |
Maybe double check the URL and try again?
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/internal_server_error.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Internal Server Error" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Internal Server Error
8 |
Hmm, something doesn't seem right with that request.
9 |
Were you trying to do something bad?
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/not_authorized.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Not Authorized" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Not Authorized
8 |
Unfortunately you don't have the required permission.
9 |
Maybe you tried to change something you didn't have access to?
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/route_not_found.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Route Not Found" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Route Not Found
8 |
The page you were looking for doesn't exist.
9 |
You may have mistyped the address or the page may have moved.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/views/errors/resource_not_found.html.erb:
--------------------------------------------------------------------------------
1 | <% content_for :title do "Resource Not Found" end %>
2 |
3 |
4 |
5 |
6 |
7 |
Resource Not Found
8 |
Unfortunately the resource was not found.
9 |
You may have mistyped the address or the page may have moved.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/models/users/user.rb:
--------------------------------------------------------------------------------
1 | class User < ApplicationRecord
2 | acts_as_paranoid
3 |
4 | before_validation :set_initials
5 |
6 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
7 | devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable
8 |
9 | def self.icon
10 | 'fa-user'
11 | end
12 |
13 | def set_initials
14 | self.initials ||= self.name.split.map{|n| n[0].capitalize}.join('')
15 | end
16 |
17 | def as_json(options = nil)
18 | super({ methods: [
19 | # include other methods here
20 | ]}.merge(options || {}))
21 | end
22 |
23 | end
24 |
--------------------------------------------------------------------------------
/app/controllers/errors_controller.rb:
--------------------------------------------------------------------------------
1 | class ErrorsController < ApplicationController
2 |
3 | def bad_request
4 | render(status: 400)
5 | end
6 |
7 | def unknown_error
8 | render(status: 400)
9 | end
10 |
11 | def route_not_found
12 | render(status: 404)
13 | end
14 |
15 | def resource_not_found
16 | render(status: 404)
17 | end
18 |
19 | def not_acceptable
20 | render(status: 406)
21 | end
22 |
23 | def not_authorized
24 | render(status: 422)
25 | end
26 |
27 | def internal_server_error
28 | render(status: 500)
29 | end
30 |
31 | def service_unavailable
32 | render(status: 500)
33 | end
34 |
35 | end
36 |
--------------------------------------------------------------------------------
/config/webpack/environment.js:
--------------------------------------------------------------------------------
1 | const { environment } = require('@rails/webpacker')
2 | const { VueLoaderPlugin } = require('vue-loader')
3 | const vue = require('./loaders/vue')
4 | const erb = require('./loaders/erb')
5 | const webpack = require('webpack')
6 |
7 | environment.plugins.append('Provide', new webpack.ProvidePlugin({
8 | $: 'jquery',
9 | jquery: 'jquery',
10 | jQuery: 'jquery',
11 | 'window.jQuery': 'jquery',
12 | Popper: ['popper.js', 'default'],
13 | moment: 'moment'
14 | }))
15 | environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
16 | environment.loaders.prepend('vue', vue)
17 | environment.loaders.prepend('erb', erb)
18 |
19 | module.exports = environment
20 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/lib/templates/erb/scaffold/show.html.erb.tt:
--------------------------------------------------------------------------------
1 |
2 | <%%= link_to "<%= plural_table_name.capitalize %>", <%= index_helper %>_path %>
3 | <%%= @<%= singular_table_name %>.id %>
4 |
5 |
--------------------------------------------------------------------------------
/lib/templates/erb/scaffold/index.html.erb.tt:
--------------------------------------------------------------------------------
1 |
2 | <%= plural_table_name.capitalize %>
3 | <%%= render '/partials/breadcrumb/add', model: <%= singular_table_name.capitalize %> %>
4 | <%%= render '/partials/breadcrumb/search' %>
5 |
6 |
7 | <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
8 |
9 |
10 |
<%%= link_to <%= singular_table_name %>.to_s, <%= model_resource_name %> %>
11 |
<%%= <%= singular_table_name %>.created_at %>
12 |
13 |
14 | <%% end %>
15 |
--------------------------------------------------------------------------------
/app/javascript/packs/application.js.erb:
--------------------------------------------------------------------------------
1 | import Rails from 'rails-ujs';
2 | import Channels from 'channels';
3 | import Turbolinks from 'turbolinks';
4 | import * as ActiveStorage from 'activestorage';
5 |
6 | import 'jquery';
7 | import 'popper.js';
8 | import 'bootstrap';
9 | import 'bootstrap/dist/js/bootstrap';
10 |
11 | window.humanize = require('humanize-string');
12 | window.titleize = require('titleize');
13 |
14 | Rails.start();
15 | Turbolinks.start();
16 | ActiveStorage.start();
17 |
18 | import '../images/index.js.erb';
19 | import '../stylesheets/index.js.erb';
20 | import '../javascripts/index.js.erb';
21 |
22 | import Routes from '../routes/index.js.erb';
23 | console.log("Loaded Routes", Routes);
24 |
25 | window.Routes = Routes;
26 |
27 | console.log('Loaded Application');
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
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 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/SCSS
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 |
--------------------------------------------------------------------------------
/app/views/steps/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= link_to "Steps", steps_path %>
3 | <%= @step.id %>
4 |
5 |
6 |
7 |
8 | Name
9 | <%= @step.name %>
10 |
11 |
12 | Description
13 | <%= @step.description %>
14 |
15 |
16 | Ordinal
17 | <%= @step.ordinal %>
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <%= render 'partials/metatags' %>
6 |
7 |
8 |
9 |
10 |
11 | <%= render 'partials/navbar' %>
12 |
13 |
14 |
15 | <%= render 'partials/messages' %>
16 |
17 | <%= yield %>
18 |
19 |
20 |
21 | <%= render 'partials/modal' %>
22 | <%= render 'partials/styles' %>
23 | <%= render 'partials/javascripts' %>
24 | <%= render 'partials/analytics' %>
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/javascript/packs/vue_pack.js.erb:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.esm';
2 | import VueColcade from 'vue-colcade';
3 | import TurbolinksAdapter from 'vue-turbolinks';
4 | import moment from 'moment';
5 | import Axios from 'axios';
6 | import VueAxios from 'vue-axios';
7 | import VueForm from "vue-form-for";
8 | import VueMoment from "vue-moment";
9 | import VueCanCan from 'vue-cancan';
10 |
11 | Vue.use(VueForm);
12 | Vue.use(VueMoment);
13 | Vue.use(VueColcade);
14 | Vue.use(VueAxios, Axios);
15 | Vue.use(TurbolinksAdapter);
16 | Vue.use(VueCanCan, { rules: window.Abilities });
17 |
18 | import '../filters/index.js.erb';
19 | import '../components/index.js.erb';
20 |
21 | export const EventBus = new Vue();
22 | window.Event = EventBus;
23 |
24 | document.addEventListener('turbolinks:load', () => {
25 | const element = document.getElementById('app');
26 | if (element != null) {
27 | const app = new Vue({}).$mount(element);
28 | console.log("Loaded Vue", app);
29 | }
30 | });
--------------------------------------------------------------------------------
/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/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 |
3 | devise_for :users
4 | resources :steps
5 | get "/", to: "pages#index", as: :home
6 |
7 | match "bad-request", to: "errors#bad_request", as: "bad_request", via: :all
8 | match "not_authorized", to: "errors#not_authorized", as: "not_authorized", via: :all
9 | match "route-not-found", to: "errors#route_not_found", as: "route_not_found", via: :all
10 | match "resource-not-found", to: "errors#resource_not_found", as: "resource_not_found", via: :all
11 | match "missing-template", to: "errors#missing_template", as: "missing_template", via: :all
12 | match "not-acceptable", to: "errors#not_acceptable", as: "not_acceptable", via: :all
13 | match "unknown-error", to: "errors#unknown_error", as: "unknown_error", via: :all
14 | match "service-unavailable", to: "errors#service_unavailable", as: "service_unavailable", via: :all
15 |
16 | root to: "pages#index"
17 |
18 | match "*path", to: "errors#route_not_found", via: :all
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/app/views/partials/_navbar.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <%= link_to "Rails 6", root_path, title: "rails 6", class: 'navbar-brand' %>
6 |
7 |
8 | <%= link_to "Steps", steps_path, title: "Steps", class: "nav-link #{'active' if params[:controller] == 'steps'}" %>
9 |
10 |
11 |
12 |
13 |
14 |
22 |
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Dale Zak
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/javascript/javascripts/datetimepicker.js:
--------------------------------------------------------------------------------
1 | import "tempusdominus-bootstrap-4";
2 | $(function () {
3 | let icons = {
4 | time: 'fa far fa-clock',
5 | date: 'fa far fa-calendar',
6 | up: 'fa far fa-arrow-up',
7 | down: 'fa far fa-arrow-down',
8 | previous: 'fa far fa-chevron-left',
9 | next: 'fa far fa-chevron-right',
10 | today: 'fa far fa-calendar-check',
11 | clear: 'fa far fa-trash',
12 | close: 'fa far fa-times'
13 | }
14 | if ($(".timepicker").length > 0) {
15 | $(".timepicker").datetimepicker({
16 | format: 'h:mm a',
17 | icons: icons,
18 | focusOnShow: true,
19 | allowInputToggle: true
20 | });
21 | }
22 | if ($(".datepicker").length > 0) {
23 | $(".datepicker").datetimepicker({
24 | format: 'YYYY-MM-DD',
25 | icons: icons,
26 | focusOnShow: true,
27 | allowInputToggle: true
28 | });
29 | }
30 | if ($(".datetimepicker").length > 0) {
31 | $(".datetimepicker").datetimepicker({
32 | format: 'YYYY-MM-DD h:mm a',
33 | icons: icons,
34 | focusOnShow: true,
35 | allowInputToggle: true
36 | });
37 | }
38 | });
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require "rails"
4 | require "active_model/railtie"
5 | require "active_job/railtie"
6 | require "active_record/railtie"
7 | require "active_storage/engine"
8 | require "action_controller/railtie"
9 | require "action_mailer/railtie"
10 | require "action_mailbox/engine"
11 | require "action_text/engine"
12 | require "action_view/railtie"
13 | require "action_cable/engine"
14 | require "sprockets/railtie"
15 | require "rails/test_unit/railtie"
16 |
17 | Bundler.require(*Rails.groups)
18 |
19 | module Starter
20 | class Application < Rails::Application
21 | config.load_defaults 6.0
22 |
23 | config.autoload_paths += Dir[Rails.root.join('app', 'jobs', '**/')]
24 | config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
25 | config.autoload_paths += Dir[Rails.root.join('app', 'mailers', '**/')]
26 |
27 | config.action_view.sanitized_allowed_tags = ['strong', 'em', 'a', 'ol', 'ul', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'b', 'i', 'img', 'br', 'span', 'div', 'hr', 'blockquote', 'p']
28 | config.action_view.sanitized_allowed_attributes = ['id', 'name', 'class', 'style', 'title', 'src', 'href', 'alt']
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 |
4 | # path to your application root.
5 | APP_ROOT = File.expand_path('..', __dir__)
6 |
7 | def system!(*args)
8 | system(*args) || abort("\n== Command #{args} failed ==")
9 | end
10 |
11 | FileUtils.chdir APP_ROOT do
12 | # This script is a way to setup or update your development environment automatically.
13 | # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
14 | # Add necessary setup steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # Install JavaScript dependencies
21 | # system('bin/yarn')
22 |
23 | # puts "\n== Copying sample files =="
24 | # unless File.exist?('config/database.yml')
25 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26 | # end
27 |
28 | puts "\n== Preparing database =="
29 | system! 'bin/rails db:prepare'
30 |
31 | puts "\n== Removing old logs and tempfiles =="
32 | system! 'bin/rails log:clear tmp:clear'
33 |
34 | puts "\n== Restarting application server =="
35 | system! 'bin/rails restart'
36 | end
37 |
--------------------------------------------------------------------------------
/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 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
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
23 |
24 | # Use 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
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/app/javascript/stylesheets/sidebar.scss:
--------------------------------------------------------------------------------
1 | #sidebar {
2 | width: 200px;
3 | height: calc(100vh - 64px);
4 | background-color: #ffffff;
5 | border-right: 1px #dedfe0 solid;
6 | overflow-y: auto;
7 | @media (max-width: 576px) {
8 | width: 60px;
9 | }
10 | .nav {
11 | .nav-item {
12 | &:first-child {
13 | margin-top: 8px;
14 | }
15 | &:last-child {
16 | padding-bottom: 8px;
17 | border-bottom: 1px solid #dedfe0;
18 | }
19 | .nav-link {
20 | color: #333;
21 | font-size: 15px;
22 | font-weight: 500;
23 | padding-top: 5px;
24 | padding-bottom: 5px;
25 | .fa {
26 | color: #999;
27 | @media (max-width: 576px) {
28 | font-size: 24px;
29 | }
30 | }
31 | .badge {
32 | margin-top: 3px;
33 | float:right;
34 | }
35 | &.active {
36 | color: var(--primary);
37 | .fa {
38 | color: var(--primary);
39 | }
40 | }
41 | }
42 | }
43 | }
44 | }
45 | .sidebar-content {
46 | padding-left: 200px;
47 | padding-right: 0;
48 | @media (max-width: 576px) {
49 | padding-left: 60px;
50 | padding-right: 0;
51 | }
52 | }
--------------------------------------------------------------------------------
/app/javascript/components/alert-messages.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{data.message}}
5 |
6 | ×
7 |
8 |
9 |
10 |
11 |
12 |
47 |
48 |
50 |
--------------------------------------------------------------------------------
/test/controllers/steps_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class StepsControllerTest < ActionDispatch::IntegrationTest
4 | setup do
5 | @step = steps(:one)
6 | end
7 |
8 | test "should get index" do
9 | get steps_url
10 | assert_response :success
11 | end
12 |
13 | test "should get new" do
14 | get new_step_url
15 | assert_response :success
16 | end
17 |
18 | test "should create step" do
19 | assert_difference('Step.count') do
20 | post steps_url, params: { step: { deleted_at: @step.deleted_at, description: @step.description, name: @step.name, ordinal: @step.ordinal, type: @step.type } }
21 | end
22 |
23 | assert_redirected_to step_url(Step.last)
24 | end
25 |
26 | test "should show step" do
27 | get step_url(@step)
28 | assert_response :success
29 | end
30 |
31 | test "should get edit" do
32 | get edit_step_url(@step)
33 | assert_response :success
34 | end
35 |
36 | test "should update step" do
37 | patch step_url(@step), params: { step: { deleted_at: @step.deleted_at, description: @step.description, name: @step.name, ordinal: @step.ordinal, type: @step.type } }
38 | assert_redirected_to step_url(@step)
39 | end
40 |
41 | test "should destroy step" do
42 | assert_difference('Step.count', -1) do
43 | delete step_url(@step)
44 | end
45 |
46 | assert_redirected_to steps_url
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/app/views/partials/_share.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | <%= link_to "mailto:?&subject=#{CGI.escape(title)}&body=#{CGI.escape(description)}",
4 | class: 'btn btn-block btn-email', title: 'Share via Email', target: '_blank' do %>
5 | Email
6 | <% end %>
7 |
8 |
9 | <%= link_to "http://twitter.com/intent/tweet?status=#{title}+#{url}+#{CGI.escape(tags.split(",").map{ |tag| "##{tag}"}.join(" "))}",
10 | data: { popup_width: 600, popup_height: 400}, class: 'btn btn-block btn-twitter', title: 'Share via Twitter', target: '_blank' do %>
11 | Twitter
12 | <% end %>
13 |
14 |
15 | <%= link_to "http://www.facebook.com/share.php?u=#{url}&title=#{CGI.escape(title)}",
16 | data: { popup_width: 600, popup_height: 400}, class: 'btn btn-block btn-linkedin', title: 'Share via Facebook', target: '_blank' do %>
17 | Facebook
18 | <% end %>
19 |
20 |
21 | <%= link_to "http://www.linkedin.com/shareArticle?mini=true&url=#{url}&title=#{CGI.escape(title)}&source=goingto.com",
22 | data: { popup_width: 600, popup_height: 400}, class: 'btn btn-block btn-linkedin', title: 'Share via LinkedIn', target: '_blank' do %>
23 | LinkedIn
24 | <% end %>
25 |
26 |
--------------------------------------------------------------------------------
/test/system/steps_test.rb:
--------------------------------------------------------------------------------
1 | require "application_system_test_case"
2 |
3 | class StepsTest < ApplicationSystemTestCase
4 | setup do
5 | @step = steps(:one)
6 | end
7 |
8 | test "visiting the index" do
9 | visit steps_url
10 | assert_selector "h1", text: "Steps"
11 | end
12 |
13 | test "creating a Step" do
14 | visit steps_url
15 | click_on "New Step"
16 |
17 | fill_in "Deleted at", with: @step.deleted_at
18 | fill_in "Description", with: @step.description
19 | fill_in "Name", with: @step.name
20 | fill_in "Ordinal", with: @step.ordinal
21 | fill_in "Type", with: @step.type
22 | click_on "Create Step"
23 |
24 | assert_text "Step was successfully created"
25 | click_on "Back"
26 | end
27 |
28 | test "updating a Step" do
29 | visit steps_url
30 | click_on "Edit", match: :first
31 |
32 | fill_in "Deleted at", with: @step.deleted_at
33 | fill_in "Description", with: @step.description
34 | fill_in "Name", with: @step.name
35 | fill_in "Ordinal", with: @step.ordinal
36 | fill_in "Type", with: @step.type
37 | click_on "Update Step"
38 |
39 | assert_text "Step was successfully updated"
40 | click_on "Back"
41 | end
42 |
43 | test "destroying a Step" do
44 | visit steps_url
45 | page.accept_confirm do
46 | click_on "Destroy", match: :first
47 | end
48 |
49 | assert_text "Step was successfully destroyed"
50 | end
51 | end
52 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "starter",
3 | "private": true,
4 | "dependencies": {
5 | "@fortawesome/fontawesome-free": "^5.12.1",
6 | "@fortawesome/fontawesome-svg-core": "^1.2.27",
7 | "@fortawesome/free-regular-svg-icons": "^5.12.1",
8 | "@rails/actioncable": "^6.0.0",
9 | "@rails/activestorage": "^6.0.0",
10 | "@rails/ujs": "^6.0.0",
11 | "@rails/webpacker": "4.2.2",
12 | "activestorage": "^5.2.4-1",
13 | "axios": "^0.19.2",
14 | "bootstrap": "^4.4.1",
15 | "colcade": "^0.2.0",
16 | "css-loader": "^3.4.2",
17 | "humanize-string": "^2.1.0",
18 | "jquery": "^3.4.1",
19 | "moment": "^2.24.0",
20 | "moment-timezone": "^0.5.28",
21 | "pluralize": "^8.0.0",
22 | "pnp-webpack-plugin": "^1.6.4",
23 | "popper.js": "^1.16.1",
24 | "rails-erb-loader": "^5.5.2",
25 | "rails-ujs": "^5.2.4-1",
26 | "tempusdominus-bootstrap-4": "^5.1.2",
27 | "tempusdominus-core": "^5.0.3",
28 | "titleize": "^2.1.0",
29 | "turbolinks": "^5.2.0",
30 | "vue": "^2.6.11",
31 | "vue-axios": "^2.1.5",
32 | "vue-cancan": "^0.0.2",
33 | "vue-colcade": "^1.2.4",
34 | "vue-form-for": "^1.1.1",
35 | "vue-loader": "^15.9.0",
36 | "vue-moment": "^4.1.0",
37 | "vue-template-compiler": "^2.6.11",
38 | "vue-turbolinks": "^2.1.0",
39 | "webpack": "^4.42.0",
40 | "webpack-cli": "^3.3.11"
41 | },
42 | "version": "0.1.0",
43 | "devDependencies": {
44 | "webpack-dev-server": "^3.10.3"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide content security policy
4 | # For further information see the following documentation
5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6 |
7 | # Rails.application.config.content_security_policy do |policy|
8 | # policy.default_src :self, :https
9 | # policy.font_src :self, :https, :data
10 | # policy.img_src :self, :https, :data
11 | # policy.object_src :none
12 | # policy.script_src :self, :https
13 | # policy.style_src :self, :https
14 | # # If you are using webpack-dev-server then specify webpack-dev-server host
15 | # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
16 |
17 | # # Specify URI for violation reports
18 | # # policy.report_uri "/csp-violation-report-endpoint"
19 | # end
20 |
21 | # If you are using UJS then enable automatic nonce generation
22 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
23 |
24 | # Set the nonce only to specific directives
25 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
26 |
27 | # Report CSP violations to a specified URI
28 | # For further information see the following documentation:
29 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
30 | # Rails.application.config.content_security_policy_report_only = true
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.rbc
2 | capybara-*.html
3 | .rspec
4 | /db/*.sqlite3
5 | /db/*.sqlite3-journal
6 | /db/*.sqlite3-[0-9]*
7 | /public/system
8 | /coverage/
9 | /spec/tmp
10 | *.orig
11 | rerun.txt
12 | pickle-email-*.html
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*
16 | /tmp/*
17 | !/log/.keep
18 | !/tmp/.keep
19 |
20 | # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
21 | config/initializers/secret_token.rb
22 | config/master.key
23 |
24 | # Only include if you have production secrets in this file, which is no longer a Rails default
25 | # config/secrets.yml
26 |
27 | # dotenv
28 | # TODO Comment out this rule if environment variables can be committed
29 | .env
30 |
31 | ## Environment normalization:
32 | /.bundle
33 | /vendor/bundle
34 |
35 | # these should all be checked in to normalize the environment:
36 | # Gemfile.lock, .ruby-version, .ruby-gemset
37 |
38 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
39 | .rvmrc
40 |
41 | # if using bower-rails ignore default bower_components path bower.json files
42 | /vendor/assets/bower_components
43 | *.bowerrc
44 | bower.json
45 |
46 | # Ignore pow environment settings
47 | .powenv
48 |
49 | # Ignore Byebug command history file.
50 | .byebug_history
51 |
52 | # Ignore node_modules
53 | node_modules/
54 |
55 | # Ignore precompiled javascript packs
56 | /public/packs
57 | /public/packs-test
58 | /public/assets
59 |
60 | # Ignore yarn files
61 | /yarn-error.log
62 | yarn-debug.log*
63 | .yarn-integrity
64 |
65 | # Ignore uploaded files in development
66 | /storage/*
67 | !/storage/.keep
68 |
--------------------------------------------------------------------------------
/app/views/steps/_form.html.erb:
--------------------------------------------------------------------------------
1 | <% if step.errors.any? %>
2 | <% step.errors.full_messages.each do |message| %>
3 |
4 | <%= message %>
5 |
6 | <% end %>
7 | <% end %>
8 | <%= form_with(model: step, local: true) do |form| -%>
9 |
10 |
11 |
12 |
13 | <%= form.label :name, class: "font-weight-bold" %>
14 | <%= form.text_field :name, placeholder: "Enter name", class: "form-control" %>
15 |
16 |
17 |
18 |
19 | <%= form.label :description, class: "font-weight-bold" %>
20 | <%= form.text_area :description, placeholder: "Enter description", class: "form-control" %>
21 |
22 |
23 |
24 |
25 | <%= form.label :ordinal, class: "font-weight-bold" %>
26 | <%= form.number_field :ordinal, placeholder: "Enter ordinal", class: "form-control" %>
27 |
28 |
29 |
30 |
36 |
37 | <% end %>
--------------------------------------------------------------------------------
/db/migrate/20200321024706_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class DeviseCreateUsers < ActiveRecord::Migration[6.0]
4 | def change
5 | create_table :users do |t|
6 | ## Database authenticatable
7 | t.string :email, null: false, default: ""
8 | t.string :encrypted_password, null: false, default: ""
9 |
10 | ## Recoverable
11 | t.string :reset_password_token
12 | t.datetime :reset_password_sent_at
13 |
14 | ## Rememberable
15 | t.datetime :remember_created_at
16 |
17 | ## Trackable
18 | # t.integer :sign_in_count, default: 0, null: false
19 | # t.datetime :current_sign_in_at
20 | # t.datetime :last_sign_in_at
21 | # t.inet :current_sign_in_ip
22 | # t.inet :last_sign_in_ip
23 |
24 | ## Confirmable
25 | # t.string :confirmation_token
26 | # t.datetime :confirmed_at
27 | # t.datetime :confirmation_sent_at
28 | # t.string :unconfirmed_email # Only if using reconfirmable
29 |
30 | ## Lockable
31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
32 | # t.string :unlock_token # Only if unlock strategy is :email or :both
33 | # t.datetime :locked_at
34 |
35 | t.string :type
36 | t.string :name
37 | t.string :initials
38 | t.datetime :deleted_at
39 |
40 | t.timestamps null: false
41 | end
42 |
43 | add_index :users, :email, unique: true
44 | add_index :users, :reset_password_token, unique: true
45 | # add_index :users, :confirmation_token, unique: true
46 | # add_index :users, :unlock_token, unique: true
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9 | threads min_threads_count, max_threads_count
10 |
11 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
12 | #
13 | port ENV.fetch("PORT") { 3000 }
14 |
15 | # Specifies the `environment` that Puma will run in.
16 | #
17 | environment ENV.fetch("RAILS_ENV") { "development" }
18 |
19 | # Specifies the `pidfile` that Puma will use.
20 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
21 |
22 | # Specifies the number of `workers` to boot in clustered mode.
23 | # Workers are forked web server processes. If using threads and workers together
24 | # the concurrency of the application would be max `threads` * `workers`.
25 | # Workers do not work on JRuby or Windows (both of which do not support
26 | # processes).
27 | #
28 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
29 |
30 | # Use the `preload_app!` method when specifying a `workers` number.
31 | # This directive tells Puma to first boot the application and load code
32 | # before forking the application. This takes advantage of Copy On Write
33 | # process behavior so workers use less memory.
34 | #
35 | # preload_app!
36 |
37 | # Allow puma to be restarted by `rails restart` command.
38 | plugin :tmp_restart
39 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3 |
4 | ruby '2.6.5'
5 |
6 | gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
7 |
8 | gem 'pg', '>= 0.18', '< 2.0'
9 |
10 | gem 'puma', '~> 4.1'
11 | gem "puma_worker_killer", "~> 0.1.1"
12 |
13 | gem 'webpacker', '~> 4.0'
14 | gem 'turbolinks', '~> 5'
15 | gem 'jbuilder', '~> 2.7'
16 |
17 | gem "paranoia", "~> 2.4"
18 | gem "annotate", "~> 3.1"
19 | gem "rails-erd", "~> 1.6"
20 |
21 | gem "devise", "~> 4.7"
22 | gem "devise-jwt", "~> 0.6.0"
23 | gem "cancancan", "~> 3.1"
24 |
25 | gem "delayed_job", "~> 4.1"
26 | gem "delayed_job_active_record", "~> 4.1"
27 |
28 | gem "mail", "~> 2.7"
29 | gem "sendgrid", "~> 1.2"
30 | gem "sendgrid-ruby", "~> 6.1"
31 |
32 | gem "faker", "~> 2.10"
33 |
34 | gem "js-routes", "~> 1.4"
35 | gem "vueonrails", "~> 0.3.0"
36 |
37 | gem "httparty", "~> 0.18.0"
38 | gem "nokogiri", "~> 1.10"
39 | gem "simple-rss", "~> 1.3"
40 | gem "sitemap_generator", "~> 6.1"
41 |
42 | gem "rack-cors", "~> 1.1"
43 | gem "rack-attack", "~> 6.2"
44 | gem "rack-timeout-puma", "~> 0.0.1"
45 |
46 | gem 'bootsnap', '>= 1.4.2', require: false
47 |
48 | group :development, :test do
49 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
50 | gem "bullet", "~> 6.1"
51 | gem "brakeman", "~> 4.8"
52 | gem "memory_profiler", "~> 0.9.14"
53 | gem "derailed_benchmarks", "~> 1.6"
54 | gem "rubocop", "~> 0.80.1"
55 | gem "better_errors", "~> 2.6"
56 | gem "binding_of_caller", "~> 0.8.0"
57 | gem "rack-mini-profiler", "~> 2.0"
58 | end
59 |
60 | group :development do
61 | gem 'web-console', '>= 3.3.0'
62 | gem 'listen', '>= 3.0.5', '< 3.2'
63 | gem 'spring'
64 | gem 'spring-watcher-listen', '~> 2.0.0'
65 | end
66 |
67 | group :test do
68 | gem 'capybara', '>= 2.15'
69 | gem 'selenium-webdriver'
70 | gem 'webdrivers'
71 | end
72 |
73 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
74 |
--------------------------------------------------------------------------------
/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 `rails
6 | # db:schema:load`. When creating a new database, `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.define(version: 2020_03_21_024706) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | create_table "steps", force: :cascade do |t|
19 | t.string "type"
20 | t.string "name"
21 | t.text "description"
22 | t.integer "ordinal"
23 | t.datetime "deleted_at"
24 | t.datetime "created_at", precision: 6, null: false
25 | t.datetime "updated_at", precision: 6, null: false
26 | end
27 |
28 | create_table "users", force: :cascade do |t|
29 | t.string "email", default: "", null: false
30 | t.string "encrypted_password", default: "", null: false
31 | t.string "reset_password_token"
32 | t.datetime "reset_password_sent_at"
33 | t.datetime "remember_created_at"
34 | t.string "type"
35 | t.string "name"
36 | t.string "initials"
37 | t.datetime "deleted_at"
38 | t.datetime "created_at", precision: 6, null: false
39 | t.datetime "updated_at", precision: 6, null: false
40 | t.index ["email"], name: "index_users_on_email", unique: true
41 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
42 | end
43 |
44 | end
45 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.detectIndentation": false,
3 | "editor.formatOnPaste": true,
4 | "editor.formatOnSave": false,
5 | "editor.tabSize": 2,
6 | "editor.wordWrapColumn": 120,
7 | "eslint.autoFixOnSave": true,
8 | "eslint.enable": true,
9 | "eslint.options": {
10 | "extensions": [
11 | ".js",
12 | ".vue"
13 | ]
14 | },
15 | "eslint.validate": [
16 | {
17 | "autoFix": true,
18 | "language": "javascript"
19 | },
20 | {
21 | "autoFix": true,
22 | "language": "vue"
23 | }
24 | ],
25 | "json.format.enable": true,
26 | "html.format.enable": true,
27 | "html.format.preserveNewLines": false,
28 | "html.format.wrapLineLength": 0,
29 | "html.format.endWithNewline": false,
30 | "javascript.format.enable": true,
31 | "javascript.format.insertSpaceAfterCommaDelimiter": true,
32 | "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
33 | "javascript.format.insertSpaceAfterKeywordsInControlFlowStatements": true,
34 | "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
35 | "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
36 | "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
37 | "javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
38 | "javascript.format.insertSpaceAfterSemicolonInForStatements": true,
39 | "javascript.format.insertSpaceBeforeAndAfterBinaryOperators": true,
40 | "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
41 | "javascript.format.placeOpenBraceOnNewLineForControlBlocks": false,
42 | "javascript.format.placeOpenBraceOnNewLineForFunctions": false,
43 | "typescript.format.placeOpenBraceOnNewLineForControlBlocks": false,
44 | "typescript.format.placeOpenBraceOnNewLineForFunctions": false,
45 | "editor.codeActionsOnSave": {
46 | "source.fixAll.eslint": true
47 | }
48 | }
--------------------------------------------------------------------------------
/lib/templates/rails/scaffold_controller/api_controller.rb:
--------------------------------------------------------------------------------
1 | <% if namespaced? -%>
2 | require_dependency "<%= namespaced_file_path %>/application_controller"
3 |
4 | <% end -%>
5 | <% module_namespacing do -%>
6 | class <%= controller_class_name %>Controller < ApplicationController
7 | before_action :set_<%= singular_table_name %>, only: [:show, :update, :destroy]
8 |
9 | def index
10 | authorize! :index, <%= class_name %>
11 | @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
12 | end
13 |
14 | def show
15 | authorize! :show, @<%= singular_table_name %>
16 | end
17 |
18 | def create
19 | authorize! :new, <%= class_name %>
20 | @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
21 | if @<%= orm_instance.save %>
22 | render :show, status: :created, location: <%= "@#{singular_table_name}" %>
23 | else
24 | render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity
25 | end
26 | end
27 |
28 | def update
29 | authorize! :update, @<%= singular_table_name %>
30 | if @<%= orm_instance.update("#{singular_table_name}_params") %>
31 | render :show, status: :ok, location: <%= "@#{singular_table_name}" %>
32 | else
33 | render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity
34 | end
35 | end
36 |
37 | def destroy
38 | authorize! :destroy, @<%= singular_table_name %>
39 | @<%= orm_instance.destroy %>
40 | end
41 |
42 | private
43 |
44 | def set_<%= singular_table_name %>
45 | @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
46 | end
47 |
48 | def <%= "#{singular_table_name}_params" %>
49 | <%- if attributes_names.empty? -%>
50 | params.fetch(<%= ":#{singular_table_name}" %>, {})
51 | <%- else -%>
52 | params.require(<%= ":#{singular_table_name}" %>).permit(<%= permitted_params %>)
53 | <%- end -%>
54 | end
55 | end
56 | <% end -%>
57 |
--------------------------------------------------------------------------------
/lib/templates/erb/scaffold/_form.html.erb.tt:
--------------------------------------------------------------------------------
1 | <%% if <%= singular_table_name %>.errors.any? %>
2 | <%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
3 |
4 | <%%= message %>
5 |
6 | <%% end %>
7 | <%% end %>
8 | <%%= form_with(model: <%= model_resource_name %>, local: true) do |form| -%>
9 |
10 |
11 | <% attributes.reject{|a| a.name == 'type' || a.name == 'deleted_at' || a.name.end_with?("_count")}.each do |attribute| -%>
12 |
13 |
14 | <% if attribute.password_digest? -%>
15 | <%%= form.label :password, class: "font-weight-bold" %>
16 | <%%= form.password_field :password, placeholder: "Enter password", class: "form-control" %>
17 | <%%= form.label :password_confirmation, class: "font-weight-bold" %>
18 | <%%= form.password_field :password_confirmation, placeholder: "Enter password confirmation", class: "form-control" %>
19 | <% else -%>
20 | <%%= form.label :<%= attribute.column_name %>, class: "font-weight-bold" %>
21 | <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, placeholder: "Enter <%= attribute.column_name %>", class: "form-control" %>
22 | <% end -%>
23 |
24 |
25 | <% end -%>
26 |
27 |
33 |
34 | <%% end %>
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function(api) {
2 | var validEnv = ['development', 'test', 'production']
3 | var currentEnv = api.env()
4 | var isDevelopmentEnv = api.env('development')
5 | var isProductionEnv = api.env('production')
6 | var isTestEnv = api.env('test')
7 |
8 | if (!validEnv.includes(currentEnv)) {
9 | throw new Error(
10 | 'Please specify a valid `NODE_ENV` or ' +
11 | '`BABEL_ENV` environment variables. Valid values are "development", ' +
12 | '"test", and "production". Instead, received: ' +
13 | JSON.stringify(currentEnv) +
14 | '.'
15 | )
16 | }
17 |
18 | return {
19 | presets: [
20 | isTestEnv && [
21 | '@babel/preset-env',
22 | {
23 | targets: {
24 | node: 'current'
25 | }
26 | }
27 | ],
28 | (isProductionEnv || isDevelopmentEnv) && [
29 | '@babel/preset-env',
30 | {
31 | forceAllTransforms: true,
32 | useBuiltIns: 'entry',
33 | corejs: 3,
34 | modules: false,
35 | exclude: ['transform-typeof-symbol']
36 | }
37 | ]
38 | ].filter(Boolean),
39 | plugins: [
40 | 'babel-plugin-macros',
41 | '@babel/plugin-syntax-dynamic-import',
42 | isTestEnv && 'babel-plugin-dynamic-import-node',
43 | '@babel/plugin-transform-destructuring',
44 | [
45 | '@babel/plugin-proposal-class-properties',
46 | {
47 | loose: true
48 | }
49 | ],
50 | [
51 | '@babel/plugin-proposal-object-rest-spread',
52 | {
53 | useBuiltIns: true
54 | }
55 | ],
56 | [
57 | '@babel/plugin-transform-runtime',
58 | {
59 | helpers: false,
60 | regenerator: true,
61 | corejs: false
62 | }
63 | ],
64 | [
65 | '@babel/plugin-transform-regenerator',
66 | {
67 | async: false
68 | }
69 | ]
70 | ].filter(Boolean)
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | # The test environment is used exclusively to run your application's
2 | # test suite. You never need to work with it otherwise. Remember that
3 | # your test database is "scratch space" for the test suite and is wiped
4 | # and recreated between test runs. Don't rely on the data there!
5 |
6 | Rails.application.configure do
7 | # Settings specified here will take precedence over those in config/application.rb.
8 |
9 | config.cache_classes = false
10 |
11 | # Do not eager load code on boot. This avoids loading your whole application
12 | # just for the purpose of running a single test. If you are using a tool that
13 | # preloads Rails for running tests, you may have to set it to true.
14 | config.eager_load = false
15 |
16 | # Configure public file server for tests with Cache-Control for performance.
17 | config.public_file_server.enabled = true
18 | config.public_file_server.headers = {
19 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
20 | }
21 |
22 | # Show full error reports and disable caching.
23 | config.consider_all_requests_local = true
24 | config.action_controller.perform_caching = false
25 | config.cache_store = :null_store
26 |
27 | # Raise exceptions instead of rendering exception templates.
28 | config.action_dispatch.show_exceptions = false
29 |
30 | # Disable request forgery protection in test environment.
31 | config.action_controller.allow_forgery_protection = false
32 |
33 | # Store uploaded files on the local file system in a temporary directory.
34 | config.active_storage.service = :test
35 |
36 | config.action_mailer.perform_caching = false
37 |
38 | # Tell Action Mailer not to deliver emails to the real world.
39 | # The :test delivery method accumulates sent emails in the
40 | # ActionMailer::Base.deliveries array.
41 | config.action_mailer.delivery_method = :test
42 |
43 | # Print deprecation notices to the stderr.
44 | config.active_support.deprecation = :stderr
45 |
46 | # Raises error for missing translations.
47 | # config.action_view.raise_on_missing_translations = true
48 | end
49 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports.
13 | config.consider_all_requests_local = true
14 |
15 | # Enable/disable caching. By default caching is disabled.
16 | # Run rails dev:cache to toggle caching.
17 | if Rails.root.join('tmp', 'caching-dev.txt').exist?
18 | config.action_controller.perform_caching = true
19 | config.action_controller.enable_fragment_cache_logging = true
20 |
21 | config.cache_store = :memory_store
22 | config.public_file_server.headers = {
23 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
24 | }
25 | else
26 | config.action_controller.perform_caching = false
27 |
28 | config.cache_store = :null_store
29 | end
30 |
31 | # Store uploaded files on the local file system (see config/storage.yml for options).
32 | config.active_storage.service = :local
33 |
34 | # Don't care if the mailer can't send.
35 | config.action_mailer.raise_delivery_errors = false
36 |
37 | config.action_mailer.perform_caching = false
38 |
39 | # Print deprecation notices to the Rails logger.
40 | config.active_support.deprecation = :log
41 |
42 | # Raise an error on page load if there are pending migrations.
43 | config.active_record.migration_error = :page_load
44 |
45 | # Highlight code that triggered database queries in logs.
46 | config.active_record.verbose_query_logs = true
47 |
48 |
49 | # Raises error for missing translations.
50 | # config.action_view.raise_on_missing_translations = true
51 |
52 | # Use an evented file watcher to asynchronously detect changes in source code,
53 | # routes, locales, etc. This feature depends on the listen gem.
54 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
55 | end
56 |
--------------------------------------------------------------------------------
/app/controllers/steps_controller.rb:
--------------------------------------------------------------------------------
1 | class StepsController < ApplicationController
2 | before_action :set_step, only: [:show, :edit, :update, :destroy]
3 |
4 | def index
5 | authorize! :index, Step
6 | @search = params.fetch(:search, nil)
7 | @offset = params.fetch(:offset, 0).to_i
8 | @limit = [params.fetch(:limit, 12).to_i, 48].min
9 | query = Step.for_search(@search)
10 | @steps = query.limit(@limit).offset(@offset).order(ordinal: :asc).all
11 | @steps_count = query.count(:all)
12 | respond_to do |format|
13 | format.html { render layout: true }
14 | format.json { }
15 | end
16 | end
17 |
18 | def show
19 | authorize! :show, @step
20 | end
21 |
22 | def new
23 | authorize! :new, Step
24 | @step = Step.new
25 | end
26 |
27 | def edit
28 | authorize! :edit, @step
29 | end
30 |
31 | def create
32 | authorize! :create, Step
33 | @step = Step.new(step_params)
34 | respond_to do |format|
35 | if @step.save
36 | format.html { redirect_to @step, notice: 'Step was successfully created.' }
37 | format.json { render :show, status: :created, location: @step }
38 | else
39 | format.html { render :new }
40 | format.json { render json: @step.errors, status: :unprocessable_entity }
41 | end
42 | end
43 | end
44 |
45 | def update
46 | authorize! :update, @step
47 | respond_to do |format|
48 | if @step.update(step_params)
49 | format.html { redirect_to @step, notice: 'Step was successfully updated.' }
50 | format.json { render :show, status: :ok, location: @step }
51 | else
52 | format.html { render :edit }
53 | format.json { render json: @step.errors, status: :unprocessable_entity }
54 | end
55 | end
56 | end
57 |
58 | def destroy
59 | authorize! :destroy, @step
60 | @step.destroy
61 | respond_to do |format|
62 | format.html { redirect_to steps_url, notice: 'Step was successfully destroyed.' }
63 | format.json { head :no_content }
64 | end
65 | end
66 |
67 | private
68 |
69 | def set_step
70 | @step = Step.find(params[:id])
71 | end
72 |
73 | def step_params
74 | params.require(:step).permit(:type, :name, :description, :ordinal, :deleted_at)
75 | end
76 |
77 | end
78 |
--------------------------------------------------------------------------------
/app/views/partials/_metatags.html.erb:
--------------------------------------------------------------------------------
1 | <%=h sanitize current_title %>
2 |
3 | <% if content_for?(:image) -%>
4 |
5 | <% end %>
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | <% if content_for?(:image) -%>
19 |
20 | <% end %>
21 | <% if content_for?(:video) -%>
22 |
23 | <% end %>
24 |
25 |
26 |
27 |
28 |
29 |
30 | <% if content_for?(:image) -%>
31 |
32 | <% end %>
33 | <%= auto_discovery_link_tag(:rss, content_for(:rss), {title: "RSS Feed"}) if content_for?(:rss) %>
34 | <%= auto_discovery_link_tag(:atom, content_for(:atom), {title: "Atom Feed"}) if content_for?(:atom) %>
35 | <%= stylesheet_pack_tag 'application', preload: true, media: 'all', 'data-turbolinks-track': 'reload' %>
36 | <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
37 | <%= javascript_pack_tag 'vue_pack', 'data-turbolinks-track': 'reload' %>
38 | <%= javascript_pack_tag 'erb_pack', 'data-turbolinks-track': 'reload' %>
39 | <%= csrf_meta_tags %>
40 | <%= csp_meta_tag %>
--------------------------------------------------------------------------------
/config/webpacker.yml:
--------------------------------------------------------------------------------
1 | # Note: You must restart bin/webpack-dev-server for changes to take effect
2 |
3 | default: &default
4 | source_path: app/javascript
5 | source_entry_path: packs
6 | public_root_path: public
7 | public_output_path: packs
8 | cache_path: tmp/cache/webpacker
9 | check_yarn_integrity: false
10 | webpack_compile_output: true
11 |
12 | # Additional paths webpack should lookup modules
13 | # ['app/assets', 'engine/foo/app/assets']
14 | resolved_paths: []
15 |
16 | # Reload manifest.json on all requests so we reload latest compiled packs
17 | cache_manifest: false
18 |
19 | # Extract and emit a css file
20 | extract_css: false
21 |
22 | static_assets_extensions:
23 | - .jpg
24 | - .jpeg
25 | - .png
26 | - .gif
27 | - .tiff
28 | - .ico
29 | - .svg
30 | - .eot
31 | - .otf
32 | - .ttf
33 | - .woff
34 | - .woff2
35 |
36 | extensions:
37 | - .erb
38 | - .vue
39 | - .mjs
40 | - .js
41 | - .sass
42 | - .scss
43 | - .css
44 | - .module.sass
45 | - .module.scss
46 | - .module.css
47 | - .png
48 | - .svg
49 | - .gif
50 | - .jpeg
51 | - .jpg
52 |
53 | development:
54 | <<: *default
55 | compile: true
56 |
57 | # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
58 | check_yarn_integrity: true
59 |
60 | # Reference: https://webpack.js.org/configuration/dev-server/
61 | dev_server:
62 | https: false
63 | host: localhost
64 | port: 3035
65 | public: localhost:3035
66 | hmr: false
67 | # Inline should be set to true if using HMR
68 | inline: true
69 | overlay: true
70 | compress: true
71 | disable_host_check: true
72 | use_local_ip: false
73 | quiet: false
74 | pretty: false
75 | headers:
76 | 'Access-Control-Allow-Origin': '*'
77 | watch_options:
78 | ignored: '**/node_modules/**'
79 |
80 |
81 | test:
82 | <<: *default
83 | compile: true
84 |
85 | # Compile test packs to a separate directory
86 | public_output_path: packs-test
87 |
88 | production:
89 | <<: *default
90 |
91 | # Production depends on precompilation of packs prior to booting for performance.
92 | compile: false
93 |
94 | # Extract and emit a css file
95 | extract_css: true
96 |
97 | # Cache manifest.json for performance
98 | cache_manifest: true
99 |
--------------------------------------------------------------------------------
/app/javascript/components/step-cards.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
12 |
{{ card.description }}
13 |
14 |
15 |
16 |
17 |
18 |
No steps
19 |
There are currently no steps for {{search}}
20 |
21 |
22 |
Load More
23 |
24 |
25 |
26 |
110 |
111 |
113 |
--------------------------------------------------------------------------------
/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 | development:
25 | <<: *default
26 | database: starter_development
27 |
28 | # The specified database role being used to connect to postgres.
29 | # To create additional roles in postgres see `$ createuser --help`.
30 | # When left blank, postgres will use the default role. This is
31 | # the same name as the operating system user that initialized the database.
32 | #username: starter
33 |
34 | # The password associated with the postgres role (username).
35 | #password:
36 |
37 | # Connect on a TCP socket. Omitted by default since the client uses a
38 | # domain socket that doesn't need configuration. Windows does not have
39 | # domain sockets, so uncomment these lines.
40 | #host: localhost
41 |
42 | # The TCP port the server listens on. Defaults to 5432.
43 | # If your server runs on a different port number, change accordingly.
44 | #port: 5432
45 |
46 | # Schema search path. The server defaults to $user,public
47 | #schema_search_path: myapp,sharedapp,public
48 |
49 | # Minimum log levels, in increasing order:
50 | # debug5, debug4, debug3, debug2, debug1,
51 | # log, notice, warning, error, fatal, and panic
52 | # Defaults to warning.
53 | #min_messages: notice
54 |
55 | # Warning: The database defined as "test" will be erased and
56 | # re-generated from your development database when you run "rake".
57 | # Do not set this db to the same as development or production.
58 | test:
59 | <<: *default
60 | database: starter_test
61 |
62 | # As with config/credentials.yml, you never want to store sensitive information,
63 | # like your database password, in your source code. If your source code is
64 | # ever seen by anyone, they now have access to your database.
65 | #
66 | # Instead, provide the password as a unix environment variable when you boot
67 | # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
68 | # for a full rundown on how to provide these environment variables in a
69 | # production deployment.
70 | #
71 | # On Heroku and other platform providers, you may have a full connection URL
72 | # available as an environment variable. For example:
73 | #
74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75 | #
76 | # You can use this database configuration with:
77 | #
78 | # production:
79 | # url: <%= ENV['DATABASE_URL'] %>
80 | #
81 | production:
82 | <<: *default
83 | database: starter_production
84 | username: starter
85 | password: <%= ENV['STARTER_DATABASE_PASSWORD'] %>
86 |
--------------------------------------------------------------------------------
/lib/templates/rails/scaffold_controller/controller.rb:
--------------------------------------------------------------------------------
1 | <% if namespaced? -%>
2 | require_dependency "<%= namespaced_file_path %>/application_controller"
3 |
4 | <% end -%>
5 | <% module_namespacing do -%>
6 | class <%= controller_class_name %>Controller < ApplicationController
7 | before_action :set_<%= singular_table_name %>, only: [:show, :edit, :update, :destroy]
8 |
9 | def index
10 | authorize! :index, <%= class_name %>
11 | @search = params.fetch(:search, nil)
12 | @offset = params.fetch(:offset, 0).to_i
13 | @limit = [params.fetch(:limit, 12).to_i, 48].min
14 | query = <%= class_name %>.for_search(@search)
15 | @<%= plural_table_name %> = query.limit(@limit).offset(@offset).order(created_at: :asc).all
16 | @<%= plural_table_name %>_count = query.count(:all)
17 | respond_to do |format|
18 | format.html { render layout: true }
19 | format.json { }
20 | end
21 | end
22 |
23 | def show
24 | authorize! :show, @<%= singular_table_name %>
25 | end
26 |
27 | def new
28 | authorize! :new, <%= class_name %>
29 | @<%= singular_table_name %> = <%= orm_class.build(class_name) %>
30 | end
31 |
32 | def edit
33 | authorize! :edit, @<%= singular_table_name %>
34 | end
35 |
36 | def create
37 | authorize! :create, <%= class_name %>
38 | @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
39 | respond_to do |format|
40 | if @<%= orm_instance.save %>
41 | format.html { redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully created.'" %> }
42 | format.json { render :show, status: :created, location: <%= "@#{singular_table_name}" %> }
43 | else
44 | format.html { render :new }
45 | format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
46 | end
47 | end
48 | end
49 |
50 | def update
51 | authorize! :update, @<%= singular_table_name %>
52 | respond_to do |format|
53 | if @<%= orm_instance.update("#{singular_table_name}_params") %>
54 | format.html { redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %> }
55 | format.json { render :show, status: :ok, location: <%= "@#{singular_table_name}" %> }
56 | else
57 | format.html { render :edit }
58 | format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
59 | end
60 | end
61 | end
62 |
63 | def destroy
64 | authorize! :destroy, @<%= singular_table_name %>
65 | @<%= orm_instance.destroy %>
66 | respond_to do |format|
67 | format.html { redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully destroyed.'" %> }
68 | format.json { head :no_content }
69 | end
70 | end
71 |
72 | private
73 |
74 | def set_<%= singular_table_name %>
75 | @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
76 | end
77 |
78 | def <%= "#{singular_table_name}_params" %>
79 | <%- if attributes_names.empty? -%>
80 | params.fetch(<%= ":#{singular_table_name}" %>, {})
81 | <%- else -%>
82 | params.require(<%= ":#{singular_table_name}" %>).permit(<%= permitted_params %>)
83 | <%- end -%>
84 | end
85 |
86 | end
87 | <% end -%>
88 |
--------------------------------------------------------------------------------
/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($0) == 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 | bundler_version = nil
28 | update_index = nil
29 | ARGV.each_with_index do |a, i|
30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31 | bundler_version = a
32 | end
33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34 | bundler_version = $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", __FILE__)
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 | lockfile_contents = File.read(lockfile)
59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60 | Regexp.last_match(1)
61 | end
62 |
63 | def bundler_version
64 | @bundler_version ||=
65 | env_var_version || cli_arg_version ||
66 | lockfile_version
67 | end
68 |
69 | def bundler_requirement
70 | return "#{Gem::Requirement.default}.a" unless bundler_version
71 |
72 | bundler_gem_version = Gem::Version.new(bundler_version)
73 |
74 | requirement = bundler_gem_version.approximate_recommendation
75 |
76 | return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77 |
78 | requirement += ".a" if bundler_gem_version.prerelease?
79 |
80 | requirement
81 | end
82 |
83 | def load_bundler!
84 | ENV["BUNDLE_GEMFILE"] ||= gemfile
85 |
86 | activate_bundler
87 | end
88 |
89 | def activate_bundler
90 | gem_error = activation_error_handling do
91 | gem "bundler", bundler_requirement
92 | end
93 | return if gem_error.nil?
94 | require_error = activation_error_handling do
95 | require "bundler/version"
96 | end
97 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98 | 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}'`"
99 | exit 42
100 | end
101 |
102 | def activation_error_handling
103 | yield
104 | nil
105 | rescue StandardError, LoadError => e
106 | e
107 | end
108 | end
109 |
110 | m.load_bundler!
111 |
112 | if m.invoked_as_script?
113 | load Gem.bin_path("bundler", "bundle")
114 | end
115 |
--------------------------------------------------------------------------------
/.rubocop.yml:
--------------------------------------------------------------------------------
1 | AllCops:
2 | Exclude:
3 | - bin/*
4 | - test/*.rb
5 | - test/controllers/*.rb
6 | - db/schema.rb
7 | - db/migrate/*.rb
8 | - db/seeds/*.rb
9 | - config/puma.rb
10 | - config/routes.rb
11 |
12 | Style/Documentation:
13 | Enabled: false
14 |
15 | Metrics/AbcSize:
16 | Enabled: false
17 |
18 | Layout/LineLength:
19 | Enabled: false
20 |
21 | Metrics/MethodLength:
22 | Max: 125
23 |
24 | Metrics/BlockLength:
25 | Max: 125
26 |
27 | Metrics/ClassLength:
28 | Max: 500
29 |
30 | Metrics/ModuleLength:
31 | Max: 250
32 |
33 | Metrics/CyclomaticComplexity:
34 | Max: 100
35 |
36 | Metrics/PerceivedComplexity:
37 | Max: 100
38 |
39 | Style/GuardClause:
40 | Enabled: false
41 |
42 | Layout/TrailingEmptyLines:
43 | Enabled: false
44 |
45 | Style/RedundantSelf:
46 | Enabled: false
47 |
48 | Style/RedundantBegin:
49 | Enabled: false
50 |
51 | Style/NumericLiterals:
52 | Enabled: false
53 |
54 | Style/StringLiterals:
55 | Enabled: false
56 |
57 | Style/FrozenStringLiteralComment:
58 | Enabled: false
59 |
60 | Style/SymbolArray:
61 | Enabled: false
62 |
63 | Style/SafeNavigation:
64 | Enabled: false
65 |
66 | Style/IfUnlessModifier:
67 | Enabled: false
68 |
69 | Style/Next:
70 | Enabled: false
71 |
72 | Style/IdenticalConditionalBranches:
73 | Enabled: false
74 |
75 | Style/EmptyMethod:
76 | Enabled: false
77 |
78 | Style/MultilineIfModifier:
79 | Enabled: false
80 |
81 | Style/Lambda:
82 | Enabled: false
83 |
84 | Style/SymbolProc:
85 | Enabled: false
86 |
87 | Style/DateTime:
88 | Enabled: false
89 |
90 | Style/ConditionalAssignment:
91 | Enabled: false
92 |
93 | Style/DoubleNegation:
94 | Enabled: false
95 |
96 | Style/Proc:
97 | Enabled: false
98 |
99 | Style/RegexpLiteral:
100 | Enabled: false
101 |
102 | Layout/EmptyLines:
103 | Enabled: false
104 |
105 | Layout/EmptyLineBetweenDefs:
106 | Enabled: false
107 |
108 | Layout/EmptyLinesAroundBlockBody:
109 | Enabled: false
110 |
111 | Layout/EmptyLinesAroundClassBody:
112 | Enabled: false
113 |
114 | Layout/EmptyLinesAroundMethodBody:
115 | Enabled: false
116 |
117 | Layout/EmptyLinesAroundModuleBody:
118 | Enabled: false
119 |
120 | Layout/LeadingCommentSpace:
121 | Enabled: false
122 |
123 | Layout/SpaceAroundEqualsInParameterDefault:
124 | Enabled: false
125 |
126 | Layout/MultilineMethodCallIndentation:
127 | Enabled: false
128 |
129 | Layout/FirstParameterIndentation:
130 | Enabled: false
131 |
132 | Layout/MultilineMethodCallBraceLayout:
133 | Enabled: false
134 |
135 | Layout/MultilineBlockLayout:
136 | Enabled: false
137 |
138 | Layout/ClosingParenthesisIndentation:
139 | Enabled: false
140 |
141 | Layout/FirstHashElementIndentation:
142 | Enabled: false
143 |
144 | Layout/DotPosition:
145 | Enabled: false
146 |
147 | Layout/FirstArrayElementIndentation:
148 | Enabled: false
149 |
150 | Lint/UnderscorePrefixedVariableName:
151 | Enabled: false
152 |
153 | Lint/UnusedMethodArgument:
154 | Enabled: false
155 |
156 | Lint/UnusedBlockArgument:
157 | Enabled: false
158 |
159 | Bundler/OrderedGems:
160 | Enabled: false
161 |
162 | Layout/SpaceInLambdaLiteral:
163 | Enabled: false
164 |
165 | Layout/SpaceInsideHashLiteralBraces:
166 | Enabled: false
167 |
168 | Layout/TrailingWhitespace:
169 | Enabled: false
170 |
171 | Style/WhileUntilModifier:
172 | Enabled: false
173 |
174 | Layout/SpaceInsideBlockBraces:
175 | Enabled: false
176 |
177 | Style/BracesAroundHashParameters:
178 | Enabled: false
179 |
180 | Style/WhileUntilDo:
181 | Enabled: false
182 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 |
3 | def current_url
4 | "#{request.protocol}#{request.host_with_port}#{request.fullpath}"
5 | end
6 |
7 | def current_site
8 | ENV["APP_NAME"]
9 | end
10 |
11 | def current_title
12 | title = []
13 | title << current_site
14 | if content_for?(:title)
15 | title << content_for(:title)
16 | else
17 | title << params[:controller].split("/").last.titleize
18 | end
19 | title.uniq.join(" | ")
20 | end
21 |
22 | def sanitize(content)
23 | ActionController::Base.helpers.sanitize(content)
24 | end
25 |
26 | def strip_tags_and_entities(string)
27 | unless string.blank?
28 | stripped = strip_tags(string)
29 | decoded = HTMLEntities.new.decode(stripped)
30 | decoded.squish.gsub(%r{/<\/?[^>]*>/}, "")
31 | end
32 | end
33 |
34 | def route_exists?(path)
35 | begin
36 | recognize_path = Rails.application.routes.recognize_path(path, method: :get)
37 | recognize_path.present? && recognize_path[:action] != "route_not_found"
38 | rescue StandardError
39 | false
40 | end
41 | end
42 |
43 | def content_for_or(name, default)
44 | if content_for?(name)
45 | content_for(name)
46 | else
47 | default
48 | end
49 | end
50 |
51 | def body_class(params)
52 | body = []
53 | return unless params[:controller]
54 | if params[:controller].include?("/")
55 | body << params[:controller].split("/").first
56 | body << params[:controller].gsub("/", "-")
57 | else
58 | body << params[:controller]
59 | end
60 | if params[:controller].include?("/")
61 | body << "#{params[:controller].gsub("/", "-")}-#{params[:action]}"
62 | else
63 | body << "#{params[:controller]}-#{params[:action]}"
64 | end
65 | if params.key?(:page)
66 | body << "#{params[:controller]}-#{params[:action]}-#{params[:page]}"
67 | end
68 | body.join(" ")
69 | end
70 |
71 | def controller?(*controller)
72 | controller.include?(params[:controller])
73 | end
74 |
75 | def action?(*action)
76 | action.include?(params[:action])
77 | end
78 |
79 | def resource
80 | @resource ||= User.new
81 | end
82 |
83 | def devise_mapping
84 | @devise_mapping ||= Devise.mappings[:user]
85 | end
86 |
87 | def resource_name
88 | devise_mapping.name
89 | end
90 |
91 | def resource_class
92 | devise_mapping.to
93 | end
94 |
95 | def current_token
96 | request.env["warden-jwt_auth.token"]
97 | end
98 |
99 | def link_to_with_icon(icon_css, title, url, options = {})
100 | icon = content_tag(:span, nil, class: icon_css)
101 | title_with_icon = icon << " ".html_safe << h(title)
102 | link_to(title_with_icon, url, options)
103 | end
104 |
105 | def link_to_new_window(name = nil, options = nil, html_options = {}, &block)
106 | if options.is_a?(Hash)
107 | options[:target] = "_blank"
108 | options[:rel] = "noopener nofollow noindex"
109 | end
110 | html_options[:target] = "_blank"
111 | html_options[:rel] = "noopener nofollow noindex"
112 | link_to(name, options, html_options, &block)
113 | end
114 |
115 | def pretty_number(number)
116 | number_to_human(number,
117 | format: "%n%u",
118 | units: { million: "M",
119 | thousand: "K" })
120 | end
121 |
122 | def require_javascript(*javascript)
123 | @require_javascript ||= []
124 | @require_javascript |= javascript
125 | end
126 |
127 | def require_stylesheet(*stylesheet)
128 | @require_stylesheet ||= []
129 | @require_stylesheet |= stylesheet
130 | end
131 |
132 | def include_required_javascript
133 | javascript_include_tag(*@require_javascript, 'data-turbolinks-track': "reload")
134 | end
135 |
136 | def include_required_stylesheet
137 | stylesheet_link_tag(*@require_stylesheet, 'data-turbolinks-track': "reload")
138 | end
139 |
140 | def serialize(template, options = {})
141 | JbuilderTemplate.new(self) { |json| json.partial! template, options }.attributes!
142 | end
143 |
144 | end
145 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/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 |
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | protect_from_forgery with: :exception, unless: -> { request.format.json? }
3 |
4 | respond_to :html, :json
5 |
6 | rescue_from Exception, with: :unknown_error if Rails.env.production?
7 | rescue_from StandardError, with: :unknown_error
8 | rescue_from ActionController::RoutingError, with: :route_not_found
9 | rescue_from ActionController::UnknownFormat, with: :bad_request
10 | rescue_from ActionController::InvalidCrossOriginRequest, with: :bad_request
11 | rescue_from ActionController::InvalidAuthenticityToken, with: :bad_request
12 | rescue_from AbstractController::ActionNotFound, with: :route_not_found
13 | rescue_from ActionView::MissingTemplate, with: :bad_request
14 | rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found
15 | rescue_from ActiveRecord::RecordNotSaved, with: :not_acceptable
16 | rescue_from ActionController::RoutingError, with: :route_not_found
17 | rescue_from AbstractController::DoubleRenderError, with: :bad_request
18 | rescue_from CanCan::AccessDenied, with: :not_authorized
19 |
20 | def not_authorized(error)
21 | logger.error "not_authorized #{error}"
22 | respond_to do |format|
23 | format.html { render template: "errors/not_authorized", status: 401 }
24 | format.json { render json: { error: "Not Authorized", status: 401 }, status: 401 }
25 | format.all { render nothing: true, status: 401 }
26 | end
27 | end
28 |
29 | def resource_forbidden(error)
30 | logger.error "resource_forbidden #{error}"
31 | respond_to do |format|
32 | format.html { render template: "errors/not_authorized", status: 403 }
33 | format.json { render json: { error: "Forbidden", status: 403 }, status: 403 }
34 | format.all { render nothing: true, status: 403 }
35 | end
36 | end
37 |
38 | def resource_not_found(error)
39 | logger.error "resource_not_found #{error}"
40 | respond_to do |format|
41 | format.html { render template: "errors/resource_not_found", status: 404 }
42 | format.json { render json: { error: "Resource Not Found", status: 404 }, status: 404 }
43 | format.all { render nothing: true, status: 404 }
44 | end
45 | end
46 |
47 | def route_not_found(error)
48 | logger.error "route_not_found #{error}"
49 | respond_to do |format|
50 | format.html { render template: "errors/route_not_found", status: 404 }
51 | format.json { render json: { error: "Route Not Found" }, status: 404 }
52 | format.all { render nothing: true, status: 404 }
53 | end
54 | end
55 |
56 | def unsupported_version(error)
57 | logger.error "unsupported_version #{error}"
58 | respond_to do |format|
59 | format.html { render template: "errors/unsupported_version", status: 404 }
60 | format.json { render json: { error: "Unsupported Version", status: 404 }, status: 404 }
61 | format.all { render nothing: true, status: 404 }
62 | end
63 | end
64 |
65 | def not_acceptable(error)
66 | logger.error "not_acceptable #{error}"
67 | logger.error error.backtrace.join("\n") unless error.backtrace.nil?
68 | respond_to do |format|
69 | format.html { render template: "errors/not_acceptable", status: 406 }
70 | format.json { render json: { error: "Not Acceptable", status: 406 }, status: 406 }
71 | format.all { render nothing: true, status: 406 }
72 | end
73 | end
74 |
75 | def bad_request(error)
76 | logger.error "bad_request #{error}"
77 | logger.error error.backtrace.join("\n") unless error.backtrace.nil?
78 | respond_to do |format|
79 | format.html { render template: "errors/bad_request", status: 400 }
80 | format.json { render json: { error: "Bad Request", status: 400 }, status: 400 }
81 | format.all { render nothing: true, status: 400 }
82 | end
83 | end
84 |
85 | def unknown_error(error)
86 | logger.error "unknown_error #{error}"
87 | logger.error error.backtrace.join("\n") unless error.backtrace.nil?
88 | respond_to do |format|
89 | format.html { render template: "errors/unknown_error", status: 500 }
90 | format.json { render json: { error: "Unknown Error", status: 500 }, status: 500 }
91 | format.all { render nothing: true, status: 500 }
92 | end
93 | end
94 |
95 | protected
96 |
97 | def set_current_user
98 | User.current = current_user
99 | end
100 |
101 | def current_token
102 | request.env["warden-jwt_auth.token"]
103 | end
104 |
105 | end
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19 | # config.require_master_key = true
20 |
21 | # Disable serving static files from the `/public` folder by default since
22 | # Apache or NGINX already handles this.
23 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
24 |
25 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
26 | # config.action_controller.asset_host = 'http://assets.example.com'
27 |
28 | # Specifies the header that your server uses for sending files.
29 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
30 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
31 |
32 | # Store uploaded files on the local file system (see config/storage.yml for options).
33 | config.active_storage.service = :local
34 |
35 | # Mount Action Cable outside main process or domain.
36 | # config.action_cable.mount_path = nil
37 | # config.action_cable.url = 'wss://example.com/cable'
38 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
39 |
40 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
41 | # config.force_ssl = true
42 |
43 | # Use the lowest log level to ensure availability of diagnostic information
44 | # when problems arise.
45 | config.log_level = :debug
46 |
47 | # Prepend all log lines with the following tags.
48 | config.log_tags = [ :request_id ]
49 |
50 | # Use a different cache store in production.
51 | # config.cache_store = :mem_cache_store
52 |
53 | # Use a real queuing backend for Active Job (and separate queues per environment).
54 | # config.active_job.queue_adapter = :resque
55 | # config.active_job.queue_name_prefix = "starter_production"
56 |
57 | config.action_mailer.perform_caching = false
58 |
59 | # Ignore bad email addresses and do not raise email delivery errors.
60 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
61 | # config.action_mailer.raise_delivery_errors = false
62 |
63 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
64 | # the I18n.default_locale when a translation cannot be found).
65 | config.i18n.fallbacks = true
66 |
67 | # Send deprecation notices to registered listeners.
68 | config.active_support.deprecation = :notify
69 |
70 | # Use default logging formatter so that PID and timestamp are not suppressed.
71 | config.log_formatter = ::Logger::Formatter.new
72 |
73 | # Use a different logger for distributed setups.
74 | # require 'syslog/logger'
75 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
76 |
77 | if ENV["RAILS_LOG_TO_STDOUT"].present?
78 | logger = ActiveSupport::Logger.new(STDOUT)
79 | logger.formatter = config.log_formatter
80 | config.logger = ActiveSupport::TaggedLogging.new(logger)
81 | end
82 |
83 | # Do not dump schema after migrations.
84 | config.active_record.dump_schema_after_migration = false
85 |
86 | # Inserts middleware to perform automatic connection switching.
87 | # The `database_selector` hash is used to pass options to the DatabaseSelector
88 | # middleware. The `delay` is used to determine how long to wait after a write
89 | # to send a subsequent read to the primary.
90 | #
91 | # The `database_resolver` class is used by the middleware to determine which
92 | # database is appropriate to use based on the time delay.
93 | #
94 | # The `database_resolver_context` class is used by the middleware to set
95 | # timestamps for the last write to the primary. The resolver uses the context
96 | # class timestamps to determine how long to wait before reading from the
97 | # replica.
98 | #
99 | # By default Rails will store a last write timestamp in the session. The
100 | # DatabaseSelector middleware is designed as such you can define your own
101 | # strategy for connection switching and pass that into the middleware through
102 | # these configuration options.
103 | # config.active_record.database_selector = { delay: 2.seconds }
104 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
105 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
106 | end
107 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actioncable (6.0.2.1)
5 | actionpack (= 6.0.2.1)
6 | nio4r (~> 2.0)
7 | websocket-driver (>= 0.6.1)
8 | actionmailbox (6.0.2.1)
9 | actionpack (= 6.0.2.1)
10 | activejob (= 6.0.2.1)
11 | activerecord (= 6.0.2.1)
12 | activestorage (= 6.0.2.1)
13 | activesupport (= 6.0.2.1)
14 | mail (>= 2.7.1)
15 | actionmailer (6.0.2.1)
16 | actionpack (= 6.0.2.1)
17 | actionview (= 6.0.2.1)
18 | activejob (= 6.0.2.1)
19 | mail (~> 2.5, >= 2.5.4)
20 | rails-dom-testing (~> 2.0)
21 | actionpack (6.0.2.1)
22 | actionview (= 6.0.2.1)
23 | activesupport (= 6.0.2.1)
24 | rack (~> 2.0, >= 2.0.8)
25 | rack-test (>= 0.6.3)
26 | rails-dom-testing (~> 2.0)
27 | rails-html-sanitizer (~> 1.0, >= 1.2.0)
28 | actiontext (6.0.2.1)
29 | actionpack (= 6.0.2.1)
30 | activerecord (= 6.0.2.1)
31 | activestorage (= 6.0.2.1)
32 | activesupport (= 6.0.2.1)
33 | nokogiri (>= 1.8.5)
34 | actionview (6.0.2.1)
35 | activesupport (= 6.0.2.1)
36 | builder (~> 3.1)
37 | erubi (~> 1.4)
38 | rails-dom-testing (~> 2.0)
39 | rails-html-sanitizer (~> 1.1, >= 1.2.0)
40 | activejob (6.0.2.1)
41 | activesupport (= 6.0.2.1)
42 | globalid (>= 0.3.6)
43 | activemodel (6.0.2.1)
44 | activesupport (= 6.0.2.1)
45 | activerecord (6.0.2.1)
46 | activemodel (= 6.0.2.1)
47 | activesupport (= 6.0.2.1)
48 | activestorage (6.0.2.1)
49 | actionpack (= 6.0.2.1)
50 | activejob (= 6.0.2.1)
51 | activerecord (= 6.0.2.1)
52 | marcel (~> 0.3.1)
53 | activesupport (6.0.2.1)
54 | concurrent-ruby (~> 1.0, >= 1.0.2)
55 | i18n (>= 0.7, < 2)
56 | minitest (~> 5.1)
57 | tzinfo (~> 1.1)
58 | zeitwerk (~> 2.2)
59 | addressable (2.7.0)
60 | public_suffix (>= 2.0.2, < 5.0)
61 | annotate (3.1.0)
62 | activerecord (>= 3.2, < 7.0)
63 | rake (>= 10.4, < 14.0)
64 | ast (2.4.0)
65 | bcrypt (3.1.13)
66 | benchmark-ips (2.7.2)
67 | better_errors (2.6.0)
68 | coderay (>= 1.0.0)
69 | erubi (>= 1.0.0)
70 | rack (>= 0.9.0)
71 | bindex (0.8.1)
72 | binding_of_caller (0.8.0)
73 | debug_inspector (>= 0.0.1)
74 | bootsnap (1.4.6)
75 | msgpack (~> 1.0)
76 | brakeman (4.8.0)
77 | builder (3.2.4)
78 | bullet (6.1.0)
79 | activesupport (>= 3.0.0)
80 | uniform_notifier (~> 1.11)
81 | byebug (11.1.1)
82 | cancancan (3.1.0)
83 | capybara (3.31.0)
84 | addressable
85 | mini_mime (>= 0.1.3)
86 | nokogiri (~> 1.8)
87 | rack (>= 1.6.0)
88 | rack-test (>= 0.6.3)
89 | regexp_parser (~> 1.5)
90 | xpath (~> 3.2)
91 | childprocess (3.0.0)
92 | choice (0.2.0)
93 | coderay (1.1.2)
94 | concurrent-ruby (1.1.6)
95 | crass (1.0.6)
96 | debug_inspector (0.0.3)
97 | delayed_job (4.1.8)
98 | activesupport (>= 3.0, < 6.1)
99 | delayed_job_active_record (4.1.4)
100 | activerecord (>= 3.0, < 6.1)
101 | delayed_job (>= 3.0, < 5)
102 | derailed_benchmarks (1.6.0)
103 | benchmark-ips (~> 2)
104 | get_process_mem (~> 0)
105 | heapy (~> 0)
106 | memory_profiler (~> 0)
107 | rack (>= 1)
108 | rake (> 10, < 14)
109 | ruby-statistics (>= 2.1)
110 | thor (>= 0.19, < 2)
111 | devise (4.7.1)
112 | bcrypt (~> 3.0)
113 | orm_adapter (~> 0.1)
114 | railties (>= 4.1.0)
115 | responders
116 | warden (~> 1.2.3)
117 | devise-jwt (0.6.0)
118 | devise (~> 4.0)
119 | warden-jwt_auth (~> 0.4)
120 | dry-auto_inject (0.7.0)
121 | dry-container (>= 0.3.4)
122 | dry-configurable (0.9.0)
123 | concurrent-ruby (~> 1.0)
124 | dry-core (~> 0.4, >= 0.4.7)
125 | dry-container (0.7.2)
126 | concurrent-ruby (~> 1.0)
127 | dry-configurable (~> 0.1, >= 0.1.3)
128 | dry-core (0.4.9)
129 | concurrent-ruby (~> 1.0)
130 | erubi (1.9.0)
131 | faker (2.10.2)
132 | i18n (>= 1.6, < 2)
133 | ffi (1.12.2)
134 | get_process_mem (0.2.5)
135 | ffi (~> 1.0)
136 | globalid (0.4.2)
137 | activesupport (>= 4.2.0)
138 | heapy (0.1.4)
139 | httparty (0.18.0)
140 | mime-types (~> 3.0)
141 | multi_xml (>= 0.5.2)
142 | i18n (1.8.2)
143 | concurrent-ruby (~> 1.0)
144 | jaro_winkler (1.5.4)
145 | jbuilder (2.10.0)
146 | activesupport (>= 5.0.0)
147 | js-routes (1.4.9)
148 | railties (>= 4)
149 | sprockets-rails
150 | json (2.3.0)
151 | jwt (2.2.1)
152 | listen (3.1.5)
153 | rb-fsevent (~> 0.9, >= 0.9.4)
154 | rb-inotify (~> 0.9, >= 0.9.7)
155 | ruby_dep (~> 1.2)
156 | loofah (2.4.0)
157 | crass (~> 1.0.2)
158 | nokogiri (>= 1.5.9)
159 | mail (2.7.1)
160 | mini_mime (>= 0.1.1)
161 | marcel (0.3.3)
162 | mimemagic (~> 0.3.2)
163 | memory_profiler (0.9.14)
164 | method_source (1.0.0)
165 | mime-types (3.3.1)
166 | mime-types-data (~> 3.2015)
167 | mime-types-data (3.2019.1009)
168 | mimemagic (0.3.4)
169 | mini_mime (1.0.2)
170 | mini_portile2 (2.4.0)
171 | minitest (5.14.0)
172 | msgpack (1.3.3)
173 | multi_xml (0.6.0)
174 | nio4r (2.5.2)
175 | nokogiri (1.10.9)
176 | mini_portile2 (~> 2.4.0)
177 | orm_adapter (0.5.0)
178 | parallel (1.19.1)
179 | paranoia (2.4.2)
180 | activerecord (>= 4.0, < 6.1)
181 | parser (2.7.0.4)
182 | ast (~> 2.4.0)
183 | pg (1.2.3)
184 | public_suffix (4.0.3)
185 | puma (4.3.3)
186 | nio4r (~> 2.0)
187 | puma_worker_killer (0.1.1)
188 | get_process_mem (~> 0.2)
189 | puma (>= 2.7, < 5)
190 | rack (2.2.2)
191 | rack-attack (6.2.2)
192 | rack (>= 1.0, < 3)
193 | rack-cors (1.1.1)
194 | rack (>= 2.0.0)
195 | rack-mini-profiler (2.0.1)
196 | rack (>= 1.2.0)
197 | rack-proxy (0.6.5)
198 | rack
199 | rack-test (1.1.0)
200 | rack (>= 1.0, < 3)
201 | rack-timeout (0.6.0)
202 | rack-timeout-puma (0.0.1)
203 | rack-timeout (~> 0.2, >= 0.2.0)
204 | rails (6.0.2.1)
205 | actioncable (= 6.0.2.1)
206 | actionmailbox (= 6.0.2.1)
207 | actionmailer (= 6.0.2.1)
208 | actionpack (= 6.0.2.1)
209 | actiontext (= 6.0.2.1)
210 | actionview (= 6.0.2.1)
211 | activejob (= 6.0.2.1)
212 | activemodel (= 6.0.2.1)
213 | activerecord (= 6.0.2.1)
214 | activestorage (= 6.0.2.1)
215 | activesupport (= 6.0.2.1)
216 | bundler (>= 1.3.0)
217 | railties (= 6.0.2.1)
218 | sprockets-rails (>= 2.0.0)
219 | rails-dom-testing (2.0.3)
220 | activesupport (>= 4.2.0)
221 | nokogiri (>= 1.6)
222 | rails-erd (1.6.0)
223 | activerecord (>= 4.2)
224 | activesupport (>= 4.2)
225 | choice (~> 0.2.0)
226 | ruby-graphviz (~> 1.2)
227 | rails-html-sanitizer (1.3.0)
228 | loofah (~> 2.3)
229 | railties (6.0.2.1)
230 | actionpack (= 6.0.2.1)
231 | activesupport (= 6.0.2.1)
232 | method_source
233 | rake (>= 0.8.7)
234 | thor (>= 0.20.3, < 2.0)
235 | rainbow (3.0.0)
236 | rake (13.0.1)
237 | rb-fsevent (0.10.3)
238 | rb-inotify (0.10.1)
239 | ffi (~> 1.0)
240 | regexp_parser (1.7.0)
241 | responders (3.0.0)
242 | actionpack (>= 5.0)
243 | railties (>= 5.0)
244 | rexml (3.2.4)
245 | rubocop (0.80.1)
246 | jaro_winkler (~> 1.5.1)
247 | parallel (~> 1.10)
248 | parser (>= 2.7.0.1)
249 | rainbow (>= 2.2.2, < 4.0)
250 | rexml
251 | ruby-progressbar (~> 1.7)
252 | unicode-display_width (>= 1.4.0, < 1.7)
253 | ruby-graphviz (1.2.5)
254 | rexml
255 | ruby-progressbar (1.10.1)
256 | ruby-statistics (2.1.2)
257 | ruby_dep (1.5.0)
258 | ruby_http_client (3.5.0)
259 | rubyzip (2.3.0)
260 | selenium-webdriver (3.142.7)
261 | childprocess (>= 0.5, < 4.0)
262 | rubyzip (>= 1.2.2)
263 | sendgrid (1.2.4)
264 | json
265 | sendgrid-ruby (6.1.2)
266 | ruby_http_client (~> 3.4)
267 | simple-rss (1.3.3)
268 | sitemap_generator (6.1.0)
269 | builder (~> 3.0)
270 | spring (2.1.0)
271 | spring-watcher-listen (2.0.1)
272 | listen (>= 2.7, < 4.0)
273 | spring (>= 1.2, < 3.0)
274 | sprockets (4.0.0)
275 | concurrent-ruby (~> 1.0)
276 | rack (> 1, < 3)
277 | sprockets-rails (3.2.1)
278 | actionpack (>= 4.0)
279 | activesupport (>= 4.0)
280 | sprockets (>= 3.0.0)
281 | thor (1.0.1)
282 | thread_safe (0.3.6)
283 | turbolinks (5.2.1)
284 | turbolinks-source (~> 5.2)
285 | turbolinks-source (5.2.0)
286 | tzinfo (1.2.6)
287 | thread_safe (~> 0.1)
288 | unicode-display_width (1.6.1)
289 | uniform_notifier (1.13.0)
290 | vueonrails (0.3.0)
291 | warden (1.2.8)
292 | rack (>= 2.0.6)
293 | warden-jwt_auth (0.4.2)
294 | dry-auto_inject (~> 0.6)
295 | dry-configurable (~> 0.9, < 0.11)
296 | jwt (~> 2.1)
297 | warden (~> 1.2)
298 | web-console (4.0.1)
299 | actionview (>= 6.0.0)
300 | activemodel (>= 6.0.0)
301 | bindex (>= 0.4.0)
302 | railties (>= 6.0.0)
303 | webdrivers (4.2.0)
304 | nokogiri (~> 1.6)
305 | rubyzip (>= 1.3.0)
306 | selenium-webdriver (>= 3.0, < 4.0)
307 | webpacker (4.2.2)
308 | activesupport (>= 4.2)
309 | rack-proxy (>= 0.6.1)
310 | railties (>= 4.2)
311 | websocket-driver (0.7.1)
312 | websocket-extensions (>= 0.1.0)
313 | websocket-extensions (0.1.4)
314 | xpath (3.2.0)
315 | nokogiri (~> 1.8)
316 | zeitwerk (2.3.0)
317 |
318 | PLATFORMS
319 | ruby
320 |
321 | DEPENDENCIES
322 | annotate (~> 3.1)
323 | better_errors (~> 2.6)
324 | binding_of_caller (~> 0.8.0)
325 | bootsnap (>= 1.4.2)
326 | brakeman (~> 4.8)
327 | bullet (~> 6.1)
328 | byebug
329 | cancancan (~> 3.1)
330 | capybara (>= 2.15)
331 | delayed_job (~> 4.1)
332 | delayed_job_active_record (~> 4.1)
333 | derailed_benchmarks (~> 1.6)
334 | devise (~> 4.7)
335 | devise-jwt (~> 0.6.0)
336 | faker (~> 2.10)
337 | httparty (~> 0.18.0)
338 | jbuilder (~> 2.7)
339 | js-routes (~> 1.4)
340 | listen (>= 3.0.5, < 3.2)
341 | mail (~> 2.7)
342 | memory_profiler (~> 0.9.14)
343 | nokogiri (~> 1.10)
344 | paranoia (~> 2.4)
345 | pg (>= 0.18, < 2.0)
346 | puma (~> 4.1)
347 | puma_worker_killer (~> 0.1.1)
348 | rack-attack (~> 6.2)
349 | rack-cors (~> 1.1)
350 | rack-mini-profiler (~> 2.0)
351 | rack-timeout-puma (~> 0.0.1)
352 | rails (~> 6.0.2, >= 6.0.2.1)
353 | rails-erd (~> 1.6)
354 | rubocop (~> 0.80.1)
355 | selenium-webdriver
356 | sendgrid (~> 1.2)
357 | sendgrid-ruby (~> 6.1)
358 | simple-rss (~> 1.3)
359 | sitemap_generator (~> 6.1)
360 | spring
361 | spring-watcher-listen (~> 2.0.0)
362 | turbolinks (~> 5)
363 | tzinfo-data
364 | vueonrails (~> 0.3.0)
365 | web-console (>= 3.3.0)
366 | webdrivers
367 | webpacker (~> 4.0)
368 |
369 | RUBY VERSION
370 | ruby 2.6.5p114
371 |
372 | BUNDLED WITH
373 | 2.1.4
374 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Rails 6
2 | ## Boilerplate for Webpacker, Vue, Bootstrap, FontAwesome
3 |
4 | This is a boilerplate project sharing some tips and strategies for using Rails 6 with Webpacker, Vue, Bootstrap and FontAwesome.
5 |
6 | #### Init Rails Project
7 | First create a new Rails project with options to use Git, Postgres as a database and Vue for the frontend framework.
8 | ```
9 | rails new starter --git --skip-sprockets --webpack=vue --database=postgresql
10 | ```
11 |
12 | #### Add Procfile File
13 | ```
14 | web: bundle exec puma -C config/puma.rb
15 | ```
16 |
17 | #### Add Profile.dev File
18 | ```
19 | web: bundle exec rails s -p 3000
20 | webpack: ./bin/webpack-dev-server
21 | ```
22 |
23 | #### Add Server Gems
24 | ```
25 | bundle add puma
26 | bundle add puma_worker_killer
27 | ```
28 |
29 | #### Add Frontend Gems
30 | ```
31 | bundle add webpacker
32 | bundle add turbolinks
33 | bundle add jbuilder
34 | ```
35 |
36 | #### Add Model Gems
37 | ```
38 | bundle add paranoia
39 | bundle add annotate
40 | ```
41 |
42 | #### Add Database Gems
43 | ```
44 | bundle add rails-erd
45 | ```
46 |
47 | #### Add Authentication Gems
48 | ```
49 | bundle add devise
50 | bundle add devise-jwt
51 | ```
52 |
53 | #### Add Authorization Gems
54 | ```
55 | bundle add cancancan
56 | ```
57 |
58 | #### Add Worker Gems
59 | ```
60 | bundle add delayed_job
61 | bundle add delayed_job_active_record
62 | ```
63 |
64 | #### Add Mail Gems
65 | ```
66 | bundle add mail
67 | bundle add sendgrid
68 | bundle add sendgrid-ruby
69 | ```
70 |
71 | #### Add Configuration Gems
72 | ```
73 | bundle add figaro
74 | ```
75 |
76 | #### Add Seed Gems
77 | ```
78 | bundle add faker
79 | ```
80 |
81 | #### Add Frontend Gems
82 | ```
83 | bundle add js-routes
84 | bundle add vueonrails
85 | ```
86 |
87 | #### Add HTTP Gems
88 | ```
89 | bundle add httparty
90 | bundle add nokogiri
91 | bundle add simple-rss
92 | bundle add sitemap_generator
93 | ```
94 |
95 | #### Add Security Gems
96 | ```
97 | bundle add rack-cors
98 | bundle add rack-attack
99 | bundle add rack-timeout-puma
100 | ```
101 |
102 | #### Add Development Gems
103 | ```
104 | bundle add bullet
105 | bundle add brakeman
106 | bundle add memory_profiler
107 | bundle add derailed_benchmarks
108 | bundle add byebug
109 | bundle add rubocop
110 | bundle add better_errors
111 | bundle add binding_of_caller
112 | bundle add rack-mini-profiler
113 | ```
114 |
115 | #### Update Gems
116 | ```
117 | bundle install
118 | bundle update
119 | ```
120 |
121 | #### Add Node Packages
122 | Next add some node packages we'll use on the frontend.
123 | ```
124 | yarn add webpack webpack-cli pnp-webpack-plugin
125 | yarn add turbolinks rails-ujs activestorage
126 | yarn add jquery bootstrap popper.js css-loader
127 | yarn add colcade vue-colcade
128 | yarn add axios vue-axios vue-turbolinks
129 | yarn add @fortawesome/fontawesome-free @fortawesome/fontawesome-svg-core @fortawesome/free-regular-svg-icons
130 | yarn add titleize pluralize humanize-string
131 | yarn add moment moment-timezone vue-moment
132 | yarn add vue-cancan vue-form-for
133 | yarn add tempusdominus-core tempusdominus-bootstrap-4
134 | ```
135 |
136 | #### Enable Sprockets Railtie
137 | In `config/application.rb`, uncoment
138 | ```
139 | require "sprockets/railtie"
140 | ```
141 |
142 | #### Enable Subfolder Models
143 | In `config/application.rb`, add these lines to allow subfolders to be loaded
144 | ```
145 | config.autoload_paths += Dir[Rails.root.join('app', 'jobs', '**/')]
146 | config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
147 | config.autoload_paths += Dir[Rails.root.join('app', 'mailers', '**/')]
148 | ```
149 |
150 | #### Add ERB Webpacker
151 | Enable ERB on our frontend so we can dynamically load javascript, stylesheets, images
152 | ```
153 | rails webpacker:install:erb
154 | ```
155 |
156 | #### Add ERB Indexes
157 | Add `app/javascript/components/index.js.erb`
158 | ```
159 | import Vue from 'vue/dist/vue.esm';
160 | <% vues = Rails.application.root.join('app', 'javascript', 'components', '**', '*.vue') %>
161 | <% Dir.glob(vues).each do |path| %>
162 | <% component = File.basename(path, ".vue") %>
163 | import <%= component.underscore.camelize %> from "<%= path %>";
164 | Vue.component("<%= component.underscore.dasherize %>", <%= component.underscore.camelize %>);
165 | <% end %>
166 | ```
167 | Add `app/javascript/filters/index.js.erb`
168 | ```
169 | import Vue from 'vue/dist/vue.esm';
170 | <% filters = Rails.application.root.join('app', 'javascript', 'filters', '**', '*.js') %>
171 | <% Dir.glob(filters).each do |path| %>
172 | <% filter = File.basename(path, ".js") %>
173 | import <%= filter.underscore.camelize %> from "<%= path %>";
174 | <% end %>
175 | ```
176 | Add `app/javascript/javascripts/index.js.erb`
177 | ```
178 | <% javascripts_glob = Rails.application.root.join('app', 'javascript', 'javascripts', '**', '*.js') %>
179 | <% Dir.glob(javascripts_glob).each do |file| %>
180 | import '<%= file %>';
181 | <% end %>
182 | ```
183 | Add `app/javascript/images/index.js.erb`
184 | ```
185 | <% images = Rails.application.root.join('app', 'javascript', 'images', '**', '*.{png,svg,jpg}') %>
186 | <% Dir.glob(images).each do |image| %>
187 | import '<%= image %>';
188 | <% end %>
189 | ```
190 | Add `app/javascript/stylesheets/index.js.erb`
191 | ```
192 | <% stylesheets = Rails.application.root.join('app', 'javascript', 'stylesheets', '**', '*.{css,scss}') %>
193 | <% Dir.glob(stylesheets).each do |file| %>
194 | import '<%= file %>';
195 | <% end %>
196 | ```
197 | Add `app/javascript/routes/index.js.erb`
198 | ```
199 | <%= JsRoutes.generate() %>
200 | ```
201 |
202 | #### Update Webpacker Environment
203 | Update `config/webpack/environment.js`
204 | ```
205 | const { environment } = require('@rails/webpacker')
206 | const { VueLoaderPlugin } = require('vue-loader')
207 | const vue = require('./loaders/vue')
208 | const erb = require('./loaders/erb')
209 | const webpack = require('webpack')
210 | environment.plugins.append('Provide', new webpack.ProvidePlugin({
211 | $: 'jquery',
212 | jquery: 'jquery',
213 | jQuery: 'jquery',
214 | 'window.jQuery': 'jquery',
215 | Popper: ['popper.js', 'default'],
216 | moment: 'moment'
217 | }))
218 | environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
219 | environment.loaders.prepend('vue', vue)
220 | environment.loaders.prepend('erb', erb)
221 | module.exports = environment
222 | ```
223 |
224 | #### Setup Database
225 | ```
226 | bundle exec rake db:create
227 | bundle exec rake db:migrate
228 | ```
229 |
230 | #### Setup Authentication
231 | ```
232 | rails generate devise:install
233 | ```
234 |
235 | #### Setup Authorization
236 | ```
237 | rails generate cancan:ability
238 | ```
239 |
240 | #### Setup Configuration
241 | ```
242 | bundle exec figaro install
243 | ```
244 |
245 | #### Setup Jobs
246 | ```
247 | rails generate delayed_job:active_record
248 | ```
249 |
250 | #### Add GitHub Templates
251 | *.github/ISSUE_TEMPLATE/bug-report.md*
252 | ```
253 | ---
254 | name: Bug Report
255 | about: Report something that is broken or not working as intended
256 | title: ''
257 | labels: 'Type: Bug'
258 | assignees: ''
259 | ---
260 |
261 | #### Expected Behaviour
262 |
263 | #### Actual Behaviour
264 |
265 | #### Steps to Reproduce
266 | -
267 |
268 | ```
269 | *.github/ISSUE_TEMPLATE/feature-request.md*
270 | ```
271 | ---
272 | name: Feature Request
273 | about: Suggest an idea for a new feature or enhancement to existing features
274 | title: ''
275 | labels: 'Type: Feature'
276 | assignees: ''
277 | ---
278 |
279 | #### Describe Problem
280 |
281 | #### Suggest Solution
282 |
283 | #### Additional Details
284 |
285 | ```
286 | *.github/ISSUE_TEMPLATE/code-maintenance.md*
287 | ```
288 | ---
289 | name: Code Maintenance
290 | about: Project cleanup, improve documentation, refactor code
291 | title: ''
292 | labels: 'Type: Maintenance'
293 | assignees: ''
294 | ---
295 |
296 | #### Describe Problem
297 |
298 | #### Suggest Changes
299 |
300 | #### Provide Examples
301 |
302 | ```
303 |
304 | #### Generate DB Diagram
305 | ```
306 | brew install graphviz
307 | bundle exec rails g erd:install
308 | ```
309 |
310 | #### Overwrite Rails Templates
311 | ```
312 | mkdir -p lib/templates/rails/scaffold_controller && cp $(bundle show jbuilder)/lib/generators/rails/templates/* lib/templates/rails/scaffold_controller
313 | mkdir -p lib/rails/generators/erb/scaffold && cp $(bundle show railties)/lib/rails/generators/erb/scaffold/scaffold_generator.rb lib/rails/generators/erb/scaffold/
314 | ```
315 |
316 | - `lib/templates/erb/scaffold/index.html.erb.tt`
317 | ```
318 |
319 | <%= plural_table_name.capitalize %>
320 |
321 |
322 | <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
323 |
324 |
325 |
<%%= link_to <%= singular_table_name %>.to_s, <%= model_resource_name %> %>
326 |
<%%= <%= singular_table_name %>.created_at %>
327 |
328 |
329 | <%% end %>
330 |
331 | ```
332 |
333 | - `lib/templates/erb/scaffold/show.html.erb.tt`
334 | ```
335 |
336 | <%%= link_to "<%= plural_table_name.capitalize %>", <%= index_helper %>_path %>
337 | <%%= @<%= singular_table_name %>.id %>
338 |
339 |
349 | ```
350 |
351 | - `lib/templates/erb/scaffold/new.html.erb.tt`
352 | ```
353 |
354 | <%%= link_to "<%= plural_table_name.capitalize %>", <%= index_helper %>_path %>
355 | Add
356 |
357 |
358 | <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
359 | ```
360 |
361 | - `lib/templates/erb/scaffold/edit.html.erb.tt`
362 | ```
363 |
364 | <%%= link_to "<%= plural_table_name.capitalize %>", <%= index_helper %>_path %>
365 | <%%= link_to @<%= singular_table_name %>.id, @<%= singular_table_name %> %>
366 | Edit
367 |
368 |
369 | <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
370 | ```
371 |
372 | - `lib/templates/erb/scaffold/_form.html.erb.tt`
373 | ```
374 | <%% if <%= singular_table_name %>.errors.any? %>
375 | <%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
376 |
377 | <%%= message %>
378 |
379 | <%% end %>
380 | <%% end %>
381 | <%%= form_with(model: <%= model_resource_name %>, local: true) do |form| -%>
382 |
383 |
384 | <% attributes.reject{|a| a.name == 'type' || a.name == 'deleted_at' || a.name.end_with?("_count")}.each do |attribute| -%>
385 |
386 |
387 | <% if attribute.password_digest? -%>
388 | <%%= form.label :password, class: "font-weight-bold" %>
389 | <%%= form.password_field :password, placeholder: "Enter password", class: "form-control" %>
390 | <%%= form.label :password_confirmation, class: "font-weight-bold" %>
391 | <%%= form.password_field :password_confirmation, placeholder: "Enter password confirmation", class: "form-control" %>
392 | <% else -%>
393 | <%%= form.label :<%= attribute.column_name %>, class: "font-weight-bold" %>
394 | <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, placeholder: "Enter <%= attribute.column_name %>", class: "form-control" %>
395 | <% end -%>
396 |
397 |
398 | <% end -%>
399 |
400 |
406 |
407 | <%% end %>
408 | ```
409 |
410 | #### Generate Landing Pages
411 | ```
412 | rails generate controller Pages index --no-javascripts --no-stylesheets --no-helper --no-assets --no-fixture
413 | ```
414 |
415 | #### Generate Scaffold Models
416 | ```
417 | rails generate devise User type:string name:string initials:string deleted_at:datetime --force --no-javascripts --no-stylesheets --no-helper --no-assets
418 |
419 | rails generate scaffold Step type:string name:string description:text ordinal:integer deleted_at:datetime --force --no-javascripts --no-stylesheets --no-helper --no-assets
420 | ```
421 |
422 | #### Reset Database
423 | ```
424 | rake db:drop
425 | rake db:create
426 | rake db:migrate
427 | rake db:reset
428 | ```
429 |
430 | #### Generate DB Diagram
431 | ```
432 | bundle exec erd
433 | ```
434 |
435 | #### Run Code Audits
436 | ```
437 | rubocop
438 | brakeman
439 | rails-audit
440 | ```
441 |
442 | #### Generate Model Annotations
443 | ```
444 | annotate --models
445 | annotate --routes
446 | ```
447 |
448 | #### Update Yarn Packages
449 | ```
450 | rm -rf node_modules
451 | rm -f yarn.lock
452 | yarn install
453 | ```
454 |
455 | #### Create Pull Request
456 | ```
457 | ISSUE_NAME="123 Fixed A Bug"
458 | BRANCH_NAME=$(echo $ISSUE_NAME | tr '[:upper:]' '[:lower:]' | tr '/' '-' | tr ' ' '-')
459 | git checkout -b $BRANCH_NAME
460 | git add .
461 | git add -u
462 | git commit -m "Fixed a bug for #123"
463 | git push -u origin $BRANCH_NAME
464 | ```
465 |
466 | #### Create Release Tag
467 | ```
468 | TAG_NAME=`date "+%Y-%m-%d_%H-%M-%S"`
469 | git tag -a $TAG_NAME -m $TAG_NAME
470 | git push origin --tags
471 | ```
472 |
473 | #### Create Vue Helpers
474 | ```
475 | rails g vue something --single
476 | rails g vue something --single --state
477 | vue g component_name --form
478 | vue g component_name --vuex
479 | rails vue:i18n
480 | rails vue:translate
481 | rails vue:store
482 | ```
483 |
484 | #### Run Local Environment
485 | ```
486 | foreman start -f Procfile.dev
487 | ```
488 |
489 | #### Edit Rails Credentials
490 | ```
491 | EDITOR="vim" bin/rails credentials:edit
492 | ```
493 |
494 |
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Use this hook to configure devise mailer, warden hooks and so forth.
4 | # Many of these configuration options can be set straight in your model.
5 | Devise.setup do |config|
6 | # The secret key used by Devise. Devise uses this key to generate
7 | # random tokens. Changing this key will render invalid all existing
8 | # confirmation, reset password and unlock tokens in the database.
9 | # Devise will use the `secret_key_base` as its `secret_key`
10 | # by default. You can change it below and use your own secret key.
11 | # config.secret_key = '7eeb88c53cc1b1fd6beca72090b7a8259029c4ed1e9b96b97dc63e4829905b8bd111e225cad3ce736b6242c17f63a6f061220dfc967185f4c6385ff8a5efef0e'
12 |
13 | # ==> Controller configuration
14 | # Configure the parent class to the devise controllers.
15 | # config.parent_controller = 'DeviseController'
16 |
17 | # ==> Mailer Configuration
18 | # Configure the e-mail address which will be shown in Devise::Mailer,
19 | # note that it will be overwritten if you use your own mailer class
20 | # with default "from" parameter.
21 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
22 |
23 | # Configure the class responsible to send e-mails.
24 | # config.mailer = 'Devise::Mailer'
25 |
26 | # Configure the parent class responsible to send e-mails.
27 | # config.parent_mailer = 'ActionMailer::Base'
28 |
29 | # ==> ORM configuration
30 | # Load and configure the ORM. Supports :active_record (default) and
31 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
32 | # available as additional gems.
33 | require 'devise/orm/active_record'
34 |
35 | # ==> Configuration for any authentication mechanism
36 | # Configure which keys are used when authenticating a user. The default is
37 | # just :email. You can configure it to use [:username, :subdomain], so for
38 | # authenticating a user, both parameters are required. Remember that those
39 | # parameters are used only when authenticating and not when retrieving from
40 | # session. If you need permissions, you should implement that in a before filter.
41 | # You can also supply a hash where the value is a boolean determining whether
42 | # or not authentication should be aborted when the value is not present.
43 | # config.authentication_keys = [:email]
44 |
45 | # Configure parameters from the request object used for authentication. Each entry
46 | # given should be a request method and it will automatically be passed to the
47 | # find_for_authentication method and considered in your model lookup. For instance,
48 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
49 | # The same considerations mentioned for authentication_keys also apply to request_keys.
50 | # config.request_keys = []
51 |
52 | # Configure which authentication keys should be case-insensitive.
53 | # These keys will be downcased upon creating or modifying a user and when used
54 | # to authenticate or find a user. Default is :email.
55 | config.case_insensitive_keys = [:email]
56 |
57 | # Configure which authentication keys should have whitespace stripped.
58 | # These keys will have whitespace before and after removed upon creating or
59 | # modifying a user and when used to authenticate or find a user. Default is :email.
60 | config.strip_whitespace_keys = [:email]
61 |
62 | # Tell if authentication through request.params is enabled. True by default.
63 | # It can be set to an array that will enable params authentication only for the
64 | # given strategies, for example, `config.params_authenticatable = [:database]` will
65 | # enable it only for database (email + password) authentication.
66 | # config.params_authenticatable = true
67 |
68 | # Tell if authentication through HTTP Auth is enabled. False by default.
69 | # It can be set to an array that will enable http authentication only for the
70 | # given strategies, for example, `config.http_authenticatable = [:database]` will
71 | # enable it only for database authentication. The supported strategies are:
72 | # :database = Support basic authentication with authentication key + password
73 | # config.http_authenticatable = false
74 |
75 | # If 401 status code should be returned for AJAX requests. True by default.
76 | # config.http_authenticatable_on_xhr = true
77 |
78 | # The realm used in Http Basic Authentication. 'Application' by default.
79 | # config.http_authentication_realm = 'Application'
80 |
81 | # It will change confirmation, password recovery and other workflows
82 | # to behave the same regardless if the e-mail provided was right or wrong.
83 | # Does not affect registerable.
84 | # config.paranoid = true
85 |
86 | # By default Devise will store the user in session. You can skip storage for
87 | # particular strategies by setting this option.
88 | # Notice that if you are skipping storage for all authentication paths, you
89 | # may want to disable generating routes to Devise's sessions controller by
90 | # passing skip: :sessions to `devise_for` in your config/routes.rb
91 | config.skip_session_storage = [:http_auth]
92 |
93 | # By default, Devise cleans up the CSRF token on authentication to
94 | # avoid CSRF token fixation attacks. This means that, when using AJAX
95 | # requests for sign in and sign up, you need to get a new CSRF token
96 | # from the server. You can disable this option at your own risk.
97 | # config.clean_up_csrf_token_on_authentication = true
98 |
99 | # When false, Devise will not attempt to reload routes on eager load.
100 | # This can reduce the time taken to boot the app but if your application
101 | # requires the Devise mappings to be loaded during boot time the application
102 | # won't boot properly.
103 | # config.reload_routes = true
104 |
105 | # ==> Configuration for :database_authenticatable
106 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
107 | # using other algorithms, it sets how many times you want the password to be hashed.
108 | #
109 | # Limiting the stretches to just one in testing will increase the performance of
110 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
111 | # a value less than 10 in other environments. Note that, for bcrypt (the default
112 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
113 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114 | config.stretches = Rails.env.test? ? 1 : 11
115 |
116 | # Set up a pepper to generate the hashed password.
117 | # config.pepper = '7067a6ef50231d8862b8047e4198c9be985085c79600690d99eaa5874f91384f7f1cf64f1e3c3a8507c27607ee8593cb85f24b2014b1fc3d646b0e2a2807082e'
118 |
119 | # Send a notification to the original email when the user's email is changed.
120 | # config.send_email_changed_notification = false
121 |
122 | # Send a notification email when the user's password is changed.
123 | # config.send_password_change_notification = false
124 |
125 | # ==> Configuration for :confirmable
126 | # A period that the user is allowed to access the website even without
127 | # confirming their account. For instance, if set to 2.days, the user will be
128 | # able to access the website for two days without confirming their account,
129 | # access will be blocked just in the third day.
130 | # You can also set it to nil, which will allow the user to access the website
131 | # without confirming their account.
132 | # Default is 0.days, meaning the user cannot access the website without
133 | # confirming their account.
134 | # config.allow_unconfirmed_access_for = 2.days
135 |
136 | # A period that the user is allowed to confirm their account before their
137 | # token becomes invalid. For example, if set to 3.days, the user can confirm
138 | # their account within 3 days after the mail was sent, but on the fourth day
139 | # their account can't be confirmed with the token any more.
140 | # Default is nil, meaning there is no restriction on how long a user can take
141 | # before confirming their account.
142 | # config.confirm_within = 3.days
143 |
144 | # If true, requires any email changes to be confirmed (exactly the same way as
145 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
146 | # db field (see migrations). Until confirmed, new email is stored in
147 | # unconfirmed_email column, and copied to email column on successful confirmation.
148 | config.reconfirmable = true
149 |
150 | # Defines which key will be used when confirming an account
151 | # config.confirmation_keys = [:email]
152 |
153 | # ==> Configuration for :rememberable
154 | # The time the user will be remembered without asking for credentials again.
155 | # config.remember_for = 2.weeks
156 |
157 | # Invalidates all the remember me tokens when the user signs out.
158 | config.expire_all_remember_me_on_sign_out = true
159 |
160 | # If true, extends the user's remember period when remembered via cookie.
161 | # config.extend_remember_period = false
162 |
163 | # Options to be passed to the created cookie. For instance, you can set
164 | # secure: true in order to force SSL only cookies.
165 | # config.rememberable_options = {}
166 |
167 | # ==> Configuration for :validatable
168 | # Range for password length.
169 | config.password_length = 6..128
170 |
171 | # Email regex used to validate email formats. It simply asserts that
172 | # one (and only one) @ exists in the given string. This is mainly
173 | # to give user feedback and not to assert the e-mail validity.
174 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
175 |
176 | # ==> Configuration for :timeoutable
177 | # The time you want to timeout the user session without activity. After this
178 | # time the user will be asked for credentials again. Default is 30 minutes.
179 | # config.timeout_in = 30.minutes
180 |
181 | # ==> Configuration for :lockable
182 | # Defines which strategy will be used to lock an account.
183 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
184 | # :none = No lock strategy. You should handle locking by yourself.
185 | # config.lock_strategy = :failed_attempts
186 |
187 | # Defines which key will be used when locking and unlocking an account
188 | # config.unlock_keys = [:email]
189 |
190 | # Defines which strategy will be used to unlock an account.
191 | # :email = Sends an unlock link to the user email
192 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
193 | # :both = Enables both strategies
194 | # :none = No unlock strategy. You should handle unlocking by yourself.
195 | # config.unlock_strategy = :both
196 |
197 | # Number of authentication tries before locking an account if lock_strategy
198 | # is failed attempts.
199 | # config.maximum_attempts = 20
200 |
201 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
202 | # config.unlock_in = 1.hour
203 |
204 | # Warn on the last attempt before the account is locked.
205 | # config.last_attempt_warning = true
206 |
207 | # ==> Configuration for :recoverable
208 | #
209 | # Defines which key will be used when recovering the password for an account
210 | # config.reset_password_keys = [:email]
211 |
212 | # Time interval you can reset your password with a reset password key.
213 | # Don't put a too small interval or your users won't have the time to
214 | # change their passwords.
215 | config.reset_password_within = 6.hours
216 |
217 | # When set to false, does not sign a user in automatically after their password is
218 | # reset. Defaults to true, so a user is signed in automatically after a reset.
219 | # config.sign_in_after_reset_password = true
220 |
221 | # ==> Configuration for :encryptable
222 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
223 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
224 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
225 | # for default behavior) and :restful_authentication_sha1 (then you should set
226 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
227 | #
228 | # Require the `devise-encryptable` gem when using anything other than bcrypt
229 | # config.encryptor = :sha512
230 |
231 | # ==> Scopes configuration
232 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
233 | # "users/sessions/new". It's turned off by default because it's slower if you
234 | # are using only default views.
235 | # config.scoped_views = false
236 |
237 | # Configure the default scope given to Warden. By default it's the first
238 | # devise role declared in your routes (usually :user).
239 | # config.default_scope = :user
240 |
241 | # Set this configuration to false if you want /users/sign_out to sign out
242 | # only the current scope. By default, Devise signs out all scopes.
243 | # config.sign_out_all_scopes = true
244 |
245 | # ==> Navigation configuration
246 | # Lists the formats that should be treated as navigational. Formats like
247 | # :html, should redirect to the sign in page when the user does not have
248 | # access, but formats like :xml or :json, should return 401.
249 | #
250 | # If you have any extra navigational formats, like :iphone or :mobile, you
251 | # should add them to the navigational formats lists.
252 | #
253 | # The "*/*" below is required to match Internet Explorer requests.
254 | # config.navigational_formats = ['*/*', :html]
255 |
256 | # The default HTTP method used to sign out a resource. Default is :delete.
257 | config.sign_out_via = :delete
258 |
259 | # ==> OmniAuth
260 | # Add a new OmniAuth provider. Check the wiki for more information on setting
261 | # up on your models and hooks.
262 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
263 |
264 | # ==> Warden configuration
265 | # If you want to use other strategies, that are not supported by Devise, or
266 | # change the failure app, you can configure them inside the config.warden block.
267 | #
268 | # config.warden do |manager|
269 | # manager.intercept_401 = false
270 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
271 | # end
272 |
273 | # ==> Mountable engine configurations
274 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
275 | # is mountable, there are some extra configurations to be taken into account.
276 | # The following options are available, assuming the engine is mounted as:
277 | #
278 | # mount MyEngine, at: '/my_engine'
279 | #
280 | # The router that invoked `devise_for`, in the example above, would be:
281 | # config.router_name = :my_engine
282 | #
283 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
284 | # so you need to do it manually. For the users scope, it would be:
285 | # config.omniauth_path_prefix = '/my_engine/users/auth'
286 |
287 | # ==> Turbolinks configuration
288 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
289 | #
290 | # ActiveSupport.on_load(:devise_failure_app) do
291 | # include Turbolinks::Controller
292 | # end
293 |
294 | # ==> Configuration for :registerable
295 |
296 | # When set to false, does not sign a user in automatically after their password is
297 | # changed. Defaults to true, so a user is signed in automatically after changing a password.
298 | # config.sign_in_after_change_password = true
299 | end
300 |
--------------------------------------------------------------------------------