├── log └── .keep ├── tmp └── .keep ├── vendor └── .keep ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── 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 │ ├── photo_test.rb │ ├── post_test.rb │ ├── user_test.rb │ └── announcement_test.rb ├── system │ ├── .keep │ ├── posts_test.rb │ └── photos_test.rb ├── controllers │ ├── .keep │ ├── posts_controller_test.rb │ └── photos_controller_test.rb ├── fixtures │ ├── .keep │ ├── files │ │ └── .keep │ ├── photos.yml │ ├── posts.yml │ ├── announcements.yml │ └── users.yml ├── integration │ └── .keep ├── application_system_test_case.rb └── test_helper.rb ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── channels │ │ │ └── .keep │ │ ├── posts.coffee │ │ ├── photos.coffee │ │ ├── cable.js │ │ ├── application.js │ │ └── trix_uploads.js │ ├── config │ │ └── manifest.js │ └── stylesheets │ │ ├── photos.scss │ │ ├── posts.scss │ │ ├── announcements.scss │ │ ├── application.scss │ │ ├── sticky-footer.scss │ │ └── scaffolds.scss ├── models │ ├── concerns │ │ └── .keep │ ├── post.rb │ ├── image_uploader.rb │ ├── photo.rb │ ├── application_record.rb │ ├── announcement.rb │ └── user.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── home_controller.rb │ ├── announcements_controller.rb │ ├── application_controller.rb │ ├── admin │ │ ├── users_controller.rb │ │ ├── announcements_controller.rb │ │ └── application_controller.rb │ ├── posts_controller.rb │ └── photos_controller.rb ├── views │ ├── layouts │ │ ├── mailer.text.erb │ │ ├── mailer.html.erb │ │ └── application.html.erb │ ├── posts │ │ ├── show.json.jbuilder │ │ ├── index.json.jbuilder │ │ ├── new.html.erb │ │ ├── _post.json.jbuilder │ │ ├── edit.html.erb │ │ ├── show.html.erb │ │ ├── index.html.erb │ │ └── _form.html.erb │ ├── photos │ │ ├── show.json.jbuilder │ │ ├── index.json.jbuilder │ │ ├── new.html.erb │ │ ├── edit.html.erb │ │ ├── _photo.json.jbuilder │ │ ├── show.html.erb │ │ ├── _form.html.erb │ │ └── index.html.erb │ ├── home │ │ ├── privacy.html.erb │ │ ├── terms.html.erb │ │ └── index.html.erb │ ├── devise │ │ ├── mailer │ │ │ ├── password_change.html.erb │ │ │ ├── confirmation_instructions.html.erb │ │ │ ├── unlock_instructions.html.erb │ │ │ └── reset_password_instructions.html.erb │ │ ├── unlocks │ │ │ └── new.html.erb │ │ ├── passwords │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ ├── confirmations │ │ │ └── new.html.erb │ │ ├── sessions │ │ │ └── new.html.erb │ │ ├── shared │ │ │ └── _links.html.erb │ │ └── registrations │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ ├── shared │ │ ├── _notices.html.erb │ │ ├── _head.html.erb │ │ ├── _footer.html.erb │ │ └── _navbar.html.erb │ ├── announcements │ │ └── index.html.erb │ └── admin │ │ └── users │ │ └── show.html.erb ├── helpers │ ├── posts_helper.rb │ ├── photos_helper.rb │ ├── application_helper.rb │ ├── devise_helper.rb │ └── announcements_helper.rb ├── jobs │ └── application_job.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── mailers │ └── application_mailer.rb ├── javascript │ └── packs │ │ └── application.js └── dashboards │ ├── announcement_dashboard.rb │ └── user_dashboard.rb ├── .postcssrc.yml ├── Procfile ├── config ├── webpack │ ├── environment.js │ ├── test.js │ ├── production.js │ └── development.js ├── initializers │ ├── gravatar.rb │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── application_controller_renderer.rb │ ├── cookies_serializer.rb │ ├── shrine.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── assets.rb │ ├── inflections.rb │ └── devise.rb ├── spring.rb ├── boot.rb ├── environment.rb ├── cable.yml ├── routes.rb ├── application.rb ├── locales │ ├── en.yml │ └── devise.en.yml ├── webpacker.yml ├── secrets.yml ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb ├── puma.rb └── database.yml ├── bin ├── bundle ├── rake ├── rails ├── yarn ├── spring ├── webpack ├── update ├── setup └── webpack-dev-server ├── config.ru ├── package.json ├── db ├── migrate │ ├── 20171003150750_create_photos.rb │ ├── 20171003145534_create_posts.rb │ ├── 20171003144143_create_announcements.rb │ └── 20171003144108_devise_create_users.rb ├── seeds.rb └── schema.rb ├── Rakefile ├── .babelrc ├── README.md ├── .gitignore ├── Gemfile └── Gemfile.lock /log/.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/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | module PostsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/photos_helper.rb: -------------------------------------------------------------------------------- 1 | module PhotosHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/models/post.rb: -------------------------------------------------------------------------------- 1 | class Post < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/image_uploader.rb: -------------------------------------------------------------------------------- 1 | class ImageUploader < Shrine 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/views/posts/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.partial! "posts/post", post: @post 2 | -------------------------------------------------------------------------------- /app/views/photos/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.partial! "photos/photo", photo: @photo 2 | -------------------------------------------------------------------------------- /.postcssrc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | postcss-smart-import: {} 3 | postcss-cssnext: {} 4 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: rails server 2 | sidekiq: sidekiq 3 | webpack: bin/webpack-dev-server 4 | -------------------------------------------------------------------------------- /app/views/posts/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array! @posts, partial: 'posts/post', as: :post 2 | -------------------------------------------------------------------------------- /app/views/photos/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array! @photos, partial: 'photos/photo', as: :photo 2 | -------------------------------------------------------------------------------- /app/models/photo.rb: -------------------------------------------------------------------------------- 1 | class Photo < ApplicationRecord 2 | include ImageUploader[:image] 3 | end 4 | -------------------------------------------------------------------------------- /app/views/home/privacy.html.erb: -------------------------------------------------------------------------------- 1 |

Privacy Policy

2 |

Use this for your Privacy Policy

3 | -------------------------------------------------------------------------------- /app/views/home/terms.html.erb: -------------------------------------------------------------------------------- 1 |

Terms of Service

2 |

Use this for your Terms of Service

3 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | module.exports = environment 4 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | const environment = require('./environment') 2 | 3 | module.exports = environment.toWebpackConfig() 4 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | const environment = require('./environment') 2 | 3 | module.exports = environment.toWebpackConfig() 4 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/views/posts/new.html.erb: -------------------------------------------------------------------------------- 1 |

New Post

2 | 3 | <%= render 'form', post: @post %> 4 | 5 | <%= link_to 'Back', posts_path %> 6 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | const environment = require('./environment') 2 | 3 | module.exports = environment.toWebpackConfig() 4 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/views/photos/new.html.erb: -------------------------------------------------------------------------------- 1 |

New Photo

2 | 3 | <%= render 'form', photo: @photo %> 4 | 5 | <%= link_to 'Back', photos_path %> 6 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/views/posts/_post.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! post, :id, :title, :body, :created_at, :updated_at 2 | json.url post_url(post, format: :json) 3 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/initializers/gravatar.rb: -------------------------------------------------------------------------------- 1 | GravatarImageTag.configure do |config| 2 | config.default_image = "mm" 3 | config.secure = true 4 | end 5 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/photo_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PhotoTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/post_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostTest < 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/devise/mailer/password_change.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

We're contacting you to notify you that your password has been changed.

4 | -------------------------------------------------------------------------------- /app/views/posts/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing Post

2 | 3 | <%= render 'form', post: @post %> 4 | 5 | <%= link_to 'Show', @post %> | 6 | <%= link_to 'Back', posts_path %> 7 | -------------------------------------------------------------------------------- /app/views/photos/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing Photo

2 | 3 | <%= render 'form', photo: @photo %> 4 | 5 | <%= link_to 'Show', @photo %> | 6 | <%= link_to 'Back', photos_path %> 7 | -------------------------------------------------------------------------------- /app/views/photos/_photo.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! photo, :id, :image_data, :created_at, :updated_at 2 | json.url photo_url(photo, format: :html) 3 | json.image_url photo.image_url 4 | -------------------------------------------------------------------------------- /test/models/announcement_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AnnouncementTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | end 4 | 5 | def terms 6 | end 7 | 8 | def privacy 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/fixtures/photos.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | image_data: MyText 5 | 6 | two: 7 | image_data: MyText 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome to Spork!

2 |

Use this document as a way to quickly start any new project.
All you get is this text and a mostly barebones HTML document.

3 | -------------------------------------------------------------------------------- /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/assets/stylesheets/photos.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Photos controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/posts.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Posts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: redis://localhost:6379/1 10 | channel_prefix: trix_example_production 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "trix_example", 3 | "private": true, 4 | "dependencies": { 5 | "@rails/webpacker": "^3.0.1" 6 | }, 7 | "devDependencies": { 8 | "webpack-dev-server": "^2.9.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/fixtures/posts.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | title: MyString 5 | body: MyText 6 | 7 | two: 8 | title: MyString 9 | body: MyText 10 | -------------------------------------------------------------------------------- /db/migrate/20171003150750_create_photos.rb: -------------------------------------------------------------------------------- 1 | class CreatePhotos < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :photos do |t| 4 | t.text :image_data 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/posts.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/assets/javascripts/photos.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /db/migrate/20171003145534_create_posts.rb: -------------------------------------------------------------------------------- 1 | class CreatePosts < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :posts do |t| 4 | t.string :title 5 | t.text :body 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/system/posts_test.rb: -------------------------------------------------------------------------------- 1 | require "application_system_test_case" 2 | 3 | class PostsTest < ApplicationSystemTestCase 4 | # test "visiting the index" do 5 | # visit posts_url 6 | # 7 | # assert_selector "h1", text: "Post" 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /test/system/photos_test.rb: -------------------------------------------------------------------------------- 1 | require "application_system_test_case" 2 | 3 | class PhotosTest < ApplicationSystemTestCase 4 | # test "visiting the index" do 5 | # visit photos_url 6 | # 7 | # assert_selector "h1", text: "Photo" 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome <%= @email %>!

2 | 3 |

