├── log └── .keep ├── storage └── .keep ├── tmp └── .keep ├── vendor └── .keep ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── public ├── favicon.ico ├── apple-touch-icon.png ├── apple-touch-icon-precomposed.png ├── open_todoist_logo.png ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── .ruby-version ├── app ├── assets │ ├── images │ │ └── .keep │ ├── config │ │ └── manifest.js │ └── stylesheets │ │ ├── controllers │ │ ├── tasksArchiveds.scss │ │ ├── login.scss │ │ └── home.scss │ │ ├── shared │ │ ├── sidebar.scss │ │ └── header.scss │ │ └── application.scss ├── models │ ├── concerns │ │ └── .keep │ ├── application_record.rb │ ├── score.rb │ ├── project.rb │ ├── user.rb │ └── task.rb ├── controllers │ ├── concerns │ │ ├── .keep │ │ └── response.rb │ ├── home_controller.rb │ ├── application_controller.rb │ └── api │ │ └── v1 │ │ ├── users_controller.rb │ │ ├── skills_controller.rb │ │ ├── sessions_controller.rb │ │ ├── tasks_controller.rb │ │ └── projects_controller.rb ├── views │ ├── layouts │ │ ├── mailer.text.erb │ │ ├── mailer.html.erb │ │ └── application.html.erb │ └── home │ │ └── index.html.erb ├── helpers │ └── application_helper.rb ├── jobs │ └── application_job.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── mailers │ └── application_mailer.rb ├── javascript │ ├── packs │ │ ├── week │ │ │ └── index.vue │ │ ├── routes.js │ │ ├── App.vue │ │ ├── application.js │ │ ├── login │ │ │ └── index.vue │ │ ├── shared │ │ │ ├── header.vue │ │ │ └── sidebar.vue │ │ ├── tasksArchiveds │ │ │ └── index.vue │ │ └── home │ │ │ └── index.vue │ └── channels │ │ ├── index.js │ │ └── consumer.js └── serializers │ └── api │ └── v1 │ ├── user_serializer.rb │ ├── session_serializer.rb │ ├── task_serializer.rb │ └── project_serializer.rb ├── .browserslistrc ├── .rspec ├── start.sh ├── db ├── seeds.rb ├── migrate │ ├── 20200410224823_add_authentication_token_to_users.rb │ ├── 20200405210627_scores.rb │ ├── 20200405210811_projects.rb │ ├── 20200405210817_tasks.rb │ └── 20200405210759_devise_create_users.rb └── schema.rb ├── Procfile.old ├── config ├── webpack │ ├── loaders │ │ └── vue.js │ ├── test.js │ ├── production.js │ ├── development.js │ └── environment.js ├── spring.rb ├── environment.rb ├── initializers │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── application_controller_renderer.rb │ ├── cookies_serializer.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── assets.rb │ ├── inflections.rb │ ├── content_security_policy.rb │ └── devise.rb ├── cable.yml ├── boot.rb ├── application.rb ├── credentials.yml.enc ├── database.yml ├── routes.rb ├── locales │ ├── en.yml │ └── devise.en.yml ├── storage.yml ├── puma.rb ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb └── webpacker.yml ├── docker-entrypoint.sh ├── spec ├── support │ └── response.rb ├── factories │ ├── score.rb │ ├── task.rb │ ├── project.rb │ └── user.rb ├── spec_helper.rb ├── models │ ├── product_spec.rb │ └── task_spec.rb ├── rails_helper.rb └── requests │ └── api │ └── v1 │ ├── tasks_request_spec.rb │ └── projects_request_spec.rb ├── config.ru ├── postcss.config.js ├── bin ├── rake ├── rails ├── yarn ├── webpack ├── webpack-dev-server ├── spring ├── setup └── bundle ├── Rakefile ├── docker-compose.yml ├── CONTRIBUING.md ├── Dockerfile ├── package.json ├── .gitignore ├── .rubocop.yml ├── Gemfile ├── babel.config.js ├── README.md └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.1 2 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --format documentation 4 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | bundle install && yarn install && bundle exec foreman start 2 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | User.first_or_create(email: 'root@root.com', password: '123456') 2 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /Procfile.old: -------------------------------------------------------------------------------- 1 | web: bundle exec rails s -b '0.0.0.0' -p 3334 2 | js_compiler: ./bin/webpack-dev-server 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationJob < ActiveJob::Base 4 | end 5 | -------------------------------------------------------------------------------- /public/open_todoist_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oliveira-andre/open_todoist/HEAD/public/open_todoist_logo.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /config/webpack/loaders/vue.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | test: /\.vue(\.erb)?$/, 3 | use: [{ 4 | loader: 'vue-loader' 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class HomeController < ApplicationController 4 | def index; end 5 | end 6 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ -f tmp/pids/server.pid ]; then 5 | rm tmp/pids/server.pid 6 | fi 7 | 8 | exec bundle exec "$@" 9 | -------------------------------------------------------------------------------- /app/assets/stylesheets/controllers/tasksArchiveds.scss: -------------------------------------------------------------------------------- 1 | #tasksArchiveds { 2 | ul.projects { 3 | li { 4 | cursor: pointer; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationRecord < ActiveRecord::Base 4 | self.abstract_class = true 5 | end 6 | -------------------------------------------------------------------------------- /spec/support/response.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Response 4 | def parsed_response 5 | JSON.parse(response.body) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Channel < ActionCable::Channel::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Spring.watch( 4 | '.ruby-version', 5 | '.rbenv-vars', 6 | 'tmp/restart.txt', 7 | 'tmp/caching-dev.txt' 8 | ) 9 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Connection < ActionCable::Connection::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/factories/score.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :score do 5 | points { rand(0..100) } 6 | rank { :iron } 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationMailer < ActionMailer::Base 4 | default from: 'from@example.com' 5 | layout 'mailer' 6 | end 7 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is used by Rack-based servers to start the application. 4 | 5 | require_relative 'config/environment' 6 | 7 | run Rails.application 8 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Load the Rails application. 4 | require_relative 'application' 5 | 6 | # Initialize the Rails application. 7 | Rails.application.initialize! 8 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /app/javascript/packs/week/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /app/serializers/api/v1/user_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class UserSerializer < ActiveModel::Serializer 6 | attributes :email 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # Add new mime types for use in respond_to blocks: 5 | # Mime::Type.register "text/richtext", :rtf 6 | -------------------------------------------------------------------------------- /app/serializers/api/v1/session_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class SessionSerializer < ActiveModel::Serializer 6 | attributes :authentication_token 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/factories/task.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :task do 5 | title { FFaker::Lorem.word } 6 | description { FFaker::Lorem.phrase } 7 | status { 0 } 8 | project 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: open_todoist_production 11 | -------------------------------------------------------------------------------- /app/javascript/channels/index.js: -------------------------------------------------------------------------------- 1 | // Load all the channels within this directory and all subdirectories. 2 | // Channel files must be named *_channel.js. 3 | 4 | const channels = require.context('.', true, /_channel\.js$/) 5 | channels.keys().forEach(channels) 6 | -------------------------------------------------------------------------------- /app/serializers/api/v1/task_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class TaskSerializer < ActiveModel::Serializer 6 | attributes :id, :title, :description, :status, :schedule_date 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 4 | 5 | require 'bundler/setup' # Set up gems listed in the Gemfile. 6 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 7 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'boot' 4 | 5 | require 'rails/all' 6 | 7 | Bundler.require(*Rails.groups) 8 | 9 | module OpenTodoist 10 | class Application < Rails::Application 11 | config.load_defaults 6.0 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Configure sensitive parameters which will be filtered from the log file. 6 | Rails.application.config.filter_parameters += [:password] 7 | -------------------------------------------------------------------------------- /db/migrate/20200410224823_add_authentication_token_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAuthenticationTokenToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :authentication_token, :string, limit: 30 4 | add_index :users, :authentication_token, unique: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | begin 5 | load File.expand_path('spring', __dir__) 6 | rescue LoadError => e 7 | raise unless e.message.include?('spring') 8 | end 9 | require_relative '../config/boot' 10 | require 'rake' 11 | Rake.application.run 12 | -------------------------------------------------------------------------------- /app/assets/stylesheets/controllers/login.scss: -------------------------------------------------------------------------------- 1 | #login { 2 | .card { 3 | width: 400px; 4 | height: 300px; 5 | position: absolute; 6 | top: 15%; 7 | left: 50%; 8 | transform: translate(-50%, 50%); 9 | } 10 | 11 | label { 12 | color: black !important; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Add your own tasks in files placed in lib/tasks ending in .rake, 4 | # for example lib/tasks/capistrano.rake, and they will automatically 5 | # be available to Rake. 6 | 7 | require_relative 'config/application' 8 | 9 | Rails.application.load_tasks 10 | -------------------------------------------------------------------------------- /app/javascript/channels/consumer.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | 4 | import { createConsumer } from "@rails/actioncable" 5 | 6 | export default createConsumer() 7 | -------------------------------------------------------------------------------- /app/serializers/api/v1/project_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class ProjectSerializer < ActiveModel::Serializer 6 | attributes :id, :title, :schedule_date 7 | 8 | has_many :tasks, each_serializer: TaskSerializer 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/models/score.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Score < ApplicationRecord 4 | enum rank: { iron: 0, bronze: 1, silver: 2, gold: 3, platinum: 4, diamound: 5, 5 | master: 6, grand_master: 7, challenger: 8 } 6 | 7 | has_one :user 8 | 9 | validates :points, :rank, presence: true 10 | end 11 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | const { VueLoaderPlugin } = require('vue-loader') 3 | const vue = require('./loaders/vue') 4 | 5 | environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin()) 6 | environment.loaders.prepend('vue', vue) 7 | module.exports = environment 8 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # ActiveSupport::Reloader.to_prepare do 5 | # ApplicationController.renderer.defaults.merge!( 6 | # http_host: 'example.org', 7 | # https: false 8 | # ) 9 | # end 10 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Specify a serializer for the signed and encrypted cookie jars. 6 | # Valid options are :json, :marshal, and :hybrid. 7 | Rails.application.config.action_dispatch.cookies_serializer = :json 8 | -------------------------------------------------------------------------------- /db/migrate/20200405210627_scores.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Scores < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :scores do |t| 6 | t.integer :points, null: false, default: 0 7 | t.integer :rank, null: false, default: 0 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | begin 5 | load File.expand_path('spring', __dir__) 6 | rescue LoadError => e 7 | raise unless e.message.include?('spring') 8 | end 9 | APP_PATH = File.expand_path('../config/application', __dir__) 10 | require_relative '../config/boot' 11 | require 'rails/commands' 12 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | APP_ROOT = File.expand_path('..', __dir__) 5 | Dir.chdir(APP_ROOT) do 6 | exec 'yarnpkg', *ARGV 7 | rescue Errno::ENOENT 8 | warn 'Yarn executable was not detected in the system.' 9 | warn 'Download Yarn at https://yarnpkg.com/en/docs/install' 10 | exit 1 11 | end 12 | -------------------------------------------------------------------------------- /spec/factories/project.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :project do 5 | title { FFaker::Lorem.word } 6 | status { :active } 7 | user 8 | 9 | trait :archived do 10 | status { :archived } 11 | end 12 | 13 | factory :project_deactive, traits: [:deactive] 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/factories/user.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :user do 5 | email { FFaker::Internet.email } 6 | password { 'root123' } 7 | status { :active } 8 | score 9 | 10 | trait :deative do 11 | status { :deactive } 12 | end 13 | 14 | factory :user_deactive, traits: [:deactive] 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationController < ActionController::Base 4 | include Response 5 | 6 | private 7 | 8 | def load_user 9 | @user = User&.find_by(authentication_token: request.headers['token']) 10 | 11 | return @user if @user 12 | 13 | raise ActiveRecord::RecordNotFound 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.configure do |config| 4 | config.expect_with :rspec do |expectations| 5 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 6 | end 7 | 8 | config.mock_with :rspec do |mocks| 9 | mocks.verify_partial_doubles = true 10 | end 11 | 12 | config.shared_context_metadata_behavior = :apply_to_host_groups 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20200405210811_projects.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Projects < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :projects do |t| 6 | t.string :title, null: false, default: '' 7 | t.integer :status, null: false, default: 0 8 | t.datetime :schedule_date 9 | t.references :user, foreign_key: true 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/models/product_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Project, type: :model do 6 | context 'validate presence of' do 7 | it { should validate_presence_of(:title) } 8 | it { should validate_presence_of(:status) } 9 | end 10 | 11 | context 'associations' do 12 | it { should belong_to(:user) } 13 | it { should have_many(:tasks) } 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/models/task_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Task, type: :model do 6 | context 'validate presence of' do 7 | it { should validate_presence_of(:title) } 8 | it { should validate_presence_of(:status) } 9 | it { should validate_presence_of(:project_id) } 10 | end 11 | 12 | context 'associations' do 13 | it { should belong_to(:project) } 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | 0RSapoDVKa8qnTvHBKlot6hhm68sKWeoCVyDLqkX3a9wLpXkvoq1ciNMqdpaIxJi8n93Tgt/uwz1NHqTutLxtd9ZTf94avP9tXMh6emLXVJLgz6fWwhkSG+KChRrOC7dpaDvIxoK2kgDTMjYkAM2GAXPx47+q2+plH3rOF0urVwCzb3e0mJKoeD1FoK6/gH8OpOUwhL5mGOWHnZGi6RcvMsIO+cYPxVdMfMzFTpKZEcKlxOOLrgAgz/T9xC+Qo71GNQaT3oMagHbUquR8xzQ23ddRgg3ERka1uwPxlr31/Vmqwuv7+PZzG8LwZYTBJqbqz19j6klhwCczoJ452WM4Dqf2HFSNR9kcrf5VWENTtdeGeZcMqYMdLq1WRVtCN7JBwmUNl8wE8P+1LzaR6n6XIdvYAgKNYCsHXv3--hZJ9RGhsWD+VOGt2--tay8F2fGMLJsSsiN7wqy/g== -------------------------------------------------------------------------------- /app/models/project.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Project < ApplicationRecord 4 | default_scope -> { order(created_at: :desc) } 5 | enum status: { active: 0, finalized: 1, archived: 2 } 6 | 7 | validates :title, :status, presence: true 8 | 9 | belongs_to :user 10 | has_many :tasks 11 | 12 | before_save :archive_tasks 13 | 14 | private 15 | 16 | def archive_tasks 17 | return unless status == 'archived' 18 | 19 | tasks.each(&:archived!) 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /db/migrate/20200405210817_tasks.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Tasks < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :tasks do |t| 6 | t.string :title, null: false, default: '' 7 | t.text :description 8 | t.integer :status, default: 0, null: false 9 | t.datetime :schedule_date 10 | t.integer :order, default: 0, null: false 11 | t.references :project, foreign_key: true 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # You can add backtrace silencers for libraries that you're using but 5 | # don't wish to see in your backtraces. 6 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 7 | 8 | # You can also remove all the silencers if you're trying to debug a problem 9 | # that might stem from framework code. 10 | # Rails.backtrace_cleaner.remove_silencers! 11 | -------------------------------------------------------------------------------- /app/controllers/api/v1/users_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class UsersController < ApplicationController 6 | before_action :load_user 7 | 8 | def show 9 | success_response(data: @user, model: 'User') if @user 10 | error_response unless @user 11 | end 12 | 13 | private 14 | 15 | def load_user 16 | @user = User&.find_by(authentication_token: params[:token]) 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | adapter: postgresql 3 | encoding: unicode 4 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 5 | username: <%= ENV['db_user'] %> 6 | password: <%= ENV['db_pass'] %> 7 | port: <%= ENV['db_port'] || 5432 %> 8 | host: <%= ENV['db_host'] %> 9 | 10 | development: 11 | <<: *default 12 | database: open_todoist_development 13 | 14 | test: 15 | <<: *default 16 | database: open_todoist_test 17 | 18 | production: 19 | <<: *default 20 | database: open_todoist_production 21 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OpenTodoist 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | 8 | 9 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 10 | <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 11 | 12 | 13 | 14 | <%= yield %> 15 | 16 | 17 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development' 5 | ENV['NODE_ENV'] ||= 'development' 6 | 7 | require 'pathname' 8 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', 9 | Pathname.new(__FILE__).realpath) 10 | 11 | require 'bundler/setup' 12 | 13 | require 'webpacker' 14 | require 'webpacker/webpack_runner' 15 | 16 | APP_ROOT = File.expand_path('..', __dir__) 17 | Dir.chdir(APP_ROOT) do 18 | Webpacker::WebpackRunner.run(ARGV) 19 | end 20 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | postgres: 5 | image: 'postgres:9.5' 6 | volumes: 7 | - 'postgres:/var/lib/postgresql/data' 8 | env_file: 9 | - .env 10 | 11 | 12 | web_app: 13 | build: . 14 | command: bash start.sh 15 | ports: 16 | - '3334:3334' 17 | volumes: 18 | - '.:/open_todoist' 19 | - gems:/gems 20 | env_file: 21 | - .env 22 | depends_on: 23 | - postgres 24 | stdin_open: true 25 | tty: true 26 | 27 | volumes: 28 | postgres: 29 | gems: 30 | web: 31 | 32 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development' 5 | ENV['NODE_ENV'] ||= 'development' 6 | 7 | require 'pathname' 8 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', 9 | Pathname.new(__FILE__).realpath) 10 | 11 | require 'bundler/setup' 12 | 13 | require 'webpacker' 14 | require 'webpacker/dev_server_runner' 15 | 16 | APP_ROOT = File.expand_path('..', __dir__) 17 | Dir.chdir(APP_ROOT) do 18 | Webpacker::DevServerRunner.run(ARGV) 19 | end 20 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.routes.draw do 4 | namespace :api do 5 | namespace :v1 do 6 | resources :sessions, only: :create 7 | resources :users, only: %i[show], param: :token 8 | resources :projects, only: %i[index create destroy] do 9 | resources :tasks, only: %i[create destroy] 10 | end 11 | resources :alexa, only: [], param: :skill_name do 12 | resources :skills, only: :index 13 | end 14 | end 15 | end 16 | 17 | root to: 'home#index' 18 | get '/*path', to: 'home#index' 19 | end 20 | -------------------------------------------------------------------------------- /app/controllers/api/v1/skills_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class SkillsController < ApplicationController 6 | before_action :load_user 7 | before_action :load_projects 8 | 9 | def index 10 | success_response(data: @projects, status: :ok, model: 'Project') 11 | end 12 | 13 | private 14 | 15 | def load_projects 16 | @projects = @user.projects.active.includes(:tasks) 17 | .where(tasks: { status: 0, order: 0..4 }).distinct.limit(3) 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # This file loads Spring without using Bundler, in order to be fast. 5 | # It gets overwritten when you run the `spring binstub` command. 6 | 7 | unless defined?(Spring) 8 | require 'rubygems' 9 | require 'bundler' 10 | 11 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 12 | spring = lockfile.specs.detect { |spec| spec.name == 'spring' } 13 | if spring 14 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 15 | gem 'spring', spring.version 16 | require 'spring/binstub' 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/javascript/packs/routes.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router'; 3 | Vue.use(VueRouter); 4 | 5 | import HomeIndex from './home/index'; 6 | import LoginIndex from './login/index'; 7 | import TasksArchivedsIndex from './tasksArchiveds/index'; 8 | import WeekIndex from './week/index'; 9 | 10 | export default new VueRouter({ 11 | mode: 'history', 12 | routes: [ 13 | { path: '/', component: HomeIndex }, 14 | { path: '/login', component: LoginIndex }, 15 | { path: '/archiveds', component: TasksArchivedsIndex }, 16 | { path: '/week', component: WeekIndex }, 17 | ], 18 | }); 19 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # This file contains settings for ActionController::ParamsWrapper which 6 | # is enabled by default. 7 | 8 | # Enable parameter wrapping for JSON. You can disable this by setting 9 | # :format to an empty array. 10 | ActiveSupport.on_load(:action_controller) do 11 | wrap_parameters format: [:json] 12 | end 13 | 14 | # To enable root element in JSON for ActiveRecord objects. 15 | # ActiveSupport.on_load(:active_record) do 16 | # self.include_root_in_json = true 17 | # end 18 | -------------------------------------------------------------------------------- /app/javascript/packs/App.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 29 | 30 | -------------------------------------------------------------------------------- /CONTRIBUING.md: -------------------------------------------------------------------------------- 1 | # Request for contributions 2 | 3 | Please contribute to this repository if any of the following is true: 4 | - You have expertise in community development, communication, or education 5 | - You want open source communities to be more collaborative and inclusive 6 | - You want to help lower the burden to first time contributors 7 | 8 | # How to contribute 9 | 10 | Prerequisites: 11 | 12 | - Familiarity with [pull requests](https://help.github.com/articles/using-pull-requests) and [issues](https://guides.github.com/features/issues/). 13 | - Knowledge of [Markdown](https://help.github.com/articles/markdown-basics/) for editing `.md` documents. 14 | 15 | -------------------------------------------------------------------------------- /app/assets/stylesheets/controllers/home.scss: -------------------------------------------------------------------------------- 1 | #home { 2 | .is-flex { 3 | justify-content: space-between; 4 | } 5 | 6 | .right-side { 7 | justify-content: flex-end; 8 | 9 | & * { 10 | margin-left: 20px; 11 | } 12 | } 13 | 14 | .center { 15 | margin-top: 20%; 16 | 17 | & * { 18 | margin-bottom: 20px; 19 | } 20 | } 21 | 22 | .projects { 23 | cursor: pointer; 24 | 25 | & .input { 26 | margin-top: 10px; 27 | margin-bottom: 10px; 28 | } 29 | 30 | & li.has-text-weight-bold { 31 | margin-top: 20px; 32 | } 33 | } 34 | 35 | .tasks { 36 | margin-left: 20px; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/controllers/concerns/response.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Response 4 | def success_response(data:, model:, includes: '', status: :ok) 5 | return unless data || model 6 | 7 | if data.respond_to?('each') 8 | render json: data, 9 | each_serializer: "Api::V1::#{model}Serializer".constantize, 10 | includes: includes.split(','), status: status 11 | else 12 | render json: data, serializer: "Api::V1::#{model}Serializer".constantize, 13 | includes: includes.split(','), status: status 14 | end 15 | end 16 | 17 | def error_response 18 | render json: {}, status: :unprocessable_entity 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class User < ApplicationRecord 4 | acts_as_token_authenticatable 5 | # Include default devise modules. Others available are: 6 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 7 | devise :database_authenticatable, :registerable, 8 | :recoverable, :rememberable, :validatable 9 | 10 | before_validation :vinculate_score 11 | 12 | enum status: { active: 0, deactive: 1 } 13 | 14 | belongs_to :score 15 | 16 | has_many :projects 17 | 18 | validates :email, :password, :status, :score_id, presence: true 19 | 20 | private 21 | 22 | def vinculate_score 23 | self.score_id = Score.create.id 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Version of your assets, change this if you want to expire all your assets. 6 | Rails.application.config.assets.version = '1.0' 7 | 8 | # Add additional assets to the asset load path. 9 | # Rails.application.config.assets.paths << Emoji.images_path 10 | # Add Yarn node_modules folder to the asset load path. 11 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 12 | 13 | # Precompile additional assets. 14 | # application.js, application.css, and all non-JS/CSS in the app/assets 15 | # folder are already added. 16 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.7.1 2 | 3 | RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \ 4 | curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ 5 | echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 6 | 7 | RUN apt-get update && apt-get install -qq -y --no-install-recommends \ 8 | nodejs yarn build-essential libpq-dev imagemagick git-all vim 9 | 10 | 11 | ENV BUNDLE_PATH /gems 12 | RUN mkdir $BUNDLE_PATH 13 | 14 | COPY Gemfile . 15 | RUN bundle install 16 | 17 | ENV INSTALL_PATH /var/www/open_todoist 18 | RUN mkdir -p $INSTALL_PATH 19 | WORKDIR $INSTALL_PATH 20 | 21 | COPY . . 22 | 23 | RUN yarn install 24 | 25 | ENTRYPOINT ["./docker-entrypoint.sh"] 26 | 27 | EXPOSE 3334 28 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # Add new inflection rules using the following format. Inflections 5 | # are locale specific, and you may define rules for as many different 6 | # locales as you wish. All of these examples are active by default: 7 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 8 | # inflect.plural /^(ox)$/i, '\1en' 9 | # inflect.singular /^(ox)en/i, '\1' 10 | # inflect.irregular 'person', 'people' 11 | # inflect.uncountable %w( fish sheep ) 12 | # end 13 | 14 | # These inflection rules are supported but not enabled by default: 15 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 16 | # inflect.acronym 'RESTful' 17 | # end 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "open_todoist", 3 | "private": true, 4 | "dependencies": { 5 | "@fortawesome/fontawesome-free": "^5.13.0", 6 | "@rails/actioncable": "^6.0.0", 7 | "@rails/activestorage": "^6.0.0", 8 | "@rails/ujs": "^6.0.0", 9 | "@rails/webpacker": "5.4.0", 10 | "axios": "^0.21.1", 11 | "bulma": "^0.9.3", 12 | "query-string": "^7.0.1", 13 | "toastr": "^2.1.4", 14 | "turbolinks": "^5.2.0", 15 | "vue": "^2.6.11", 16 | "vue-loader": "^15.9.1", 17 | "vue-resource": "^1.5.1", 18 | "vue-router": "^3.1.6", 19 | "vue-template-compiler": "^2.6.11", 20 | "vue-turbolinks": "^2.1.0" 21 | }, 22 | "version": "0.1.0", 23 | "devDependencies": { 24 | "webpack-dev-server": "^3.10.3" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/controllers/api/v1/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class SessionsController < ApplicationController 6 | before_action :sign_in_params, only: :create 7 | before_action :load_user 8 | 9 | def create 10 | if valid_password? 11 | success_response(data: @user, model: 'Session', status: :created) 12 | else 13 | error_response 14 | end 15 | end 16 | 17 | def sign_in_params 18 | params.require(:users).permit(:email, :password) 19 | end 20 | 21 | def load_user 22 | @user = User.find_by(email: sign_in_params[:email]) 23 | end 24 | 25 | def valid_password? 26 | @user.valid_password?(sign_in_params[:password]) 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | require("@rails/ujs").start(); 2 | require("turbolinks").start(); 3 | require("@rails/activestorage").start(); 4 | require("channels"); 5 | 6 | import "@fortawesome/fontawesome-free/js/all"; 7 | 8 | import Vue from 'vue/dist/vue.esm'; 9 | import TurbolinksAdapter from 'vue-turbolinks'; 10 | import VueResource from 'vue-resource'; 11 | import VueRouter from 'vue-router' 12 | 13 | import router from './routes.js'; 14 | import App from './App.vue'; 15 | 16 | Vue.use(VueResource); 17 | Vue.use(TurbolinksAdapter); 18 | Vue.use(VueRouter); 19 | 20 | document.addEventListener("turbolinks:load", function() { 21 | Vue.http.headers.common['X-CSRF-Token'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); 22 | const app = new Vue({ 23 | el: '#app', 24 | router: router, 25 | render: h => h(App) 26 | }); 27 | }); 28 | 29 | -------------------------------------------------------------------------------- /app/models/task.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Task < ApplicationRecord 4 | default_scope -> { order(order: :desc) } 5 | 6 | enum status: { opened: 0, finalized: 1, archived: 2 } 7 | 8 | belongs_to :project 9 | 10 | validates :title, :status, :project_id, presence: true 11 | 12 | before_save :set_order 13 | 14 | private 15 | 16 | def set_order 17 | downgrade_orders if archived? 18 | return if order_changed? 19 | 20 | self.order = new_record? ? opened_tasks_count : archived_tasks_count 21 | end 22 | 23 | def downgrade_orders 24 | tasks = project.tasks.opened.where('tasks.order > ?', order) 25 | tasks.each { |task| task.update(order: (task.order - 1)) } 26 | end 27 | 28 | def opened_tasks_count 29 | project.tasks.opened.count || 0 30 | end 31 | 32 | def archived_tasks_count 33 | project.tasks.archived.count || 0 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /.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 | # Ignore uploaded files in development. 17 | /storage/* 18 | !/storage/.keep 19 | 20 | /public/assets 21 | .byebug_history 22 | 23 | # Ignore master key for decrypting credentials and more. 24 | /config/master.key 25 | 26 | /config/database.yml 27 | 28 | /public/packs 29 | /public/packs-test 30 | /node_modules 31 | /yarn-error.log 32 | yarn-debug.log* 33 | .yarn-integrity 34 | 35 | tags 36 | 37 | .env 38 | .env.* 39 | 40 | cookie 41 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | ENV['RAILS_ENV'] ||= 'test' 5 | require File.expand_path('../config/environment', __dir__) 6 | abort('The Rails environment is running in production mode!') if Rails.env.production? 7 | require 'rspec/rails' 8 | 9 | Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } 10 | 11 | begin 12 | ActiveRecord::Migration.maintain_test_schema! 13 | rescue ActiveRecord::PendingMigrationError => e 14 | puts e.to_s.strip 15 | exit 1 16 | end 17 | 18 | RSpec.configure do |config| 19 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 20 | config.use_transactional_fixtures = true 21 | config.infer_spec_type_from_file_location! 22 | config.filter_rails_from_backtrace! 23 | config.include FactoryBot::Syntax::Methods 24 | config.include Response 25 | end 26 | 27 | Shoulda::Matchers.configure do |config| 28 | config.integrate do |with| 29 | with.test_framework :rspec 30 | with.library :rails 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | TargetRubyVersion: 2.6 3 | # Include common Ruby source files. 4 | Include: 5 | - '**/*.rb' 6 | - '**/*.gemspec' 7 | - '**/*.podspec' 8 | - '**/*.jbuilder' 9 | - '**/*.rake' 10 | - '**/*.opal' 11 | - '**/Gemfile' 12 | - '**/Rakefile' 13 | - '**/Capfile' 14 | - '**/Guardfile' 15 | - '**/Podfile' 16 | - '**/Thorfile' 17 | - '**/Vagrantfile' 18 | - '**/Berksfile' 19 | - '**/Cheffile' 20 | - '**/Vagabondfile' 21 | - '**/Fastfile' 22 | - '**/*Fastfile' 23 | Exclude: 24 | - 'spec/responses/*' 25 | - 'vendor/**/*' 26 | - 'bin/**/*' 27 | - 'db/**/*' 28 | - 'config/environments/*' 29 | - 'config/routes.rb' 30 | - 'codeship/*' 31 | - 'discord.rb' 32 | - 'gandalf.rb' 33 | - 'notify.rb' 34 | - 'config/initializers/devise.rb' 35 | - 'node_modules/**/*' 36 | 37 | Style/Documentation: 38 | Description: 'Document classes and non-namespace modules.' 39 | Enabled: false 40 | 41 | Metrics/BlockLength: 42 | Max: 100 43 | -------------------------------------------------------------------------------- /app/controllers/api/v1/tasks_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class TasksController < ApplicationController 6 | before_action :load_user, :load_project 7 | before_action :load_task, only: :destroy 8 | 9 | def create 10 | @task = Task.create(tasks_params) 11 | 12 | if @task.valid? 13 | success_response(data: @task, model: 'Task', status: :created) 14 | else 15 | error_response 16 | end 17 | end 18 | 19 | def destroy 20 | @task.archived! 21 | success_response(data: @task, model: 'Task', status: :ok) 22 | end 23 | 24 | private 25 | 26 | def load_project 27 | @project = @user.projects.find(params[:project_id]) 28 | end 29 | 30 | def load_task 31 | @task = @project.tasks.find(params[:id]) 32 | end 33 | 34 | def tasks_params 35 | params.require(:tasks).permit(:title, :description) 36 | .merge(project_id: @project.id) 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require 'fileutils' 5 | 6 | # path to your application root. 7 | APP_ROOT = File.expand_path('..', __dir__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | FileUtils.chdir APP_ROOT do 14 | # This script is a way to setup or update your development environment automatically. 15 | # This script is idempotent, so that you can run it at anytime and get an expectable outcome. 16 | # Add necessary setup steps to this file. 17 | 18 | puts '== Installing dependencies ==' 19 | system! 'gem install bundler --conservative' 20 | system('bundle check') || system!('bundle install') 21 | 22 | # Install JavaScript dependencies 23 | # system('bin/yarn') 24 | 25 | # puts "\n== Copying sample files ==" 26 | # unless File.exist?('config/database.yml') 27 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 28 | # end 29 | 30 | puts "\n== Preparing database ==" 31 | system! 'bin/rails db:prepare' 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 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 5 | 6 | ruby '2.7.1' 7 | 8 | gem 'active_model_serializers' 9 | gem 'bootsnap', '>= 1.4.2', require: false 10 | gem 'capistrano', '~> 3.11' 11 | gem 'devise' 12 | gem 'dotenv-rails' 13 | gem 'foreman' 14 | gem 'jbuilder', '~> 2.7' 15 | gem 'pg', '>= 0.18', '< 2.0' 16 | gem 'puma', '~> 4.3' 17 | gem 'rails', '~> 6.0.2', '>= 6.0.2.2' 18 | gem 'sass-rails', '>= 6' 19 | gem 'simple_token_authentication' 20 | gem 'turbolinks', '~> 5' 21 | gem 'webpacker', '~> 4.0' 22 | 23 | group :development, :test do 24 | gem 'brakeman' 25 | gem 'byebug', platforms: %i[mri mingw x64_mingw] 26 | gem 'factory_bot_rails' 27 | gem 'ffaker' 28 | gem 'rails-controller-testing' 29 | gem 'rspec-rails' 30 | gem 'rubocop' 31 | gem 'shoulda-matchers' 32 | end 33 | 34 | group :development do 35 | gem 'listen', '>= 3.0.5', '< 3.2' 36 | gem 'pry-rails' 37 | gem 'spring' 38 | gem 'spring-watcher-listen', '~> 2.0.0' 39 | gem 'web-console', '>= 3.3.0' 40 | end 41 | 42 | group :test do 43 | gem 'capybara', '>= 2.15' 44 | gem 'selenium-webdriver' 45 | gem 'webdrivers' 46 | end 47 | 48 | gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] 49 | -------------------------------------------------------------------------------- /app/assets/stylesheets/shared/sidebar.scss: -------------------------------------------------------------------------------- 1 | #bSidebar { 2 | width: 305px; 3 | height: 100%; 4 | left: 0; 5 | top: 0px; 6 | box-sizing: border-box; 7 | margin-top: 44px; 8 | padding-top: 30px; 9 | padding-left: 35px; 10 | position: fixed; 11 | overflow-x: hidden; 12 | overflow-y: hidden; 13 | background: #282828; 14 | transition: 0.5s; 15 | 16 | &.exited { 17 | left: -305px; 18 | } 19 | 20 | ul.main_filter { 21 | li { 22 | min-height: 24px; 23 | font-size: 14px; 24 | color: #333; 25 | list-style: none; 26 | cursor: pointer; 27 | transition: color .1s ease-in,background-color .1s ease-in; 28 | line-height: 1.25; 29 | border-radius: 3px; 30 | align-items: center; 31 | margin-bottom: 5px; 32 | padding: 0px; 33 | 34 | &:hover { 35 | background: #363636; 36 | } 37 | 38 | &.current { 39 | background: #363636; 40 | font-weight: bold; 41 | } 42 | 43 | a { 44 | display: inline-block; 45 | width: 187px; 46 | vertical-align: top; 47 | min-height: 24px; 48 | line-height: 24px; 49 | word-break: break-word; 50 | padding: 5px 16px 5px 5px; 51 | 52 | i { 53 | margin-right: 5px; 54 | } 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/controllers/api/v1/projects_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class ProjectsController < ApplicationController 6 | before_action :load_user 7 | before_action :load_projects, only: :index 8 | before_action :load_project, only: :destroy 9 | 10 | def index 11 | success_response(data: @projects, model: 'Project') 12 | end 13 | 14 | def create 15 | @project = Project.create(projects_params) 16 | 17 | if @project.valid? 18 | success_response(data: @project, model: 'Project', status: :created) 19 | else 20 | error_response 21 | end 22 | end 23 | 24 | def destroy 25 | @project.archived! 26 | success_response(data: @project, model: 'Project', status: :ok) 27 | end 28 | 29 | private 30 | 31 | def projects_params 32 | params.require(:projects).permit(:title).merge(user: @user) 33 | end 34 | 35 | def load_projects 36 | @projects = case params[:status] 37 | when 'archiveds' 38 | @user.projects.archived.includes(:tasks) 39 | .where(tasks: { status: 2 }).distinct 40 | else 41 | @user.projects.active.includes(:tasks) 42 | .where(tasks: { status: 0 }).distinct 43 | end 44 | end 45 | 46 | def load_project 47 | @project = @user.projects.find(params[:id]) 48 | end 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # Define an application-wide content security policy 5 | # For further information see the following documentation 6 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 7 | 8 | # Rails.application.config.content_security_policy do |policy| 9 | # policy.default_src :self, :https 10 | # policy.font_src :self, :https, :data 11 | # policy.img_src :self, :https, :data 12 | # policy.object_src :none 13 | # policy.script_src :self, :https 14 | # policy.style_src :self, :https 15 | # # If you are using webpack-dev-server then specify webpack-dev-server host 16 | # policy.connect_src :self, :https, "http://localhost:3035", 17 | # "ws://localhost:3035" if Rails.env.development? 18 | 19 | # # Specify URI for violation reports 20 | # # policy.report_uri "/csp-violation-report-endpoint" 21 | # end 22 | 23 | # If you are using UJS then enable automatic nonce generation 24 | # Rails.application.config. 25 | # content_security_policy_nonce_generator = -> 26 | # request { SecureRandom.base64(16) } 27 | 28 | # Set the nonce only to specific directives 29 | # Rails.application.config.content_security_policy_nonce_directives = 30 | # %w(script-src) 31 | 32 | # Report CSP violations to a specified URI 33 | # For further information see the following documentation: 34 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 35 | # Rails.application.config.content_security_policy_report_only = true 36 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | @import "bulma/bulma"; 2 | $fa-font-path: "@fortawesome/fontawesome-free/webfonts"; 3 | @import '@fortawesome/fontawesome-free/scss/fontawesome'; 4 | @import '@fortawesome/fontawesome-free/scss/solid'; 5 | @import '@fortawesome/fontawesome-free/scss/regular'; 6 | @import '@fortawesome/fontawesome-free/scss/brands'; 7 | @import '@fortawesome/fontawesome-free/scss/v4-shims'; 8 | @import "@fortawesome/fontawesome-free/css/all.css"; 9 | @import "toastr/toastr"; 10 | @import "shared/*"; 11 | @import "controllers/*"; 12 | 13 | body, 14 | html { 15 | height: 100%; 16 | } 17 | 18 | .black-background { 19 | color: white; 20 | font-feature-settings: "liga" 0; 21 | line-height: 1.7; 22 | background: #1f1f1f; 23 | padding: 0px; 24 | background-repeat: repeat-y; 25 | height: auto; 26 | min-height: 100%; 27 | } 28 | 29 | p { 30 | color: white !important; 31 | } 32 | 33 | a { 34 | color: white; 35 | 36 | &:visited { 37 | color: white; 38 | } 39 | } 40 | 41 | label { 42 | color: white !important; 43 | } 44 | 45 | input { 46 | background: transparent !important; 47 | color: white; 48 | 49 | &:active { 50 | border-color: #FFF !important; 51 | } 52 | 53 | &:focus { 54 | border-color: #FFF !important; 55 | } 56 | } 57 | 58 | #app { 59 | transition: 0.5s; 60 | 61 | &.menu_show { 62 | margin-left: 350px; 63 | } 64 | } 65 | 66 | .is-danger { 67 | background-color: #de4c4a !important; 68 | } 69 | 70 | .modal-content { 71 | background-color: #282828 !important; 72 | padding: 30px; 73 | border-radius: 5px; 74 | } 75 | 76 | .container { 77 | max-width: 1000px !important; 78 | } 79 | 80 | -------------------------------------------------------------------------------- /db/migrate/20200405210759_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DeviseCreateUsers < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :users do |t| 6 | t.string :email, null: false, default: '' 7 | t.string :encrypted_password, null: false, default: '' 8 | t.integer :status, null: false, default: 0 9 | t.references :score, foreign_key: true 10 | 11 | ## Recoverable 12 | t.string :reset_password_token 13 | t.datetime :reset_password_sent_at 14 | 15 | ## Rememberable 16 | t.datetime :remember_created_at 17 | 18 | ## Trackable 19 | # t.integer :sign_in_count, default: 0, null: false 20 | # t.datetime :current_sign_in_at 21 | # t.datetime :last_sign_in_at 22 | # t.inet :current_sign_in_ip 23 | # t.inet :last_sign_in_ip 24 | 25 | ## Confirmable 26 | # t.string :confirmation_token 27 | # t.datetime :confirmed_at 28 | # t.datetime :confirmation_sent_at 29 | # t.string :unconfirmed_email # Only if using reconfirmable 30 | 31 | ## Lockable 32 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 33 | # t.string :unlock_token # Only if unlock strategy is :email or :both 34 | # t.datetime :locked_at 35 | 36 | t.timestamps null: false 37 | end 38 | 39 | add_index :users, :email, unique: true 40 | add_index :users, :reset_password_token, unique: true 41 | # add_index :users, :confirmation_token, unique: true 42 | # add_index :users, :unlock_token, unique: true 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Puma can serve each request in a thread from an internal thread pool. 4 | # The `threads` method setting takes two numbers: a minimum and maximum. 5 | # Any libraries that use thread pools should be configured to match 6 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 7 | # and maximum; this matches the default thread size of Active Record. 8 | # 9 | max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5) 10 | min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count } 11 | threads min_threads_count, max_threads_count 12 | 13 | # Specifies the `port` that Puma will listen on to receive requests; 14 | # default is 3000. 15 | # 16 | port ENV.fetch('PORT', 3000) 17 | 18 | # Specifies the `environment` that Puma will run in. 19 | # 20 | environment ENV.fetch('RAILS_ENV', 'development') 21 | 22 | # Specifies the `pidfile` that Puma will use. 23 | pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid') 24 | 25 | # Specifies the number of `workers` to boot in clustered mode. 26 | # Workers are forked web server processes. If using threads and workers together 27 | # the concurrency of the application would be max `threads` * `workers`. 28 | # Workers do not work on JRuby or Windows (both of which do not support 29 | # processes). 30 | # 31 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 32 | 33 | # Use the `preload_app!` method when specifying a `workers` number. 34 | # This directive tells Puma to first boot the application and load code 35 | # before forking the application. This takes advantage of Copy On Write 36 | # process behavior so workers use less memory. 37 | # 38 | # preload_app! 39 | 40 | # Allow puma to be restarted by `rails restart` command. 41 | plugin :tmp_restart 42 | -------------------------------------------------------------------------------- /app/assets/stylesheets/shared/header.scss: -------------------------------------------------------------------------------- 1 | #bHeader { 2 | .navbar { 3 | display: contents; 4 | 5 | .navbar-brand { 6 | background: #282828; 7 | min-height: 43px; 8 | margin-bottom: 40px; 9 | 10 | .left-side { 11 | margin-top: 8px; 12 | margin-left: 40px; 13 | 14 | .input-search { 15 | height: 25px; 16 | width: 200px; 17 | background: transparent; 18 | color: white; 19 | transition: 0.5s; 20 | padding-bottom: 10px; 21 | 22 | &:active { 23 | border-color: #FFF !important; 24 | width: 250px; 25 | } 26 | 27 | &:focus { 28 | border-color: #FFF !important; 29 | width: 250px; 30 | } 31 | 32 | &::placeholder { 33 | color: white; 34 | opacity: 0.8; 35 | font-size: 13px; 36 | padding-bottom: 55px; 37 | } 38 | } 39 | 40 | .fa-bars { 41 | cursor: pointer; 42 | position: absolute; 43 | top: 13px; 44 | left: 18px; 45 | } 46 | } 47 | 48 | .right-side { 49 | text-align: right; 50 | display: flex; 51 | width: 100%; 52 | flex-direction: row-reverse; 53 | margin-top: 2px; 54 | padding-right: 40px; 55 | 56 | .item { 57 | margin-left: 20px; 58 | 59 | .weight-light { 60 | font-weight: 200; 61 | } 62 | 63 | span { 64 | margin-bottom: -10px !important; 65 | } 66 | 67 | button { 68 | margin-top: 5px; 69 | } 70 | } 71 | } 72 | } 73 | } 74 | .modal-content { 75 | width: 300px !important; 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/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/javascript/packs/login/index.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 61 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | var validEnv = ['development', 'test', 'production'] 3 | var currentEnv = api.env() 4 | var isDevelopmentEnv = api.env('development') 5 | var isProductionEnv = api.env('production') 6 | var isTestEnv = api.env('test') 7 | 8 | if (!validEnv.includes(currentEnv)) { 9 | throw new Error( 10 | 'Please specify a valid `NODE_ENV` or ' + 11 | '`BABEL_ENV` environment variables. Valid values are "development", ' + 12 | '"test", and "production". Instead, received: ' + 13 | JSON.stringify(currentEnv) + 14 | '.' 15 | ) 16 | } 17 | 18 | return { 19 | presets: [ 20 | isTestEnv && [ 21 | '@babel/preset-env', 22 | { 23 | targets: { 24 | node: 'current' 25 | } 26 | } 27 | ], 28 | (isProductionEnv || isDevelopmentEnv) && [ 29 | '@babel/preset-env', 30 | { 31 | forceAllTransforms: true, 32 | useBuiltIns: 'entry', 33 | corejs: 3, 34 | modules: false, 35 | exclude: ['transform-typeof-symbol'] 36 | } 37 | ] 38 | ].filter(Boolean), 39 | plugins: [ 40 | 'babel-plugin-macros', 41 | '@babel/plugin-syntax-dynamic-import', 42 | isTestEnv && 'babel-plugin-dynamic-import-node', 43 | '@babel/plugin-transform-destructuring', 44 | [ 45 | '@babel/plugin-proposal-class-properties', 46 | { 47 | loose: true 48 | } 49 | ], 50 | [ 51 | '@babel/plugin-proposal-object-rest-spread', 52 | { 53 | useBuiltIns: true 54 | } 55 | ], 56 | [ 57 | '@babel/plugin-transform-runtime', 58 | { 59 | helpers: false, 60 | regenerator: true, 61 | corejs: false 62 | } 63 | ], 64 | [ 65 | '@babel/plugin-transform-regenerator', 66 | { 67 | async: false 68 | } 69 | ] 70 | ].filter(Boolean) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | config.cache_classes = false 12 | 13 | # Do not eager load code on boot. This avoids loading your whole application 14 | # just for the purpose of running a single test. If you are using a tool that 15 | # preloads Rails for running tests, you may have to set it to true. 16 | config.eager_load = false 17 | 18 | # Configure public file server for tests with Cache-Control for performance. 19 | config.public_file_server.enabled = true 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 22 | } 23 | 24 | # Show full error reports and disable caching. 25 | config.consider_all_requests_local = true 26 | config.action_controller.perform_caching = false 27 | config.cache_store = :null_store 28 | 29 | # Raise exceptions instead of rendering exception templates. 30 | config.action_dispatch.show_exceptions = false 31 | 32 | # Disable request forgery protection in test environment. 33 | config.action_controller.allow_forgery_protection = false 34 | 35 | # Store uploaded files on the local file system in a temporary directory. 36 | config.active_storage.service = :test 37 | 38 | config.action_mailer.perform_caching = false 39 | 40 | # Tell Action Mailer not to deliver emails to the real world. 41 | # The :test delivery method accumulates sent emails in the 42 | # ActionMailer::Base.deliveries array. 43 | config.action_mailer.delivery_method = :test 44 | 45 | # Print deprecation notices to the stderr. 46 | config.active_support.deprecation = :stderr 47 | 48 | # Raises error for missing translations. 49 | # config.action_view.raise_on_missing_translations = true 50 | end 51 | -------------------------------------------------------------------------------- /app/javascript/packs/shared/header.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 72 | 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Open Todoist 2 | 3 | ![logo](./public/open_todoist_logo.png) 4 | 5 | This project is a clone of todoist to benefit who wants to get a open source project and get the same result of this 6 | amazing tecnology 7 | 8 | ## running project 9 | 10 | config dotenv variables: 11 | ``` 12 | db_user=root 13 | db_pass=root 14 | db_host=postgres 15 | ``` 16 | 17 | starting server rails and webpack 18 | ``` 19 | sudo docker-compose up --build 20 | ``` 21 | 22 | create and migrate database: 23 | ``` 24 | sudo docker-compose run --rm web_app rails db:create db:migrate 25 | ``` 26 | 27 | ## How run tests 28 | 29 | rspec 30 | ``` 31 | sudo docker-compose run --rm web_app rspec 32 | ``` 33 | 34 | rubocop 35 | ``` 36 | sudo docker-compose run --rm web_app rubocop -A 37 | ``` 38 | 39 | brakeman 40 | ``` 41 | sudo docker-compose run --rm web_app brakeman 42 | ``` 43 | 44 | ## API 45 | 46 | ### Authenticity token 47 | 48 |
49 | Get 50 | 51 | - curl: 52 | ```shell 53 | curl -X "GET" 'http://localhost:3000' --cookie-jar cookie | grep csrf 54 | ``` 55 | 56 | - return: 57 | ```HTML 58 | 59 | ``` 60 |
61 | 62 | ### Session 63 | 64 |
65 | Create 66 | 67 | - curl: 68 | ```shell 69 | curl -kv -H 'Content-Type: application/json' -d '{"users": { "email": "root@root.com", "password": "123456"}, "authenticity_token": "eZHlcA3MW7i4Kfl6lo4i7wvE6V54x3SZcdIvWYXT5idHpnjTFgA+rjIzFbp78L3jnXLmAnVcSEA2rBHpw7JbOA==" }' --cookie cookie -X 'POST' "http://localhost:3000/api/v1/sessions" | jq 70 | ``` 71 | 72 | - status_code: 201 Created 73 | 74 | - return: 75 | ```json 76 | { 77 | "authentication_token": "2yPsyWBjLPci4xoyzaG4" 78 | } 79 | ``` 80 |
81 | 82 | ### Projects 83 | 84 |
85 | Get 86 | 87 | - curl: 88 | ```shell 89 | curl -kv -H 'Content-Type: application/json' -H 'token: 2yPsyWBjLPci4xoyzaG4' --cookie cookie -X 'GET' "http://localhost:3000/api/v1/projects" | jq 90 | ``` 91 | 92 | - status_code: 200 Ok 93 | 94 | - return: 95 | ```json 96 | [] 97 | ``` 98 |
99 | -------------------------------------------------------------------------------- /config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_root_path: public 7 | public_output_path: packs 8 | cache_path: tmp/cache/webpacker 9 | check_yarn_integrity: false 10 | webpack_compile_output: true 11 | 12 | # Additional paths webpack should lookup modules 13 | # ['app/assets', 'engine/foo/app/assets'] 14 | resolved_paths: [] 15 | 16 | # Reload manifest.json on all requests so we reload latest compiled packs 17 | cache_manifest: false 18 | 19 | # Extract and emit a css file 20 | extract_css: false 21 | 22 | static_assets_extensions: 23 | - .jpg 24 | - .jpeg 25 | - .png 26 | - .gif 27 | - .tiff 28 | - .ico 29 | - .svg 30 | - .eot 31 | - .otf 32 | - .ttf 33 | - .woff 34 | - .woff2 35 | 36 | extensions: 37 | - .vue 38 | - .mjs 39 | - .js 40 | - .sass 41 | - .scss 42 | - .css 43 | - .module.sass 44 | - .module.scss 45 | - .module.css 46 | - .png 47 | - .svg 48 | - .gif 49 | - .jpeg 50 | - .jpg 51 | 52 | development: 53 | <<: *default 54 | compile: true 55 | 56 | # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules 57 | check_yarn_integrity: true 58 | 59 | # Reference: https://webpack.js.org/configuration/dev-server/ 60 | dev_server: 61 | https: false 62 | host: localhost 63 | port: 3035 64 | public: localhost:3035 65 | hmr: false 66 | # Inline should be set to true if using HMR 67 | inline: true 68 | overlay: true 69 | compress: true 70 | disable_host_check: true 71 | use_local_ip: false 72 | quiet: false 73 | pretty: false 74 | headers: 75 | 'Access-Control-Allow-Origin': '*' 76 | watch_options: 77 | ignored: '**/node_modules/**' 78 | 79 | 80 | test: 81 | <<: *default 82 | compile: true 83 | 84 | # Compile test packs to a separate directory 85 | public_output_path: packs-test 86 | 87 | production: 88 | <<: *default 89 | 90 | # Production depends on precompilation of packs prior to booting for performance. 91 | compile: false 92 | 93 | # Extract and emit a css file 94 | extract_css: true 95 | 96 | # Cache manifest.json for performance 97 | cache_manifest: true 98 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded on 7 | # every request. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable/disable caching. By default caching is disabled. 18 | # Run rails dev:cache to toggle caching. 19 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 20 | config.action_controller.perform_caching = true 21 | config.action_controller.enable_fragment_cache_logging = true 22 | 23 | config.cache_store = :memory_store 24 | config.public_file_server.headers = { 25 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 26 | } 27 | else 28 | config.action_controller.perform_caching = false 29 | 30 | config.cache_store = :null_store 31 | end 32 | 33 | # Store uploaded files on the local file system (see config/storage.yml for options). 34 | config.active_storage.service = :local 35 | 36 | # Don't care if the mailer can't send. 37 | config.action_mailer.raise_delivery_errors = false 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | # Print deprecation notices to the Rails logger. 42 | config.active_support.deprecation = :log 43 | 44 | # Raise an error on page load if there are pending migrations. 45 | config.active_record.migration_error = :page_load 46 | 47 | # Highlight code that triggered database queries in logs. 48 | config.active_record.verbose_query_logs = true 49 | 50 | # Debug mode disables concatenation and preprocessing of assets. 51 | # This option may cause significant delays in view rendering with a large 52 | # number of complex assets. 53 | config.assets.debug = true 54 | 55 | # Suppress logger output for asset requests. 56 | config.assets.quiet = true 57 | 58 | # Raises error for missing translations. 59 | # config.action_view.raise_on_missing_translations = true 60 | 61 | # Use an evented file watcher to asynchronously detect changes in source code, 62 | # routes, locales, etc. This feature depends on the listen gem. 63 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 64 | end 65 | -------------------------------------------------------------------------------- /app/javascript/packs/shared/sidebar.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 74 | -------------------------------------------------------------------------------- /app/javascript/packs/tasksArchiveds/index.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 77 | -------------------------------------------------------------------------------- /spec/requests/api/v1/tasks_request_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'Task Management', type: :request do 6 | let!(:project) { create(:project) } 7 | 8 | context :index do 9 | subject { post current_path, headers: headers } 10 | let(:current_path) { "/api/v1/projects/#{project.id}/tasks" } 11 | 12 | context 'invalid headers' do 13 | let(:headers) { { 'token' => '' } } 14 | 15 | it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) } 16 | end 17 | end 18 | 19 | context :create do 20 | subject { post current_path, params: params, headers: headers } 21 | let(:current_path) { "/api/v1/projects/#{project.id}/tasks" } 22 | 23 | context 'invalid params' do 24 | let(:params) { { tasks: { title: nil } } } 25 | let(:headers) { { 'token' => project.user.authentication_token } } 26 | 27 | before { subject } 28 | 29 | it { expect(response).to have_http_status(:unprocessable_entity) } 30 | it { expect(assigns(:task)).to_not be_valid } 31 | end 32 | 33 | context 'invalid headers' do 34 | let(:params) do 35 | { tasks: attributes_for(:task, project: project) } 36 | end 37 | let(:headers) { { 'token' => '' } } 38 | 39 | it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) } 40 | end 41 | 42 | context 'valid with params and headers' do 43 | let(:params) do 44 | { tasks: attributes_for(:task, project: project) } 45 | end 46 | let(:headers) { { 'token' => project.user.authentication_token } } 47 | let(:keys_returned) { %w[id title description status schedule_date] } 48 | 49 | before { subject } 50 | 51 | it { expect(response).to have_http_status(:created) } 52 | it { expect(parsed_response.keys).to match_array(keys_returned) } 53 | end 54 | end 55 | 56 | context :destroy do 57 | subject { delete current_path, headers: headers } 58 | let(:current_path) { "/api/v1/projects/#{project.id}/tasks/#{task.id}" } 59 | 60 | context 'invalid headers' do 61 | let(:task) { create(:task, project: project) } 62 | let(:headers) { { 'token' => '' } } 63 | 64 | it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) } 65 | end 66 | 67 | context 'not found task' do 68 | let(:current_path) { "/api/v1/projects/#{project.id}/tasks/:invalid_task" } 69 | let(:headers) { { 'token' => project.user.authentication_token } } 70 | 71 | it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) } 72 | end 73 | 74 | context 'valid task and headers' do 75 | let(:task) { create(:task, project: project) } 76 | let(:headers) { { 'token' => project.user.authentication_token } } 77 | 78 | before { subject } 79 | 80 | it { expect(response).to have_http_status(:ok) } 81 | it { expect(parsed_response['status']).to eq('archived') } 82 | end 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # This file is the source Rails uses to define your schema when running `rails 6 | # db:schema:load`. When creating a new database, `rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 2020_04_10_224823) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | 18 | create_table "projects", force: :cascade do |t| 19 | t.string "title", default: "", null: false 20 | t.integer "status", default: 0, null: false 21 | t.datetime "schedule_date" 22 | t.bigint "user_id" 23 | t.datetime "created_at", precision: 6, null: false 24 | t.datetime "updated_at", precision: 6, null: false 25 | t.index ["user_id"], name: "index_projects_on_user_id" 26 | end 27 | 28 | create_table "scores", force: :cascade do |t| 29 | t.integer "points", default: 0, null: false 30 | t.integer "rank", default: 0, null: false 31 | t.datetime "created_at", precision: 6, null: false 32 | t.datetime "updated_at", precision: 6, null: false 33 | end 34 | 35 | create_table "tasks", force: :cascade do |t| 36 | t.string "title", default: "", null: false 37 | t.text "description" 38 | t.integer "status", default: 0, null: false 39 | t.datetime "schedule_date" 40 | t.integer "order", default: 0, null: false 41 | t.bigint "project_id" 42 | t.datetime "created_at", precision: 6, null: false 43 | t.datetime "updated_at", precision: 6, null: false 44 | t.index ["project_id"], name: "index_tasks_on_project_id" 45 | end 46 | 47 | create_table "users", force: :cascade do |t| 48 | t.string "email", default: "", null: false 49 | t.string "encrypted_password", default: "", null: false 50 | t.integer "status", default: 0, null: false 51 | t.bigint "score_id" 52 | t.string "reset_password_token" 53 | t.datetime "reset_password_sent_at" 54 | t.datetime "remember_created_at" 55 | t.datetime "created_at", precision: 6, null: false 56 | t.datetime "updated_at", precision: 6, null: false 57 | t.string "authentication_token", limit: 30 58 | t.index ["authentication_token"], name: "index_users_on_authentication_token", unique: true 59 | t.index ["email"], name: "index_users_on_email", unique: true 60 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 61 | t.index ["score_id"], name: "index_users_on_score_id" 62 | end 63 | 64 | add_foreign_key "projects", "users" 65 | add_foreign_key "tasks", "projects" 66 | add_foreign_key "users", "scores" 67 | end 68 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'bundle' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require 'rubygems' 12 | 13 | m = Module.new do 14 | module_function 15 | 16 | def invoked_as_script? 17 | File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__) 18 | end 19 | 20 | def env_var_version 21 | ENV['BUNDLER_VERSION'] 22 | end 23 | 24 | def cli_arg_version 25 | return unless invoked_as_script? # don't want to hijack other binstubs 26 | unless 'update'.start_with?(ARGV.first || ' ') 27 | return 28 | end # must be running `bundle update` 29 | 30 | bundler_version = nil 31 | update_index = nil 32 | ARGV.each_with_index do |a, i| 33 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 34 | bundler_version = a 35 | end 36 | unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 37 | next 38 | end 39 | 40 | bundler_version = Regexp.last_match(1) 41 | update_index = i 42 | end 43 | bundler_version 44 | end 45 | 46 | def gemfile 47 | gemfile = ENV['BUNDLE_GEMFILE'] 48 | return gemfile if gemfile && !gemfile.empty? 49 | 50 | File.expand_path('../Gemfile', __dir__) 51 | end 52 | 53 | def lockfile 54 | lockfile = 55 | case File.basename(gemfile) 56 | when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile) 57 | else "#{gemfile}.lock" 58 | end 59 | File.expand_path(lockfile) 60 | end 61 | 62 | def lockfile_version 63 | return unless File.file?(lockfile) 64 | 65 | lockfile_contents = File.read(lockfile) 66 | unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 67 | return 68 | end 69 | 70 | Regexp.last_match(1) 71 | end 72 | 73 | def bundler_version 74 | @bundler_version ||= 75 | env_var_version || cli_arg_version || 76 | lockfile_version 77 | end 78 | 79 | def bundler_requirement 80 | return "#{Gem::Requirement.default}.a" unless bundler_version 81 | 82 | bundler_gem_version = Gem::Version.new(bundler_version) 83 | 84 | requirement = bundler_gem_version.approximate_recommendation 85 | 86 | unless Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.7.0') 87 | return requirement 88 | end 89 | 90 | requirement += '.a' if bundler_gem_version.prerelease? 91 | 92 | requirement 93 | end 94 | 95 | def load_bundler! 96 | ENV['BUNDLE_GEMFILE'] ||= gemfile 97 | 98 | activate_bundler 99 | end 100 | 101 | def activate_bundler 102 | gem_error = activation_error_handling do 103 | gem 'bundler', bundler_requirement 104 | end 105 | return if gem_error.nil? 106 | 107 | require_error = activation_error_handling do 108 | require 'bundler/version' 109 | end 110 | if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 111 | return 112 | end 113 | 114 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" 115 | exit 42 116 | end 117 | 118 | def activation_error_handling 119 | yield 120 | nil 121 | rescue StandardError, LoadError => e 122 | e 123 | end 124 | end 125 | 126 | m.load_bundler! 127 | 128 | load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script? 129 | -------------------------------------------------------------------------------- /spec/requests/api/v1/projects_request_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'Project Management' do 6 | context :index do 7 | subject { get current_path, headers: headers } 8 | let(:current_path) { '/api/v1/projects' } 9 | 10 | context 'invalid headers' do 11 | let(:header) { { 'token' => '' } } 12 | 13 | it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) } 14 | end 15 | 16 | context 'valid headers' do 17 | let(:user) { create(:user) } 18 | let(:headers) { { 'token' => user.authentication_token } } 19 | 20 | context "project don't exists" do 21 | before { subject } 22 | 23 | it { expect(response).to have_http_status(:ok) } 24 | it { expect(parsed_response).to be_empty } 25 | end 26 | 27 | context 'project exists' do 28 | let!(:project) { create(:project, user: user) } 29 | let!(:task) { create(:task, project: project) } 30 | let(:project_keys) { %w[id title schedule_date tasks] } 31 | let(:task_keys) { %w[id title description status schedule_date] } 32 | 33 | before { subject } 34 | 35 | it { expect(response).to have_http_status(:ok) } 36 | 37 | context :projects do 38 | it { expect(parsed_response).to_not be_empty } 39 | it { expect(parsed_response.last.keys).to match_array(project_keys) } 40 | end 41 | 42 | context :tasks do 43 | let(:tasks) { parsed_response.last['tasks'] } 44 | 45 | it { expect(tasks).to_not be_empty } 46 | it { expect(tasks.last.keys).to match_array(task_keys) } 47 | end 48 | end 49 | end 50 | end 51 | 52 | context :create do 53 | subject { post current_path, params: params, headers: headers } 54 | let(:current_path) { '/api/v1/projects' } 55 | 56 | context 'invalid headers' do 57 | let(:headers) { { 'token' => '' } } 58 | let(:params) { { projects: attributes_for(:project) } } 59 | 60 | it { expect { subject }.to raise_error(ActiveRecord::RecordNotFound) } 61 | end 62 | 63 | context 'valid headers' do 64 | let(:user) { create(:user) } 65 | let(:headers) { { 'token' => user.authentication_token } } 66 | 67 | context 'invalid params' do 68 | let(:params) { { projects: { title: nil } } } 69 | 70 | before { subject } 71 | 72 | it { expect(response).to have_http_status(:unprocessable_entity) } 73 | it { expect(Project.all).to be_empty } 74 | end 75 | 76 | context 'valid params' do 77 | let(:params) { { projects: attributes_for(:project) } } 78 | let(:project_keys) { %w[id title schedule_date tasks] } 79 | 80 | before { subject } 81 | 82 | it { expect(response).to have_http_status(:created) } 83 | it { expect(parsed_response.keys).to match_array(project_keys) } 84 | it { expect(Project.active).to_not be_empty } 85 | end 86 | end 87 | end 88 | 89 | context :destroy do 90 | subject { delete current_path, headers: headers } 91 | let(:current_path) { "/api/v1/projects/#{project.id}" } 92 | 93 | context 'valid headers' do 94 | let(:user) { create(:user) } 95 | let(:headers) { { 'token' => user.authentication_token } } 96 | 97 | context 'project exists' do 98 | let(:project) { create(:project, user: user) } 99 | 100 | before { subject } 101 | 102 | it { expect(response).to have_http_status(:ok) } 103 | it { expect(Project.find(project.id).status).to eq('archived') } 104 | end 105 | end 106 | end 107 | end 108 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | email_changed: 27 | subject: "Email Changed" 28 | password_change: 29 | subject: "Password Changed" 30 | omniauth_callbacks: 31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 32 | success: "Successfully authenticated from %{kind} account." 33 | passwords: 34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 37 | updated: "Your password has been changed successfully. You are now signed in." 38 | updated_not_active: "Your password has been changed successfully." 39 | registrations: 40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 41 | signed_up: "Welcome! You have signed up successfully." 42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." 45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." 46 | updated: "Your account has been updated successfully." 47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again" 48 | sessions: 49 | signed_in: "Signed in successfully." 50 | signed_out: "Signed out successfully." 51 | already_signed_out: "Signed out successfully." 52 | unlocks: 53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 56 | errors: 57 | messages: 58 | already_confirmed: "was already confirmed, please try signing in" 59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 60 | expired: "has expired, please request a new one" 61 | not_found: "not found" 62 | not_locked: "was not locked" 63 | not_saved: 64 | one: "1 error prohibited this %{resource} from being saved:" 65 | other: "%{count} errors prohibited this %{resource} from being saved:" 66 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress CSS using a preprocessor. 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 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 34 | # config.action_controller.asset_host = 'http://assets.example.com' 35 | 36 | # Specifies the header that your server uses for sending files. 37 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 38 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 39 | 40 | # Store uploaded files on the local file system (see config/storage.yml for options). 41 | config.active_storage.service = :local 42 | 43 | # Mount Action Cable outside main process or domain. 44 | # config.action_cable.mount_path = nil 45 | # config.action_cable.url = 'wss://example.com/cable' 46 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 47 | 48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 | # config.force_ssl = true 50 | 51 | # Use the lowest log level to ensure availability of diagnostic information 52 | # when problems arise. 53 | config.log_level = :debug 54 | 55 | # Prepend all log lines with the following tags. 56 | config.log_tags = [:request_id] 57 | 58 | # Use a different cache store in production. 59 | # config.cache_store = :mem_cache_store 60 | 61 | # Use a real queuing backend for Active Job (and separate queues per environment). 62 | # config.active_job.queue_adapter = :resque 63 | # config.active_job.queue_name_prefix = "open_todoist_production" 64 | 65 | config.action_mailer.perform_caching = false 66 | 67 | # Ignore bad email addresses and do not raise email delivery errors. 68 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 69 | # config.action_mailer.raise_delivery_errors = false 70 | 71 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 72 | # the I18n.default_locale when a translation cannot be found). 73 | config.i18n.fallbacks = true 74 | 75 | # Send deprecation notices to registered listeners. 76 | config.active_support.deprecation = :notify 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = ::Logger::Formatter.new 80 | 81 | # Use a different logger for distributed setups. 82 | # require 'syslog/logger' 83 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 84 | 85 | if ENV['RAILS_LOG_TO_STDOUT'].present? 86 | logger = ActiveSupport::Logger.new(STDOUT) 87 | logger.formatter = config.log_formatter 88 | config.logger = ActiveSupport::TaggedLogging.new(logger) 89 | end 90 | 91 | # Do not dump schema after migrations. 92 | config.active_record.dump_schema_after_migration = false 93 | 94 | # Inserts middleware to perform automatic connection switching. 95 | # The `database_selector` hash is used to pass options to the DatabaseSelector 96 | # middleware. The `delay` is used to determine how long to wait after a write 97 | # to send a subsequent read to the primary. 98 | # 99 | # The `database_resolver` class is used by the middleware to determine which 100 | # database is appropriate to use based on the time delay. 101 | # 102 | # The `database_resolver_context` class is used by the middleware to set 103 | # timestamps for the last write to the primary. The resolver uses the context 104 | # class timestamps to determine how long to wait before reading from the 105 | # replica. 106 | # 107 | # By default Rails will store a last write timestamp in the session. The 108 | # DatabaseSelector middleware is designed as such you can define your own 109 | # strategy for connection switching and pass that into the middleware through 110 | # these configuration options. 111 | # config.active_record.database_selector = { delay: 2.seconds } 112 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver 113 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session 114 | end 115 | -------------------------------------------------------------------------------- /app/javascript/packs/home/index.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 185 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (6.0.4) 5 | actionpack (= 6.0.4) 6 | nio4r (~> 2.0) 7 | websocket-driver (>= 0.6.1) 8 | actionmailbox (6.0.4) 9 | actionpack (= 6.0.4) 10 | activejob (= 6.0.4) 11 | activerecord (= 6.0.4) 12 | activestorage (= 6.0.4) 13 | activesupport (= 6.0.4) 14 | mail (>= 2.7.1) 15 | actionmailer (6.0.4) 16 | actionpack (= 6.0.4) 17 | actionview (= 6.0.4) 18 | activejob (= 6.0.4) 19 | mail (~> 2.5, >= 2.5.4) 20 | rails-dom-testing (~> 2.0) 21 | actionpack (6.0.4) 22 | actionview (= 6.0.4) 23 | activesupport (= 6.0.4) 24 | rack (~> 2.0, >= 2.0.8) 25 | rack-test (>= 0.6.3) 26 | rails-dom-testing (~> 2.0) 27 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 28 | actiontext (6.0.4) 29 | actionpack (= 6.0.4) 30 | activerecord (= 6.0.4) 31 | activestorage (= 6.0.4) 32 | activesupport (= 6.0.4) 33 | nokogiri (>= 1.8.5) 34 | actionview (6.0.4) 35 | activesupport (= 6.0.4) 36 | builder (~> 3.1) 37 | erubi (~> 1.4) 38 | rails-dom-testing (~> 2.0) 39 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 40 | active_model_serializers (0.10.12) 41 | actionpack (>= 4.1, < 6.2) 42 | activemodel (>= 4.1, < 6.2) 43 | case_transform (>= 0.2) 44 | jsonapi-renderer (>= 0.1.1.beta1, < 0.3) 45 | activejob (6.0.4) 46 | activesupport (= 6.0.4) 47 | globalid (>= 0.3.6) 48 | activemodel (6.0.4) 49 | activesupport (= 6.0.4) 50 | activerecord (6.0.4) 51 | activemodel (= 6.0.4) 52 | activesupport (= 6.0.4) 53 | activestorage (6.0.4) 54 | actionpack (= 6.0.4) 55 | activejob (= 6.0.4) 56 | activerecord (= 6.0.4) 57 | marcel (~> 1.0.0) 58 | activesupport (6.0.4) 59 | concurrent-ruby (~> 1.0, >= 1.0.2) 60 | i18n (>= 0.7, < 2) 61 | minitest (~> 5.1) 62 | tzinfo (~> 1.1) 63 | zeitwerk (~> 2.2, >= 2.2.2) 64 | addressable (2.8.0) 65 | public_suffix (>= 2.0.2, < 5.0) 66 | airbrussh (1.4.0) 67 | sshkit (>= 1.6.1, != 1.7.0) 68 | ast (2.4.2) 69 | bcrypt (3.1.16) 70 | bindex (0.8.1) 71 | bootsnap (1.7.5) 72 | msgpack (~> 1.0) 73 | brakeman (5.1.1) 74 | builder (3.2.4) 75 | byebug (11.1.3) 76 | capistrano (3.16.0) 77 | airbrussh (>= 1.0.0) 78 | i18n 79 | rake (>= 10.0.0) 80 | sshkit (>= 1.9.0) 81 | capybara (3.35.3) 82 | addressable 83 | mini_mime (>= 0.1.3) 84 | nokogiri (~> 1.8) 85 | rack (>= 1.6.0) 86 | rack-test (>= 0.6.3) 87 | regexp_parser (>= 1.5, < 3.0) 88 | xpath (~> 3.2) 89 | case_transform (0.2) 90 | activesupport 91 | childprocess (3.0.0) 92 | coderay (1.1.3) 93 | concurrent-ruby (1.1.9) 94 | crass (1.0.6) 95 | devise (4.8.0) 96 | bcrypt (~> 3.0) 97 | orm_adapter (~> 0.1) 98 | railties (>= 4.1.0) 99 | responders 100 | warden (~> 1.2.3) 101 | diff-lcs (1.4.4) 102 | dotenv (2.7.6) 103 | dotenv-rails (2.7.6) 104 | dotenv (= 2.7.6) 105 | railties (>= 3.2) 106 | erubi (1.10.0) 107 | factory_bot (6.2.0) 108 | activesupport (>= 5.0.0) 109 | factory_bot_rails (6.2.0) 110 | factory_bot (~> 6.2.0) 111 | railties (>= 5.0.0) 112 | ffaker (2.18.0) 113 | ffi (1.15.3) 114 | foreman (0.87.2) 115 | globalid (0.4.2) 116 | activesupport (>= 4.2.0) 117 | i18n (1.8.10) 118 | concurrent-ruby (~> 1.0) 119 | jbuilder (2.11.2) 120 | activesupport (>= 5.0.0) 121 | jsonapi-renderer (0.2.2) 122 | listen (3.1.5) 123 | rb-fsevent (~> 0.9, >= 0.9.4) 124 | rb-inotify (~> 0.9, >= 0.9.7) 125 | ruby_dep (~> 1.2) 126 | loofah (2.10.0) 127 | crass (~> 1.0.2) 128 | nokogiri (>= 1.5.9) 129 | mail (2.7.1) 130 | mini_mime (>= 0.1.1) 131 | marcel (1.0.1) 132 | method_source (1.0.0) 133 | mini_mime (1.1.0) 134 | mini_portile2 (2.5.3) 135 | minitest (5.14.4) 136 | msgpack (1.4.2) 137 | net-scp (3.0.0) 138 | net-ssh (>= 2.6.5, < 7.0.0) 139 | net-ssh (6.1.0) 140 | nio4r (2.5.7) 141 | nokogiri (1.11.7) 142 | mini_portile2 (~> 2.5.0) 143 | racc (~> 1.4) 144 | orm_adapter (0.5.0) 145 | parallel (1.20.1) 146 | parser (3.0.2.0) 147 | ast (~> 2.4.1) 148 | pg (1.2.3) 149 | pry (0.14.1) 150 | coderay (~> 1.1) 151 | method_source (~> 1.0) 152 | pry-rails (0.3.9) 153 | pry (>= 0.10.4) 154 | public_suffix (4.0.6) 155 | puma (4.3.8) 156 | nio4r (~> 2.0) 157 | racc (1.5.2) 158 | rack (2.2.3) 159 | rack-proxy (0.7.0) 160 | rack 161 | rack-test (1.1.0) 162 | rack (>= 1.0, < 3) 163 | rails (6.0.4) 164 | actioncable (= 6.0.4) 165 | actionmailbox (= 6.0.4) 166 | actionmailer (= 6.0.4) 167 | actionpack (= 6.0.4) 168 | actiontext (= 6.0.4) 169 | actionview (= 6.0.4) 170 | activejob (= 6.0.4) 171 | activemodel (= 6.0.4) 172 | activerecord (= 6.0.4) 173 | activestorage (= 6.0.4) 174 | activesupport (= 6.0.4) 175 | bundler (>= 1.3.0) 176 | railties (= 6.0.4) 177 | sprockets-rails (>= 2.0.0) 178 | rails-controller-testing (1.0.5) 179 | actionpack (>= 5.0.1.rc1) 180 | actionview (>= 5.0.1.rc1) 181 | activesupport (>= 5.0.1.rc1) 182 | rails-dom-testing (2.0.3) 183 | activesupport (>= 4.2.0) 184 | nokogiri (>= 1.6) 185 | rails-html-sanitizer (1.3.0) 186 | loofah (~> 2.3) 187 | railties (6.0.4) 188 | actionpack (= 6.0.4) 189 | activesupport (= 6.0.4) 190 | method_source 191 | rake (>= 0.8.7) 192 | thor (>= 0.20.3, < 2.0) 193 | rainbow (3.0.0) 194 | rake (13.0.6) 195 | rb-fsevent (0.11.0) 196 | rb-inotify (0.10.1) 197 | ffi (~> 1.0) 198 | regexp_parser (2.1.1) 199 | responders (3.0.1) 200 | actionpack (>= 5.0) 201 | railties (>= 5.0) 202 | rexml (3.2.5) 203 | rspec-core (3.10.1) 204 | rspec-support (~> 3.10.0) 205 | rspec-expectations (3.10.1) 206 | diff-lcs (>= 1.2.0, < 2.0) 207 | rspec-support (~> 3.10.0) 208 | rspec-mocks (3.10.2) 209 | diff-lcs (>= 1.2.0, < 2.0) 210 | rspec-support (~> 3.10.0) 211 | rspec-rails (5.0.1) 212 | actionpack (>= 5.2) 213 | activesupport (>= 5.2) 214 | railties (>= 5.2) 215 | rspec-core (~> 3.10) 216 | rspec-expectations (~> 3.10) 217 | rspec-mocks (~> 3.10) 218 | rspec-support (~> 3.10) 219 | rspec-support (3.10.2) 220 | rubocop (1.18.3) 221 | parallel (~> 1.10) 222 | parser (>= 3.0.0.0) 223 | rainbow (>= 2.2.2, < 4.0) 224 | regexp_parser (>= 1.8, < 3.0) 225 | rexml 226 | rubocop-ast (>= 1.7.0, < 2.0) 227 | ruby-progressbar (~> 1.7) 228 | unicode-display_width (>= 1.4.0, < 3.0) 229 | rubocop-ast (1.8.0) 230 | parser (>= 3.0.1.1) 231 | ruby-progressbar (1.11.0) 232 | ruby_dep (1.5.0) 233 | rubyzip (2.3.2) 234 | sass-rails (6.0.0) 235 | sassc-rails (~> 2.1, >= 2.1.1) 236 | sassc (2.4.0) 237 | ffi (~> 1.9) 238 | sassc-rails (2.1.2) 239 | railties (>= 4.0.0) 240 | sassc (>= 2.0) 241 | sprockets (> 3.0) 242 | sprockets-rails 243 | tilt 244 | selenium-webdriver (3.142.7) 245 | childprocess (>= 0.5, < 4.0) 246 | rubyzip (>= 1.2.2) 247 | shoulda-matchers (5.0.0) 248 | activesupport (>= 5.2.0) 249 | simple_token_authentication (1.17.0) 250 | actionmailer (>= 3.2.6, < 7) 251 | actionpack (>= 3.2.6, < 7) 252 | devise (>= 3.2, < 6) 253 | spring (2.1.1) 254 | spring-watcher-listen (2.0.1) 255 | listen (>= 2.7, < 4.0) 256 | spring (>= 1.2, < 3.0) 257 | sprockets (4.0.2) 258 | concurrent-ruby (~> 1.0) 259 | rack (> 1, < 3) 260 | sprockets-rails (3.2.2) 261 | actionpack (>= 4.0) 262 | activesupport (>= 4.0) 263 | sprockets (>= 3.0.0) 264 | sshkit (1.21.2) 265 | net-scp (>= 1.1.2) 266 | net-ssh (>= 2.8.0) 267 | thor (1.1.0) 268 | thread_safe (0.3.6) 269 | tilt (2.0.10) 270 | turbolinks (5.2.1) 271 | turbolinks-source (~> 5.2) 272 | turbolinks-source (5.2.0) 273 | tzinfo (1.2.9) 274 | thread_safe (~> 0.1) 275 | unicode-display_width (2.0.0) 276 | warden (1.2.9) 277 | rack (>= 2.0.9) 278 | web-console (4.1.0) 279 | actionview (>= 6.0.0) 280 | activemodel (>= 6.0.0) 281 | bindex (>= 0.4.0) 282 | railties (>= 6.0.0) 283 | webdrivers (4.6.0) 284 | nokogiri (~> 1.6) 285 | rubyzip (>= 1.3.0) 286 | selenium-webdriver (>= 3.0, < 4.0) 287 | webpacker (4.3.0) 288 | activesupport (>= 4.2) 289 | rack-proxy (>= 0.6.1) 290 | railties (>= 4.2) 291 | websocket-driver (0.7.5) 292 | websocket-extensions (>= 0.1.0) 293 | websocket-extensions (0.1.5) 294 | xpath (3.2.0) 295 | nokogiri (~> 1.8) 296 | zeitwerk (2.4.2) 297 | 298 | PLATFORMS 299 | ruby 300 | 301 | DEPENDENCIES 302 | active_model_serializers 303 | bootsnap (>= 1.4.2) 304 | brakeman 305 | byebug 306 | capistrano (~> 3.11) 307 | capybara (>= 2.15) 308 | devise 309 | dotenv-rails 310 | factory_bot_rails 311 | ffaker 312 | foreman 313 | jbuilder (~> 2.7) 314 | listen (>= 3.0.5, < 3.2) 315 | pg (>= 0.18, < 2.0) 316 | pry-rails 317 | puma (~> 4.3) 318 | rails (~> 6.0.2, >= 6.0.2.2) 319 | rails-controller-testing 320 | rspec-rails 321 | rubocop 322 | sass-rails (>= 6) 323 | selenium-webdriver 324 | shoulda-matchers 325 | simple_token_authentication 326 | spring 327 | spring-watcher-listen (~> 2.0.0) 328 | turbolinks (~> 5) 329 | tzinfo-data 330 | web-console (>= 3.3.0) 331 | webdrivers 332 | webpacker (~> 4.0) 333 | 334 | RUBY VERSION 335 | ruby 2.7.1p83 336 | 337 | BUNDLED WITH 338 | 2.1.4 339 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Use this hook to configure devise mailer, warden hooks and so forth. 4 | # Many of these configuration options can be set straight in your model. 5 | Devise.setup do |config| 6 | # The secret key used by Devise. Devise uses this key to generate 7 | # random tokens. Changing this key will render invalid all existing 8 | # confirmation, reset password and unlock tokens in the database. 9 | # Devise will use the `secret_key_base` as its `secret_key` 10 | # by default. You can change it below and use your own secret key. 11 | # config.secret_key = '5f22879bc283ed4ae1158982ff5d962e7c0de939927bf46cf04612 12 | # 466f63e549f4158a4df8e687f19c7a6a92e3b0d68f944fa6aeb71 13 | # c4dced352e20ea3599e2a' 14 | 15 | # ==> Controller configuration 16 | # Configure the parent class to the devise controllers. 17 | # config.parent_controller = 'DeviseController' 18 | 19 | # ==> Mailer Configuration 20 | # Configure the e-mail address which will be shown in Devise::Mailer, 21 | # note that it will be overwritten if you use your own mailer class 22 | # with default "from" parameter. 23 | # config.mailer_sender = 24 | # 'please-change-me-at-config-initializers-devise@example.com' 25 | 26 | # Configure the class responsible to send e-mails. 27 | # config.mailer = 'Devise::Mailer' 28 | 29 | # Configure the parent class responsible to send e-mails. 30 | # config.parent_mailer = 'ActionMailer::Base' 31 | 32 | # ==> ORM configuration 33 | # Load and configure the ORM. Supports :active_record (default) and 34 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 35 | # available as additional gems. 36 | require 'devise/orm/active_record' 37 | 38 | # ==> Configuration for any authentication mechanism 39 | # Configure which keys are used when authenticating a user. The default is 40 | # just :email. You can configure it to use [:username, :subdomain], so for 41 | # authenticating a user, both parameters are required. Remember that those 42 | # parameters are used only when authenticating and not when retrieving from 43 | # session. If you need permissions, you should implement that in a 44 | # before filter. 45 | # You can also supply a hash where the value is a boolean determining whether 46 | # or not authentication should be aborted when the value is not present. 47 | # config.authentication_keys = [:email] 48 | 49 | # Configure parameters from the request object used for authentication. 50 | # Each entry 51 | # given should be a request method and it will automatically be passed to the 52 | # find_for_authentication method and considered in your model lookup. For instance, 53 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 54 | # The same considerations mentioned for authentication_keys also apply to request_keys. 55 | # config.request_keys = [] 56 | 57 | # Configure which authentication keys should be case-insensitive. 58 | # These keys will be downcased upon creating or modifying a user and when used 59 | # to authenticate or find a user. Default is :email. 60 | config.case_insensitive_keys = [:email] 61 | 62 | # Configure which authentication keys should have whitespace stripped. 63 | # These keys will have whitespace before and after removed upon creating or 64 | # modifying a user and when used to authenticate or find a user. Default is :email. 65 | config.strip_whitespace_keys = [:email] 66 | 67 | # Tell if authentication through request.params is enabled. True by default. 68 | # It can be set to an array that will enable params authentication only for the 69 | # given strategies, for example, `config.params_authenticatable = [:database] 70 | # ` will 71 | # enable it only for database (email + password) authentication. 72 | # config.params_authenticatable = true 73 | 74 | # Tell if authentication through HTTP Auth is enabled. False by default. 75 | # It can be set to an array that will enable http authentication only for the 76 | # given strategies, for example, `config.http_authenticatable = [:database]` will 77 | # enable it only for database authentication. The supported strategies are: 78 | # :database = Support basic authentication with authentication key + password 79 | # config.http_authenticatable = false 80 | 81 | # If 401 status code should be returned for AJAX requests. True by default. 82 | # config.http_authenticatable_on_xhr = true 83 | 84 | # The realm used in Http Basic Authentication. 'Application' by default. 85 | # config.http_authentication_realm = 'Application' 86 | 87 | # It will change confirmation, password recovery and other workflows 88 | # to behave the same regardless if the e-mail provided was right or wrong. 89 | # Does not affect registerable. 90 | # config.paranoid = true 91 | 92 | # By default Devise will store the user in session. You can skip storage for 93 | # particular strategies by setting this option. 94 | # Notice that if you are skipping storage for all authentication paths, you 95 | # may want to disable generating routes to Devise's sessions controller by 96 | # passing skip: :sessions to `devise_for` in your config/routes.rb 97 | config.skip_session_storage = [:http_auth] 98 | 99 | # By default, Devise cleans up the CSRF token on authentication to 100 | # avoid CSRF token fixation attacks. This means that, when using AJAX 101 | # requests for sign in and sign up, you need to get a new CSRF token 102 | # from the server. You can disable this option at your own risk. 103 | # config.clean_up_csrf_token_on_authentication = true 104 | 105 | # When false, Devise will not attempt to reload routes on eager load. 106 | # This can reduce the time taken to boot the app but if your application 107 | # requires the Devise mappings to be loaded during boot time the application 108 | # won't boot properly. 109 | # config.reload_routes = true 110 | 111 | # ==> Configuration for :database_authenticatable 112 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If 113 | # using other algorithms, it sets how many times you want the password to be hashed. 114 | # 115 | # Limiting the stretches to just one in testing will increase the performance of 116 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 117 | # a value less than 10 in other environments. Note that, for bcrypt (the default 118 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 119 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 120 | config.stretches = Rails.env.test? ? 1 : 11 121 | 122 | # Set up a pepper to generate the hashed password. 123 | # config.pepper = '9d487506f5fa46b137a9c2ea6d49f4b6970e878c56807432f4acb5c211da73d50a8081b19545562401e38ec57689343b552f501e4e63939d5e009635efd9bb82' 124 | 125 | # Send a notification to the original email when the user's email is changed. 126 | # config.send_email_changed_notification = false 127 | 128 | # Send a notification email when the user's password is changed. 129 | # config.send_password_change_notification = false 130 | 131 | # ==> Configuration for :confirmable 132 | # A period that the user is allowed to access the website even without 133 | # confirming their account. For instance, if set to 2.days, the user will be 134 | # able to access the website for two days without confirming their account, 135 | # access will be blocked just in the third day. 136 | # You can also set it to nil, which will allow the user to access the website 137 | # without confirming their account. 138 | # Default is 0.days, meaning the user cannot access the website without 139 | # confirming their account. 140 | # config.allow_unconfirmed_access_for = 2.days 141 | 142 | # A period that the user is allowed to confirm their account before their 143 | # token becomes invalid. For example, if set to 3.days, the user can confirm 144 | # their account within 3 days after the mail was sent, but on the fourth day 145 | # their account can't be confirmed with the token any more. 146 | # Default is nil, meaning there is no restriction on how long a user can take 147 | # before confirming their account. 148 | # config.confirm_within = 3.days 149 | 150 | # If true, requires any email changes to be confirmed (exactly the same way as 151 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 152 | # db field (see migrations). Until confirmed, new email is stored in 153 | # unconfirmed_email column, and copied to email column on successful confirmation. 154 | config.reconfirmable = true 155 | 156 | # Defines which key will be used when confirming an account 157 | # config.confirmation_keys = [:email] 158 | 159 | # ==> Configuration for :rememberable 160 | # The time the user will be remembered without asking for credentials again. 161 | # config.remember_for = 2.weeks 162 | 163 | # Invalidates all the remember me tokens when the user signs out. 164 | config.expire_all_remember_me_on_sign_out = true 165 | 166 | # If true, extends the user's remember period when remembered via cookie. 167 | # config.extend_remember_period = false 168 | 169 | # Options to be passed to the created cookie. For instance, you can set 170 | # secure: true in order to force SSL only cookies. 171 | # config.rememberable_options = {} 172 | 173 | # ==> Configuration for :validatable 174 | # Range for password length. 175 | config.password_length = 6..128 176 | 177 | # Email regex used to validate email formats. It simply asserts that 178 | # one (and only one) @ exists in the given string. This is mainly 179 | # to give user feedback and not to assert the e-mail validity. 180 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 181 | 182 | # ==> Configuration for :timeoutable 183 | # The time you want to timeout the user session without activity. After this 184 | # time the user will be asked for credentials again. Default is 30 minutes. 185 | # config.timeout_in = 30.minutes 186 | 187 | # ==> Configuration for :lockable 188 | # Defines which strategy will be used to lock an account. 189 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 190 | # :none = No lock strategy. You should handle locking by yourself. 191 | # config.lock_strategy = :failed_attempts 192 | 193 | # Defines which key will be used when locking and unlocking an account 194 | # config.unlock_keys = [:email] 195 | 196 | # Defines which strategy will be used to unlock an account. 197 | # :email = Sends an unlock link to the user email 198 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 199 | # :both = Enables both strategies 200 | # :none = No unlock strategy. You should handle unlocking by yourself. 201 | # config.unlock_strategy = :both 202 | 203 | # Number of authentication tries before locking an account if lock_strategy 204 | # is failed attempts. 205 | # config.maximum_attempts = 20 206 | 207 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 208 | # config.unlock_in = 1.hour 209 | 210 | # Warn on the last attempt before the account is locked. 211 | # config.last_attempt_warning = true 212 | 213 | # ==> Configuration for :recoverable 214 | # 215 | # Defines which key will be used when recovering the password for an account 216 | # config.reset_password_keys = [:email] 217 | 218 | # Time interval you can reset your password with a reset password key. 219 | # Don't put a too small interval or your users won't have the time to 220 | # change their passwords. 221 | config.reset_password_within = 6.hours 222 | 223 | # When set to false, does not sign a user in automatically after their password is 224 | # reset. Defaults to true, so a user is signed in automatically after a reset. 225 | # config.sign_in_after_reset_password = true 226 | 227 | # ==> Configuration for :encryptable 228 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 229 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 230 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 231 | # for default behavior) and :restful_authentication_sha1 (then you should set 232 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 233 | # 234 | # Require the `devise-encryptable` gem when using anything other than bcrypt 235 | # config.encryptor = :sha512 236 | 237 | # ==> Scopes configuration 238 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 239 | # "users/sessions/new". It's turned off by default because it's slower if you 240 | # are using only default views. 241 | # config.scoped_views = false 242 | 243 | # Configure the default scope given to Warden. By default it's the first 244 | # devise role declared in your routes (usually :user). 245 | # config.default_scope = :user 246 | 247 | # Set this configuration to false if you want /users/sign_out to sign out 248 | # only the current scope. By default, Devise signs out all scopes. 249 | # config.sign_out_all_scopes = true 250 | 251 | # ==> Navigation configuration 252 | # Lists the formats that should be treated as navigational. Formats like 253 | # :html, should redirect to the sign in page when the user does not have 254 | # access, but formats like :xml or :json, should return 401. 255 | # 256 | # If you have any extra navigational formats, like :iphone or :mobile, you 257 | # should add them to the navigational formats lists. 258 | # 259 | # The "*/*" below is required to match Internet Explorer requests. 260 | # config.navigational_formats = ['*/*', :html] 261 | 262 | # The default HTTP method used to sign out a resource. Default is :delete. 263 | config.sign_out_via = :delete 264 | 265 | # ==> OmniAuth 266 | # Add a new OmniAuth provider. Check the wiki for more information on setting 267 | # up on your models and hooks. 268 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 269 | 270 | # ==> Warden configuration 271 | # If you want to use other strategies, that are not supported by Devise, or 272 | # change the failure app, you can configure them inside the config.warden block. 273 | # 274 | # config.warden do |manager| 275 | # manager.intercept_401 = false 276 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 277 | # end 278 | 279 | # ==> Mountable engine configurations 280 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 281 | # is mountable, there are some extra configurations to be taken into account. 282 | # The following options are available, assuming the engine is mounted as: 283 | # 284 | # mount MyEngine, at: '/my_engine' 285 | # 286 | # The router that invoked `devise_for`, in the example above, would be: 287 | # config.router_name = :my_engine 288 | # 289 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 290 | # so you need to do it manually. For the users scope, it would be: 291 | # config.omniauth_path_prefix = '/my_engine/users/auth' 292 | 293 | # ==> Turbolinks configuration 294 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: 295 | # 296 | # ActiveSupport.on_load(:devise_failure_app) do 297 | # include Turbolinks::Controller 298 | # end 299 | 300 | # ==> Configuration for :registerable 301 | 302 | # When set to false, does not sign a user in automatically after their password is 303 | # changed. Defaults to true, so a user is signed in automatically after changing a password. 304 | # config.sign_in_after_change_password = true 305 | end 306 | --------------------------------------------------------------------------------