9 |
10 |
11 |
23 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Connection < ActionCable::Connection::Base
3 | identified_by :current_user
4 |
5 | def connect
6 | self.current_user = find_verified_user
7 | logger.add_tags "ActionCable", "User #{current_user.id}"
8 | end
9 |
10 | protected
11 |
12 | def find_verified_user
13 | if current_user = env['warden'].user
14 | current_user
15 | else
16 | reject_unauthorized_connection
17 | end
18 | end
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/test/fixtures/services.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | one:
4 | user: one
5 | provider: MyString
6 | uid: MyString
7 | access_token: MyString
8 | access_token_secret: MyString
9 | refresh_token: MyString
10 | expires_at: 2018-11-14 10:00:57
11 | auth: MyText
12 |
13 | two:
14 | user: two
15 | provider: MyString
16 | uid: MyString
17 | access_token: MyString
18 | access_token_secret: MyString
19 | refresh_token: MyString
20 | expires_at: 2018-11-14 10:00:57
21 | auth: MyText
22 |
--------------------------------------------------------------------------------
/app/javascript/packs/application.js:
--------------------------------------------------------------------------------
1 | /* eslint no-console:0 */
2 | // This file is automatically compiled by Webpack, along with any other files
3 | // present in this directory. You're encouraged to place your actual application logic in
4 | // a relevant structure within app/javascript and only use these pack files to reference
5 | // that code so it'll be compiled.
6 | //
7 | // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8 | // layout file, like app/views/layouts/application.html.erb
9 |
10 | console.log('Hello World from Webpacker')
11 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/config/schedule.rb:
--------------------------------------------------------------------------------
1 | # Use this file to easily define all of your cron jobs.
2 | #
3 | # It's helpful, but not entirely necessary to understand cron before proceeding.
4 | # http://en.wikipedia.org/wiki/Cron
5 |
6 | # Example:
7 | #
8 | # set :output, "/path/to/my/cron_log.log"
9 | #
10 | # every 2.hours do
11 | # command "/usr/bin/some_great_command"
12 | # runner "MyModel.some_method"
13 | # rake "some:great:rake:task"
14 | # end
15 | #
16 | # every 4.days do
17 | # runner "AnotherModel.prune_old_records"
18 | # end
19 |
20 | # Learn more: http://github.com/javan/whenever
21 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.scss:
--------------------------------------------------------------------------------
1 | // $navbar-default-bg: #312312;
2 | // $light-orange: #ff8c00;
3 | // $navbar-default-color: $light-orange;
4 |
5 | @import "font-awesome-sprockets";
6 | @import "font-awesome";
7 | @import "bootstrap";
8 | @import "sticky-footer";
9 | @import "announcements";
10 |
11 | // Fixes bootstrap nav-brand container overlap
12 | @include media-breakpoint-down(xs) {
13 | .container {
14 | margin-left: 0;
15 | margin-right: 0;
16 | }
17 | }
18 |
19 | // Masquerade alert shouldn't have a bottom margin
20 | body > .alert {
21 | margin-bottom: 0;
22 | }
23 |
--------------------------------------------------------------------------------
/app/helpers/announcements_helper.rb:
--------------------------------------------------------------------------------
1 | module AnnouncementsHelper
2 | def unread_announcements(user)
3 | last_announcement = Announcement.order(published_at: :desc).first
4 | return if last_announcement.nil?
5 |
6 | # Highlight announcements for anyone not logged in, cuz tempting
7 | if user.nil? || user.announcements_last_read_at.nil? || user.announcements_last_read_at < last_announcement.published_at
8 | "unread-announcements"
9 | end
10 | end
11 |
12 | def announcement_class(type)
13 | {
14 | "new" => "text-success",
15 | "update" => "text-warning",
16 | "fix" => "text-danger",
17 | }.fetch(type, "text-success")
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/app/controllers/admin/users_controller.rb:
--------------------------------------------------------------------------------
1 | module Admin
2 | class UsersController < Admin::ApplicationController
3 | # To customize the behavior of this controller,
4 | # you can overwrite any of the RESTful actions. For example:
5 | #
6 | # def index
7 | # super
8 | # @resources = User.
9 | # page(params[:page]).
10 | # per(10)
11 | # end
12 |
13 | # Define a custom finder by overriding the `find_resource` method:
14 | # def find_resource(param)
15 | # User.find_by!(slug: param)
16 | # end
17 |
18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
19 | # for more information
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/app/views/discussions/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= link_to discussions_path, class: 'btn btn-default' do %>
3 |
4 | All Discussions
5 | <% end %>
6 | <%= link_to edit_discussion_path(@discussion), class: 'btn btn-primary' do %>
7 |
8 | Edit
9 | <% end %>
10 |
Show discussion
11 |
12 |
13 |
14 |
Url:
15 |
<%= @discussion.url %>
16 |
17 |
Title:
18 |
<%= @discussion.title %>
19 |
20 |
Comments count:
21 |
<%= @discussion.comments_count %>
22 |
23 |
24 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 | # Add Yarn node_modules folder to the asset load path.
9 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 |
11 | # Precompile additional assets.
12 | # application.js, application.css, and all non-JS/CSS in the app/assets
13 | # folder are already added.
14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15 |
--------------------------------------------------------------------------------
/app/controllers/admin/services_controller.rb:
--------------------------------------------------------------------------------
1 | module Admin
2 | class ServicesController < Admin::ApplicationController
3 | # To customize the behavior of this controller,
4 | # you can overwrite any of the RESTful actions. For example:
5 | #
6 | # def index
7 | # super
8 | # @resources = Service.
9 | # page(params[:page]).
10 | # per(10)
11 | # end
12 |
13 | # Define a custom finder by overriding the `find_resource` method:
14 | # def find_resource(param)
15 | # Service.find_by!(slug: param)
16 | # end
17 |
18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
19 | # for more information
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/app/controllers/admin/announcements_controller.rb:
--------------------------------------------------------------------------------
1 | module Admin
2 | class AnnouncementsController < Admin::ApplicationController
3 | # To customize the behavior of this controller,
4 | # you can overwrite any of the RESTful actions. For example:
5 | #
6 | # def index
7 | # super
8 | # @resources = Announcement.
9 | # page(params[:page]).
10 | # per(10)
11 | # end
12 |
13 | # Define a custom finder by overriding the `find_resource` method:
14 | # def find_resource(param)
15 | # Announcement.find_by!(slug: param)
16 | # end
17 |
18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
19 | # for more information
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/app/controllers/admin/notifications_controller.rb:
--------------------------------------------------------------------------------
1 | module Admin
2 | class NotificationsController < Admin::ApplicationController
3 | # To customize the behavior of this controller,
4 | # you can overwrite any of the RESTful actions. For example:
5 | #
6 | # def index
7 | # super
8 | # @resources = Notification.
9 | # page(params[:page]).
10 | # per(10)
11 | # end
12 |
13 | # Define a custom finder by overriding the `find_resource` method:
14 | # def find_resource(param)
15 | # Notification.find_by!(slug: param)
16 | # end
17 |
18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
19 | # for more information
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/app/models/discussion.rb:
--------------------------------------------------------------------------------
1 | class Discussion < ApplicationRecord
2 | belongs_to :site
3 | has_many :comments, dependent: :destroy
4 |
5 | # http://example.com
6 | # https://example.com
7 | # http://example.com/asdf
8 | # https://example.com/asdf
9 | # http://example.com/asdf/
10 | # https://example.com/asdf/
11 | # http://example.com/asdf?foo=1
12 | # http://example.com/asdf/?foo=1
13 | # http://example.com/asdf#anchor
14 | # http://example.com/asdf/#anchor
15 | # http://example.com/asdf?foo=1#anchor
16 | # http://example.com/asdf/?foo=1#anchor
17 | # https://example.com/asdf/?foo=1#anchor
18 | def self.by_url(url)
19 | uri = URI.parse(url)
20 | where(url: uri.path).first_or_create
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/views/sites/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= link_to sites_path, class: 'btn btn-default' do %>
3 |
4 | All Sites
5 | <% end %>
6 | <%= link_to edit_site_path(@site), class: 'btn btn-primary' do %>
7 |
8 | Edit
9 | <% end %>
10 |
36 |
--------------------------------------------------------------------------------
/app/controllers/admin/application_controller.rb:
--------------------------------------------------------------------------------
1 | # All Administrate controllers inherit from this `Admin::ApplicationController`,
2 | # making it the ideal place to put authentication logic or other
3 | # before_actions.
4 | #
5 | # If you want to add pagination or other controller-level concerns,
6 | # you're free to overwrite the RESTful controller actions.
7 | module Admin
8 | class ApplicationController < Administrate::ApplicationController
9 | before_action :authenticate_admin
10 |
11 | def authenticate_admin
12 | redirect_to '/', alert: 'Not authorized.' unless user_signed_in? && current_user.admin?
13 | end
14 |
15 | # Override this value to specify the number of elements to display at a time
16 | # on index pages. Defaults to 20.
17 | # def records_per_page
18 | # params[:per_page] || 20
19 | # end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/app/views/comments/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= link_to comments_path, class: 'btn btn-default' do %>
3 |
4 | All Comments
5 | <% end %>
6 | <%= link_to edit_comment_path(@comment), class: 'btn btn-primary' do %>
7 |
8 | Edit
9 | <% end %>
10 |
<%= link_to "Deactivate my account", registration_path(resource_name), data: { confirm: "Are you sure? You cannot undo this." }, method: :delete %>
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/javascript/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | import { getField, updateField } from 'vuex-map-fields'
5 |
6 | Vue.use(Vuex)
7 |
8 | const store = new Vuex.Store({
9 | state: {
10 | discussion: {
11 | comments: [],
12 | },
13 | loading: true,
14 | name: '',
15 | email: '',
16 | body: '',
17 | errors: [],
18 | },
19 |
20 | getters: {
21 | getField,
22 | },
23 |
24 | mutations: {
25 | updateField,
26 |
27 | load(state, discussion) {
28 | state.discussion = discussion
29 | state.loading = false
30 | },
31 |
32 | addComment(state, comment) {
33 | state.discussion.comments.push(comment)
34 | },
35 |
36 | setErrors(state, errors) {
37 | state.errors = errors
38 | },
39 |
40 | clearComment(state) {
41 | state.name = ''
42 | state.email = ''
43 | state.body = ''
44 | }
45 |
46 | },
47 |
48 | actions: {
49 | async loadComments({ commit }) {
50 | let url = window.location.href
51 |
52 | fetch(`http://localhost:3000/api/v1/discussions/${encodeURIComponent(url)}`, {
53 | headers: { accept: 'application/json' }
54 | })
55 | .then(response => response.json())
56 | .then(data => commit('load', data))
57 | },
58 |
59 | async createComment({ commit }, formData) {
60 | let url = window.location.href
61 |
62 | fetch(`http://localhost:3000/api/v1/discussions/${encodeURIComponent(url)}/comments`, {
63 | headers: { accept: 'application/json' },
64 | method: 'post',
65 | body: formData,
66 | })
67 | .then(response => response.json())
68 | .then(comment => {
69 | if (comment.errors) {
70 | commit('setErrors', comment.errors)
71 | } else {
72 | commit('setErrors', [])
73 | commit('clearComment')
74 | commit('addComment', comment)
75 | }
76 | })
77 | }
78 | }
79 | })
80 |
81 | window.store = store
82 | export default store
83 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 |
31 | # Store uploaded files on the local file system in a temporary directory
32 | config.active_storage.service = :test
33 |
34 | config.action_mailer.perform_caching = false
35 |
36 | # Tell Action Mailer not to deliver emails to the real world.
37 | # The :test delivery method accumulates sent emails in the
38 | # ActionMailer::Base.deliveries array.
39 | config.action_mailer.delivery_method = :test
40 |
41 | # Print deprecation notices to the stderr.
42 | config.active_support.deprecation = :stderr
43 |
44 | # Raises error for missing translations
45 | # config.action_view.raise_on_missing_translations = true
46 | end
47 |
--------------------------------------------------------------------------------
/app/dashboards/service_dashboard.rb:
--------------------------------------------------------------------------------
1 | require "administrate/base_dashboard"
2 |
3 | class ServiceDashboard < Administrate::BaseDashboard
4 | # ATTRIBUTE_TYPES
5 | # a hash that describes the type of each of the model's fields.
6 | #
7 | # Each different type represents an Administrate::Field object,
8 | # which determines how the attribute is displayed
9 | # on pages throughout the dashboard.
10 | ATTRIBUTE_TYPES = {
11 | user: Field::BelongsTo,
12 | id: Field::Number,
13 | provider: Field::String,
14 | uid: Field::String,
15 | access_token: Field::String,
16 | access_token_secret: Field::String,
17 | refresh_token: Field::String,
18 | expires_at: Field::DateTime,
19 | auth: Field::Text,
20 | created_at: Field::DateTime,
21 | updated_at: Field::DateTime,
22 | }.freeze
23 |
24 | # COLLECTION_ATTRIBUTES
25 | # an array of attributes that will be displayed on the model's index page.
26 | #
27 | # By default, it's limited to four items to reduce clutter on index pages.
28 | # Feel free to add, remove, or rearrange items.
29 | COLLECTION_ATTRIBUTES = [
30 | :user,
31 | :id,
32 | :provider,
33 | :uid,
34 | ].freeze
35 |
36 | # SHOW_PAGE_ATTRIBUTES
37 | # an array of attributes that will be displayed on the model's show page.
38 | SHOW_PAGE_ATTRIBUTES = [
39 | :user,
40 | :id,
41 | :provider,
42 | :uid,
43 | :access_token,
44 | :access_token_secret,
45 | :refresh_token,
46 | :expires_at,
47 | :auth,
48 | :created_at,
49 | :updated_at,
50 | ].freeze
51 |
52 | # FORM_ATTRIBUTES
53 | # an array of attributes that will be displayed
54 | # on the model's form (`new` and `edit`) pages.
55 | FORM_ATTRIBUTES = [
56 | :user,
57 | :provider,
58 | :uid,
59 | :access_token,
60 | :access_token_secret,
61 | :refresh_token,
62 | :expires_at,
63 | :auth,
64 | ].freeze
65 |
66 | # Overwrite this method to customize how services are displayed
67 | # across all pages of the admin dashboard.
68 | #
69 | # def display_resource(service)
70 | # "Service ##{service.id}"
71 | # end
72 | end
73 |
--------------------------------------------------------------------------------
/app/controllers/sites_controller.rb:
--------------------------------------------------------------------------------
1 | class SitesController < ApplicationController
2 | before_action :set_site, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /sites
5 | # GET /sites.json
6 | def index
7 | @sites = Site.all
8 | end
9 |
10 | # GET /sites/1
11 | # GET /sites/1.json
12 | def show
13 | end
14 |
15 | # GET /sites/new
16 | def new
17 | @site = Site.new
18 | end
19 |
20 | # GET /sites/1/edit
21 | def edit
22 | end
23 |
24 | # POST /sites
25 | # POST /sites.json
26 | def create
27 | @site = current_user.sites.new(site_params)
28 |
29 | respond_to do |format|
30 | if @site.save
31 | format.html { redirect_to @site, notice: 'Site was successfully created.' }
32 | format.json { render :show, status: :created, location: @site }
33 | else
34 | format.html { render :new }
35 | format.json { render json: @site.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /sites/1
41 | # PATCH/PUT /sites/1.json
42 | def update
43 | respond_to do |format|
44 | if @site.update(site_params)
45 | format.html { redirect_to @site, notice: 'Site was successfully updated.' }
46 | format.json { render :show, status: :ok, location: @site }
47 | else
48 | format.html { render :edit }
49 | format.json { render json: @site.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /sites/1
55 | # DELETE /sites/1.json
56 | def destroy
57 | @site.destroy
58 | respond_to do |format|
59 | format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_site
67 | @site = current_user.sites.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def site_params
72 | params.require(:site).permit(:user_id, :domain)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/dashboards/notification_dashboard.rb:
--------------------------------------------------------------------------------
1 | require "administrate/base_dashboard"
2 |
3 | class NotificationDashboard < Administrate::BaseDashboard
4 | # ATTRIBUTE_TYPES
5 | # a hash that describes the type of each of the model's fields.
6 | #
7 | # Each different type represents an Administrate::Field object,
8 | # which determines how the attribute is displayed
9 | # on pages throughout the dashboard.
10 | ATTRIBUTE_TYPES = {
11 | recipient: Field::BelongsTo.with_options(class_name: "User"),
12 | actor: Field::BelongsTo.with_options(class_name: "User"),
13 | notifiable: Field::Polymorphic,
14 | id: Field::Number,
15 | recipient_id: Field::Number,
16 | actor_id: Field::Number,
17 | read_at: Field::DateTime,
18 | action: Field::String,
19 | created_at: Field::DateTime,
20 | updated_at: Field::DateTime,
21 | }.freeze
22 |
23 | # COLLECTION_ATTRIBUTES
24 | # an array of attributes that will be displayed on the model's index page.
25 | #
26 | # By default, it's limited to four items to reduce clutter on index pages.
27 | # Feel free to add, remove, or rearrange items.
28 | COLLECTION_ATTRIBUTES = [
29 | :recipient,
30 | :actor,
31 | :notifiable,
32 | :id,
33 | ].freeze
34 |
35 | # SHOW_PAGE_ATTRIBUTES
36 | # an array of attributes that will be displayed on the model's show page.
37 | SHOW_PAGE_ATTRIBUTES = [
38 | :recipient,
39 | :actor,
40 | :notifiable,
41 | :id,
42 | :recipient_id,
43 | :actor_id,
44 | :read_at,
45 | :action,
46 | :created_at,
47 | :updated_at,
48 | ].freeze
49 |
50 | # FORM_ATTRIBUTES
51 | # an array of attributes that will be displayed
52 | # on the model's form (`new` and `edit`) pages.
53 | FORM_ATTRIBUTES = [
54 | :recipient,
55 | :actor,
56 | :notifiable,
57 | :recipient_id,
58 | :actor_id,
59 | :read_at,
60 | :action,
61 | ].freeze
62 |
63 | # Overwrite this method to customize how notifications are displayed
64 | # across all pages of the admin dashboard.
65 | #
66 | # def display_resource(notification)
67 | # "Notification ##{notification.id}"
68 | # end
69 | end
70 |
--------------------------------------------------------------------------------
/app/controllers/comments_controller.rb:
--------------------------------------------------------------------------------
1 | class CommentsController < ApplicationController
2 | before_action :set_comment, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /comments
5 | # GET /comments.json
6 | def index
7 | @comments = Comment.all
8 | end
9 |
10 | # GET /comments/1
11 | # GET /comments/1.json
12 | def show
13 | end
14 |
15 | # GET /comments/new
16 | def new
17 | @comment = Comment.new
18 | end
19 |
20 | # GET /comments/1/edit
21 | def edit
22 | end
23 |
24 | # POST /comments
25 | # POST /comments.json
26 | def create
27 | @comment = Comment.new(comment_params)
28 |
29 | respond_to do |format|
30 | if @comment.save
31 | format.html { redirect_to @comment, notice: 'Comment was successfully created.' }
32 | format.json { render :show, status: :created, location: @comment }
33 | else
34 | format.html { render :new }
35 | format.json { render json: @comment.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /comments/1
41 | # PATCH/PUT /comments/1.json
42 | def update
43 | respond_to do |format|
44 | if @comment.update(comment_params)
45 | format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }
46 | format.json { render :show, status: :ok, location: @comment }
47 | else
48 | format.html { render :edit }
49 | format.json { render json: @comment.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /comments/1
55 | # DELETE /comments/1.json
56 | def destroy
57 | @comment.destroy
58 | respond_to do |format|
59 | format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_comment
67 | @comment = Comment.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def comment_params
72 | params.require(:comment).permit(:discussion_id, :name, :email, :body, :ip_address, :user_agent)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/controllers/discussions_controller.rb:
--------------------------------------------------------------------------------
1 | class DiscussionsController < ApplicationController
2 | before_action :set_discussion, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /discussions
5 | # GET /discussions.json
6 | def index
7 | @discussions = Discussion.all
8 | end
9 |
10 | # GET /discussions/1
11 | # GET /discussions/1.json
12 | def show
13 | end
14 |
15 | # GET /discussions/new
16 | def new
17 | @discussion = Discussion.new
18 | end
19 |
20 | # GET /discussions/1/edit
21 | def edit
22 | end
23 |
24 | # POST /discussions
25 | # POST /discussions.json
26 | def create
27 | @discussion = Discussion.new(discussion_params)
28 |
29 | respond_to do |format|
30 | if @discussion.save
31 | format.html { redirect_to @discussion, notice: 'Discussion was successfully created.' }
32 | format.json { render :show, status: :created, location: @discussion }
33 | else
34 | format.html { render :new }
35 | format.json { render json: @discussion.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /discussions/1
41 | # PATCH/PUT /discussions/1.json
42 | def update
43 | respond_to do |format|
44 | if @discussion.update(discussion_params)
45 | format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }
46 | format.json { render :show, status: :ok, location: @discussion }
47 | else
48 | format.html { render :edit }
49 | format.json { render json: @discussion.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /discussions/1
55 | # DELETE /discussions/1.json
56 | def destroy
57 | @discussion.destroy
58 | respond_to do |format|
59 | format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_discussion
67 | @discussion = Discussion.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def discussion_params
72 | params.require(:discussion).permit(:url, :title, :comments_count)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/controllers/users/omniauth_callbacks_controller.rb:
--------------------------------------------------------------------------------
1 | module Users
2 | class OmniauthCallbacksController < Devise::OmniauthCallbacksController
3 | before_action :set_service
4 | before_action :set_user
5 |
6 | attr_reader :service, :user
7 |
8 | def facebook
9 | handle_auth "Facebook"
10 | end
11 |
12 | def twitter
13 | handle_auth "Twitter"
14 | end
15 |
16 | def github
17 | handle_auth "Github"
18 | end
19 |
20 | private
21 |
22 | def handle_auth(kind)
23 | if service.present?
24 | service.update(service_attrs)
25 | else
26 | user.services.create(service_attrs)
27 | end
28 |
29 | if user_signed_in?
30 | flash[:notice] = "Your #{kind} account was connected."
31 | redirect_to edit_user_registration_path
32 | else
33 | sign_in_and_redirect user, event: :authentication
34 | set_flash_message :notice, :success, kind: kind
35 | end
36 | end
37 |
38 | def auth
39 | request.env['omniauth.auth']
40 | end
41 |
42 | def set_service
43 | @service = Service.where(provider: auth.provider, uid: auth.uid).first
44 | end
45 |
46 | def set_user
47 | if user_signed_in?
48 | @user = current_user
49 | elsif service.present?
50 | @user = service.user
51 | elsif User.where(email: auth.info.email).any?
52 | # 5. User is logged out and they login to a new account which doesn't match their old one
53 | flash[:alert] = "An account with this email already exists. Please sign in with that account before connecting your #{auth.provider.titleize} account."
54 | redirect_to new_user_session_path
55 | else
56 | @user = create_user
57 | end
58 | end
59 |
60 | def service_attrs
61 | expires_at = auth.credentials.expires_at.present? ? Time.at(auth.credentials.expires_at) : nil
62 | {
63 | provider: auth.provider,
64 | uid: auth.uid,
65 | expires_at: expires_at,
66 | access_token: auth.credentials.token,
67 | access_token_secret: auth.credentials.secret,
68 | }
69 | end
70 |
71 | def create_user
72 | User.create(
73 | email: auth.info.email,
74 | #name: auth.info.name,
75 | password: Devise.friendly_token[0,20]
76 | )
77 | end
78 |
79 | end
80 | end
81 |
--------------------------------------------------------------------------------
/app/javascript/packs/embed.js:
--------------------------------------------------------------------------------
1 | /* eslint no-console: 0 */
2 | // Run this example by adding <%= javascript_pack_tag 'hello_vue' %> (and
3 | // <%= stylesheet_pack_tag 'hello_vue' %> if you have styles in your component)
4 | // to the head of your layout file,
5 | // like app/views/layouts/application.html.erb.
6 | // All it does is render
Hello Vue
at the bottom of the page.
7 |
8 | // for handling regeneratorRuntime error
9 | import "babel-polyfill"
10 |
11 | import Vue from 'vue'
12 | import App from '../app.vue'
13 | import Discussion from '../discussion.vue'
14 | Vue.component('Discussion', Discussion)
15 |
16 | import store from '../store'
17 |
18 | const event = (typeof Turbolinks == "object" && Turbolinks.supported) ? "turbolinks:load" : 'DOMContentLoaded'
19 |
20 | document.addEventListener(event, () => {
21 | const el = document.querySelector("#comments")
22 |
23 | store.dispatch('loadComments')
24 |
25 | const app = new Vue({
26 | el,
27 | store,
28 | render: h => h(App)
29 | })
30 |
31 | console.log(app)
32 | })
33 |
34 |
35 | // The above code uses Vue without the compiler, which means you cannot
36 | // use Vue to target elements in your existing html templates. You would
37 | // need to always use single file components.
38 | // To be able to target elements in your existing html/erb templates,
39 | // comment out the above code and uncomment the below
40 | // Add <%= javascript_pack_tag 'hello_vue' %> to your layout
41 | // Then add this markup to your html template:
42 | //
43 | //
44 | // {{message}}
45 | //
46 | //
47 |
48 |
49 | // import Vue from 'vue/dist/vue.esm'
50 | // import App from '../app.vue'
51 | //
52 | // document.addEventListener('DOMContentLoaded', () => {
53 | // const app = new Vue({
54 | // el: '#hello',
55 | // data: {
56 | // message: "Can you say hello?"
57 | // },
58 | // components: { App }
59 | // })
60 | // })
61 | //
62 | //
63 | //
64 | // If the using turbolinks, install 'vue-turbolinks':
65 | //
66 | // yarn add 'vue-turbolinks'
67 | //
68 | // Then uncomment the code block below:
69 | //
70 | // import TurbolinksAdapter from 'vue-turbolinks'
71 | // import Vue from 'vue/dist/vue.esm'
72 | // import App from '../app.vue'
73 | //
74 | // Vue.use(TurbolinksAdapter)
75 | //
76 | // document.addEventListener('turbolinks:load', () => {
77 | // const app = new Vue({
78 | // el: '#hello',
79 | // data: {
80 | // message: "Can you say hello?"
81 | // },
82 | // components: { App }
83 | // })
84 | // })
85 |
--------------------------------------------------------------------------------
/app/dashboards/user_dashboard.rb:
--------------------------------------------------------------------------------
1 | require "administrate/base_dashboard"
2 |
3 | class UserDashboard < Administrate::BaseDashboard
4 | # ATTRIBUTE_TYPES
5 | # a hash that describes the type of each of the model's fields.
6 | #
7 | # Each different type represents an Administrate::Field object,
8 | # which determines how the attribute is displayed
9 | # on pages throughout the dashboard.
10 | ATTRIBUTE_TYPES = {
11 | notifications: Field::HasMany,
12 | services: Field::HasMany,
13 | id: Field::Number,
14 | email: Field::String,
15 | password: Field::String.with_options(searchable: false),
16 | encrypted_password: Field::String,
17 | reset_password_token: Field::String,
18 | reset_password_sent_at: Field::DateTime,
19 | remember_created_at: Field::DateTime,
20 | first_name: Field::String,
21 | last_name: Field::String,
22 | announcements_last_read_at: Field::DateTime,
23 | admin: Field::Boolean,
24 | created_at: Field::DateTime,
25 | updated_at: Field::DateTime,
26 | }.freeze
27 |
28 | # COLLECTION_ATTRIBUTES
29 | # an array of attributes that will be displayed on the model's index page.
30 | #
31 | # By default, it's limited to four items to reduce clutter on index pages.
32 | # Feel free to add, remove, or rearrange items.
33 | COLLECTION_ATTRIBUTES = [
34 | :notifications,
35 | :services,
36 | :id,
37 | :email,
38 | ].freeze
39 |
40 | # SHOW_PAGE_ATTRIBUTES
41 | # an array of attributes that will be displayed on the model's show page.
42 | SHOW_PAGE_ATTRIBUTES = [
43 | :notifications,
44 | :services,
45 | :id,
46 | :email,
47 | :encrypted_password,
48 | :reset_password_token,
49 | :reset_password_sent_at,
50 | :remember_created_at,
51 | :first_name,
52 | :last_name,
53 | :announcements_last_read_at,
54 | :admin,
55 | :created_at,
56 | :updated_at,
57 | ].freeze
58 |
59 | # FORM_ATTRIBUTES
60 | # an array of attributes that will be displayed
61 | # on the model's form (`new` and `edit`) pages.
62 | FORM_ATTRIBUTES = [
63 | :password,
64 | :notifications,
65 | :services,
66 | :email,
67 | :encrypted_password,
68 | :reset_password_token,
69 | :reset_password_sent_at,
70 | :remember_created_at,
71 | :first_name,
72 | :last_name,
73 | :announcements_last_read_at,
74 | :admin,
75 | ].freeze
76 |
77 | # Overwrite this method to customize how users are displayed
78 | # across all pages of the admin dashboard.
79 | #
80 | # def display_resource(user)
81 | # "User ##{user.id}"
82 | # end
83 | end
84 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | config.webpacker.check_yarn_integrity = true
4 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
5 | # Settings specified here will take precedence over those in config/application.rb.
6 |
7 | # In the development environment your application's code is reloaded on
8 | # every request. This slows down response time but is perfect for development
9 | # since you don't have to restart the web server when you make code changes.
10 | config.cache_classes = false
11 |
12 | # Do not eager load code on boot.
13 | config.eager_load = false
14 |
15 | # Show full error reports.
16 | config.consider_all_requests_local = true
17 |
18 | # Enable/disable caching. By default caching is disabled.
19 | # Run rails dev:cache to toggle caching.
20 | if Rails.root.join('tmp', 'caching-dev.txt').exist?
21 | config.action_controller.perform_caching = true
22 |
23 | config.cache_store = :memory_store
24 | config.public_file_server.headers = {
25 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
26 | }
27 | else
28 | config.action_controller.perform_caching = false
29 |
30 | config.cache_store = :null_store
31 | end
32 |
33 | # Store uploaded files on the local file system (see config/storage.yml for options)
34 | config.active_storage.service = :local
35 |
36 | # Don't care if the mailer can't send.
37 | config.action_mailer.raise_delivery_errors = false
38 |
39 | config.action_mailer.perform_caching = false
40 |
41 | # Print deprecation notices to the Rails logger.
42 | config.active_support.deprecation = :log
43 |
44 | # Raise an error on page load if there are pending migrations.
45 | config.active_record.migration_error = :page_load
46 |
47 | # Highlight code that triggered database queries in logs.
48 | config.active_record.verbose_query_logs = true
49 |
50 | # Debug mode disables concatenation and preprocessing of assets.
51 | # This option may cause significant delays in view rendering with a large
52 | # number of complex assets.
53 | config.assets.debug = true
54 |
55 | # Suppress logger output for asset requests.
56 | config.assets.quiet = true
57 |
58 | # Raises error for missing translations
59 | # config.action_view.raise_on_missing_translations = true
60 |
61 | # Use an evented file watcher to asynchronously detect changes in source code,
62 | # routes, locales, etc. This feature depends on the listen gem.
63 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
64 | end
65 |
--------------------------------------------------------------------------------
/app/javascript/discussion.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | You're logged in as <%= current_user.name %> (<%= current_user.email %>)
4 | <%= link_to back_masquerade_path(current_user) do %><%= icon("fas", "times") %> Logout <% end %>
5 |
6 | <% end %>
7 |
8 |
54 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3 |
4 | ruby '2.5.3'
5 |
6 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7 | gem 'rails', '~> 5.2.1'
8 | # Use sqlite3 as the database for Active Record
9 | gem 'sqlite3'
10 | # Use Puma as the app server
11 | gem 'puma', '~> 3.11'
12 | # Use SCSS for stylesheets
13 | gem 'sass-rails', '~> 5.0'
14 | # Use Uglifier as compressor for JavaScript assets
15 | gem 'uglifier', '>= 1.3.0'
16 | # See https://github.com/rails/execjs#readme for more supported runtimes
17 | # gem 'mini_racer', platforms: :ruby
18 |
19 | # Use CoffeeScript for .coffee assets and views
20 | gem 'coffee-rails', '~> 4.2'
21 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
22 | gem 'turbolinks', '~> 5'
23 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24 | gem 'jbuilder', '~> 2.5'
25 | # Use Redis adapter to run Action Cable in production
26 | # gem 'redis', '~> 4.0'
27 | # Use ActiveModel has_secure_password
28 | # gem 'bcrypt', '~> 3.1.7'
29 |
30 | # Use ActiveStorage variant
31 | # gem 'mini_magick', '~> 4.8'
32 |
33 | # Use Capistrano for deployment
34 | # gem 'capistrano-rails', group: :development
35 |
36 | # Reduces boot times through caching; required in config/boot.rb
37 | gem 'bootsnap', '>= 1.1.0', require: false
38 |
39 | group :development, :test do
40 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console
41 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
42 | end
43 |
44 | group :development do
45 | # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
46 | gem 'web-console', '>= 3.3.0'
47 | gem 'listen', '>= 3.0.5', '< 3.2'
48 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
49 | gem 'spring'
50 | gem 'spring-watcher-listen', '~> 2.0.0'
51 | end
52 |
53 | group :test do
54 | # Adds support for Capybara system testing and selenium driver
55 | gem 'capybara', '>= 2.15'
56 | gem 'selenium-webdriver'
57 | # Easy installation and use of chromedriver to run system tests with Chrome
58 | gem 'chromedriver-helper'
59 | end
60 |
61 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
62 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
63 |
64 | gem 'administrate', '~> 0.10.0'
65 | gem 'bootstrap', '~> 4.1', '>= 4.1.1'
66 | gem 'data-confirm-modal', '~> 1.6', '>= 1.6.2'
67 | gem 'devise', '~> 4.4', '>= 4.4.3'
68 | gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4'
69 | gem 'devise_masquerade', '~> 0.6.2'
70 | gem 'font-awesome-sass', '~> 5.0', '>= 5.0.13'
71 | gem 'foreman', '~> 0.84.0'
72 | gem 'friendly_id', '~> 5.2', '>= 5.2.4'
73 | gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'
74 | gem 'jquery-rails', '~> 4.3.1'
75 | gem 'local_time', '~> 2.0', '>= 2.0.1'
76 | gem 'mini_magick', '~> 4.8'
77 | gem 'name_of_person', '~> 1.0'
78 | gem 'omniauth-facebook', '~> 5.0'
79 | gem 'omniauth-github', '~> 1.3'
80 | gem 'omniauth-twitter', '~> 1.4'
81 | gem 'sidekiq', '~> 5.1', '>= 5.1.3'
82 | gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
83 | gem 'webpacker', '~> 3.5', '>= 3.5.3'
84 | gem 'whenever', require: false
85 |
86 |
87 | gem 'rack-cors', require: 'rack/cors'
88 |
89 |
--------------------------------------------------------------------------------
/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 confirm link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | sessions:
48 | signed_in: "Signed in successfully."
49 | signed_out: "Signed out successfully."
50 | already_signed_out: "Signed out successfully."
51 | unlocks:
52 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
53 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
54 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
55 | errors:
56 | messages:
57 | already_confirmed: "was already confirmed, please try signing in"
58 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
59 | expired: "has expired, please request a new one"
60 | not_found: "not found"
61 | not_locked: "was not locked"
62 | not_saved:
63 | one: "1 error prohibited this %{resource} from being saved:"
64 | other: "%{count} errors prohibited this %{resource} from being saved:"
65 |
--------------------------------------------------------------------------------
/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 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 2018_12_03_152013) do
14 |
15 | create_table "announcements", force: :cascade do |t|
16 | t.datetime "published_at"
17 | t.string "announcement_type"
18 | t.string "name"
19 | t.text "description"
20 | t.datetime "created_at", null: false
21 | t.datetime "updated_at", null: false
22 | end
23 |
24 | create_table "comments", force: :cascade do |t|
25 | t.integer "discussion_id"
26 | t.string "name"
27 | t.string "email"
28 | t.text "body"
29 | t.string "ip_address"
30 | t.string "user_agent"
31 | t.datetime "created_at", null: false
32 | t.datetime "updated_at", null: false
33 | t.index ["discussion_id"], name: "index_comments_on_discussion_id"
34 | end
35 |
36 | create_table "discussions", force: :cascade do |t|
37 | t.string "url"
38 | t.string "title"
39 | t.integer "comments_count"
40 | t.datetime "created_at", null: false
41 | t.datetime "updated_at", null: false
42 | t.integer "site_id"
43 | t.index ["site_id"], name: "index_discussions_on_site_id"
44 | end
45 |
46 | create_table "friendly_id_slugs", force: :cascade do |t|
47 | t.string "slug", null: false
48 | t.integer "sluggable_id", null: false
49 | t.string "sluggable_type", limit: 50
50 | t.string "scope"
51 | t.datetime "created_at"
52 | t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
53 | t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
54 | t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id"
55 | t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
56 | end
57 |
58 | create_table "notifications", force: :cascade do |t|
59 | t.integer "recipient_id"
60 | t.integer "actor_id"
61 | t.datetime "read_at"
62 | t.string "action"
63 | t.integer "notifiable_id"
64 | t.string "notifiable_type"
65 | t.datetime "created_at", null: false
66 | t.datetime "updated_at", null: false
67 | end
68 |
69 | create_table "services", force: :cascade do |t|
70 | t.integer "user_id"
71 | t.string "provider"
72 | t.string "uid"
73 | t.string "access_token"
74 | t.string "access_token_secret"
75 | t.string "refresh_token"
76 | t.datetime "expires_at"
77 | t.text "auth"
78 | t.datetime "created_at", null: false
79 | t.datetime "updated_at", null: false
80 | t.index ["user_id"], name: "index_services_on_user_id"
81 | end
82 |
83 | create_table "sites", force: :cascade do |t|
84 | t.integer "user_id"
85 | t.string "domain"
86 | t.datetime "created_at", null: false
87 | t.datetime "updated_at", null: false
88 | t.index ["user_id"], name: "index_sites_on_user_id"
89 | end
90 |
91 | create_table "users", force: :cascade do |t|
92 | t.string "email", default: "", null: false
93 | t.string "encrypted_password", default: "", null: false
94 | t.string "reset_password_token"
95 | t.datetime "reset_password_sent_at"
96 | t.datetime "remember_created_at"
97 | t.string "first_name"
98 | t.string "last_name"
99 | t.datetime "announcements_last_read_at"
100 | t.boolean "admin", default: false
101 | t.datetime "created_at", null: false
102 | t.datetime "updated_at", null: false
103 | t.index ["email"], name: "index_users_on_email", unique: true
104 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
105 | end
106 |
107 | end
108 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | config.webpacker.check_yarn_integrity = false
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # Code is not reloaded between requests.
7 | config.cache_classes = true
8 |
9 | # Eager load code on boot. This eager loads most of Rails and
10 | # your application in memory, allowing both threaded web servers
11 | # and those relying on copy on write to perform better.
12 | # Rake tasks automatically ignore this option for performance.
13 | config.eager_load = true
14 |
15 | # Full error reports are disabled and caching is turned on.
16 | config.consider_all_requests_local = false
17 | config.action_controller.perform_caching = true
18 |
19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21 | # config.require_master_key = true
22 |
23 | # Disable serving static files from the `/public` folder by default since
24 | # Apache or NGINX already handles this.
25 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26 |
27 | # Compress JavaScripts and CSS.
28 | config.assets.js_compressor = :uglifier
29 | # config.assets.css_compressor = :sass
30 |
31 | # Do not fallback to assets pipeline if a precompiled asset is missed.
32 | config.assets.compile = false
33 |
34 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
35 |
36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
37 | # config.action_controller.asset_host = 'http://assets.example.com'
38 |
39 | # Specifies the header that your server uses for sending files.
40 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
41 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
42 |
43 | # Store uploaded files on the local file system (see config/storage.yml for options)
44 | config.active_storage.service = :local
45 |
46 | # Mount Action Cable outside main process or domain
47 | # config.action_cable.mount_path = nil
48 | # config.action_cable.url = 'wss://example.com/cable'
49 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
50 |
51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52 | # config.force_ssl = true
53 |
54 | # Use the lowest log level to ensure availability of diagnostic information
55 | # when problems arise.
56 | config.log_level = :debug
57 |
58 | # Prepend all log lines with the following tags.
59 | config.log_tags = [ :request_id ]
60 |
61 | # Use a different cache store in production.
62 | # config.cache_store = :mem_cache_store
63 |
64 | # Use a real queuing backend for Active Job (and separate queues per environment)
65 | # config.active_job.queue_adapter = :resque
66 | # config.active_job.queue_name_prefix = "embeddable_comments_#{Rails.env}"
67 |
68 | config.action_mailer.perform_caching = false
69 |
70 | # Ignore bad email addresses and do not raise email delivery errors.
71 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72 | # config.action_mailer.raise_delivery_errors = false
73 |
74 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75 | # the I18n.default_locale when a translation cannot be found).
76 | config.i18n.fallbacks = true
77 |
78 | # Send deprecation notices to registered listeners.
79 | config.active_support.deprecation = :notify
80 |
81 | # Use default logging formatter so that PID and timestamp are not suppressed.
82 | config.log_formatter = ::Logger::Formatter.new
83 |
84 | # Use a different logger for distributed setups.
85 | # require 'syslog/logger'
86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
87 |
88 | if ENV["RAILS_LOG_TO_STDOUT"].present?
89 | logger = ActiveSupport::Logger.new(STDOUT)
90 | logger.formatter = config.log_formatter
91 | config.logger = ActiveSupport::TaggedLogging.new(logger)
92 | end
93 |
94 | # Do not dump schema after migrations.
95 | config.active_record.dump_schema_after_migration = false
96 | end
97 |
--------------------------------------------------------------------------------
/config/initializers/friendly_id.rb:
--------------------------------------------------------------------------------
1 | # FriendlyId Global Configuration
2 | #
3 | # Use this to set up shared configuration options for your entire application.
4 | # Any of the configuration options shown here can also be applied to single
5 | # models by passing arguments to the `friendly_id` class method or defining
6 | # methods in your model.
7 | #
8 | # To learn more, check out the guide:
9 | #
10 | # http://norman.github.io/friendly_id/file.Guide.html
11 |
12 | FriendlyId.defaults do |config|
13 | # ## Reserved Words
14 | #
15 | # Some words could conflict with Rails's routes when used as slugs, or are
16 | # undesirable to allow as slugs. Edit this list as needed for your app.
17 | config.use :reserved
18 |
19 | config.reserved_words = %w(new edit index session login logout users admin
20 | stylesheets assets javascripts images)
21 |
22 | # This adds an option to to treat reserved words as conflicts rather than exceptions.
23 | # When there is no good candidate, a UUID will be appended, matching the existing
24 | # conflict behavior.
25 |
26 | # config.treat_reserved_as_conflict = true
27 |
28 | # ## Friendly Finders
29 | #
30 | # Uncomment this to use friendly finders in all models. By default, if
31 | # you wish to find a record by its friendly id, you must do:
32 | #
33 | # MyModel.friendly.find('foo')
34 | #
35 | # If you uncomment this, you can do:
36 | #
37 | # MyModel.find('foo')
38 | #
39 | # This is significantly more convenient but may not be appropriate for
40 | # all applications, so you must explicity opt-in to this behavior. You can
41 | # always also configure it on a per-model basis if you prefer.
42 | #
43 | # Something else to consider is that using the :finders addon boosts
44 | # performance because it will avoid Rails-internal code that makes runtime
45 | # calls to `Module.extend`.
46 | #
47 | # config.use :finders
48 | #
49 | # ## Slugs
50 | #
51 | # Most applications will use the :slugged module everywhere. If you wish
52 | # to do so, uncomment the following line.
53 | #
54 | # config.use :slugged
55 | #
56 | # By default, FriendlyId's :slugged addon expects the slug column to be named
57 | # 'slug', but you can change it if you wish.
58 | #
59 | # config.slug_column = 'slug'
60 | #
61 | # By default, slug has no size limit, but you can change it if you wish.
62 | #
63 | # config.slug_limit = 255
64 | #
65 | # When FriendlyId can not generate a unique ID from your base method, it appends
66 | # a UUID, separated by a single dash. You can configure the character used as the
67 | # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
68 | # with two dashes.
69 | #
70 | # config.sequence_separator = '-'
71 | #
72 | # Note that you must use the :slugged addon **prior** to the line which
73 | # configures the sequence separator, or else FriendlyId will raise an undefined
74 | # method error.
75 | #
76 | # ## Tips and Tricks
77 | #
78 | # ### Controlling when slugs are generated
79 | #
80 | # As of FriendlyId 5.0, new slugs are generated only when the slug field is
81 | # nil, but if you're using a column as your base method can change this
82 | # behavior by overriding the `should_generate_new_friendly_id?` method that
83 | # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
84 | # more like 4.0.
85 | # Note: Use(include) Slugged module in the config if using the anonymous module.
86 | # If you have `friendly_id :name, use: slugged` in the model, Slugged module
87 | # is included after the anonymous module defined in the initializer, so it
88 | # overrides the `should_generate_new_friendly_id?` method from the anonymous module.
89 | #
90 | # config.use :slugged
91 | # config.use Module.new {
92 | # def should_generate_new_friendly_id?
93 | # slug.blank? || _changed?
94 | # end
95 | # }
96 | #
97 | # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
98 | # languages that don't use the Roman alphabet, that's not usually sufficient.
99 | # Here we use the Babosa library to transliterate Russian Cyrillic slugs to
100 | # ASCII. If you use this, don't forget to add "babosa" to your Gemfile.
101 | #
102 | # config.use Module.new {
103 | # def normalize_friendly_id(text)
104 | # text.to_slug.normalize! :transliterations => [:russian, :latin]
105 | # end
106 | # }
107 | end
108 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GIT
2 | remote: https://github.com/excid3/devise-bootstrapped.git
3 | revision: a963d93052ce0069d050e4615fb06e95dc30ac2b
4 | branch: bootstrap4
5 | specs:
6 | devise-bootstrapped (0.2.0)
7 |
8 | GIT
9 | remote: https://github.com/mdeering/gravatar_image_tag.git
10 | revision: c02351f7d6649e2346394e33164a7154e671ec19
11 | specs:
12 | gravatar_image_tag (1.2.0)
13 |
14 | GEM
15 | remote: https://rubygems.org/
16 | specs:
17 | actioncable (5.2.1)
18 | actionpack (= 5.2.1)
19 | nio4r (~> 2.0)
20 | websocket-driver (>= 0.6.1)
21 | actionmailer (5.2.1)
22 | actionpack (= 5.2.1)
23 | actionview (= 5.2.1)
24 | activejob (= 5.2.1)
25 | mail (~> 2.5, >= 2.5.4)
26 | rails-dom-testing (~> 2.0)
27 | actionpack (5.2.1)
28 | actionview (= 5.2.1)
29 | activesupport (= 5.2.1)
30 | rack (~> 2.0)
31 | rack-test (>= 0.6.3)
32 | rails-dom-testing (~> 2.0)
33 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
34 | actionview (5.2.1)
35 | activesupport (= 5.2.1)
36 | builder (~> 3.1)
37 | erubi (~> 1.4)
38 | rails-dom-testing (~> 2.0)
39 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
40 | activejob (5.2.1)
41 | activesupport (= 5.2.1)
42 | globalid (>= 0.3.6)
43 | activemodel (5.2.1)
44 | activesupport (= 5.2.1)
45 | activerecord (5.2.1)
46 | activemodel (= 5.2.1)
47 | activesupport (= 5.2.1)
48 | arel (>= 9.0)
49 | activestorage (5.2.1)
50 | actionpack (= 5.2.1)
51 | activerecord (= 5.2.1)
52 | marcel (~> 0.3.1)
53 | activesupport (5.2.1)
54 | concurrent-ruby (~> 1.0, >= 1.0.2)
55 | i18n (>= 0.7, < 2)
56 | minitest (~> 5.1)
57 | tzinfo (~> 1.1)
58 | addressable (2.5.2)
59 | public_suffix (>= 2.0.2, < 4.0)
60 | administrate (0.10.0)
61 | actionpack (>= 4.2, < 6.0)
62 | actionview (>= 4.2, < 6.0)
63 | activerecord (>= 4.2, < 6.0)
64 | autoprefixer-rails (>= 6.0)
65 | datetime_picker_rails (~> 0.0.7)
66 | jquery-rails (>= 4.0)
67 | kaminari (>= 1.0)
68 | momentjs-rails (~> 2.8)
69 | sass-rails (~> 5.0)
70 | selectize-rails (~> 0.6)
71 | archive-zip (0.11.0)
72 | io-like (~> 0.3.0)
73 | arel (9.0.0)
74 | autoprefixer-rails (9.3.1)
75 | execjs
76 | bcrypt (3.1.12)
77 | bindex (0.5.0)
78 | bootsnap (1.3.2)
79 | msgpack (~> 1.0)
80 | bootstrap (4.1.3)
81 | autoprefixer-rails (>= 6.0.3)
82 | popper_js (>= 1.12.9, < 2)
83 | sass (>= 3.5.2)
84 | builder (3.2.3)
85 | byebug (10.0.2)
86 | capybara (3.10.1)
87 | addressable
88 | mini_mime (>= 0.1.3)
89 | nokogiri (~> 1.8)
90 | rack (>= 1.6.0)
91 | rack-test (>= 0.6.3)
92 | regexp_parser (~> 1.2)
93 | xpath (~> 3.2)
94 | childprocess (0.9.0)
95 | ffi (~> 1.0, >= 1.0.11)
96 | chromedriver-helper (2.1.0)
97 | archive-zip (~> 0.10)
98 | nokogiri (~> 1.8)
99 | chronic (0.10.2)
100 | coffee-rails (4.2.2)
101 | coffee-script (>= 2.2.0)
102 | railties (>= 4.0.0)
103 | coffee-script (2.4.1)
104 | coffee-script-source
105 | execjs
106 | coffee-script-source (1.12.2)
107 | concurrent-ruby (1.1.3)
108 | connection_pool (2.2.2)
109 | crass (1.0.4)
110 | data-confirm-modal (1.6.2)
111 | railties (>= 3.0)
112 | datetime_picker_rails (0.0.7)
113 | momentjs-rails (>= 2.8.1)
114 | devise (4.5.0)
115 | bcrypt (~> 3.0)
116 | orm_adapter (~> 0.1)
117 | railties (>= 4.1.0, < 6.0)
118 | responders
119 | warden (~> 1.2.3)
120 | devise_masquerade (0.6.5)
121 | devise (>= 2.1.0)
122 | railties (>= 3.0)
123 | erubi (1.7.1)
124 | execjs (2.7.0)
125 | faraday (0.15.3)
126 | multipart-post (>= 1.2, < 3)
127 | ffi (1.9.25)
128 | font-awesome-sass (5.5.0.1)
129 | sassc (>= 1.11)
130 | foreman (0.84.0)
131 | thor (~> 0.19.1)
132 | friendly_id (5.2.4)
133 | activerecord (>= 4.0.0)
134 | globalid (0.4.1)
135 | activesupport (>= 4.2.0)
136 | hashie (3.5.7)
137 | i18n (1.1.1)
138 | concurrent-ruby (~> 1.0)
139 | io-like (0.3.0)
140 | jbuilder (2.8.0)
141 | activesupport (>= 4.2.0)
142 | multi_json (>= 1.2)
143 | jquery-rails (4.3.3)
144 | rails-dom-testing (>= 1, < 3)
145 | railties (>= 4.2.0)
146 | thor (>= 0.14, < 2.0)
147 | jwt (2.1.0)
148 | kaminari (1.1.1)
149 | activesupport (>= 4.1.0)
150 | kaminari-actionview (= 1.1.1)
151 | kaminari-activerecord (= 1.1.1)
152 | kaminari-core (= 1.1.1)
153 | kaminari-actionview (1.1.1)
154 | actionview
155 | kaminari-core (= 1.1.1)
156 | kaminari-activerecord (1.1.1)
157 | activerecord
158 | kaminari-core (= 1.1.1)
159 | kaminari-core (1.1.1)
160 | listen (3.1.5)
161 | rb-fsevent (~> 0.9, >= 0.9.4)
162 | rb-inotify (~> 0.9, >= 0.9.7)
163 | ruby_dep (~> 1.2)
164 | local_time (2.1.0)
165 | loofah (2.2.3)
166 | crass (~> 1.0.2)
167 | nokogiri (>= 1.5.9)
168 | mail (2.7.1)
169 | mini_mime (>= 0.1.1)
170 | marcel (0.3.3)
171 | mimemagic (~> 0.3.2)
172 | method_source (0.9.2)
173 | mimemagic (0.3.2)
174 | mini_magick (4.9.2)
175 | mini_mime (1.0.1)
176 | mini_portile2 (2.3.0)
177 | minitest (5.11.3)
178 | momentjs-rails (2.20.1)
179 | railties (>= 3.1)
180 | msgpack (1.2.4)
181 | multi_json (1.13.1)
182 | multi_xml (0.6.0)
183 | multipart-post (2.0.0)
184 | name_of_person (1.0.0)
185 | activesupport (>= 5.2.0)
186 | nio4r (2.3.1)
187 | nokogiri (1.8.5)
188 | mini_portile2 (~> 2.3.0)
189 | oauth (0.5.4)
190 | oauth2 (1.4.1)
191 | faraday (>= 0.8, < 0.16.0)
192 | jwt (>= 1.0, < 3.0)
193 | multi_json (~> 1.3)
194 | multi_xml (~> 0.5)
195 | rack (>= 1.2, < 3)
196 | omniauth (1.8.1)
197 | hashie (>= 3.4.6, < 3.6.0)
198 | rack (>= 1.6.2, < 3)
199 | omniauth-facebook (5.0.0)
200 | omniauth-oauth2 (~> 1.2)
201 | omniauth-github (1.3.0)
202 | omniauth (~> 1.5)
203 | omniauth-oauth2 (>= 1.4.0, < 2.0)
204 | omniauth-oauth (1.1.0)
205 | oauth
206 | omniauth (~> 1.0)
207 | omniauth-oauth2 (1.5.0)
208 | oauth2 (~> 1.1)
209 | omniauth (~> 1.2)
210 | omniauth-twitter (1.4.0)
211 | omniauth-oauth (~> 1.1)
212 | rack
213 | orm_adapter (0.5.0)
214 | popper_js (1.14.5)
215 | public_suffix (3.0.3)
216 | puma (3.12.0)
217 | rack (2.0.6)
218 | rack-cors (1.0.2)
219 | rack-protection (2.0.4)
220 | rack
221 | rack-proxy (0.6.5)
222 | rack
223 | rack-test (1.1.0)
224 | rack (>= 1.0, < 3)
225 | rails (5.2.1)
226 | actioncable (= 5.2.1)
227 | actionmailer (= 5.2.1)
228 | actionpack (= 5.2.1)
229 | actionview (= 5.2.1)
230 | activejob (= 5.2.1)
231 | activemodel (= 5.2.1)
232 | activerecord (= 5.2.1)
233 | activestorage (= 5.2.1)
234 | activesupport (= 5.2.1)
235 | bundler (>= 1.3.0)
236 | railties (= 5.2.1)
237 | sprockets-rails (>= 2.0.0)
238 | rails-dom-testing (2.0.3)
239 | activesupport (>= 4.2.0)
240 | nokogiri (>= 1.6)
241 | rails-html-sanitizer (1.0.4)
242 | loofah (~> 2.2, >= 2.2.2)
243 | railties (5.2.1)
244 | actionpack (= 5.2.1)
245 | activesupport (= 5.2.1)
246 | method_source
247 | rake (>= 0.8.7)
248 | thor (>= 0.19.0, < 2.0)
249 | rake (12.3.1)
250 | rb-fsevent (0.10.3)
251 | rb-inotify (0.9.10)
252 | ffi (>= 0.5.0, < 2)
253 | redis (4.0.3)
254 | regexp_parser (1.2.0)
255 | responders (2.4.0)
256 | actionpack (>= 4.2.0, < 5.3)
257 | railties (>= 4.2.0, < 5.3)
258 | ruby_dep (1.5.0)
259 | rubyzip (1.2.2)
260 | sass (3.7.2)
261 | sass-listen (~> 4.0.0)
262 | sass-listen (4.0.0)
263 | rb-fsevent (~> 0.9, >= 0.9.4)
264 | rb-inotify (~> 0.9, >= 0.9.7)
265 | sass-rails (5.0.7)
266 | railties (>= 4.0.0, < 6)
267 | sass (~> 3.1)
268 | sprockets (>= 2.8, < 4.0)
269 | sprockets-rails (>= 2.0, < 4.0)
270 | tilt (>= 1.1, < 3)
271 | sassc (2.0.0)
272 | ffi (~> 1.9.6)
273 | rake
274 | selectize-rails (0.12.6)
275 | selenium-webdriver (3.141.0)
276 | childprocess (~> 0.5)
277 | rubyzip (~> 1.2, >= 1.2.2)
278 | sidekiq (5.2.3)
279 | connection_pool (~> 2.2, >= 2.2.2)
280 | rack-protection (>= 1.5.0)
281 | redis (>= 3.3.5, < 5)
282 | sitemap_generator (6.0.1)
283 | builder (~> 3.0)
284 | spring (2.0.2)
285 | activesupport (>= 4.2)
286 | spring-watcher-listen (2.0.1)
287 | listen (>= 2.7, < 4.0)
288 | spring (>= 1.2, < 3.0)
289 | sprockets (3.7.2)
290 | concurrent-ruby (~> 1.0)
291 | rack (> 1, < 3)
292 | sprockets-rails (3.2.1)
293 | actionpack (>= 4.0)
294 | activesupport (>= 4.0)
295 | sprockets (>= 3.0.0)
296 | sqlite3 (1.3.13)
297 | thor (0.19.4)
298 | thread_safe (0.3.6)
299 | tilt (2.0.8)
300 | turbolinks (5.2.0)
301 | turbolinks-source (~> 5.2)
302 | turbolinks-source (5.2.0)
303 | tzinfo (1.2.5)
304 | thread_safe (~> 0.1)
305 | uglifier (4.1.19)
306 | execjs (>= 0.3.0, < 3)
307 | warden (1.2.7)
308 | rack (>= 1.0)
309 | web-console (3.7.0)
310 | actionview (>= 5.0)
311 | activemodel (>= 5.0)
312 | bindex (>= 0.4.0)
313 | railties (>= 5.0)
314 | webpacker (3.5.5)
315 | activesupport (>= 4.2)
316 | rack-proxy (>= 0.6.1)
317 | railties (>= 4.2)
318 | websocket-driver (0.7.0)
319 | websocket-extensions (>= 0.1.0)
320 | websocket-extensions (0.1.3)
321 | whenever (0.10.0)
322 | chronic (>= 0.6.3)
323 | xpath (3.2.0)
324 | nokogiri (~> 1.8)
325 |
326 | PLATFORMS
327 | ruby
328 |
329 | DEPENDENCIES
330 | administrate (~> 0.10.0)
331 | bootsnap (>= 1.1.0)
332 | bootstrap (~> 4.1, >= 4.1.1)
333 | byebug
334 | capybara (>= 2.15)
335 | chromedriver-helper
336 | coffee-rails (~> 4.2)
337 | data-confirm-modal (~> 1.6, >= 1.6.2)
338 | devise (~> 4.4, >= 4.4.3)
339 | devise-bootstrapped!
340 | devise_masquerade (~> 0.6.2)
341 | font-awesome-sass (~> 5.0, >= 5.0.13)
342 | foreman (~> 0.84.0)
343 | friendly_id (~> 5.2, >= 5.2.4)
344 | gravatar_image_tag!
345 | jbuilder (~> 2.5)
346 | jquery-rails (~> 4.3.1)
347 | listen (>= 3.0.5, < 3.2)
348 | local_time (~> 2.0, >= 2.0.1)
349 | mini_magick (~> 4.8)
350 | name_of_person (~> 1.0)
351 | omniauth-facebook (~> 5.0)
352 | omniauth-github (~> 1.3)
353 | omniauth-twitter (~> 1.4)
354 | puma (~> 3.11)
355 | rack-cors
356 | rails (~> 5.2.1)
357 | sass-rails (~> 5.0)
358 | selenium-webdriver
359 | sidekiq (~> 5.1, >= 5.1.3)
360 | sitemap_generator (~> 6.0, >= 6.0.1)
361 | spring
362 | spring-watcher-listen (~> 2.0.0)
363 | sqlite3
364 | turbolinks (~> 5)
365 | tzinfo-data
366 | uglifier (>= 1.3.0)
367 | web-console (>= 3.3.0)
368 | webpacker (~> 3.5, >= 3.5.3)
369 | whenever
370 |
371 | RUBY VERSION
372 | ruby 2.5.3p105
373 |
374 | BUNDLED WITH
375 | 1.17.1
376 |
--------------------------------------------------------------------------------
/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 = Rails.application.credentials.secret_key_base
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 = 'f5f47bb432c1a07bca0a3bfb9d65fd0a93dfa911a1d2b9a19764fe7f869258cafa9ddfb89b1aa13a45acd363e37fedc8ef9d93ae2437b0840a08889f0f096186'
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. Default is 0.days, meaning
130 | # the user cannot access the website without confirming their account.
131 | # config.allow_unconfirmed_access_for = 2.days
132 |
133 | # A period that the user is allowed to confirm their account before their
134 | # token becomes invalid. For example, if set to 3.days, the user can confirm
135 | # their account within 3 days after the mail was sent, but on the fourth day
136 | # their account can't be confirmed with the token any more.
137 | # Default is nil, meaning there is no restriction on how long a user can take
138 | # before confirming their account.
139 | # config.confirm_within = 3.days
140 |
141 | # If true, requires any email changes to be confirmed (exactly the same way as
142 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
143 | # db field (see migrations). Until confirmed, new email is stored in
144 | # unconfirmed_email column, and copied to email column on successful confirmation.
145 | config.reconfirmable = true
146 |
147 | # Defines which key will be used when confirming an account
148 | # config.confirmation_keys = [:email]
149 |
150 | # ==> Configuration for :rememberable
151 | # The time the user will be remembered without asking for credentials again.
152 | # config.remember_for = 2.weeks
153 |
154 | # Invalidates all the remember me tokens when the user signs out.
155 | config.expire_all_remember_me_on_sign_out = true
156 |
157 | # If true, extends the user's remember period when remembered via cookie.
158 | # config.extend_remember_period = false
159 |
160 | # Options to be passed to the created cookie. For instance, you can set
161 | # secure: true in order to force SSL only cookies.
162 | # config.rememberable_options = {}
163 |
164 | # ==> Configuration for :validatable
165 | # Range for password length.
166 | config.password_length = 6..128
167 |
168 | # Email regex used to validate email formats. It simply asserts that
169 | # one (and only one) @ exists in the given string. This is mainly
170 | # to give user feedback and not to assert the e-mail validity.
171 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
172 |
173 | # ==> Configuration for :timeoutable
174 | # The time you want to timeout the user session without activity. After this
175 | # time the user will be asked for credentials again. Default is 30 minutes.
176 | # config.timeout_in = 30.minutes
177 |
178 | # ==> Configuration for :lockable
179 | # Defines which strategy will be used to lock an account.
180 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
181 | # :none = No lock strategy. You should handle locking by yourself.
182 | # config.lock_strategy = :failed_attempts
183 |
184 | # Defines which key will be used when locking and unlocking an account
185 | # config.unlock_keys = [:email]
186 |
187 | # Defines which strategy will be used to unlock an account.
188 | # :email = Sends an unlock link to the user email
189 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
190 | # :both = Enables both strategies
191 | # :none = No unlock strategy. You should handle unlocking by yourself.
192 | # config.unlock_strategy = :both
193 |
194 | # Number of authentication tries before locking an account if lock_strategy
195 | # is failed attempts.
196 | # config.maximum_attempts = 20
197 |
198 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
199 | # config.unlock_in = 1.hour
200 |
201 | # Warn on the last attempt before the account is locked.
202 | # config.last_attempt_warning = true
203 |
204 | # ==> Configuration for :recoverable
205 | #
206 | # Defines which key will be used when recovering the password for an account
207 | # config.reset_password_keys = [:email]
208 |
209 | # Time interval you can reset your password with a reset password key.
210 | # Don't put a too small interval or your users won't have the time to
211 | # change their passwords.
212 | config.reset_password_within = 6.hours
213 |
214 | # When set to false, does not sign a user in automatically after their password is
215 | # reset. Defaults to true, so a user is signed in automatically after a reset.
216 | # config.sign_in_after_reset_password = true
217 |
218 | # ==> Configuration for :encryptable
219 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
220 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
221 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
222 | # for default behavior) and :restful_authentication_sha1 (then you should set
223 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
224 | #
225 | # Require the `devise-encryptable` gem when using anything other than bcrypt
226 | # config.encryptor = :sha512
227 |
228 | # ==> Scopes configuration
229 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
230 | # "users/sessions/new". It's turned off by default because it's slower if you
231 | # are using only default views.
232 | # config.scoped_views = false
233 |
234 | # Configure the default scope given to Warden. By default it's the first
235 | # devise role declared in your routes (usually :user).
236 | # config.default_scope = :user
237 |
238 | # Set this configuration to false if you want /users/sign_out to sign out
239 | # only the current scope. By default, Devise signs out all scopes.
240 | # config.sign_out_all_scopes = true
241 |
242 | # ==> Navigation configuration
243 | # Lists the formats that should be treated as navigational. Formats like
244 | # :html, should redirect to the sign in page when the user does not have
245 | # access, but formats like :xml or :json, should return 401.
246 | #
247 | # If you have any extra navigational formats, like :iphone or :mobile, you
248 | # should add them to the navigational formats lists.
249 | #
250 | # The "*/*" below is required to match Internet Explorer requests.
251 | # config.navigational_formats = ['*/*', :html]
252 |
253 | # The default HTTP method used to sign out a resource. Default is :delete.
254 | config.sign_out_via = :delete
255 |
256 | # ==> OmniAuth
257 | # Add a new OmniAuth provider. Check the wiki for more information on setting
258 | # up on your models and hooks.
259 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
260 |
261 | if Rails.application.secrets.facebook_app_id.present? && Rails.application.secrets.facebook_app_secret.present?
262 | config.omniauth :facebook, Rails.application.secrets.facebook_app_id, Rails.application.secrets.facebook_app_secret, scope: 'email,user_posts'
263 | end
264 |
265 | if Rails.application.secrets.twitter_app_id.present? && Rails.application.secrets.twitter_app_secret.present?
266 | config.omniauth :twitter, Rails.application.secrets.twitter_app_id, Rails.application.secrets.twitter_app_secret
267 | end
268 |
269 | if Rails.application.secrets.github_app_id.present? && Rails.application.secrets.github_app_secret.present?
270 | config.omniauth :github, Rails.application.secrets.github_app_id, Rails.application.secrets.github_app_secret
271 | end
272 |
273 | # ==> Warden configuration
274 | # If you want to use other strategies, that are not supported by Devise, or
275 | # change the failure app, you can configure them inside the config.warden block.
276 | #
277 | # config.warden do |manager|
278 | # manager.intercept_401 = false
279 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
280 | # end
281 |
282 | # ==> Mountable engine configurations
283 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
284 | # is mountable, there are some extra configurations to be taken into account.
285 | # The following options are available, assuming the engine is mounted as:
286 | #
287 | # mount MyEngine, at: '/my_engine'
288 | #
289 | # The router that invoked `devise_for`, in the example above, would be:
290 | # config.router_name = :my_engine
291 | #
292 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
293 | # so you need to do it manually. For the users scope, it would be:
294 | # config.omniauth_path_prefix = '/my_engine/users/auth'
295 |
296 | # ==> Turbolinks configuration
297 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
298 | #
299 | # ActiveSupport.on_load(:devise_failure_app) do
300 | # include Turbolinks::Controller
301 | # end
302 | end
303 |
--------------------------------------------------------------------------------