You can confirm your account email through the link below:

4 | 5 |

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

6 | -------------------------------------------------------------------------------- /app/views/photos/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 | <%= image_tag @photo.image_url %> 4 |

5 | Image data: 6 | <%= @photo.image_data %> 7 |

8 | 9 | <%= link_to 'Edit', edit_photo_path(@photo) %> | 10 | <%= link_to 'Back', photos_path %> 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/views/shared/_notices.html.erb: -------------------------------------------------------------------------------- 1 | <% flash.each do |msg_type, message| %> 2 |
3 |
4 | 5 | <%= message %> 6 |
7 |
8 | <% end %> 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | def bootstrap_class_for(flash_type) 3 | { 4 | success: "alert-success", 5 | error: "alert-danger", 6 | alert: "alert-warning", 7 | notice: "alert-info" 8 | }.stringify_keys[flash_type.to_s] || flash_type.to_s 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 |

4 | Title: 5 | <%= @post.title %> 6 |

7 | 8 |

9 | Body: 10 | <%= sanitize @post.body %> 11 |

12 | 13 | <%= link_to 'Edit', edit_post_path(@post) %> | 14 | <%= link_to 'Back', posts_path %> 15 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../config/environment', __FILE__) 2 | require 'rails/test_help' 3 | 4 | class ActiveSupport::TestCase 5 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 6 | fixtures :all 7 | 8 | # Add more helper methods to be used by all tests here... 9 | end 10 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

4 | 5 |

Click the link below to unlock your account:

6 | 7 |

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

8 | -------------------------------------------------------------------------------- /db/migrate/20171003144143_create_announcements.rb: -------------------------------------------------------------------------------- 1 | class CreateAnnouncements < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :announcements do |t| 4 | t.datetime :published_at 5 | t.string :announcement_type 6 | t.string :name 7 | t.text :description 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/shared/_head.html.erb: -------------------------------------------------------------------------------- 1 | Spark 2 | 3 | 4 | 5 | <%= csrf_meta_tags %> 6 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 7 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 8 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | VENDOR_PATH = File.expand_path('..', __dir__) 3 | Dir.chdir(VENDOR_PATH) do 4 | begin 5 | exec "yarnpkg #{ARGV.join(" ")}" 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/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= render 'shared/head' %> 5 | 6 | 7 | 8 | <%= render 'shared/navbar' %> 9 | <%= render 'shared/notices' %> 10 | 11 |
12 | <%= yield %> 13 |
14 | 15 | <%= render 'shared/footer' %> 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/helpers/devise_helper.rb: -------------------------------------------------------------------------------- 1 | module DeviseHelper 2 | def devise_error_messages! 3 | return '' if resource.errors.empty? 4 | 5 | messages = resource.errors.full_messages.map { |msg| content_tag(:div, msg) }.join 6 | html = <<-HTML 7 |
8 | #{messages} 9 |
10 | HTML 11 | 12 | html.html_safe 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/fixtures/announcements.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | published_at: 2017-10-03 09:41:43 5 | announcement_type: MyString 6 | name: MyString 7 | description: MyText 8 | 9 | two: 10 | published_at: 2017-10-03 09:41:43 11 | announcement_type: MyString 12 | name: MyString 13 | description: MyText 14 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": "> 1%", 7 | "uglify": true 8 | }, 9 | "useBuiltIns": true 10 | }] 11 | ], 12 | 13 | "plugins": [ 14 | "syntax-dynamic-import", 15 | "transform-object-rest-spread", 16 | ["transform-class-properties", { "spec": true }] 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /app/controllers/announcements_controller.rb: -------------------------------------------------------------------------------- 1 | class AnnouncementsController < ApplicationController 2 | before_action :mark_as_read, if: :user_signed_in? 3 | 4 | def index 5 | @announcements = Announcement.order(published_at: :desc) 6 | end 7 | 8 | private 9 | 10 | def mark_as_read 11 | current_user.update(announcements_last_read_at: Time.zone.now) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /config/initializers/shrine.rb: -------------------------------------------------------------------------------- 1 | require "shrine" 2 | require "shrine/storage/file_system" 3 | 4 | Shrine.storages = { 5 | cache: Shrine::Storage::FileSystem.new("public", prefix: "uploads/cache"), # temporary 6 | store: Shrine::Storage::FileSystem.new("public", prefix: "uploads/store"), # permanent 7 | } 8 | 9 | Shrine.plugin :activerecord 10 | Shrine.plugin :cached_attachment_data # for forms 11 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://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/views/shared/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.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 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /app/models/announcement.rb: -------------------------------------------------------------------------------- 1 | class Announcement < ApplicationRecord 2 | TYPES = %w{ new fix update } 3 | 4 | after_initialize :set_defaults 5 | 6 | validates :announcement_type, :description, :name, :published_at, presence: true 7 | validates :announcement_type, inclusion: { in: TYPES } 8 | 9 | def set_defaults 10 | self.published_at ||= Time.zone.now 11 | self.announcement_type ||= TYPES.first 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :masqueradable, :database_authenticatable, :registerable, 5 | :recoverable, :rememberable, :trackable, :validatable 6 | 7 | validates :first_name, :last_name, presence: true 8 | 9 | def name 10 | "#{first_name} #{last_name}" 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /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/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Someone has requested a link to change your password. You can do this through the link below.

4 | 5 |

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

6 | 7 |

If you didn't request this, please ignore this email.

8 |

Your password won't change until you access the link above and create a new one.

9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | 4 | before_action :configure_permitted_parameters, if: :devise_controller? 5 | 6 | protected 7 | 8 | def configure_permitted_parameters 9 | devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name]) 10 | devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name]) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend unlock instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %> 9 |
10 | 11 |
12 | <%= f.submit "Resend unlock instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/assets/stylesheets/announcements.scss: -------------------------------------------------------------------------------- 1 | .announcement { 2 | strong { 3 | color: $gray-700; 4 | font-weight: 900; 5 | } 6 | } 7 | 8 | .unread-announcements:before { 9 | -moz-border-radius: 50%; 10 | -webkit-border-radius: 50%; 11 | border-radius: 50%; 12 | -moz-background-clip: padding-box; 13 | -webkit-background-clip: padding-box; 14 | background-clip: padding-box; 15 | background: $red; 16 | content: ''; 17 | display: inline-block; 18 | height: 8px; 19 | width: 8px; 20 | margin-right: 6px; 21 | } 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | //*= require trix 2 | 3 | // $navbar-default-bg: #312312; 4 | // $light-orange: #ff8c00; 5 | // $navbar-default-color: $light-orange; 6 | 7 | @import "font-awesome-sprockets"; 8 | @import "font-awesome"; 9 | @import "bootstrap"; 10 | @import "sticky-footer"; 11 | @import "announcements"; 12 | 13 | // Fixes bootstrap nav-brand container overlap 14 | @include media-breakpoint-down(xs) { 15 | .container { 16 | margin-left: 0; 17 | margin-right: 0; 18 | } 19 | } 20 | 21 | // Masquerade alert shouldn't have a bottom margin 22 | body > .alert { 23 | margin-bottom: 0; 24 | } 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | /node_modules 17 | /yarn-error.log 18 | 19 | .byebug_history 20 | /public/packs 21 | /public/packs-test 22 | /public/uploads 23 | /node_modules 24 | -------------------------------------------------------------------------------- /app/views/photos/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with(model: photo, local: true) do |form| %> 2 | <% if photo.errors.any? %> 3 |
4 |

<%= pluralize(photo.errors.count, "error") %> prohibited this photo from being saved:

5 | 6 | 11 |
12 | <% end %> 13 | 14 |
15 | <%= form.label :image %> 16 | <%= form.file_field :image, id: :photo_image %> 17 |
18 | 19 |
20 | <%= form.submit %> 21 |
22 | <% end %> 23 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | require 'sidekiq/web' 2 | 3 | Rails.application.routes.draw do 4 | resources :photos 5 | resources :posts 6 | get '/privacy', to: 'home#privacy' 7 | get '/terms', to: 'home#terms' 8 | namespace :admin do 9 | resources :users 10 | resources :announcements 11 | 12 | root to: "users#index" 13 | end 14 | 15 | resources :announcements, only: [:index] 16 | authenticate :user, lambda { |u| u.admin? } do 17 | mount Sidekiq::Web => '/sidekiq' 18 | end 19 | 20 | devise_for :users 21 | root to: 'home#index' 22 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 23 | end 24 | -------------------------------------------------------------------------------- /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/photos/index.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 |

Photos

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <% @photos.each do |photo| %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | <% end %> 22 | 23 |
Image data
<%= photo.image_data %><%= link_to 'Show', photo %><%= link_to 'Edit', edit_photo_path(photo) %><%= link_to 'Destroy', photo, method: :delete, data: { confirm: 'Are you sure?' } %>
24 | 25 |
26 | 27 | <%= link_to 'New Photo', new_photo_path %> 28 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module TrixExample 10 | class Application < Rails::Application 11 | config.active_job.queue_adapter = :sidekiq 12 | # Initialize configuration defaults for originally generated Rails version. 13 | config.load_defaults 5.1 14 | 15 | # Settings in config/environments/* take precedence over those specified here. 16 | # Application configuration should go into files in config/initializers 17 | # -- all .rb files in that directory are automatically loaded. 18 | end 19 | end 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 | -------------------------------------------------------------------------------- /app/views/posts/index.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 |

Posts

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | <% @posts.each do |post| %> 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | <% end %> 24 | 25 |
TitleBody
<%= post.title %><%= post.body %><%= link_to 'Show', post %><%= link_to 'Edit', edit_post_path(post) %><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %>
26 | 27 |
28 | 29 | <%= link_to 'New Post', new_post_path %> 30 | -------------------------------------------------------------------------------- /app/assets/stylesheets/sticky-footer.scss: -------------------------------------------------------------------------------- 1 | /* Sticky footer styles 2 | -------------------------------------------------- */ 3 | html { 4 | position: relative; 5 | min-height: 100%; 6 | } 7 | body { 8 | /* Margin bottom by footer height */ 9 | margin-bottom: 60px; 10 | } 11 | .footer { 12 | position: absolute; 13 | bottom: 0; 14 | width: 100%; 15 | /* Set the fixed height of the footer here */ 16 | height: 60px; 17 | line-height: 60px; /* Vertically center the text there */ 18 | } 19 | 20 | 21 | /* Custom page CSS 22 | -------------------------------------------------- */ 23 | /* Not required for template or sticky footer method. */ 24 | 25 | body > .container { 26 | padding: 40px 15px 0; 27 | } 28 | 29 | .footer > .container { 30 | padding-right: 15px; 31 | padding-left: 15px; 32 | } 33 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $stdout.sync = true 3 | 4 | require "shellwords" 5 | 6 | ENV["RAILS_ENV"] ||= "development" 7 | RAILS_ENV = ENV["RAILS_ENV"] 8 | 9 | ENV["NODE_ENV"] ||= RAILS_ENV 10 | NODE_ENV = ENV["NODE_ENV"] 11 | 12 | APP_PATH = File.expand_path("../", __dir__) 13 | NODE_MODULES_PATH = File.join(APP_PATH, "node_modules") 14 | WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js") 15 | 16 | unless File.exist?(WEBPACK_CONFIG) 17 | puts "Webpack configuration not found." 18 | puts "Please run bundle exec rails webpacker:install to install webpacker" 19 | exit! 20 | end 21 | 22 | env = { "NODE_PATH" => NODE_MODULES_PATH.shellescape } 23 | cmd = [ "#{NODE_MODULES_PATH}/.bin/webpack", "--config", WEBPACK_CONFIG ] + ARGV 24 | 25 | Dir.chdir(APP_PATH) do 26 | exec env, *cmd 27 | end 28 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5 | // vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require jquery 15 | //= require popper 16 | //= require bootstrap 17 | //= require turbolinks 18 | //= require trix 19 | //= require_tree . 20 | -------------------------------------------------------------------------------- /app/views/posts/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with(model: post, local: true) do |form| %> 2 | <% if post.errors.any? %> 3 |
4 |

<%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:

5 | 6 | 11 |
12 | <% end %> 13 | 14 |
15 | <%= form.label :title %> 16 | <%= form.text_field :title, id: :post_title, class: "form-control" %> 17 |
18 | 19 |
20 | <%= form.label :body %> 21 | <%= form.hidden_field :body, id: :post_body, class: "form-control" %> 22 | 23 |
24 | 25 |
26 | <%= form.submit %> 27 |
28 | <% end %> 29 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Reset your password

4 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 5 | <%= devise_error_messages! %> 6 |
7 |

Enter your email address below and we will send you a link to reset your password.

8 |
9 | <%= f.email_field :email, autofocus: true, placeholder: 'Email Address', class: 'form-control' %> 10 |
11 | 12 |
13 | <%= f.submit "Send password reset email", class: 'btn btn-primary btn-block btn-lg' %> 14 |
15 | <% end %> 16 |
17 | <%= render "devise/shared/links" %> 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Resend confirmation instructions

4 | 5 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 6 | <%= devise_error_messages! %> 7 | 8 |
9 | <%= f.label :email %>
10 | <%= f.email_field :email, autofocus: true, class: 'form-control', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> 11 |
12 | 13 |
14 | <%= f.submit "Resend confirmation instructions", class: 'btn btn-primary btn-lg btn-block' %> 15 |
16 | <% end %> 17 | 18 |
19 | <%= render "devise/shared/links" %> 20 |
21 | 22 |
23 |
24 | -------------------------------------------------------------------------------- /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 http://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /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 | before_action :default_params 11 | 12 | def authenticate_admin 13 | redirect_to '/', alert: 'Not authorized.' unless user_signed_in? && current_user.admin? 14 | end 15 | 16 | def default_params 17 | params[:order] ||= "created_at" 18 | params[:direction] ||= "desc" 19 | end 20 | 21 | # Override this value to specify the number of elements to display at a time 22 | # on index pages. Defaults to 20. 23 | # def records_per_page 24 | # params[:per_page] || 20 25 | # end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /app/views/announcements/index.html.erb: -------------------------------------------------------------------------------- 1 |

What's New

2 | 3 |
4 |
5 | <% @announcements.each_with_index do |announcement, index| %> 6 | <% if index != 0 %> 7 |

8 | <% end %> 9 | 10 |
11 |
12 | <%= link_to announcements_path(anchor: dom_id(announcement)) do %> 13 | <%= announcement.published_at.strftime("%b %d") %> 14 | <% end %> 15 |
16 |
17 | <%= announcement.announcement_type.titleize %>: 18 | <%= announcement.name %> 19 | <%= simple_format announcement.description %> 20 |
21 |
22 | <% end %> 23 | 24 | <% if @announcements.empty? %> 25 |
Exciting stuff coming very soon!
26 | <% end %> 27 |
28 |
29 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # Install JavaScript dependencies if using Yarn 22 | # system('bin/yarn') 23 | 24 | 25 | # puts "\n== Copying sample files ==" 26 | # unless File.exist?('config/database.yml') 27 | # cp 'config/database.yml.sample', 'config/database.yml' 28 | # end 29 | 30 | puts "\n== Preparing database ==" 31 | system! 'bin/rails db:setup' 32 | 33 | puts "\n== Removing old logs and tempfiles ==" 34 | system! 'bin/rails log:clear tmp:clear' 35 | 36 | puts "\n== Restarting application server ==" 37 | system! 'bin/rails restart' 38 | end 39 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Log in

4 | 5 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 6 |
7 | <%= f.email_field :email, autofocus: true, placeholder: 'Email Address', class: 'form-control' %> 8 |
9 | 10 |
11 | <%= f.password_field :password, autocomplete: "off", placeholder: 'Password', class: 'form-control' %> 12 |
13 | 14 | <% if devise_mapping.rememberable? -%> 15 |
16 | 20 |
21 | <% end -%> 22 | 23 |
24 | <%= f.submit "Log in", class: "btn btn-primary btn-block btn-lg" %> 25 |
26 | <% end %> 27 | 28 |
29 | <%= render "devise/shared/links" %> 30 |
31 |
32 |
33 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Change your password

4 | 5 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 6 | <%= devise_error_messages! %> 7 | <%= f.hidden_field :reset_password_token %> 8 | 9 |
10 | <%= f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control', placeholder: "Password" %> 11 | <% if @minimum_password_length %> 12 |

<%= @minimum_password_length %> characters minimum

13 | <% end %> 14 |
15 | 16 |
17 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: "Confirm Password" %> 18 |
19 | 20 |
21 | <%= f.submit "Change my password", class: 'btn btn-primary btn-block btn-lg' %> 22 |
23 | <% end %> 24 | 25 |
26 | <%= render "devise/shared/links" %> 27 |
28 |
29 |
30 | -------------------------------------------------------------------------------- /test/controllers/posts_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostsControllerTest < ActionDispatch::IntegrationTest 4 | setup do 5 | @post = posts(:one) 6 | end 7 | 8 | test "should get index" do 9 | get posts_url 10 | assert_response :success 11 | end 12 | 13 | test "should get new" do 14 | get new_post_url 15 | assert_response :success 16 | end 17 | 18 | test "should create post" do 19 | assert_difference('Post.count') do 20 | post posts_url, params: { post: { body: @post.body, title: @post.title } } 21 | end 22 | 23 | assert_redirected_to post_url(Post.last) 24 | end 25 | 26 | test "should show post" do 27 | get post_url(@post) 28 | assert_response :success 29 | end 30 | 31 | test "should get edit" do 32 | get edit_post_url(@post) 33 | assert_response :success 34 | end 35 | 36 | test "should update post" do 37 | patch post_url(@post), params: { post: { body: @post.body, title: @post.title } } 38 | assert_redirected_to post_url(@post) 39 | end 40 | 41 | test "should destroy post" do 42 | assert_difference('Post.count', -1) do 43 | delete post_url(@post) 44 | end 45 | 46 | assert_redirected_to posts_url 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /test/controllers/photos_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PhotosControllerTest < ActionDispatch::IntegrationTest 4 | setup do 5 | @photo = photos(:one) 6 | end 7 | 8 | test "should get index" do 9 | get photos_url 10 | assert_response :success 11 | end 12 | 13 | test "should get new" do 14 | get new_photo_url 15 | assert_response :success 16 | end 17 | 18 | test "should create photo" do 19 | assert_difference('Photo.count') do 20 | post photos_url, params: { photo: { image_data: @photo.image_data } } 21 | end 22 | 23 | assert_redirected_to photo_url(Photo.last) 24 | end 25 | 26 | test "should show photo" do 27 | get photo_url(@photo) 28 | assert_response :success 29 | end 30 | 31 | test "should get edit" do 32 | get edit_photo_url(@photo) 33 | assert_response :success 34 | end 35 | 36 | test "should update photo" do 37 | patch photo_url(@photo), params: { photo: { image_data: @photo.image_data } } 38 | assert_redirected_to photo_url(@photo) 39 | end 40 | 41 | test "should destroy photo" do 42 | assert_difference('Photo.count', -1) do 43 | delete photo_url(@photo) 44 | end 45 | 46 | assert_redirected_to photos_url 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%> 25 | <% end -%> 26 | -------------------------------------------------------------------------------- /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_output_path: packs 7 | cache_path: tmp/cache/webpacker 8 | 9 | # Additional paths webpack should lookup modules 10 | # ['app/assets', 'engine/foo/app/assets'] 11 | resolved_paths: [] 12 | 13 | # Reload manifest.json on all requests so we reload latest compiled packs 14 | cache_manifest: false 15 | 16 | extensions: 17 | - .coffee 18 | - .erb 19 | - .js 20 | - .jsx 21 | - .ts 22 | - .vue 23 | - .sass 24 | - .scss 25 | - .css 26 | - .png 27 | - .svg 28 | - .gif 29 | - .jpeg 30 | - .jpg 31 | 32 | development: 33 | <<: *default 34 | compile: true 35 | 36 | dev_server: 37 | host: localhost 38 | port: 3035 39 | hmr: false 40 | https: false 41 | 42 | test: 43 | <<: *default 44 | compile: true 45 | 46 | # Compile test packs to a separate directory 47 | public_output_path: packs-test 48 | 49 | production: 50 | <<: *default 51 | 52 | # Production depends on precompilation of packs prior to booting for performance. 53 | compile: false 54 | 55 | # Cache manifest.json for performance 56 | cache_manifest: true 57 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | # Shared secrets are available across all environments. 14 | 15 | # shared: 16 | # api_key: a1B2c3D4e5F6 17 | 18 | # Environmental secrets are only available for that specific environment. 19 | 20 | development: 21 | secret_key_base: 31495a31cb81bdaca1bb6f285d67e9829ee03eed497958350a0ee00a7465ac7a66c766c9f7d56e4185fadd203f8033e5792e5475a1a763a8cd8ccdd79e31877b 22 | 23 | test: 24 | secret_key_base: 6c24ea49952d8c35a23196a55c6a1b86fa623b27243e48a275db47e5fab182166df4a9d19b196dbf7dff02c48b165c06ff8c359d342f6d6d76504be975bb860d 25 | 26 | # Do not keep production secrets in the unencrypted secrets file. 27 | # Instead, either read values from the environment. 28 | # Or, use `bin/rails secrets:setup` to configure encrypted secrets 29 | # and move the `production:` environment over there. 30 | 31 | production: 32 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 33 | -------------------------------------------------------------------------------- /app/assets/javascripts/trix_uploads.js: -------------------------------------------------------------------------------- 1 | // Turn off the default Trix captions 2 | Trix.config.attachments.preview.caption = { 3 | name: false, 4 | size: false 5 | }; 6 | 7 | function uploadAttachment(attachment) { 8 | // Create our form data to submit 9 | var file = attachment.file; 10 | var form = new FormData; 11 | form.append("Content-Type", file.type); 12 | form.append("photo[image]", file); 13 | 14 | // Create our XHR request 15 | var xhr = new XMLHttpRequest; 16 | xhr.open("POST", "/photos.json", true); 17 | xhr.setRequestHeader("X-CSRF-Token", Rails.csrfToken()); 18 | 19 | // Report file uploads back to Trix 20 | xhr.upload.onprogress = function(event) { 21 | var progress = event.loaded / event.total * 100; 22 | attachment.setUploadProgress(progress); 23 | } 24 | 25 | // Tell Trix what url and href to use on successful upload 26 | xhr.onload = function() { 27 | if (xhr.status === 201) { 28 | var data = JSON.parse(xhr.responseText); 29 | return attachment.setAttributes({ 30 | url: data.image_url, 31 | href: data.url 32 | }) 33 | } 34 | } 35 | 36 | return xhr.send(form); 37 | } 38 | 39 | // Listen for the Trix attachment event to trigger upload 40 | document.addEventListener("trix-attachment-add", function(event) { 41 | var attachment = event.attachment; 42 | if (attachment.file) { 43 | return uploadAttachment(attachment); 44 | } 45 | }); 46 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Sign Up

4 | 5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 6 | <%= devise_error_messages! %> 7 | 8 |
9 | <%= f.text_field :first_name, autofocus: true, class: 'form-control', placeholder: "First Name" %> 10 |
11 | 12 |
13 | <%= f.text_field :last_name, autofocus: false, class: 'form-control', placeholder: "Last Name" %> 14 |
15 | 16 |
17 | <%= f.email_field :email, autofocus: false, class: 'form-control', placeholder: "Email Address" %> 18 |
19 | 20 |
21 | <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %> 22 |
23 | 24 |
25 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %> 26 |
27 | 28 |
29 | <%= f.submit "Sign up", class: "btn btn-primary btn-block btn-lg" %> 30 |
31 | <% end %> 32 | 33 |
34 | <%= render "devise/shared/links" %> 35 |
36 |
37 |
38 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | margin: 33px; 5 | font-family: verdana, arial, helvetica, sans-serif; 6 | font-size: 13px; 7 | line-height: 18px; 8 | } 9 | 10 | p, ol, ul, td { 11 | font-family: verdana, arial, helvetica, sans-serif; 12 | font-size: 13px; 13 | line-height: 18px; 14 | } 15 | 16 | pre { 17 | background-color: #eee; 18 | padding: 10px; 19 | font-size: 11px; 20 | } 21 | 22 | a { 23 | color: #000; 24 | 25 | &:visited { 26 | color: #666; 27 | } 28 | 29 | &:hover { 30 | color: #fff; 31 | background-color: #000; 32 | } 33 | } 34 | 35 | th { 36 | padding-bottom: 5px; 37 | } 38 | 39 | td { 40 | padding: 0 5px 7px; 41 | } 42 | 43 | div { 44 | &.field, &.actions { 45 | margin-bottom: 10px; 46 | } 47 | } 48 | 49 | #notice { 50 | color: green; 51 | } 52 | 53 | .field_with_errors { 54 | padding: 2px; 55 | background-color: red; 56 | display: table; 57 | } 58 | 59 | #error_explanation { 60 | width: 450px; 61 | border: 2px solid red; 62 | padding: 7px 7px 0; 63 | margin-bottom: 20px; 64 | background-color: #f0f0f0; 65 | 66 | h2 { 67 | text-align: left; 68 | font-weight: bold; 69 | padding: 5px 5px 5px 15px; 70 | font-size: 12px; 71 | margin: -7px -7px 0; 72 | background-color: #c00; 73 | color: #fff; 74 | } 75 | 76 | ul li { 77 | font-size: 12px; 78 | list-style: square; 79 | } 80 | } 81 | 82 | label { 83 | display: block; 84 | } 85 | -------------------------------------------------------------------------------- /app/views/admin/users/show.html.erb: -------------------------------------------------------------------------------- 1 | <%# 2 | # Show 3 | 4 | This view is the template for the show page. 5 | It renders the attributes of a resource, 6 | as well as a link to its edit page. 7 | 8 | ## Local variables: 9 | 10 | - `page`: 11 | An instance of [Administrate::Page::Show][1]. 12 | Contains methods for accessing the resource to be displayed on the page, 13 | as well as helpers for describing how each attribute of the resource 14 | should be displayed. 15 | 16 | [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show 17 | %> 18 | 19 | <% content_for(:title) { "#{t("administrate.actions.show")} #{page.page_title}" } %> 20 | 21 | 36 | 37 |
38 |
39 | <% page.attributes.each do |attribute| %> 40 |
41 | <%= t( 42 | "helpers.label.#{resource_name}.#{attribute.name}", 43 | default: attribute.name.titleize, 44 | ) %> 45 |
46 | 47 |
<%= render_field attribute %>
49 | <% end %> 50 |
51 |
52 | -------------------------------------------------------------------------------- /db/migrate/20171003144108_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration[5.1] 2 | def change 3 | create_table :users do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.inet :current_sign_in_ip 20 | t.inet :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | t.string :first_name 34 | t.string :last_name 35 | t.datetime :announcements_last_read_at 36 | t.boolean :admin, default: false 37 | 38 | t.timestamps null: false 39 | end 40 | 41 | add_index :users, :email, unique: true 42 | add_index :users, :reset_password_token, unique: true 43 | # add_index :users, :confirmation_token, unique: true 44 | # add_index :users, :unlock_token, unique: true 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.seconds.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 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /app/dashboards/announcement_dashboard.rb: -------------------------------------------------------------------------------- 1 | require "administrate/base_dashboard" 2 | 3 | class AnnouncementDashboard < 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 | id: Field::Number, 12 | published_at: Field::DateTime, 13 | announcement_type: Field::Select.with_options(collection: Announcement::TYPES), 14 | name: Field::String, 15 | description: Field::Text, 16 | created_at: Field::DateTime, 17 | updated_at: Field::DateTime, 18 | }.freeze 19 | 20 | # COLLECTION_ATTRIBUTES 21 | # an array of attributes that will be displayed on the model's index page. 22 | # 23 | # By default, it's limited to four items to reduce clutter on index pages. 24 | # Feel free to add, remove, or rearrange items. 25 | COLLECTION_ATTRIBUTES = [ 26 | :id, 27 | :published_at, 28 | :announcement_type, 29 | :name, 30 | ].freeze 31 | 32 | # SHOW_PAGE_ATTRIBUTES 33 | # an array of attributes that will be displayed on the model's show page. 34 | SHOW_PAGE_ATTRIBUTES = [ 35 | :id, 36 | :published_at, 37 | :announcement_type, 38 | :name, 39 | :description, 40 | :created_at, 41 | :updated_at, 42 | ].freeze 43 | 44 | # FORM_ATTRIBUTES 45 | # an array of attributes that will be displayed 46 | # on the model's form (`new` and `edit`) pages. 47 | FORM_ATTRIBUTES = [ 48 | :published_at, 49 | :announcement_type, 50 | :name, 51 | :description, 52 | ].freeze 53 | 54 | # Overwrite this method to customize how announcements are displayed 55 | # across all pages of the admin dashboard. 56 | # 57 | # def display_resource(announcement) 58 | # "Announcement ##{announcement.id}" 59 | # end 60 | end 61 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/controllers/posts_controller.rb: -------------------------------------------------------------------------------- 1 | class PostsController < ApplicationController 2 | before_action :set_post, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /posts 5 | # GET /posts.json 6 | def index 7 | @posts = Post.all 8 | end 9 | 10 | # GET /posts/1 11 | # GET /posts/1.json 12 | def show 13 | end 14 | 15 | # GET /posts/new 16 | def new 17 | @post = Post.new 18 | end 19 | 20 | # GET /posts/1/edit 21 | def edit 22 | end 23 | 24 | # POST /posts 25 | # POST /posts.json 26 | def create 27 | @post = Post.new(post_params) 28 | 29 | respond_to do |format| 30 | if @post.save 31 | format.html { redirect_to @post, notice: 'Post was successfully created.' } 32 | format.json { render :show, status: :created, location: @post } 33 | else 34 | format.html { render :new } 35 | format.json { render json: @post.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /posts/1 41 | # PATCH/PUT /posts/1.json 42 | def update 43 | respond_to do |format| 44 | if @post.update(post_params) 45 | format.html { redirect_to @post, notice: 'Post was successfully updated.' } 46 | format.json { render :show, status: :ok, location: @post } 47 | else 48 | format.html { render :edit } 49 | format.json { render json: @post.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /posts/1 55 | # DELETE /posts/1.json 56 | def destroy 57 | @post.destroy 58 | respond_to do |format| 59 | format.html { redirect_to posts_url, notice: 'Post 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_post 67 | @post = Post.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def post_params 72 | params.require(:post).permit(:title, :body) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/controllers/photos_controller.rb: -------------------------------------------------------------------------------- 1 | class PhotosController < ApplicationController 2 | before_action :set_photo, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /photos 5 | # GET /photos.json 6 | def index 7 | @photos = Photo.all 8 | end 9 | 10 | # GET /photos/1 11 | # GET /photos/1.json 12 | def show 13 | end 14 | 15 | # GET /photos/new 16 | def new 17 | @photo = Photo.new 18 | end 19 | 20 | # GET /photos/1/edit 21 | def edit 22 | end 23 | 24 | # POST /photos 25 | # POST /photos.json 26 | def create 27 | @photo = Photo.new(photo_params) 28 | 29 | respond_to do |format| 30 | if @photo.save 31 | format.html { redirect_to @photo, notice: 'Photo was successfully created.' } 32 | format.json { render :show, status: :created, location: @photo } 33 | else 34 | format.html { render :new } 35 | format.json { render json: @photo.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /photos/1 41 | # PATCH/PUT /photos/1.json 42 | def update 43 | respond_to do |format| 44 | if @photo.update(photo_params) 45 | format.html { redirect_to @photo, notice: 'Photo was successfully updated.' } 46 | format.json { render :show, status: :ok, location: @photo } 47 | else 48 | format.html { render :edit } 49 | format.json { render json: @photo.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /photos/1 55 | # DELETE /photos/1.json 56 | def destroy 57 | @photo.destroy 58 | respond_to do |format| 59 | format.html { redirect_to photos_url, notice: 'Photo 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_photo 67 | @photo = Photo.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def photo_params 72 | params.require(:photo).permit(:image) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Account

4 | 5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 6 | <%= devise_error_messages! %> 7 | 8 |
9 | <%= f.text_field :first_name, autofocus: false, class: 'form-control', placeholder: "First Name" %> 10 |
11 | 12 |
13 | <%= f.text_field :last_name, autofocus: false, class: 'form-control', placeholder: "Last Name" %> 14 |
15 | 16 |
17 | <%= f.email_field :email, class: 'form-control', placeholder: 'Email Address' %> 18 |
19 | 20 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 21 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
22 | <% end %> 23 | 24 |
25 | <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %> 26 |

Leave password blank if you don't want to change it

27 |
28 | 29 |
30 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %> 31 |
32 | 33 |
34 | <%= f.password_field :current_password, autocomplete: "off", class: 'form-control', placeholder: 'Current Password' %> 35 |

We need your current password to confirm your changes

36 |
37 | 38 |
39 | <%= f.submit "Save Changes", class: 'btn btn-lg btn-block btn-primary' %> 40 |
41 | <% end %> 42 |
43 | 44 |

<%= link_to "Deactivate my account", registration_path(resource_name), data: { confirm: "Are you sure? You cannot undo this." }, method: :delete %>

45 |
46 |
47 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 3 | # Settings specified here will take precedence over those in config/application.rb. 4 | 5 | # In the development environment your application's code is reloaded on 6 | # every request. This slows down response time but is perfect for development 7 | # since you don't have to restart the web server when you make code changes. 8 | config.cache_classes = false 9 | 10 | # Do not eager load code on boot. 11 | config.eager_load = false 12 | 13 | # Show full error reports. 14 | config.consider_all_requests_local = true 15 | 16 | # Enable/disable caching. By default caching is disabled. 17 | if Rails.root.join('tmp/caching-dev.txt').exist? 18 | config.action_controller.perform_caching = true 19 | 20 | config.cache_store = :memory_store 21 | config.public_file_server.headers = { 22 | 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" 23 | } 24 | else 25 | config.action_controller.perform_caching = false 26 | 27 | config.cache_store = :null_store 28 | end 29 | 30 | # Don't care if the mailer can't send. 31 | config.action_mailer.raise_delivery_errors = false 32 | 33 | config.action_mailer.perform_caching = false 34 | 35 | # Print deprecation notices to the Rails logger. 36 | config.active_support.deprecation = :log 37 | 38 | # Raise an error on page load if there are pending migrations. 39 | config.active_record.migration_error = :page_load 40 | 41 | # Debug mode disables concatenation and preprocessing of assets. 42 | # This option may cause significant delays in view rendering with a large 43 | # number of complex assets. 44 | config.assets.debug = true 45 | 46 | # Suppress logger output for asset requests. 47 | config.assets.quiet = true 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 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $stdout.sync = true 3 | 4 | require "shellwords" 5 | require "yaml" 6 | require "socket" 7 | 8 | ENV["RAILS_ENV"] ||= "development" 9 | RAILS_ENV = ENV["RAILS_ENV"] 10 | 11 | ENV["NODE_ENV"] ||= RAILS_ENV 12 | NODE_ENV = ENV["NODE_ENV"] 13 | 14 | APP_PATH = File.expand_path("../", __dir__) 15 | CONFIG_FILE = File.join(APP_PATH, "config/webpacker.yml") 16 | NODE_MODULES_PATH = File.join(APP_PATH, "node_modules") 17 | WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js") 18 | 19 | DEFAULT_LISTEN_HOST_ADDR = NODE_ENV == 'development' ? 'localhost' : '0.0.0.0' 20 | 21 | def args(key) 22 | index = ARGV.index(key) 23 | index ? ARGV[index + 1] : nil 24 | end 25 | 26 | begin 27 | dev_server = YAML.load_file(CONFIG_FILE)[RAILS_ENV]["dev_server"] 28 | 29 | HOSTNAME = args('--host') || dev_server["host"] 30 | PORT = args('--port') || dev_server["port"] 31 | HTTPS = ARGV.include?('--https') || dev_server["https"] 32 | DEV_SERVER_ADDR = "http#{"s" if HTTPS}://#{HOSTNAME}:#{PORT}" 33 | LISTEN_HOST_ADDR = args('--listen-host') || DEFAULT_LISTEN_HOST_ADDR 34 | 35 | rescue Errno::ENOENT, NoMethodError 36 | $stdout.puts "Webpack dev_server configuration not found in #{CONFIG_FILE}." 37 | $stdout.puts "Please run bundle exec rails webpacker:install to install webpacker" 38 | exit! 39 | end 40 | 41 | begin 42 | server = TCPServer.new(LISTEN_HOST_ADDR, PORT) 43 | server.close 44 | 45 | rescue Errno::EADDRINUSE 46 | $stdout.puts "Another program is running on port #{PORT}. Set a new port in #{CONFIG_FILE} for dev_server" 47 | exit! 48 | end 49 | 50 | # Delete supplied host, port and listen-host CLI arguments 51 | ["--host", "--port", "--listen-host"].each do |arg| 52 | ARGV.delete(args(arg)) 53 | ARGV.delete(arg) 54 | end 55 | 56 | env = { "NODE_PATH" => NODE_MODULES_PATH.shellescape } 57 | 58 | cmd = [ 59 | "#{NODE_MODULES_PATH}/.bin/webpack-dev-server", "--progress", "--color", 60 | "--config", WEBPACK_CONFIG, 61 | "--host", LISTEN_HOST_ADDR, 62 | "--public", "#{HOSTNAME}:#{PORT}", 63 | "--port", PORT.to_s 64 | ] + ARGV 65 | 66 | Dir.chdir(APP_PATH) do 67 | exec env, *cmd 68 | end 69 | -------------------------------------------------------------------------------- /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 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. If you use this option 30 | # you need to make sure to reconnect any threads in the `on_worker_boot` 31 | # block. 32 | # 33 | # preload_app! 34 | 35 | # If you are preloading your application and using Active Record, it's 36 | # recommended that you close any connections to the database before workers 37 | # are forked to prevent connection leakage. 38 | # 39 | # before_fork do 40 | # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) 41 | # end 42 | 43 | # The code in the `on_worker_boot` will be called if you are using 44 | # clustered mode by specifying a number of `workers`. After each worker 45 | # process is booted, this block will be run. If you are using the `preload_app!` 46 | # option, you will want to use this block to reconnect to any threads 47 | # or connections that may have been created at application boot, as Ruby 48 | # cannot share connections between processes. 49 | # 50 | # on_worker_boot do 51 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 52 | # end 53 | # 54 | 55 | # Allow puma to be restarted by `rails restart` command. 56 | plugin :tmp_restart 57 | -------------------------------------------------------------------------------- /app/views/shared/_navbar.html.erb: -------------------------------------------------------------------------------- 1 | <% if user_masquerade? %> 2 |
3 | You're logged in as <%= current_user.name %> (<%= current_user.email %>) 4 | <%= link_to back_masquerade_path(current_user) do %><%= icon("times") %> Logout <% end %> 5 |
6 | <% end %> 7 | 8 | 48 | -------------------------------------------------------------------------------- /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: 20171003150750) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | 18 | create_table "announcements", force: :cascade do |t| 19 | t.datetime "published_at" 20 | t.string "announcement_type" 21 | t.string "name" 22 | t.text "description" 23 | t.datetime "created_at", null: false 24 | t.datetime "updated_at", null: false 25 | end 26 | 27 | create_table "photos", force: :cascade do |t| 28 | t.text "image_data" 29 | t.datetime "created_at", null: false 30 | t.datetime "updated_at", null: false 31 | end 32 | 33 | create_table "posts", force: :cascade do |t| 34 | t.string "title" 35 | t.text "body" 36 | t.datetime "created_at", null: false 37 | t.datetime "updated_at", null: false 38 | end 39 | 40 | create_table "users", force: :cascade do |t| 41 | t.string "email", default: "", null: false 42 | t.string "encrypted_password", default: "", null: false 43 | t.string "reset_password_token" 44 | t.datetime "reset_password_sent_at" 45 | t.datetime "remember_created_at" 46 | t.integer "sign_in_count", default: 0, null: false 47 | t.datetime "current_sign_in_at" 48 | t.datetime "last_sign_in_at" 49 | t.inet "current_sign_in_ip" 50 | t.inet "last_sign_in_ip" 51 | t.string "first_name" 52 | t.string "last_name" 53 | t.datetime "announcements_last_read_at" 54 | t.boolean "admin", default: false 55 | t.datetime "created_at", null: false 56 | t.datetime "updated_at", null: false 57 | t.index ["email"], name: "index_users_on_email", unique: true 58 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 59 | end 60 | 61 | end 62 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | git_source(:github) do |repo_name| 4 | repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 5 | "https://github.com/#{repo_name}.git" 6 | end 7 | 8 | 9 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 10 | gem 'rails', '~> 5.1.4' 11 | # Use postgresql as the database for Active Record 12 | gem 'pg', '~> 0.18' 13 | # Use Puma as the app server 14 | gem 'puma', '~> 3.7' 15 | # Use SCSS for stylesheets 16 | gem 'sass-rails', '~> 5.0' 17 | # Use Uglifier as compressor for JavaScript assets 18 | gem 'uglifier', '>= 1.3.0' 19 | # See https://github.com/rails/execjs#readme for more supported runtimes 20 | # gem 'therubyracer', platforms: :ruby 21 | 22 | # Use CoffeeScript for .coffee assets and views 23 | gem 'coffee-rails', '~> 4.2' 24 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 25 | gem 'turbolinks', '~> 5' 26 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 27 | gem 'jbuilder', '~> 2.5' 28 | # Use Redis adapter to run Action Cable in production 29 | # gem 'redis', '~> 3.0' 30 | # Use ActiveModel has_secure_password 31 | # gem 'bcrypt', '~> 3.1.7' 32 | 33 | # Use Capistrano for deployment 34 | # gem 'capistrano-rails', group: :development 35 | 36 | group :development, :test do 37 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 38 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 39 | # Adds support for Capybara system testing and selenium driver 40 | gem 'capybara', '~> 2.13' 41 | gem 'selenium-webdriver' 42 | end 43 | 44 | group :development do 45 | # Access an IRB console on exception pages or by using <%= 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 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 54 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 55 | 56 | gem 'administrate', '~> 0.8.1' 57 | gem 'devise', '~> 4.3.0' 58 | gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4' 59 | gem 'devise_masquerade', '~> 0.6.0' 60 | gem 'font-awesome-sass', '~> 4.7' 61 | gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag' 62 | gem 'jquery-rails', '~> 4.3.1' 63 | gem 'bootstrap', '~> 4.0.0.beta' 64 | gem 'webpacker', '~> 3.0' 65 | gem 'sidekiq', '~> 5.0' 66 | gem 'foreman', '~> 0.84.0' 67 | 68 | gem 'trix' 69 | gem 'shrine' 70 | -------------------------------------------------------------------------------- /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 | id: Field::Number, 12 | email: Field::String, 13 | encrypted_password: Field::String, 14 | reset_password_token: Field::String, 15 | reset_password_sent_at: Field::DateTime, 16 | remember_created_at: Field::DateTime, 17 | sign_in_count: Field::Number, 18 | current_sign_in_at: Field::DateTime, 19 | last_sign_in_at: Field::DateTime, 20 | current_sign_in_ip: Field::String.with_options(searchable: false), 21 | last_sign_in_ip: Field::String.with_options(searchable: false), 22 | first_name: Field::String, 23 | last_name: Field::String, 24 | announcements_last_read_at: Field::DateTime, 25 | admin: Field::Boolean, 26 | created_at: Field::DateTime, 27 | updated_at: Field::DateTime, 28 | }.freeze 29 | 30 | # COLLECTION_ATTRIBUTES 31 | # an array of attributes that will be displayed on the model's index page. 32 | # 33 | # By default, it's limited to four items to reduce clutter on index pages. 34 | # Feel free to add, remove, or rearrange items. 35 | COLLECTION_ATTRIBUTES = [ 36 | :id, 37 | :email, 38 | :encrypted_password, 39 | :reset_password_token, 40 | ].freeze 41 | 42 | # SHOW_PAGE_ATTRIBUTES 43 | # an array of attributes that will be displayed on the model's show page. 44 | SHOW_PAGE_ATTRIBUTES = [ 45 | :id, 46 | :email, 47 | :encrypted_password, 48 | :reset_password_token, 49 | :reset_password_sent_at, 50 | :remember_created_at, 51 | :sign_in_count, 52 | :current_sign_in_at, 53 | :last_sign_in_at, 54 | :current_sign_in_ip, 55 | :last_sign_in_ip, 56 | :first_name, 57 | :last_name, 58 | :announcements_last_read_at, 59 | :admin, 60 | :created_at, 61 | :updated_at, 62 | ].freeze 63 | 64 | # FORM_ATTRIBUTES 65 | # an array of attributes that will be displayed 66 | # on the model's form (`new` and `edit`) pages. 67 | FORM_ATTRIBUTES = [ 68 | :email, 69 | :encrypted_password, 70 | :reset_password_token, 71 | :reset_password_sent_at, 72 | :remember_created_at, 73 | :sign_in_count, 74 | :current_sign_in_at, 75 | :last_sign_in_at, 76 | :current_sign_in_ip, 77 | :last_sign_in_ip, 78 | :first_name, 79 | :last_name, 80 | :announcements_last_read_at, 81 | :admin, 82 | ].freeze 83 | 84 | # Overwrite this method to customize how users are displayed 85 | # across all pages of the admin dashboard. 86 | # 87 | # def display_resource(user) 88 | # "User ##{user.id}" 89 | # end 90 | end 91 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.1 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X 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 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: trix_example_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: trix_example 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: trix_example_test 61 | 62 | # As with config/secrets.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 http://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: trix_example_production 84 | username: trix_example 85 | password: <%= ENV['TRIX_EXAMPLE_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /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 | # Attempt to read encrypted secrets from `config/secrets.yml.enc`. 18 | # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or 19 | # `config/secrets.yml.key`. 20 | config.read_encrypted_secrets = true 21 | 22 | # Disable serving static files from the `/public` folder by default since 23 | # Apache or NGINX already handles this. 24 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 25 | 26 | # Compress JavaScripts and CSS. 27 | config.assets.js_compressor = :uglifier 28 | # config.assets.css_compressor = :sass 29 | 30 | # Do not fallback to assets pipeline if a precompiled asset is missed. 31 | config.assets.compile = false 32 | 33 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 34 | 35 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 36 | # config.action_controller.asset_host = 'http://assets.example.com' 37 | 38 | # Specifies the header that your server uses for sending files. 39 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 40 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 41 | 42 | # Mount Action Cable outside main process or domain 43 | # config.action_cable.mount_path = nil 44 | # config.action_cable.url = 'wss://example.com/cable' 45 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 46 | 47 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 48 | # config.force_ssl = true 49 | 50 | # Use the lowest log level to ensure availability of diagnostic information 51 | # when problems arise. 52 | config.log_level = :debug 53 | 54 | # Prepend all log lines with the following tags. 55 | config.log_tags = [ :request_id ] 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Use a real queuing backend for Active Job (and separate queues per environment) 61 | # config.active_job.queue_adapter = :resque 62 | # config.active_job.queue_name_prefix = "trix_example_#{Rails.env}" 63 | config.action_mailer.perform_caching = false 64 | 65 | # Ignore bad email addresses and do not raise email delivery errors. 66 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 67 | # config.action_mailer.raise_delivery_errors = false 68 | 69 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 70 | # the I18n.default_locale when a translation cannot be found). 71 | config.i18n.fallbacks = true 72 | 73 | # Send deprecation notices to registered listeners. 74 | config.active_support.deprecation = :notify 75 | 76 | # Use default logging formatter so that PID and timestamp are not suppressed. 77 | config.log_formatter = ::Logger::Formatter.new 78 | 79 | # Use a different logger for distributed setups. 80 | # require 'syslog/logger' 81 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 82 | 83 | if ENV["RAILS_LOG_TO_STDOUT"].present? 84 | logger = ActiveSupport::Logger.new(STDOUT) 85 | logger.formatter = config.log_formatter 86 | config.logger = ActiveSupport::TaggedLogging.new(logger) 87 | end 88 | 89 | # Do not dump schema after migrations. 90 | config.active_record.dump_schema_after_migration = false 91 | end 92 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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: 61ba79bd92d23a1edd5126d903d76b0c94f09641 11 | specs: 12 | gravatar_image_tag (1.2.0) 13 | 14 | GEM 15 | remote: https://rubygems.org/ 16 | specs: 17 | actioncable (5.1.4) 18 | actionpack (= 5.1.4) 19 | nio4r (~> 2.0) 20 | websocket-driver (~> 0.6.1) 21 | actionmailer (5.1.4) 22 | actionpack (= 5.1.4) 23 | actionview (= 5.1.4) 24 | activejob (= 5.1.4) 25 | mail (~> 2.5, >= 2.5.4) 26 | rails-dom-testing (~> 2.0) 27 | actionpack (5.1.4) 28 | actionview (= 5.1.4) 29 | activesupport (= 5.1.4) 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.1.4) 35 | activesupport (= 5.1.4) 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.1.4) 41 | activesupport (= 5.1.4) 42 | globalid (>= 0.3.6) 43 | activemodel (5.1.4) 44 | activesupport (= 5.1.4) 45 | activerecord (5.1.4) 46 | activemodel (= 5.1.4) 47 | activesupport (= 5.1.4) 48 | arel (~> 8.0) 49 | activesupport (5.1.4) 50 | concurrent-ruby (~> 1.0, >= 1.0.2) 51 | i18n (~> 0.7) 52 | minitest (~> 5.1) 53 | tzinfo (~> 1.1) 54 | addressable (2.5.2) 55 | public_suffix (>= 2.0.2, < 4.0) 56 | administrate (0.8.1) 57 | actionpack (>= 4.2, < 5.2) 58 | actionview (>= 4.2, < 5.2) 59 | activerecord (>= 4.2, < 5.2) 60 | autoprefixer-rails (>= 6.0) 61 | datetime_picker_rails (~> 0.0.7) 62 | jquery-rails (>= 4.0) 63 | kaminari (>= 1.0) 64 | momentjs-rails (~> 2.8) 65 | sass-rails (~> 5.0) 66 | selectize-rails (~> 0.6) 67 | arel (8.0.0) 68 | autoprefixer-rails (7.1.4.1) 69 | execjs 70 | bcrypt (3.1.11) 71 | bindex (0.5.0) 72 | bootstrap (4.0.0.beta) 73 | autoprefixer-rails (>= 6.0.3) 74 | popper_js (~> 1.11.1) 75 | sass (>= 3.4.19) 76 | builder (3.2.3) 77 | byebug (9.1.0) 78 | capybara (2.15.2) 79 | addressable 80 | mini_mime (>= 0.1.3) 81 | nokogiri (>= 1.3.3) 82 | rack (>= 1.0.0) 83 | rack-test (>= 0.5.4) 84 | xpath (~> 2.0) 85 | childprocess (0.8.0) 86 | ffi (~> 1.0, >= 1.0.11) 87 | coffee-rails (4.2.2) 88 | coffee-script (>= 2.2.0) 89 | railties (>= 4.0.0) 90 | coffee-script (2.4.1) 91 | coffee-script-source 92 | execjs 93 | coffee-script-source (1.12.2) 94 | concurrent-ruby (1.0.5) 95 | connection_pool (2.2.1) 96 | crass (1.0.2) 97 | datetime_picker_rails (0.0.7) 98 | momentjs-rails (>= 2.8.1) 99 | devise (4.3.0) 100 | bcrypt (~> 3.0) 101 | orm_adapter (~> 0.1) 102 | railties (>= 4.1.0, < 5.2) 103 | responders 104 | warden (~> 1.2.3) 105 | devise_masquerade (0.6.1) 106 | devise (>= 2.1.0) 107 | railties (>= 3.0) 108 | down (4.0.1) 109 | erubi (1.6.1) 110 | execjs (2.7.0) 111 | ffi (1.9.18) 112 | font-awesome-sass (4.7.0) 113 | sass (>= 3.2) 114 | foreman (0.84.0) 115 | thor (~> 0.19.1) 116 | globalid (0.4.0) 117 | activesupport (>= 4.2.0) 118 | i18n (0.8.6) 119 | jbuilder (2.7.0) 120 | activesupport (>= 4.2.0) 121 | multi_json (>= 1.2) 122 | jquery-rails (4.3.1) 123 | rails-dom-testing (>= 1, < 3) 124 | railties (>= 4.2.0) 125 | thor (>= 0.14, < 2.0) 126 | kaminari (1.0.1) 127 | activesupport (>= 4.1.0) 128 | kaminari-actionview (= 1.0.1) 129 | kaminari-activerecord (= 1.0.1) 130 | kaminari-core (= 1.0.1) 131 | kaminari-actionview (1.0.1) 132 | actionview 133 | kaminari-core (= 1.0.1) 134 | kaminari-activerecord (1.0.1) 135 | activerecord 136 | kaminari-core (= 1.0.1) 137 | kaminari-core (1.0.1) 138 | listen (3.1.5) 139 | rb-fsevent (~> 0.9, >= 0.9.4) 140 | rb-inotify (~> 0.9, >= 0.9.7) 141 | ruby_dep (~> 1.2) 142 | loofah (2.1.1) 143 | crass (~> 1.0.2) 144 | nokogiri (>= 1.5.9) 145 | mail (2.6.6) 146 | mime-types (>= 1.16, < 4) 147 | method_source (0.9.0) 148 | mime-types (3.1) 149 | mime-types-data (~> 3.2015) 150 | mime-types-data (3.2016.0521) 151 | mini_mime (0.1.4) 152 | mini_portile2 (2.3.0) 153 | minitest (5.10.3) 154 | momentjs-rails (2.17.1) 155 | railties (>= 3.1) 156 | multi_json (1.12.2) 157 | nio4r (2.1.0) 158 | nokogiri (1.8.1) 159 | mini_portile2 (~> 2.3.0) 160 | orm_adapter (0.5.0) 161 | pg (0.21.0) 162 | popper_js (1.11.1) 163 | public_suffix (3.0.0) 164 | puma (3.10.0) 165 | rack (2.0.3) 166 | rack-protection (2.0.0) 167 | rack 168 | rack-proxy (0.6.2) 169 | rack 170 | rack-test (0.7.0) 171 | rack (>= 1.0, < 3) 172 | rails (5.1.4) 173 | actioncable (= 5.1.4) 174 | actionmailer (= 5.1.4) 175 | actionpack (= 5.1.4) 176 | actionview (= 5.1.4) 177 | activejob (= 5.1.4) 178 | activemodel (= 5.1.4) 179 | activerecord (= 5.1.4) 180 | activesupport (= 5.1.4) 181 | bundler (>= 1.3.0) 182 | railties (= 5.1.4) 183 | sprockets-rails (>= 2.0.0) 184 | rails-dom-testing (2.0.3) 185 | activesupport (>= 4.2.0) 186 | nokogiri (>= 1.6) 187 | rails-html-sanitizer (1.0.3) 188 | loofah (~> 2.0) 189 | railties (5.1.4) 190 | actionpack (= 5.1.4) 191 | activesupport (= 5.1.4) 192 | method_source 193 | rake (>= 0.8.7) 194 | thor (>= 0.18.1, < 2.0) 195 | rake (12.1.0) 196 | rb-fsevent (0.10.2) 197 | rb-inotify (0.9.10) 198 | ffi (>= 0.5.0, < 2) 199 | redis (4.0.1) 200 | responders (2.4.0) 201 | actionpack (>= 4.2.0, < 5.3) 202 | railties (>= 4.2.0, < 5.3) 203 | ruby_dep (1.5.0) 204 | rubyzip (1.2.1) 205 | sass (3.5.1) 206 | sass-listen (~> 4.0.0) 207 | sass-listen (4.0.0) 208 | rb-fsevent (~> 0.9, >= 0.9.4) 209 | rb-inotify (~> 0.9, >= 0.9.7) 210 | sass-rails (5.0.6) 211 | railties (>= 4.0.0, < 6) 212 | sass (~> 3.1) 213 | sprockets (>= 2.8, < 4.0) 214 | sprockets-rails (>= 2.0, < 4.0) 215 | tilt (>= 1.1, < 3) 216 | selectize-rails (0.12.4) 217 | selenium-webdriver (3.6.0) 218 | childprocess (~> 0.5) 219 | rubyzip (~> 1.0) 220 | shrine (2.6.1) 221 | down (>= 2.3.6) 222 | sidekiq (5.0.5) 223 | concurrent-ruby (~> 1.0) 224 | connection_pool (~> 2.2, >= 2.2.0) 225 | rack-protection (>= 1.5.0) 226 | redis (>= 3.3.4, < 5) 227 | spring (2.0.2) 228 | activesupport (>= 4.2) 229 | spring-watcher-listen (2.0.1) 230 | listen (>= 2.7, < 4.0) 231 | spring (>= 1.2, < 3.0) 232 | sprockets (3.7.1) 233 | concurrent-ruby (~> 1.0) 234 | rack (> 1, < 3) 235 | sprockets-rails (3.2.1) 236 | actionpack (>= 4.0) 237 | activesupport (>= 4.0) 238 | sprockets (>= 3.0.0) 239 | thor (0.19.4) 240 | thread_safe (0.3.6) 241 | tilt (2.0.8) 242 | trix (0.11.0) 243 | rails (> 4.1, < 5.2) 244 | turbolinks (5.0.1) 245 | turbolinks-source (~> 5) 246 | turbolinks-source (5.0.3) 247 | tzinfo (1.2.3) 248 | thread_safe (~> 0.1) 249 | uglifier (3.2.0) 250 | execjs (>= 0.3.0, < 3) 251 | warden (1.2.7) 252 | rack (>= 1.0) 253 | web-console (3.5.1) 254 | actionview (>= 5.0) 255 | activemodel (>= 5.0) 256 | bindex (>= 0.4.0) 257 | railties (>= 5.0) 258 | webpacker (3.0.1) 259 | activesupport (>= 4.2) 260 | rack-proxy (>= 0.6.1) 261 | railties (>= 4.2) 262 | websocket-driver (0.6.5) 263 | websocket-extensions (>= 0.1.0) 264 | websocket-extensions (0.1.2) 265 | xpath (2.1.0) 266 | nokogiri (~> 1.3) 267 | 268 | PLATFORMS 269 | ruby 270 | 271 | DEPENDENCIES 272 | administrate (~> 0.8.1) 273 | bootstrap (~> 4.0.0.beta) 274 | byebug 275 | capybara (~> 2.13) 276 | coffee-rails (~> 4.2) 277 | devise (~> 4.3.0) 278 | devise-bootstrapped! 279 | devise_masquerade (~> 0.6.0) 280 | font-awesome-sass (~> 4.7) 281 | foreman (~> 0.84.0) 282 | gravatar_image_tag! 283 | jbuilder (~> 2.5) 284 | jquery-rails (~> 4.3.1) 285 | listen (>= 3.0.5, < 3.2) 286 | pg (~> 0.18) 287 | puma (~> 3.7) 288 | rails (~> 5.1.4) 289 | sass-rails (~> 5.0) 290 | selenium-webdriver 291 | shrine 292 | sidekiq (~> 5.0) 293 | spring 294 | spring-watcher-listen (~> 2.0.0) 295 | trix 296 | turbolinks (~> 5) 297 | tzinfo-data 298 | uglifier (>= 1.3.0) 299 | web-console (>= 3.3.0) 300 | webpacker (~> 3.0) 301 | 302 | BUNDLED WITH 303 | 1.15.3 304 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # Use this hook to configure devise mailer, warden hooks and so forth. 2 | # Many of these configuration options can be set straight in your model. 3 | Devise.setup do |config| 4 | # The secret key used by Devise. Devise uses this key to generate 5 | # random tokens. Changing this key will render invalid all existing 6 | # confirmation, reset password and unlock tokens in the database. 7 | # Devise will use the `secret_key_base` as its `secret_key` 8 | # by default. You can change it below and use your own secret key. 9 | # config.secret_key = 'dd441f5b4ec4862ac9bdd2ddfbb24ed390e9ec935d06f6169bd22e00076e545a50c6832e85fe07d31aebcd380d60b11a21dd919ca09ab8841cb8133779d294a1' 10 | 11 | # ==> Mailer Configuration 12 | # Configure the e-mail address which will be shown in Devise::Mailer, 13 | # note that it will be overwritten if you use your own mailer class 14 | # with default "from" parameter. 15 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 16 | 17 | # Configure the class responsible to send e-mails. 18 | # config.mailer = 'Devise::Mailer' 19 | 20 | # Configure the parent class responsible to send e-mails. 21 | # config.parent_mailer = 'ActionMailer::Base' 22 | 23 | # ==> ORM configuration 24 | # Load and configure the ORM. Supports :active_record (default) and 25 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 26 | # available as additional gems. 27 | require 'devise/orm/active_record' 28 | 29 | # ==> Configuration for any authentication mechanism 30 | # Configure which keys are used when authenticating a user. The default is 31 | # just :email. You can configure it to use [:username, :subdomain], so for 32 | # authenticating a user, both parameters are required. Remember that those 33 | # parameters are used only when authenticating and not when retrieving from 34 | # session. If you need permissions, you should implement that in a before filter. 35 | # You can also supply a hash where the value is a boolean determining whether 36 | # or not authentication should be aborted when the value is not present. 37 | # config.authentication_keys = [:email] 38 | 39 | # Configure parameters from the request object used for authentication. Each entry 40 | # given should be a request method and it will automatically be passed to the 41 | # find_for_authentication method and considered in your model lookup. For instance, 42 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 43 | # The same considerations mentioned for authentication_keys also apply to request_keys. 44 | # config.request_keys = [] 45 | 46 | # Configure which authentication keys should be case-insensitive. 47 | # These keys will be downcased upon creating or modifying a user and when used 48 | # to authenticate or find a user. Default is :email. 49 | config.case_insensitive_keys = [:email] 50 | 51 | # Configure which authentication keys should have whitespace stripped. 52 | # These keys will have whitespace before and after removed upon creating or 53 | # modifying a user and when used to authenticate or find a user. Default is :email. 54 | config.strip_whitespace_keys = [:email] 55 | 56 | # Tell if authentication through request.params is enabled. True by default. 57 | # It can be set to an array that will enable params authentication only for the 58 | # given strategies, for example, `config.params_authenticatable = [:database]` will 59 | # enable it only for database (email + password) authentication. 60 | # config.params_authenticatable = true 61 | 62 | # Tell if authentication through HTTP Auth is enabled. False by default. 63 | # It can be set to an array that will enable http authentication only for the 64 | # given strategies, for example, `config.http_authenticatable = [:database]` will 65 | # enable it only for database authentication. The supported strategies are: 66 | # :database = Support basic authentication with authentication key + password 67 | # config.http_authenticatable = false 68 | 69 | # If 401 status code should be returned for AJAX requests. True by default. 70 | # config.http_authenticatable_on_xhr = true 71 | 72 | # The realm used in Http Basic Authentication. 'Application' by default. 73 | # config.http_authentication_realm = 'Application' 74 | 75 | # It will change confirmation, password recovery and other workflows 76 | # to behave the same regardless if the e-mail provided was right or wrong. 77 | # Does not affect registerable. 78 | # config.paranoid = true 79 | 80 | # By default Devise will store the user in session. You can skip storage for 81 | # particular strategies by setting this option. 82 | # Notice that if you are skipping storage for all authentication paths, you 83 | # may want to disable generating routes to Devise's sessions controller by 84 | # passing skip: :sessions to `devise_for` in your config/routes.rb 85 | config.skip_session_storage = [:http_auth] 86 | 87 | # By default, Devise cleans up the CSRF token on authentication to 88 | # avoid CSRF token fixation attacks. This means that, when using AJAX 89 | # requests for sign in and sign up, you need to get a new CSRF token 90 | # from the server. You can disable this option at your own risk. 91 | # config.clean_up_csrf_token_on_authentication = true 92 | 93 | # When false, Devise will not attempt to reload routes on eager load. 94 | # This can reduce the time taken to boot the app but if your application 95 | # requires the Devise mappings to be loaded during boot time the application 96 | # won't boot properly. 97 | # config.reload_routes = true 98 | 99 | # ==> Configuration for :database_authenticatable 100 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If 101 | # using other algorithms, it sets how many times you want the password to be hashed. 102 | # 103 | # Limiting the stretches to just one in testing will increase the performance of 104 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 105 | # a value less than 10 in other environments. Note that, for bcrypt (the default 106 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 107 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 108 | config.stretches = Rails.env.test? ? 1 : 11 109 | 110 | # Set up a pepper to generate the hashed password. 111 | # config.pepper = '4446d9a5de0a2b7e6c20a724984d49b924ef4f7c47aef6ea63ef51a2da25d0ae06851b5e4c5dba1d5c34321fe89145cbd29d1b4c9d346e3fcb57f987f248cc26' 112 | 113 | # Send a notification to the original email when the user's email is changed. 114 | # config.send_email_changed_notification = false 115 | 116 | # Send a notification email when the user's password is changed. 117 | # config.send_password_change_notification = false 118 | 119 | # ==> Configuration for :confirmable 120 | # A period that the user is allowed to access the website even without 121 | # confirming their account. For instance, if set to 2.days, the user will be 122 | # able to access the website for two days without confirming their account, 123 | # access will be blocked just in the third day. Default is 0.days, meaning 124 | # the user cannot access the website without confirming their account. 125 | # config.allow_unconfirmed_access_for = 2.days 126 | 127 | # A period that the user is allowed to confirm their account before their 128 | # token becomes invalid. For example, if set to 3.days, the user can confirm 129 | # their account within 3 days after the mail was sent, but on the fourth day 130 | # their account can't be confirmed with the token any more. 131 | # Default is nil, meaning there is no restriction on how long a user can take 132 | # before confirming their account. 133 | # config.confirm_within = 3.days 134 | 135 | # If true, requires any email changes to be confirmed (exactly the same way as 136 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 137 | # db field (see migrations). Until confirmed, new email is stored in 138 | # unconfirmed_email column, and copied to email column on successful confirmation. 139 | config.reconfirmable = true 140 | 141 | # Defines which key will be used when confirming an account 142 | # config.confirmation_keys = [:email] 143 | 144 | # ==> Configuration for :rememberable 145 | # The time the user will be remembered without asking for credentials again. 146 | # config.remember_for = 2.weeks 147 | 148 | # Invalidates all the remember me tokens when the user signs out. 149 | config.expire_all_remember_me_on_sign_out = true 150 | 151 | # If true, extends the user's remember period when remembered via cookie. 152 | # config.extend_remember_period = false 153 | 154 | # Options to be passed to the created cookie. For instance, you can set 155 | # secure: true in order to force SSL only cookies. 156 | # config.rememberable_options = {} 157 | 158 | # ==> Configuration for :validatable 159 | # Range for password length. 160 | config.password_length = 6..128 161 | 162 | # Email regex used to validate email formats. It simply asserts that 163 | # one (and only one) @ exists in the given string. This is mainly 164 | # to give user feedback and not to assert the e-mail validity. 165 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 166 | 167 | # ==> Configuration for :timeoutable 168 | # The time you want to timeout the user session without activity. After this 169 | # time the user will be asked for credentials again. Default is 30 minutes. 170 | # config.timeout_in = 30.minutes 171 | 172 | # ==> Configuration for :lockable 173 | # Defines which strategy will be used to lock an account. 174 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 175 | # :none = No lock strategy. You should handle locking by yourself. 176 | # config.lock_strategy = :failed_attempts 177 | 178 | # Defines which key will be used when locking and unlocking an account 179 | # config.unlock_keys = [:email] 180 | 181 | # Defines which strategy will be used to unlock an account. 182 | # :email = Sends an unlock link to the user email 183 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 184 | # :both = Enables both strategies 185 | # :none = No unlock strategy. You should handle unlocking by yourself. 186 | # config.unlock_strategy = :both 187 | 188 | # Number of authentication tries before locking an account if lock_strategy 189 | # is failed attempts. 190 | # config.maximum_attempts = 20 191 | 192 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 193 | # config.unlock_in = 1.hour 194 | 195 | # Warn on the last attempt before the account is locked. 196 | # config.last_attempt_warning = true 197 | 198 | # ==> Configuration for :recoverable 199 | # 200 | # Defines which key will be used when recovering the password for an account 201 | # config.reset_password_keys = [:email] 202 | 203 | # Time interval you can reset your password with a reset password key. 204 | # Don't put a too small interval or your users won't have the time to 205 | # change their passwords. 206 | config.reset_password_within = 6.hours 207 | 208 | # When set to false, does not sign a user in automatically after their password is 209 | # reset. Defaults to true, so a user is signed in automatically after a reset. 210 | # config.sign_in_after_reset_password = true 211 | 212 | # ==> Configuration for :encryptable 213 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 214 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 215 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 216 | # for default behavior) and :restful_authentication_sha1 (then you should set 217 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 218 | # 219 | # Require the `devise-encryptable` gem when using anything other than bcrypt 220 | # config.encryptor = :sha512 221 | 222 | # ==> Scopes configuration 223 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 224 | # "users/sessions/new". It's turned off by default because it's slower if you 225 | # are using only default views. 226 | # config.scoped_views = false 227 | 228 | # Configure the default scope given to Warden. By default it's the first 229 | # devise role declared in your routes (usually :user). 230 | # config.default_scope = :user 231 | 232 | # Set this configuration to false if you want /users/sign_out to sign out 233 | # only the current scope. By default, Devise signs out all scopes. 234 | # config.sign_out_all_scopes = true 235 | 236 | # ==> Navigation configuration 237 | # Lists the formats that should be treated as navigational. Formats like 238 | # :html, should redirect to the sign in page when the user does not have 239 | # access, but formats like :xml or :json, should return 401. 240 | # 241 | # If you have any extra navigational formats, like :iphone or :mobile, you 242 | # should add them to the navigational formats lists. 243 | # 244 | # The "*/*" below is required to match Internet Explorer requests. 245 | # config.navigational_formats = ['*/*', :html] 246 | 247 | # The default HTTP method used to sign out a resource. Default is :delete. 248 | config.sign_out_via = :delete 249 | 250 | # ==> OmniAuth 251 | # Add a new OmniAuth provider. Check the wiki for more information on setting 252 | # up on your models and hooks. 253 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 254 | 255 | # ==> Warden configuration 256 | # If you want to use other strategies, that are not supported by Devise, or 257 | # change the failure app, you can configure them inside the config.warden block. 258 | # 259 | # config.warden do |manager| 260 | # manager.intercept_401 = false 261 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 262 | # end 263 | 264 | # ==> Mountable engine configurations 265 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 266 | # is mountable, there are some extra configurations to be taken into account. 267 | # The following options are available, assuming the engine is mounted as: 268 | # 269 | # mount MyEngine, at: '/my_engine' 270 | # 271 | # The router that invoked `devise_for`, in the example above, would be: 272 | # config.router_name = :my_engine 273 | # 274 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 275 | # so you need to do it manually. For the users scope, it would be: 276 | # config.omniauth_path_prefix = '/my_engine/users/auth' 277 | end 278 | --------------------------------------------------------------------------------