├── log └── .keep ├── storage └── .keep ├── tmp ├── .keep └── pids │ └── .keep ├── vendor └── .keep ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── public ├── favicon.ico ├── apple-touch-icon.png ├── apple-touch-icon-precomposed.png ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── test ├── helpers │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── group_test.rb │ ├── user_test.rb │ ├── transaction_test.rb │ └── transaction_group_test.rb ├── system │ └── .keep ├── controllers │ ├── .keep │ ├── groups_controller_test.rb │ └── users_controller_test.rb ├── fixtures │ ├── .keep │ ├── files │ │ └── .keep │ ├── users.yml │ ├── transaction_groups.yml │ ├── groups.yml │ └── transactions.yml ├── integration │ └── .keep ├── application_system_test_case.rb ├── channels │ └── application_cable │ │ └── connection_test.rb └── test_helper.rb ├── app ├── assets │ ├── images │ │ ├── .keep │ │ ├── baby.jpg │ │ ├── empty.png │ │ ├── home.jpg │ │ ├── pet.jpeg │ │ ├── sport.png │ │ ├── user.png │ │ ├── jewelry.jpg │ │ ├── watch.jpeg │ │ ├── clothing.jpeg │ │ └── transaction_icons │ │ │ ├── i4.jpg │ │ │ ├── tr.png │ │ │ └── i6.webp │ ├── config │ │ └── manifest.js │ ├── fonts │ │ ├── Proxima_Nova_Bold.otf │ │ └── Proxima_Nova_Light.otf │ └── stylesheets │ │ ├── groups.scss │ │ ├── users.scss │ │ ├── fonts.scss │ │ └── application.scss ├── models │ ├── concerns │ │ └── .keep │ ├── application_record.rb │ ├── transaction_group.rb │ ├── group.rb │ ├── user.rb │ └── transaction.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── pages_controller.rb │ ├── users_controller.rb │ ├── application_controller.rb │ ├── groups_controller.rb │ └── transactions_controller.rb ├── views │ ├── pages │ │ └── home.html.erb │ ├── layouts │ │ ├── mailer.text.erb │ │ ├── _footer.html.erb │ │ ├── mailer.html.erb │ │ ├── _messages.erb │ │ ├── application.html.erb │ │ └── _navigation.html.erb │ ├── transactions │ │ ├── index.html.erb │ │ ├── _list.html.erb │ │ ├── show.html.erb │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── devise │ │ ├── unlocks │ │ │ └── new.html.erb │ │ ├── passwords │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ ├── confirmations │ │ │ └── new.html.erb │ │ ├── sessions │ │ │ └── new.html.erb │ │ ├── registrations │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ └── shared │ │ │ └── _links.html.erb │ ├── groups │ │ ├── index.html.erb │ │ ├── edit.html.erb │ │ ├── new.html.erb │ │ └── show.html.erb │ └── users │ │ └── show.html.erb ├── helpers │ ├── users_helper.rb │ ├── groups_helper.rb │ └── application_helper.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── mailers │ └── application_mailer.rb ├── javascript │ ├── channels │ │ ├── index.js │ │ └── consumer.js │ └── packs │ │ └── application.js └── jobs │ └── application_job.rb ├── .browserslistrc ├── .rspec ├── .tool-versions ├── .rubocop.yml ├── config ├── spring.rb ├── webpack │ ├── test.js │ ├── production.js │ ├── development.js │ └── environment.js ├── environment.rb ├── initializers │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── application_controller_renderer.rb │ ├── cookies_serializer.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ ├── assets.rb │ ├── content_security_policy.rb │ └── devise.rb ├── cable.yml ├── boot.rb ├── routes.rb ├── credentials.yml.enc ├── cloudinary.yml ├── application.rb ├── locales │ ├── en.yml │ └── devise.en.yml ├── storage.yml ├── puma.rb ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb ├── webpacker.yml └── database.yml ├── config.ru ├── db ├── migrate │ ├── 20210105150603_create_groups.rb │ ├── 20210107171213_add_group_to_users.rb │ ├── 20210105150602_create_transactions.rb │ ├── 20210107181023_change_transaction_id.rb │ ├── 20210105151333_add_fields_to_group.rb │ ├── 20210104153730_create_users.rb │ ├── 20210107173809_create_transaction_groups.rb │ ├── 20210105151616_add_fields_to_transaction_table.rb │ ├── 20210111041457_create_active_storage_tables.active_storage.rb │ └── 20210105221042_add_devise_to_users.rb ├── seeds.rb └── schema.rb ├── Rakefile ├── postcss.config.js ├── bin ├── rake ├── rails ├── yarn ├── webpack ├── webpack-dev-server ├── spring ├── setup └── bundle ├── .stylelintrc.json ├── package.json ├── spec ├── model │ ├── group_spec.rb │ ├── transaction_spec.rb │ └── user_spec.rb ├── controller │ └── user_spec.rb ├── rails_helper.rb └── spec_helper.rb ├── .gitignore ├── .github └── workflows │ └── linters.yml ├── .robocop.yml ├── babel.config.js ├── .rubocop_todo.yml ├── Gemfile ├── 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 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/system/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | ruby 3.0.0 2 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: .rubocop_todo.yml 2 | -------------------------------------------------------------------------------- /app/views/pages/home.html.erb: -------------------------------------------------------------------------------- 1 |

Helooooo

-------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module UsersHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /app/helpers/groups_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module GroupsHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/assets/images/baby.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/baby.jpg -------------------------------------------------------------------------------- /app/assets/images/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/empty.png -------------------------------------------------------------------------------- /app/assets/images/home.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/home.jpg -------------------------------------------------------------------------------- /app/assets/images/pet.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/pet.jpeg -------------------------------------------------------------------------------- /app/assets/images/sport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/sport.png -------------------------------------------------------------------------------- /app/assets/images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/user.png -------------------------------------------------------------------------------- /app/assets/images/jewelry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/jewelry.jpg -------------------------------------------------------------------------------- /app/assets/images/watch.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/watch.jpeg -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /app/assets/images/clothing.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/clothing.jpeg -------------------------------------------------------------------------------- /app/assets/fonts/Proxima_Nova_Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/fonts/Proxima_Nova_Bold.otf -------------------------------------------------------------------------------- /app/assets/fonts/Proxima_Nova_Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/fonts/Proxima_Nova_Light.otf -------------------------------------------------------------------------------- /app/assets/images/transaction_icons/i4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/transaction_icons/i4.jpg -------------------------------------------------------------------------------- /app/assets/images/transaction_icons/tr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/transaction_icons/tr.png -------------------------------------------------------------------------------- /app/assets/images/transaction_icons/i6.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MkrtichSargsyan/Transactions/HEAD/app/assets/images/transaction_icons/i6.webp -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PagesController < ApplicationController 4 | def home; end 5 | end 6 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationRecord < ActiveRecord::Base 4 | self.abstract_class = true 5 | end 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | 6 | two: 7 | name: MyString 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/models/transaction_group.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class TransactionGroup < ApplicationRecord 4 | belongs_to :transfer, class_name: 'Transaction' 5 | belongs_to :group 6 | end 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /db/migrate/20210105150603_create_groups.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateGroups < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :groups, &:timestamps 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20210107171213_add_group_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddGroupToUsers < ActiveRecord::Migration[6.0] 4 | def change 5 | add_reference :groups, :user 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/group_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class GroupTest < ActiveSupport::TestCase 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class UserTest < ActiveSupport::TestCase 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /app/assets/stylesheets/groups.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Groups controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: https://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /db/migrate/20210105150602_create_transactions.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateTransactions < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :transactions, &:timestamps 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/transaction_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class TransactionTest < ActiveSupport::TestCase 6 | # test "the truth" do 7 | # assert true 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 | -------------------------------------------------------------------------------- /test/models/transaction_group_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class TransactionGroupTest < ActiveSupport::TestCase 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 6 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] 7 | end 8 | -------------------------------------------------------------------------------- /test/fixtures/transaction_groups.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | transaction_id: 1 5 | group_id: 1 6 | 7 | two: 8 | transaction_id: 1 9 | group_id: 1 10 | -------------------------------------------------------------------------------- /db/migrate/20210107181023_change_transaction_id.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeTransactionId < ActiveRecord::Migration[6.0] 4 | def change 5 | rename_column :transaction_groups, :transaction_id, :transfer_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/groups_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class GroupsControllerTest < ActionDispatch::IntegrationTest 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /test/controllers/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class UsersControllerTest < ActionDispatch::IntegrationTest 6 | # test "the truth" do 7 | # assert true 8 | # end 9 | end 10 | -------------------------------------------------------------------------------- /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: Transactions_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 | -------------------------------------------------------------------------------- /db/migrate/20210105151333_add_fields_to_group.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddFieldsToGroup < ActiveRecord::Migration[6.0] 4 | def change 5 | add_column :groups, :name, :string 6 | add_column :groups, :icon, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/assets/stylesheets/users.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Users controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: https://sass-lang.com/ 4 | 5 | .user_icon { 6 | width: 150px; 7 | } 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /db/migrate/20210104153730_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateUsers < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :users do |t| 6 | t.string :name 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/layouts/_footer.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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 be available to Rake. 5 | 6 | require_relative 'config/application' 7 | 8 | Rails.application.load_tasks 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /db/migrate/20210107173809_create_transaction_groups.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateTransactionGroups < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :transaction_groups do |t| 6 | t.integer :transaction_id 7 | t.integer :group_id 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationJob < ActiveJob::Base 4 | # Automatically retry jobs that encountered a deadlock 5 | # retry_on ActiveRecord::Deadlocked 6 | 7 | # Most jobs are safe to ignore if the underlying records are no longer available 8 | # discard_on ActiveJob::DeserializationError 9 | end 10 | -------------------------------------------------------------------------------- /.stylelintrc.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "extends": ["stylelint-config-standard"], 4 | "plugins": ["stylelint-scss", "stylelint-csstree-validator"], 5 | "rules": { 6 | "at-rule-no-unknown": null, 7 | "scss/at-rule-no-unknown": true, 8 | "csstree/validator": true 9 | }, 10 | "ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css"] 11 | } -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.routes.draw do 4 | devise_for :users 5 | resources :users do 6 | resources :transactions 7 | end 8 | resources :groups 9 | get 'new_user_transaction', to: 'users#new_user_transaction' 10 | get 'user_transactions', to: 'users#user_transactions' 11 | root to: 'users#show' 12 | end 13 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | const webpack = require("webpack"); 3 | 4 | environment.plugins.append( 5 | "Provide", 6 | new webpack.ProvidePlugin({ 7 | $: "jquery", 8 | jQuery: "jquery", 9 | Popper: ["popper.js", "default"] // for Bootstrap 4 10 | }) 11 | ); 12 | 13 | 14 | module.exports = environment 15 | -------------------------------------------------------------------------------- /db/migrate/20210105151616_add_fields_to_transaction_table.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddFieldsToTransactionTable < ActiveRecord::Migration[6.0] 4 | def change 5 | add_column :transactions, :name, :string 6 | add_column :transactions, :amount, :integer 7 | add_reference :transactions, :author, foreign_key: { to_table: :users } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/channels/application_cable/connection_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'test_helper' 4 | 5 | class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase 6 | # test "connects with cookies" do 7 | # cookies.signed[:user_id] = 42 8 | # 9 | # connect 10 | # 11 | # assert_equal connection.user_id, "42" 12 | # end 13 | end 14 | -------------------------------------------------------------------------------- /test/fixtures/groups.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /test/fixtures/transactions.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /app/views/transactions/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

TOTAL PAYMENTS $<%= @total_amount %>

4 | <%= link_to 'Create new transaction', new_user_transaction_path,class:'btn btn-default btn-primary' %> 5 |
6 | <%= render 'transactions/list' %> 7 |
8 | -------------------------------------------------------------------------------- /app/assets/stylesheets/fonts.scss: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Proxima_Nova_Bold'; 3 | src: url('Proxima_Nova_Bold.otf'); 4 | } 5 | 6 | @font-face { 7 | font-family: 'Proxima_Nova_Light'; 8 | src: url('Proxima_Nova_Light.otf'); 9 | } 10 | 11 | .nova_light { 12 | font-family: Proxima_Nova_Light, Arial, Helvetica, sans-serif; 13 | } 14 | 15 | .nova_bold { 16 | font-family: Proxima_Nova_Bold, Arial, Helvetica, sans-serif; 17 | } 18 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | /cuZU7zVth2RYroWxg/B4AHTsdG8tFlRnEPkCkLcH1Sv//fjQOrJO/5lcnSvGoLX+gnZ8B4Go3IkVtFdTHc9eZc92ckE+TSkSNUbz5g1cl4aV6awiDQJQp5aTdZxfxYDVFQxJDr2SBjBUH+u3Vv2FmH8LqFElRPfBuSRGz70TDu1rajMnaXc/8gqIo9vN4XOUOiWU2nhYkjqK9LR4JVwKZ87f6qjXjrDZWn+8+tOCNzzhfsHczEnp3HUueg6DO8MPzFT9800TOILfAuceqs3DQ34WFYZBcssq2qAcjXXlAYTXth4LmXASnUg/HPDQ+mQUxS3iaCQAZIrRj4jqlkZOYZeUQVTx8d1SigbuHktNXsLcQD1njsL87gVi30j9rl95VIi9e57IazfdIRy6h+Xq32CUVieGkRlyQkk--HTxJ6JIYNg2oIwrz--tj4B5OkvFyYWRpoLuJu3Ew== -------------------------------------------------------------------------------- /app/models/group.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Group < ApplicationRecord 4 | has_one_attached :icon 5 | 6 | validates :name, presence: true, uniqueness: true, length: { minimum: 3, maximum: 25 } 7 | validates :icon, presence: true 8 | 9 | belongs_to :user 10 | has_many :transaction_groups, dependent: :destroy 11 | has_many :transactions, through: :transaction_groups, source: :transfer 12 | 13 | scope :sorted_ASK, -> { order(name: :asc) } 14 | end 15 | -------------------------------------------------------------------------------- /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 don't wish to see in your backtraces. 5 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 6 | 7 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 8 | # Rails.backtrace_cleaner.remove_silencers! 9 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ENV['RAILS_ENV'] ||= 'test' 4 | require_relative '../config/environment' 5 | require 'rails/test_help' 6 | 7 | class ActiveSupport::TestCase 8 | # Run tests in parallel with specified workers 9 | parallelize(workers: :number_of_processors) 10 | 11 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 12 | fixtures :all 13 | 14 | # Add more helper methods to be used by all tests here... 15 | end 16 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class UsersController < ApplicationController 4 | def show; end 5 | 6 | def show 7 | @most_expensive_transaction = current_user.transactions.most_expensive_transaction[0] 8 | @most_cheapest_transaction = current_user.transactions.most_cheapest_transaction[0] 9 | end 10 | 11 | def user_transactions 12 | @user_transactions = current_user.transactions 13 | end 14 | 15 | def new_user_transaction; end 16 | end 17 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class User < ApplicationRecord 4 | # Include default devise modules. Others available are: 5 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 6 | devise :database_authenticatable, :registerable, 7 | :recoverable, :rememberable, :validatable 8 | validates :name, presence: true, uniqueness: true, length: { minimum: 3, maximum: 25 } 9 | 10 | has_many :groups 11 | has_many :transactions, class_name: 'Transaction', foreign_key: 'author_id' 12 | end 13 | -------------------------------------------------------------------------------- /config/cloudinary.yml: -------------------------------------------------------------------------------- 1 | development: 2 | cloud_name: dv9m8gar7 3 | api_key: '813282695155696' 4 | api_secret: 0z4O1dbDQ17hkimcL9_DWm0N2EA 5 | enhance_image_tag: true 6 | static_file_support: false 7 | production: 8 | cloud_name: dv9m8gar7 9 | api_key: '813282695155696' 10 | api_secret: 0z4O1dbDQ17hkimcL9_DWm0N2EA 11 | enhance_image_tag: true 12 | static_file_support: true 13 | test: 14 | cloud_name: dv9m8gar7 15 | api_key: '813282695155696' 16 | api_secret: 0z4O1dbDQ17hkimcL9_DWm0N2EA 17 | enhance_image_tag: true 18 | static_file_support: false -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/views/layouts/_messages.erb: -------------------------------------------------------------------------------- 1 | <% if notice %> 2 |
3 | 6 | <%= notice %> 7 |
8 | <% end %> 9 | 10 | <% if alert %> 11 |
12 | 15 | <%= alert %> 16 |
17 | <% end %> 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Transactions 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 8 | <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 9 | 10 | 11 | <%= render 'layouts/navigation' %> 12 |
13 | <%= render 'layouts/messages' %> 14 | <%= yield %> 15 |
16 | <%= render 'layouts/footer' %> 17 | 18 | 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Transactions", 3 | "private": true, 4 | "dependencies": { 5 | "@rails/actioncable": "^6.0.0", 6 | "@rails/activestorage": "^6.0.0", 7 | "@rails/ujs": "^6.0.0", 8 | "@rails/webpacker": "4.3.0", 9 | "bootstrap": "4.3.1", 10 | "jquery": "^3.5.1", 11 | "popper.js": "^1.16.1", 12 | "turbolinks": "^5.2.0" 13 | }, 14 | "version": "0.1.0", 15 | "devDependencies": { 16 | "stylelint": "^13.3.3", 17 | "stylelint-config-standard": "^20.0.0", 18 | "stylelint-csstree-validator": "^1.9.0", 19 | "stylelint-scss": "^3.17.2" 20 | } 21 | } 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 | -------------------------------------------------------------------------------- /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 :format to an empty array. 9 | ActiveSupport.on_load(:action_controller) do 10 | wrap_parameters format: [:json] 11 | end 12 | 13 | # To enable root element in JSON for ActiveRecord objects. 14 | # ActiveSupport.on_load(:active_record) do 15 | # self.include_root_in_json = true 16 | # end 17 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('.resend_unlock_instructions') %>

2 | 3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= bootstrap_devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %> 8 | <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> 9 |
10 | 11 |
12 | <%= f.submit t('.resend_unlock_instructions'), class: 'btn btn-primary'%> 13 |
14 | <% end %> 15 | 16 | <%= render 'devise/shared/links' %> 17 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('.forgot_your_password') %>

2 | 3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= bootstrap_devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %> 8 | <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> 9 |
10 | 11 |
12 | <%= f.submit t('.send_me_reset_password_instructions'), class: 'btn btn-primary' %> 13 |
14 | <% end %> 15 | 16 | <%= render 'devise/shared/links' %> 17 | -------------------------------------------------------------------------------- /app/models/transaction.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Transaction < ApplicationRecord 4 | validates :name, presence: true, uniqueness: true 5 | validates :amount, presence: true 6 | 7 | belongs_to :author, class_name: 'User', foreign_key: 'author_id' 8 | has_many :transaction_groups, dependent: :destroy, foreign_key: 'transfer_id' 9 | has_many :groups, through: :transaction_groups 10 | 11 | scope :ordered_desc, -> { order(created_at: :desc) } 12 | scope :most_expensive_transaction, -> { where(amount: maximum(:amount)) } 13 | scope :most_cheapest_transaction, -> { where(amount: minimum(:amount)) } 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationController < ActionController::Base 4 | before_action :authenticate_user! 5 | 6 | protect_from_forgery with: :exception 7 | 8 | before_action :configure_permitted_parameters, if: :devise_controller? 9 | 10 | protected 11 | 12 | def configure_permitted_parameters 13 | devise_parameter_sanitizer.permit(:sign_up) do |u| 14 | u.permit(:name, :email, :password, :password_confirmation) 15 | end 16 | devise_parameter_sanitizer.permit(:account_update) do |u| 17 | u.permit(:name, :email, :password, :current_password) 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('.resend_confirmation_instructions') %>

2 | 3 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= bootstrap_devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %> 8 | <%= f.email_field :email, autofocus: true, autocomplete: 'email', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: 'form-control' %> 9 |
10 | 11 |
12 | <%= f.submit t('.resend_confirmation_instructions'), class: 'btn btn-primary' %> 13 |
14 | <% end %> 15 | 16 | <%= render 'devise/shared/links' %> 17 | -------------------------------------------------------------------------------- /app/views/transactions/_list.html.erb: -------------------------------------------------------------------------------- 1 | <% @transactions.each do |transaction| %> 2 | <%= link_to user_transaction_path(current_user, transaction),class:'w-100 transaction_link text-secondary' do %> 3 |
4 | <%= show_transaction_icon(transaction,'transaction_icon card-img-top mr-3 border rounded') %> 5 |
6 |
7 | <%= transaction.name %> 8 | $ <%= transaction.amount %> 9 |
10 | <%= transaction.created_at.to_formatted_s(:long) %> 11 |
12 |
13 | <% end %> 14 | <% end %> -------------------------------------------------------------------------------- /spec/model/group_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Group, type: :model do 6 | let(:user) { User.create(name: 'rspec', email: 'rspec@test.com', password: '123456') } 7 | let(:group) { Group.create(name: 'rspec', user_id: user.id) } 8 | 9 | it 'is valid with valid attributes' do 10 | expect(group).to be_valid 11 | end 12 | 13 | it 'is not valid without a name' do 14 | group.name = '' 15 | expect(group).to_not be_valid 16 | end 17 | 18 | it 'is not valid without a user' do 19 | group.user_id = nil 20 | expect(group).to_not be_valid 21 | end 22 | 23 | it 'check correct association between user and groups' do 24 | user.groups.should include(group) 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/views/groups/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= link_to 'Create new group', new_group_path,class:'btn btn-default btn-primary' %> 4 |
5 | <% @groups.each do |group| %> 6 | <%= link_to group_path(group),class:'w-100 transaction_link text-secondary' do %> 7 |
8 | <%= image_tag group.icon, class: 'transaction_icon card-img-top mr-3 border rounded' %> 9 | <%= group.name %> 10 |

Created by: <%= group.user.name %>

11 |
12 | <% end %> 13 | <% end %> 14 |
15 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'boot' 4 | 5 | require 'rails/all' 6 | 7 | # Require the gems listed in Gemfile, including any gems 8 | # you've limited to :test, :development, or :production. 9 | Bundler.require(*Rails.groups) 10 | 11 | module Transactions 12 | class Application < Rails::Application 13 | # Initialize configuration defaults for originally generated Rails version. 14 | config.load_defaults 6.0 15 | 16 | # Settings in config/environments/* take precedence over those specified here. 17 | # Application configuration can go into files in config/initializers 18 | # -- all .rb files in that directory are automatically loaded after loading 19 | # the framework and any gems in your application. 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /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 | Rails.application.config.assets.paths << Rails.root.join('app', 'assets', 'fonts') 18 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | // This file is automatically compiled by Webpack, along with any other files 2 | // present in this directory. You're encouraged to place your actual application logic in 3 | // a relevant structure within app/javascript and only use these pack files to reference 4 | // that code so it'll be compiled. 5 | 6 | require("@rails/ujs").start() 7 | require("turbolinks").start() 8 | require("@rails/activestorage").start() 9 | require("channels") 10 | import 'bootstrap' 11 | 12 | // Uncomment to copy all static images under ../images to the output folder and reference 13 | // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) 14 | // or the `imagePath` JavaScript helper below. 15 | // 16 | // const images = require.context('../images', true) 17 | // const imagePath = (name) => images(name, true) -------------------------------------------------------------------------------- /spec/controller/user_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe 'User controller', type: :request do 6 | let(:user1) { User.create(name: 'Mike', email: 'mike@gmail.com', password: 'aaaaaa') } 7 | let(:transaction1) { Transaction.create(name: 'string', amount: 12, author_id: user1.id) } 8 | let(:transaction2) { Transaction.create(name: 'string', amount: 1, author_id: user1.id) } 9 | 10 | describe 'show action' do 11 | it 'show the user page' do 12 | user = User.find(user1.id) 13 | expect(user).to eq(user1) 14 | end 15 | 16 | it 'should show most expansive transaction' do 17 | expect(user1.transactions.most_expensive_transaction[0] == transaction1) 18 | end 19 | 20 | it 'should show most cheapest transaction' do 21 | expect(user1.transactions.most_cheapest_transaction[0] == transaction2) 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore pidfiles, but keep the directory. 17 | /tmp/pids/* 18 | !/tmp/pids/ 19 | !/tmp/pids/.keep 20 | 21 | # Ignore uploaded files in development. 22 | /storage/* 23 | !/storage/.keep 24 | 25 | /public/assets 26 | .byebug_history 27 | 28 | # Ignore master key for decrypting credentials and more. 29 | /config/master.key 30 | 31 | /public/packs 32 | /public/packs-test 33 | /node_modules 34 | /yarn-error.log 35 | yarn-debug.log* 36 | .yarn-integrity 37 | -------------------------------------------------------------------------------- /app/controllers/groups_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class GroupsController < ApplicationController 4 | before_action :set_group, only: %i[show edit update destroy] 5 | 6 | def index 7 | @groups = Group.all.includes(:user).sorted_ASK 8 | end 9 | 10 | def new 11 | @group = Group.new 12 | end 13 | 14 | def create 15 | @group = current_user.groups.create(group_params) 16 | if @group.save 17 | redirect_to groups_path 18 | else 19 | render 'new' 20 | end 21 | end 22 | 23 | def edit; end 24 | 25 | def update 26 | if @group.update(group_params) 27 | redirect_to groups_path 28 | else 29 | render 'edit' 30 | end 31 | end 32 | 33 | private 34 | 35 | def set_group 36 | @group = Group.find(params[:id]) 37 | end 38 | 39 | def group_params 40 | params.require(:group).permit(:name, :icon) 41 | end 42 | 43 | def group_icon 44 | params.require(:group).permit(:icon) 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('.sign_in') %>

2 | 3 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 4 |
5 | <%= f.label :email %> 6 | <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> 7 |
8 | 9 |
10 | <%= f.label :password %> 11 | <%= f.password_field :password, autocomplete: 'current-password', class: 'form-control' %> 12 |
13 | 14 | <% if devise_mapping.rememberable? %> 15 |
16 | <%= f.check_box :remember_me, class: 'form-check-input' %> 17 | <%= f.label :remember_me, class: 'form-check-label' do %> 18 | <%= resource.class.human_attribute_name('remember_me') %> 19 | <% end %> 20 |
21 | <% end %> 22 | 23 |
24 | <%= f.submit t('.sign_in'), class: 'btn btn-primary' %> 25 |
26 | <% end %> 27 | 28 | <%= render 'devise/shared/links' %> 29 | -------------------------------------------------------------------------------- /spec/model/transaction_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Transaction, type: :model do 6 | let(:user) { User.create(name: 'rspec', email: 'rspec@test.com', password: '123456') } 7 | let(:group) { Group.create(name: 'rspec', user_id: user.id) } 8 | let(:transaction) { Transaction.create(name: 'string', amount: 12, author_id: user.id) } 9 | 10 | it 'is valid with valid attributes' do 11 | expect(transaction).to be_valid 12 | end 13 | 14 | it 'is not valid without a name' do 15 | transaction.name = '' 16 | expect(transaction).to_not be_valid 17 | end 18 | 19 | it 'is not valid without a user' do 20 | transaction.author_id = nil 21 | expect(transaction).to_not be_valid 22 | end 23 | 24 | it 'is not valid without a user' do 25 | transaction.amount = nil 26 | expect(transaction).to_not be_valid 27 | end 28 | 29 | it 'check correct association between user and transaction' do 30 | user.transactions.should include(transaction) 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /spec/model/user_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe User, type: :model do 6 | let(:user) { User.create(name: 'rspec', email: 'rspec@test.com', password: '123456') } 7 | let(:transactions) { User.reflect_on_association(:transactions).macro } 8 | let(:groups) { User.reflect_on_association(:groups).macro } 9 | 10 | it 'is valid with valid attributes' do 11 | expect(user).to be_valid 12 | end 13 | 14 | it 'checks correct association with transactions' do 15 | expect(transactions).to eq(:has_many) 16 | end 17 | 18 | it 'checks correct association with groups' do 19 | expect(groups).to eq(:has_many) 20 | end 21 | 22 | it 'is not valid without a name' do 23 | user.name = nil 24 | expect(user).to_not be_valid 25 | end 26 | 27 | it 'is not valid without email' do 28 | user.email = nil 29 | expect(user).to_not be_valid 30 | end 31 | 32 | it 'is not valid without password' do 33 | user.password = '' 34 | expect(user).to_not be_valid 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('.change_your_password') %>

2 | 3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= bootstrap_devise_error_messages! %> 5 | <%= f.hidden_field :reset_password_token %> 6 | 7 |
8 | <%= f.label :password, t('.new_password') %> 9 | <%= f.password_field :password, autofocus: true, class: 'form-control' %> 10 | 11 | <% if @minimum_password_length %> 12 | <%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %> 13 | <% end %> 14 |
15 | 16 |
17 | <%= f.label :password_confirmation, t('.confirm_new_password') %> 18 | <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control' %> 19 |
20 | 21 |
22 | <%= f.submit t('.change_my_password'), class: 'btn btn-primary' %> 23 |
24 | <% end %> 25 | 26 | <%= render 'devise/shared/links' %> 27 | -------------------------------------------------------------------------------- /app/views/groups/edit.html.erb: -------------------------------------------------------------------------------- 1 | <% if !@group.errors.empty?%> 2 | 12 | <% end %> 13 |

Edit Group

14 | <%= form_with model: @group, url: group_path,class:'col-md-8 mx-md-auto mt-2',local: true do |f| %> 15 |
16 | <%= f.label :name, "Name:", class: "col-md-4 control-label" %> 17 |
18 | <%= f.text_field :name,autofocus: true, placeholder: 'Group name', class: "form-control" %> 19 |
20 |
21 |
22 |
23 | <%= f.label "Icon" %> 24 | <%= f.file_field :icon %>
25 |
26 |
27 | <%= f.submit "Submit", class: "btn btn-default btn-primary ml-3" %> 28 | <% end %> 29 | -------------------------------------------------------------------------------- /app/views/groups/new.html.erb: -------------------------------------------------------------------------------- 1 | <% if !@group.errors.empty?%> 2 | 12 | <% end %> 13 |

Create Group

14 | <%= form_with scope: :group, url: groups_path,class:'col-md-8 mx-md-auto mt-2',local: true do |f| %> 15 |
16 | <%= f.label :name, "Name:", class: "col-md-4 control-label" %> 17 |
18 | <%= f.text_field :name,autofocus: true, placeholder: 'Group name', class: "form-control" %> 19 |
20 |
21 |
22 |
23 | <%= f.label 'Icon' %> 24 | <%= f.file_field :icon,direct_upload: true %>
25 |
26 |
27 | <%= f.submit "Submit", class: "btn btn-default btn-primary ml-3" %> 28 | <% end %> 29 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # User.create!([ 3 | # { email: 'mike@gmail.com', password: 'aaaaaa', name: 'Mike' } 4 | # ]) 5 | 6 | # Group.create!([ 7 | # { name: 'Clothing, Shoes & Accessories', user: User.first }, 8 | # { name: 'Baby', user: User.first }, 9 | # { name: 'Home & Garden', user: User.first }, 10 | # { name: 'Jewelry', user: User.first }, 11 | # { name: 'Watches', user: User.first }, 12 | # { name: 'Sporting Goods', user: User.first }, 13 | # { name: 'Pet Supplies', user: User.first } 14 | # ]) 15 | 16 | # Group.find(1).icon.attach(io: File.open('https://res.cloudinary.com/dv9m8gar7/image/upload/v1610512186/group_icons/'), filename: 'clothing_cv4uuk.jpg') 17 | # Group.find(2).icon.attach('group_icons/baby_lyimex.jpg') 18 | # Group.find(3).icon.attach('group_icons/home_taglxr.jpg') 19 | # Group.find(4).icon.attach('group_icons/jewelry_u30ter.jpg') 20 | # Group.find(5).icon.attach('group_icons/watch_extl0i.jpg') 21 | # Group.find(6).icon.attach('group_icons/sport_soivkx.png') 22 | # Group.find(7).icon.attach('group_icons/pet_g8z4t8.jpg') 23 | 24 | # <% cl_image_tag("group_icons/baby_lyimex.jpg") %> 25 | -------------------------------------------------------------------------------- /db/migrate/20210111041457_create_active_storage_tables.active_storage.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This migration comes from active_storage (originally 20170806125915) 4 | class CreateActiveStorageTables < ActiveRecord::Migration[5.2] 5 | def change 6 | create_table :active_storage_blobs do |t| 7 | t.string :key, null: false 8 | t.string :filename, null: false 9 | t.string :content_type 10 | t.text :metadata 11 | t.bigint :byte_size, null: false 12 | t.string :checksum, null: false 13 | t.datetime :created_at, null: false 14 | 15 | t.index [:key], unique: true 16 | end 17 | 18 | create_table :active_storage_attachments do |t| 19 | t.string :name, null: false 20 | t.references :record, null: false, polymorphic: true, index: false 21 | t.references :blob, null: false 22 | 23 | t.datetime :created_at, null: false 24 | 25 | t.index %i[record_type record_id name blob_id], name: 'index_active_storage_attachments_uniqueness', unique: true 26 | t.foreign_key :active_storage_blobs, column: :blob_id 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= image_tag 'user.png',class:'user_icon' %> 3 |

<%= current_user.name %>

4 |
5 |
6 | <%= image_tag 'transaction_icons/tr.png',class:'payment_icon rounded-circle mr-2 border p-1' %> 7 | <%= link_to 'All my transactions', user_transactions_path(current_user,icon:true), class:'h5 m-0 border-bottom border-dark pb-1' %> 8 |
9 |
10 | <%= image_tag 'transaction_icons/i4.jpg',class:'payment_icon rounded-circle mr-2 border p-2' %> 11 | <%= link_to 'All my external transactions', user_transactions_path(current_user), class:'h5 m-0 border-bottom border-dark pb-1' %> 12 |
13 |
14 | <%= image_tag 'transaction_icons/i6.webp',class:'payment_icon rounded-circle mr-2 border p-2' %> 15 | <%= link_to 'All groups',groups_path, class:'h5 m-0 border-bottom border-dark pb-1' %> 16 |
17 |
18 | 19 |
20 | <%= show_cheapest_and_expensivest %> 21 |
22 | 23 | -------------------------------------------------------------------------------- /app/views/layouts/_navigation.html.erb: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | cloudinary: 10 | service: Cloudinary 11 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 12 | # amazon: 13 | # service: S3 14 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 15 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 16 | # region: us-east-1 17 | # bucket: your_own_bucket 18 | 19 | # Remember not to checkin your GCS keyfile to a repository 20 | # google: 21 | # service: GCS 22 | # project: your_project 23 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 24 | # bucket: your_own_bucket 25 | 26 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 27 | # microsoft: 28 | # service: AzureStorage 29 | # storage_account_name: your_account_name 30 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 31 | # container: your_container_name 32 | 33 | # mirror: 34 | # service: Mirror 35 | # primary: local 36 | # mirrors: [ amazon, google, microsoft ] 37 | -------------------------------------------------------------------------------- /.github/workflows/linters.yml: -------------------------------------------------------------------------------- 1 | name: Linters 2 | 3 | on: pull_request 4 | 5 | env: 6 | FORCE_COLOR: 1 7 | 8 | jobs: 9 | rubocop: 10 | name: Rubocop 11 | runs-on: ubuntu-18.04 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: actions/setup-ruby@v1 15 | with: 16 | ruby-version: 2.6.x 17 | - name: Setup Rubocop 18 | run: | 19 | gem install --no-document rubocop:'~>0.81.0' # https://docs.rubocop.org/en/stable/installation/ 20 | [ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.rubocop.yml 21 | - name: Rubocop Report 22 | run: rubocop --color 23 | stylelint: 24 | name: Stylelint 25 | runs-on: ubuntu-18.04 26 | steps: 27 | - uses: actions/checkout@v2 28 | - uses: actions/setup-node@v1 29 | with: 30 | node-version: "12.x" 31 | - name: Setup Stylelint 32 | run: | 33 | npm install --save-dev stylelint@13.3.x stylelint-scss@3.17.x stylelint-config-standard@20.0.x stylelint-csstree-validator 34 | [ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.stylelintrc.json 35 | - name: Stylelint Report 36 | run: npx stylelint "**/*.{css,scss}" -------------------------------------------------------------------------------- /app/views/transactions/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Details

3 |
4 |
5 | <%= show_transaction_icon(@transaction,'group_icon card-img-top mr-3') %> 6 | <%= @transaction.name %> 7 |
8 |
9 |
Amount: <%= @transaction.amount %> $
10 |
Created by: <%= @transaction.author.name %>
11 |

Date: <%= @transaction.created_at.to_formatted_s(:long) %>

12 |
13 | <%= link_to edit_user_transaction_path(@transaction) do %> 14 | 17 | <% end %> 18 | <%= link_to user_transaction_path(@transaction), method: :delete do %> 19 | 22 | <% end %> 23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('.sign_up') %>

2 | 3 | 4 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 5 | <%= bootstrap_devise_error_messages! %> 6 | 7 |
8 | <%= f.label :name %> 9 | <%= f.text_field :name, autofocus: true, autocomplete: 'name', class: 'form-control' %> 10 |
11 | 12 |
13 | <%= f.label :email %> 14 | <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> 15 |
16 | 17 |
18 | <%= f.label :password %> 19 | <%= f.password_field :password, autocomplete: 'current-password', class: 'form-control' %> 20 | 21 | <% if @minimum_password_length %> 22 | <%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %> 23 | <% end %> 24 |
25 | 26 |
27 | <%= f.label :password_confirmation %> 28 | <%= f.password_field :password_confirmation, autocomplete: 'current-password', class: 'form-control' %> 29 |
30 | 31 |
32 | <%= f.submit t('.sign_up'), class: 'btn btn-primary' %> 33 |
34 | <% end %> 35 | 36 | <%= render 'devise/shared/links' %> 37 | -------------------------------------------------------------------------------- /app/views/groups/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | <%= image_tag @group.icon, class: 'group_icon card-img-top mr-3 border rounded rounded-circle' %> 5 | <%= @group.name %> 6 |
7 |
8 | <%= link_to edit_group_path(@group) do %> 9 | 12 | <% end %> 13 |
14 | 15 | <% @group.transactions.each do |transaction| %> 16 |
17 |
18 |
19 | <%= transaction.name %> 20 | $ <%= transaction.amount %> 21 |
22 |

Created by: <%= transaction.author.name %>

23 | <%= transaction.created_at.to_formatted_s(:long) %> 24 |
25 |
26 | <% end %> 27 | 28 |
29 |
30 | -------------------------------------------------------------------------------- /.robocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - "db/**/*" 4 | - "bin/*" 5 | - "config/**/*" 6 | - "Guardfile" 7 | - "Rakefile" 8 | - "node_modules/**/*" 9 | 10 | DisplayCopNames: true 11 | Layout/LineLength: 12 | Max: 220 13 | Metrics/MethodLength: 14 | Include: 15 | - "app/controllers/*" 16 | - "app/models/*" 17 | Max: 20 18 | Metrics/LineLength: 19 | Max: 200 20 | Metrics/AbcSize: 21 | Include: 22 | - "app/controllers/*" 23 | - "app/models/*" 24 | Max: 50 25 | Metrics/ClassLength: 26 | Max: 150 27 | Metrics/BlockLength: 28 | ExcludedMethods: ['describe'] 29 | Max: 30 30 | 31 | Style/Documentation: 32 | Enabled: false 33 | Style/ClassAndModuleChildren: 34 | Enabled: false 35 | Style/EachForSimpleLoop: 36 | Enabled: false 37 | Style/AndOr: 38 | Enabled: false 39 | Style/DefWithParentheses: 40 | Enabled: false 41 | Style/FrozenStringLiteralComment: 42 | EnforcedStyle: never 43 | 44 | Layout/HashAlignment: 45 | EnforcedColonStyle: key 46 | Layout/ExtraSpacing: 47 | AllowForAlignment: false 48 | Layout/MultilineMethodCallIndentation: 49 | Enabled: true 50 | EnforcedStyle: indented 51 | Lint/RaiseException: 52 | Enabled: false 53 | Lint/StructNewOverride: 54 | Enabled: false 55 | Style/HashEachMethods: 56 | Enabled: false 57 | Style/HashTransformKeys: 58 | Enabled: false 59 | Style/HashTransformValues: 60 | Enabled: false -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%- if controller_name != 'sessions' %> 3 | <%= link_to t(".sign_in"), new_session_path(resource_name) %>
4 | <% end -%> 5 | 6 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 7 | <%= link_to t(".sign_up"), new_registration_path(resource_name) %>
8 | <% end -%> 9 | 10 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 11 | <%= link_to t(".forgot_your_password"), new_password_path(resource_name) %>
12 | <% end -%> 13 | 14 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 15 | <%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %>
16 | <% end -%> 17 | 18 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 19 | <%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %>
20 | <% end -%> 21 | 22 | <%- if devise_mapping.omniauthable? %> 23 | <%- resource_class.omniauth_providers.each do |provider| %> 24 | <%= link_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider) %>
25 | <% end -%> 26 | <% end -%> 27 |
28 | -------------------------------------------------------------------------------- /app/views/transactions/edit.html.erb: -------------------------------------------------------------------------------- 1 | <% if !@transaction.errors.empty?%> 2 | 12 | <% end %> 13 | <%= form_with model: @transaction, url: user_transaction_path,class:'col-md-8 mx-md-auto mt-4',local: true do |f| %> 14 |
15 | <%= f.label :name, "Name:", class: "col-md-4 control-label" %> 16 |
17 | <%= f.text_field :name,autofocus: true, placeholder: 'Transaction name', class: "form-control" %> 18 |
19 |
20 |
21 | <%= f.label :amount, "Amount:", class: "col-md-4 control-label" %> 22 |
23 | <%= f.text_field :amount,autofocus: true, placeholder: 'Transaction amount', class: "form-control" %> 24 |
25 |
26 |
27 | <%= f.label :group, "Select group:", class: "col-md-4 control-label" %> 28 |
29 | <%= f.select :group_id, Group.all.map{|group| [group.name,group.id]}, { include_blank: true },class:'input-group form-control' %> 30 |
31 |
32 | <%= f.submit "Submit", class: "btn btn-default btn-primary ml-3" %> 33 | <% end %> 34 | -------------------------------------------------------------------------------- /app/views/transactions/new.html.erb: -------------------------------------------------------------------------------- 1 | <% if !@transaction.errors.empty?%> 2 | 12 | <% end %> 13 | <%= form_with scope: :transaction, url: user_transactions_path,class:'col-md-8 mx-md-auto mt-4',local: true do |f| %> 14 |
15 | <%= f.label :name, "Name:", class: "col-md-4 control-label" %> 16 |
17 | <%= f.text_field :name,autofocus: true, placeholder: 'Transaction name', class: "form-control" %> 18 |
19 |
20 |
21 | <%= f.label :amount, "Amount:", class: "col-md-4 control-label" %> 22 |
23 | <%= f.text_field :amount,autofocus: true,placeholder: 'Transaction amount', class: "form-control" %> 24 |
25 |
26 |
27 | <%= f.label :group, "Select group:", class: "col-md-4 control-label" %> 28 |
29 | <%= f.select :group_id, Group.all.map{|group| [group.name,group.id]}, { include_blank: true },class:'input-group form-control' %> 30 |
31 |
32 | <%= f.submit "Submit", class: "btn btn-default btn-primary ml-3" %> 33 | <% end %> 34 | -------------------------------------------------------------------------------- /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", "ws://localhost:3035" if Rails.env.development? 17 | 18 | # # Specify URI for violation reports 19 | # # policy.report_uri "/csp-violation-report-endpoint" 20 | # end 21 | 22 | # If you are using UJS then enable automatic nonce generation 23 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 24 | 25 | # Set the nonce only to specific directives 26 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) 27 | 28 | # Report CSP violations to a specified URI 29 | # For further information see the following documentation: 30 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 31 | # Rails.application.config.content_security_policy_report_only = true 32 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('.title', resource: resource_name.to_s.humanize) %>

2 | 3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= bootstrap_devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %> 8 | <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %> 9 |
10 | 11 |
12 | <%= f.label :password %> 13 | <%= f.password_field :password, autocomplete: 'new-password', class: 'form-control' %> 14 | 15 | <%= t('.leave_blank_if_you_don_t_want_to_change_it') %> 16 |
17 | 18 |
19 | <%= f.label :password_confirmation %> 20 | <%= f.password_field :password_confirmation, autocomplete: 'new-password', class: 'form-control' %> 21 |
22 | 23 |
24 | <%= f.label :current_password %> 25 | <%= f.password_field :current_password, autocomplete: 'current-password', class: 'form-control' %> 26 | 27 | <%= t('.we_need_your_current_password_to_confirm_your_changes') %> 28 |
29 | 30 |
31 | <%= f.submit t('.update'), class: 'btn btn-primary' %> 32 |
33 | <% end %> 34 | 35 |

<%= t('.unhappy') %>? <%= link_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, method: :delete %>.

36 | 37 | <%= link_to t('.back'), :back %> 38 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationHelper 4 | def show_user_name(current_user) 5 | if signed_in? 6 | " 11 | ".html_safe 14 | else 15 | "".html_safe 18 | end 19 | end 20 | 21 | def show_transaction_icon(transaction, class_names) 22 | if transaction.groups.empty? 23 | image_tag 'empty.png', class: 'transaction_icon card-img-top mr-3 border rounded' 24 | else 25 | image_tag transaction.groups.first.icon, class: class_names 26 | end 27 | end 28 | 29 | def show_cheapest_and_expensivest 30 | unless current_user.transactions.empty? 31 | "
32 |

Expensivest

33 | #{link_to @most_expensive_transaction.name, user_transaction_path(current_user, @most_expensive_transaction)} 34 |
35 |
36 |

Cheapest

37 | #{link_to @most_cheapest_transaction.name, user_transaction_path(current_user, @most_cheapest_transaction)} 38 |
".html_safe 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /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; default is 3000. 14 | # 15 | port ENV.fetch('PORT') { 3000 } 16 | 17 | # Specifies the `environment` that Puma will run in. 18 | # 19 | environment ENV.fetch('RAILS_ENV') { 'development' } 20 | 21 | # Specifies the `pidfile` that Puma will use. 22 | pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' } 23 | 24 | # Specifies the number of `workers` to boot in clustered mode. 25 | # Workers are forked web server processes. If using threads and workers together 26 | # the concurrency of the application would be max `threads` * `workers`. 27 | # Workers do not work on JRuby or Windows (both of which do not support 28 | # processes). 29 | # 30 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 31 | 32 | # Use the `preload_app!` method when specifying a `workers` number. 33 | # This directive tells Puma to first boot the application and load code 34 | # before forking the application. This takes advantage of Copy On Write 35 | # process behavior so workers use less memory. 36 | # 37 | # preload_app! 38 | 39 | # Allow puma to be restarted by `rails restart` command. 40 | plugin :tmp_restart 41 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/controllers/transactions_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class TransactionsController < ApplicationController 4 | before_action :set_transaction, only: %i[show edit update destroy] 5 | 6 | def index 7 | temp_var = current_user.transactions.includes(:groups).ordered_desc 8 | @transactions = temp_var 9 | @transactions = temp_var.select { |tr| tr.groups.empty? } unless params[:icon] 10 | 11 | @total_amount = @transactions.reduce(0) { |sum, cur| sum + cur.amount } 12 | end 13 | 14 | def new 15 | @transaction = Transaction.new 16 | end 17 | 18 | def create 19 | @transaction = current_user.transactions.build(transaction_params) 20 | if @transaction.save 21 | @transaction.transaction_groups.create(show_group_id) 22 | redirect_to user_transaction_path(current_user, @transaction), notice: 'You successfully created a new transaction.' 23 | else 24 | render 'new' 25 | end 26 | end 27 | 28 | def update 29 | if @transaction.update(transaction_params) 30 | if show_group_id[:group_id] 31 | if @transaction.groups.empty? 32 | @transaction.transaction_groups.create(show_group_id) 33 | else 34 | @transaction.transaction_groups.update(show_group_id) 35 | end 36 | end 37 | redirect_to user_transaction_path, notice: 'Transaction updated' 38 | else 39 | render 'edit' 40 | end 41 | end 42 | 43 | def destroy 44 | if @transaction.destroy 45 | redirect_to user_transactions_path(icon: true), notice: 'Transaction deleted' 46 | else 47 | redirect_to root_path 48 | end 49 | end 50 | 51 | private 52 | 53 | def set_transaction 54 | @transaction = Transaction.find(params[:id]) 55 | end 56 | 57 | def transaction_params 58 | params.require(:transaction).permit(:name, :amount) 59 | end 60 | 61 | def show_group_id 62 | params.require(:transaction).permit(:group_id) 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require bootstrap 14 | *= require_tree . 15 | *= require_self 16 | */ 17 | 18 | @import "bootstrap/scss/bootstrap"; 19 | 20 | html, 21 | body { 22 | // height: 100%; 23 | font-family: 'Proxima_Nova_Light', Arial, Helvetica, sans-serif; 24 | background-color: lightgray; 25 | position: relative; 26 | min-height: 100vh; 27 | } 28 | 29 | a { 30 | text-decoration: none !important; 31 | } 32 | 33 | .logo { 34 | &:hover { 35 | background-color: rgb(85, 82, 82) !important; 36 | } 37 | } 38 | 39 | nav { 40 | background-color: #3778c2; 41 | 42 | a { 43 | color: white; 44 | } 45 | } 46 | 47 | .my_container { 48 | padding-bottom: 4.5rem; 49 | } 50 | 51 | .group_icon { 52 | width: 100px; 53 | } 54 | 55 | // transaction page 56 | 57 | .transaction_card { 58 | min-width: 18rem !important; 59 | } 60 | 61 | .transaction_link { 62 | text-decoration: none !important; 63 | } 64 | 65 | .transaction_title { 66 | font-family: Proxima_Nova_Bold, Arial, Helvetica, sans-serif; 67 | } 68 | 69 | .transaction_icon { 70 | width: 60px; 71 | } 72 | 73 | .payment_icon { 74 | width: 50px; 75 | height: 50px; 76 | } 77 | 78 | footer { 79 | position: absolute; 80 | bottom: 0; 81 | width: 100%; 82 | height: 4.5rem; 83 | } 84 | -------------------------------------------------------------------------------- /db/migrate/20210105221042_add_devise_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddDeviseToUsers < ActiveRecord::Migration[6.0] 4 | def self.up 5 | change_table :users do |t| 6 | ## Database authenticatable 7 | t.string :email, null: false, default: '' 8 | t.string :encrypted_password, null: false, default: '' 9 | 10 | ## Recoverable 11 | t.string :reset_password_token 12 | t.datetime :reset_password_sent_at 13 | 14 | ## Rememberable 15 | t.datetime :remember_created_at 16 | 17 | ## Trackable 18 | # t.integer :sign_in_count, default: 0, null: false 19 | # t.datetime :current_sign_in_at 20 | # t.datetime :last_sign_in_at 21 | # t.inet :current_sign_in_ip 22 | # t.inet :last_sign_in_ip 23 | 24 | ## Confirmable 25 | # t.string :confirmation_token 26 | # t.datetime :confirmed_at 27 | # t.datetime :confirmation_sent_at 28 | # t.string :unconfirmed_email # Only if using reconfirmable 29 | 30 | ## Lockable 31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 32 | # t.string :unlock_token # Only if unlock strategy is :email or :both 33 | # t.datetime :locked_at 34 | 35 | # Uncomment below if timestamps were not included in your original model. 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 | 45 | def self.down 46 | # By default, we don't want to make any assumption about how to roll back a migration when your 47 | # model already existed. Please edit below which fields you would like to remove in this migration. 48 | raise ActiveRecord::IrreversibleMigration 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

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

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

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

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | var validEnv = ['development', 'test', 'production'] 3 | var currentEnv = api.env() 4 | var isDevelopmentEnv = api.env('development') 5 | var isProductionEnv = api.env('production') 6 | var isTestEnv = api.env('test') 7 | 8 | if (!validEnv.includes(currentEnv)) { 9 | throw new Error( 10 | 'Please specify a valid `NODE_ENV` or ' + 11 | '`BABEL_ENV` environment variables. Valid values are "development", ' + 12 | '"test", and "production". Instead, received: ' + 13 | JSON.stringify(currentEnv) + 14 | '.' 15 | ) 16 | } 17 | 18 | return { 19 | presets: [ 20 | isTestEnv && [ 21 | '@babel/preset-env', 22 | { 23 | targets: { 24 | node: 'current' 25 | } 26 | } 27 | ], 28 | (isProductionEnv || isDevelopmentEnv) && [ 29 | '@babel/preset-env', 30 | { 31 | forceAllTransforms: true, 32 | useBuiltIns: 'entry', 33 | corejs: 3, 34 | modules: false, 35 | exclude: ['transform-typeof-symbol'] 36 | } 37 | ] 38 | ].filter(Boolean), 39 | plugins: [ 40 | 'babel-plugin-macros', 41 | '@babel/plugin-syntax-dynamic-import', 42 | isTestEnv && 'babel-plugin-dynamic-import-node', 43 | '@babel/plugin-transform-destructuring', 44 | [ 45 | '@babel/plugin-proposal-class-properties', 46 | { 47 | loose: true 48 | } 49 | ], 50 | [ 51 | '@babel/plugin-proposal-object-rest-spread', 52 | { 53 | useBuiltIns: true 54 | } 55 | ], 56 | [ 57 | '@babel/plugin-transform-runtime', 58 | { 59 | helpers: false, 60 | regenerator: true, 61 | corejs: false 62 | } 63 | ], 64 | [ 65 | '@babel/plugin-transform-regenerator', 66 | { 67 | async: false 68 | } 69 | ] 70 | ].filter(Boolean) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # 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 | config.action_view.cache_template_loading = true 13 | 14 | # Do not eager load code on boot. This avoids loading your whole application 15 | # just for the purpose of running a single test. If you are using a tool that 16 | # preloads Rails for running tests, you may have to set it to true. 17 | config.eager_load = false 18 | 19 | # Configure public file server for tests with Cache-Control for performance. 20 | config.public_file_server.enabled = true 21 | config.public_file_server.headers = { 22 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 23 | } 24 | 25 | # Show full error reports and disable caching. 26 | config.consider_all_requests_local = true 27 | config.action_controller.perform_caching = false 28 | config.cache_store = :null_store 29 | 30 | # Raise exceptions instead of rendering exception templates. 31 | config.action_dispatch.show_exceptions = false 32 | 33 | # Disable request forgery protection in test environment. 34 | config.action_controller.allow_forgery_protection = false 35 | 36 | # Store uploaded files on the local file system in a temporary directory. 37 | config.active_storage.service = :cloudinary 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | # Tell Action Mailer not to deliver emails to the real world. 42 | # The :test delivery method accumulates sent emails in the 43 | # ActionMailer::Base.deliveries array. 44 | config.action_mailer.delivery_method = :test 45 | 46 | # Print deprecation notices to the stderr. 47 | config.active_support.deprecation = :stderr 48 | 49 | # Raises error for missing translations. 50 | # config.action_view.raise_on_missing_translations = true 51 | end 52 | -------------------------------------------------------------------------------- /.rubocop_todo.yml: -------------------------------------------------------------------------------- 1 | # This configuration was generated by 2 | # `rubocop --auto-gen-config` 3 | # on 2021-01-14 22:42:23 +0400 using RuboCop version 0.81.0. 4 | # The point is for the user to remove these configuration records 5 | # one by one as the offenses are removed from the code base. 6 | # Note that changes in the inspected code, or installation of new 7 | # versions of RuboCop, may require this file to be generated again. 8 | 9 | # Offense count: 1 10 | Lint/DuplicateMethods: 11 | Exclude: 12 | - 'app/controllers/users_controller.rb' 13 | 14 | # Offense count: 3 15 | # Configuration parameters: IgnoredMethods. 16 | Metrics/AbcSize: 17 | Max: 17 18 | 19 | # Offense count: 1 20 | # Configuration parameters: CountComments, ExcludedMethods. 21 | # ExcludedMethods: refine 22 | Metrics/BlockLength: 23 | Max: 56 24 | 25 | # Offense count: 1 26 | # Configuration parameters: IgnoredMethods. 27 | Metrics/CyclomaticComplexity: 28 | Max: 8 29 | 30 | # Offense count: 5 31 | # Configuration parameters: CountComments, ExcludedMethods. 32 | Metrics/MethodLength: 33 | Max: 18 34 | 35 | # Offense count: 1 36 | # Configuration parameters: IgnoredMethods. 37 | Metrics/PerceivedComplexity: 38 | Max: 8 39 | 40 | # Offense count: 2 41 | # Cop supports --auto-correct. 42 | # Configuration parameters: AutoCorrect, EnforcedStyle. 43 | # SupportedStyles: nested, compact 44 | Style/ClassAndModuleChildren: 45 | Exclude: 46 | - 'test/channels/application_cable/connection_test.rb' 47 | - 'test/test_helper.rb' 48 | 49 | # Offense count: 1 50 | Style/CommentedKeyword: 51 | Exclude: 52 | - 'bin/bundle' 53 | 54 | # Offense count: 24 55 | Style/Documentation: 56 | Enabled: false 57 | 58 | # Offense count: 1 59 | # Configuration parameters: MinBodyLength. 60 | Style/GuardClause: 61 | Exclude: 62 | - 'app/helpers/application_helper.rb' 63 | 64 | # Offense count: 6 65 | # Cop supports --auto-correct. 66 | Style/IfUnlessModifier: 67 | Exclude: 68 | - 'bin/bundle' 69 | - 'spec/rails_helper.rb' 70 | 71 | # Offense count: 101 72 | # Cop supports --auto-correct. 73 | # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. 74 | # URISchemes: http, https 75 | Layout/LineLength: 76 | Max: 198 77 | -------------------------------------------------------------------------------- /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 | - .mjs 38 | - .js 39 | - .sass 40 | - .scss 41 | - .css 42 | - .module.sass 43 | - .module.scss 44 | - .module.css 45 | - .png 46 | - .svg 47 | - .gif 48 | - .jpeg 49 | - .jpg 50 | 51 | development: 52 | <<: *default 53 | compile: true 54 | 55 | # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules 56 | check_yarn_integrity: true 57 | 58 | # Reference: https://webpack.js.org/configuration/dev-server/ 59 | dev_server: 60 | https: false 61 | host: localhost 62 | port: 3035 63 | public: localhost:3035 64 | hmr: false 65 | # Inline should be set to true if using HMR 66 | inline: true 67 | overlay: true 68 | compress: true 69 | disable_host_check: true 70 | use_local_ip: false 71 | quiet: false 72 | pretty: false 73 | headers: 74 | 'Access-Control-Allow-Origin': '*' 75 | watch_options: 76 | ignored: '**/node_modules/**' 77 | 78 | 79 | test: 80 | <<: *default 81 | compile: true 82 | 83 | # Compile test packs to a separate directory 84 | public_output_path: packs-test 85 | 86 | production: 87 | <<: *default 88 | 89 | # Production depends on precompilation of packs prior to booting for performance. 90 | compile: false 91 | 92 | # Extract and emit a css file 93 | extract_css: true 94 | 95 | # Cache manifest.json for performance 96 | cache_manifest: true 97 | -------------------------------------------------------------------------------- /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 '3.0.0' 7 | 8 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 9 | gem 'rails', '~> 6.0.3', '>= 6.0.3.4' 10 | # Use postgresql as the database for Active Record 11 | gem 'pg', '>= 0.18', '< 2.0' 12 | gem 'rake' 13 | # Use Puma as the app server 14 | gem 'puma', '~> 4.1' 15 | # Use SCSS for stylesheets 16 | gem 'sass-rails', '>= 6' 17 | # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker 18 | gem 'webpacker', '~> 4.0' 19 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 20 | gem 'turbolinks', '~> 5' 21 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 22 | gem 'bootstrap' 23 | gem 'cloudinary' 24 | gem 'devise' 25 | gem 'devise-bootstrap-views', '~> 1.0' 26 | gem 'hirb' 27 | gem 'jbuilder', '~> 2.7' 28 | gem 'rubocop', '~>0.81.0' 29 | # Use Redis adapter to run Action Cable in production 30 | # gem 'redis', '~> 4.0' 31 | # Use Active Model has_secure_password 32 | # gem 'bcrypt', '~> 3.1.7' 33 | 34 | # Use Active Storage variant 35 | # gem 'image_processing', '~> 1.2' 36 | 37 | # Reduces boot times through caching; required in config/boot.rb 38 | gem 'bootsnap', '>= 1.4.2', require: false 39 | 40 | group :development, :test do 41 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 42 | gem 'byebug', platforms: %i[mri mingw x64_mingw] 43 | gem 'capybara' 44 | gem 'rspec-rails' 45 | end 46 | 47 | group :development do 48 | # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 49 | gem 'listen', '~> 3.2' 50 | gem 'web-console', '>= 3.3.0' 51 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 52 | gem 'spring' 53 | gem 'spring-watcher-listen', '~> 2.0.0' 54 | end 55 | 56 | group :test do 57 | # Adds support for Capybara system testing and selenium driver 58 | gem 'selenium-webdriver' 59 | # Easy installation and use of web drivers to run system tests with browsers 60 | gem 'webdrivers' 61 | end 62 | 63 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 64 | gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] 65 | -------------------------------------------------------------------------------- /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 = :cloudinary 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Group our transactions 2 | 3 | The project is an app made specially for mobiles. Users can create, edit and delete transactions and group them 4 | 5 | ## Desktop 6 | 7 | ![s3](https://user-images.githubusercontent.com/31889642/104623958-64c61980-56ac-11eb-85e2-3df2eedec095.png) 8 | 9 | ## Built With 10 | 11 | - ruby '2.7.0' 12 | - rails '6.0.3' 13 | - PostgreSQL 14 | - VScode 15 | - Bootstrap 16 | 17 | ## Watch a video presentation of the project 18 | 19 | [watch loom video](https://www.loom.com/share/6ad2873a06314e88943e376f05b392e0). 20 | 21 | ## Live Demo 22 | 23 | Live version 24 | 25 | ## Getting Started 26 | 27 | To get a local copy up and running follow these simple example steps. 28 | 29 | ### Setup 30 | 31 | Instal gems with: 32 | 33 | ``` 34 | yarn install 35 | ``` 36 | 37 | ``` 38 | bundle install 39 | ``` 40 | 41 | Setup database with: 42 | 43 | ``` 44 | rails db:drop 45 | rails db:create 46 | rails db:migrate 47 | ``` 48 | 49 | ### Usage 50 | 51 | Start server with: 52 | 53 | ``` 54 | rails server 55 | ``` 56 | 57 | Open `http://localhost:3000/` in your browser. 58 | 59 | ### Run tests 60 | 61 | ``` 62 | rpsec 63 | ``` 64 | 65 | ## Author 66 | 67 | Feel free to reach out. I'm always happy to connect :slightly_smiling_face: 68 | 69 | 👤 **Mkrtich Sargsyan** 70 | 71 | 72 | [](https://github.com/MkrtichSargsyan) 73 | [](https://twitter.com/MkrtichSargsyan) 74 | [](https://www.linkedin.com/in/mkrtich-sargsyan/) 75 | [](mailto:mkrtichsargsyan24@gmail.com) 76 | 77 | 78 | 79 | ## 🤝 Contributing 80 | 81 | Contributions, issues and feature requests are welcome! 82 | 83 | Feel free to check the issues page. 84 | 85 | 86 | 87 | ## Show your support 88 | 89 | Give a ⭐️ if you like this project! 90 | 91 | ## Acknowledgments 92 | 93 | Design idea by [Gregoire Vella](https://www.behance.net/gregoirevella) 94 | 95 | - The Odin Project 96 | - Stackoverflow 97 | - YouTube player page 98 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is copied to spec/ when you run 'rails generate rspec:install' 4 | require 'spec_helper' 5 | ENV['RAILS_ENV'] ||= 'test' 6 | require File.expand_path('../config/environment', __dir__) 7 | # Prevent database truncation if the environment is production 8 | if Rails.env.production? 9 | abort('The Rails environment is running in production mode!') 10 | end 11 | require 'rspec/rails' 12 | # Add additional requires below this line. Rails is not loaded until this point! 13 | 14 | # Requires supporting ruby files with custom matchers and macros, etc, in 15 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 16 | # run as spec files by default. This means that files in spec/support that end 17 | # in _spec.rb will both be required and run as specs, causing the specs to be 18 | # run twice. It is recommended that you do not name files matching this glob to 19 | # end with _spec.rb. You can configure this pattern with the --pattern 20 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 21 | # 22 | # The following line is provided for convenience purposes. It has the downside 23 | # of increasing the boot-up time by auto-requiring all files in the support 24 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 25 | # require only the support files necessary. 26 | # 27 | # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } 28 | 29 | # Checks for pending migrations and applies them before tests are run. 30 | # If you are not using ActiveRecord, you can remove these lines. 31 | begin 32 | ActiveRecord::Migration.maintain_test_schema! 33 | rescue ActiveRecord::PendingMigrationError => e 34 | puts e.to_s.strip 35 | exit 1 36 | end 37 | RSpec.configure do |config| 38 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 39 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 40 | 41 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 42 | # examples within a transaction, remove the following line or assign false 43 | # instead of true. 44 | config.use_transactional_fixtures = true 45 | 46 | # You can uncomment this line to turn off ActiveRecord support entirely. 47 | # config.use_active_record = false 48 | 49 | # RSpec Rails can automatically mix in different behaviours to your tests 50 | # based on their file location, for example enabling you to call `get` and 51 | # `post` in specs under `spec/controllers`. 52 | # 53 | # You can disable this behaviour by removing the line below, and instead 54 | # explicitly tag your specs with their type, e.g.: 55 | # 56 | # RSpec.describe UsersController, type: :controller do 57 | # # ... 58 | # end 59 | # 60 | # The different available types are documented in the features, such as in 61 | # https://relishapp.com/rspec/rspec-rails/docs 62 | config.infer_spec_type_from_file_location! 63 | 64 | # Filter lines from Rails gems in backtraces. 65 | config.filter_rails_from_backtrace! 66 | # arbitrary gems may also be filtered via: 67 | # config.filter_gems_from_backtrace("gem name") 68 | end 69 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.3 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On macOS with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On macOS with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see Rails configuration guide 21 | # https://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: Transactions_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: Transactions 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: Transactions_test 61 | 62 | # As with config/credentials.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: Transactions_production 84 | username: Transactions 85 | password: <%= ENV['TRANSACTIONS_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is auto-generated from the current state of the database. Instead 4 | # of editing this file, please use the migrations feature of Active Record to 5 | # incrementally modify your database, and then regenerate this schema definition. 6 | # 7 | # This file is the source Rails uses to define your schema when running `rails 8 | # db:schema:load`. When creating a new database, `rails db:schema:load` tends to 9 | # be faster and is potentially less error prone than running all of your 10 | # migrations from scratch. Old migrations may fail to apply correctly if those 11 | # migrations use external dependencies or application code. 12 | # 13 | # It's strongly recommended that you check this file into your version control system. 14 | 15 | ActiveRecord::Schema.define(version: 20_210_111_041_457) do 16 | # These are extensions that must be enabled in order to support this database 17 | enable_extension 'plpgsql' 18 | 19 | create_table 'active_storage_attachments', force: :cascade do |t| 20 | t.string 'name', null: false 21 | t.string 'record_type', null: false 22 | t.bigint 'record_id', null: false 23 | t.bigint 'blob_id', null: false 24 | t.datetime 'created_at', null: false 25 | t.index ['blob_id'], name: 'index_active_storage_attachments_on_blob_id' 26 | t.index %w[record_type record_id name blob_id], name: 'index_active_storage_attachments_uniqueness', unique: true 27 | end 28 | 29 | create_table 'active_storage_blobs', force: :cascade do |t| 30 | t.string 'key', null: false 31 | t.string 'filename', null: false 32 | t.string 'content_type' 33 | t.text 'metadata' 34 | t.bigint 'byte_size', null: false 35 | t.string 'checksum', null: false 36 | t.datetime 'created_at', null: false 37 | t.index ['key'], name: 'index_active_storage_blobs_on_key', unique: true 38 | end 39 | 40 | create_table 'groups', force: :cascade do |t| 41 | t.datetime 'created_at', precision: 6, null: false 42 | t.datetime 'updated_at', precision: 6, null: false 43 | t.string 'name' 44 | t.string 'icon' 45 | t.bigint 'user_id' 46 | t.index ['user_id'], name: 'index_groups_on_user_id' 47 | end 48 | 49 | create_table 'transaction_groups', force: :cascade do |t| 50 | t.integer 'transfer_id' 51 | t.integer 'group_id' 52 | t.datetime 'created_at', precision: 6, null: false 53 | t.datetime 'updated_at', precision: 6, null: false 54 | end 55 | 56 | create_table 'transactions', force: :cascade do |t| 57 | t.datetime 'created_at', precision: 6, null: false 58 | t.datetime 'updated_at', precision: 6, null: false 59 | t.string 'name' 60 | t.integer 'amount' 61 | t.bigint 'author_id' 62 | t.index ['author_id'], name: 'index_transactions_on_author_id' 63 | end 64 | 65 | create_table 'users', force: :cascade do |t| 66 | t.string 'name' 67 | t.datetime 'created_at', precision: 6, null: false 68 | t.datetime 'updated_at', precision: 6, null: false 69 | t.string 'email', default: '', null: false 70 | t.string 'encrypted_password', default: '', null: false 71 | t.string 'reset_password_token' 72 | t.datetime 'reset_password_sent_at' 73 | t.datetime 'remember_created_at' 74 | t.index ['email'], name: 'index_users_on_email', unique: true 75 | t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true 76 | end 77 | 78 | add_foreign_key 'active_storage_attachments', 'active_storage_blobs', column: 'blob_id' 79 | add_foreign_key 'transactions', 'users', column: 'author_id' 80 | end 81 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/heartcombo/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | email_changed: 27 | subject: "Email Changed" 28 | password_change: 29 | subject: "Password Changed" 30 | omniauth_callbacks: 31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 32 | success: "Successfully authenticated from %{kind} account." 33 | passwords: 34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 37 | updated: "Your password has been changed successfully. You are now signed in." 38 | updated_not_active: "Your password has been changed successfully." 39 | registrations: 40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 41 | signed_up: "Welcome! You have signed up successfully." 42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." 45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." 46 | updated: "Your account has been updated successfully." 47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again" 48 | sessions: 49 | signed_in: "Signed in successfully." 50 | signed_out: "Signed out successfully." 51 | already_signed_out: "Signed out successfully." 52 | unlocks: 53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 56 | errors: 57 | messages: 58 | already_confirmed: "was already confirmed, please try signing in" 59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 60 | expired: "has expired, please request a new one" 61 | not_found: "not found" 62 | not_locked: "was not locked" 63 | not_saved: 64 | one: "1 error prohibited this %{resource} from being saved:" 65 | other: "%{count} errors prohibited this %{resource} from being saved:" 66 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all 4 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 5 | # The generated `.rspec` file contains `--require spec_helper` which will cause 6 | # this file to always be loaded, without a need to explicitly require it in any 7 | # files. 8 | # 9 | # Given that it is always loaded, you are encouraged to keep this file as 10 | # light-weight as possible. Requiring heavyweight dependencies from this file 11 | # will add to the boot time of your test suite on EVERY test run, even for an 12 | # individual file that may not need all of that loaded. Instead, consider making 13 | # a separate helper file that requires the additional dependencies and performs 14 | # the additional setup, and require it from the spec files that actually need 15 | # it. 16 | # 17 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 18 | RSpec.configure do |config| 19 | # rspec-expectations config goes here. You can use an alternate 20 | # assertion/expectation library such as wrong or the stdlib/minitest 21 | # assertions if you prefer. 22 | config.expect_with :rspec do |expectations| 23 | # This option will default to `true` in RSpec 4. It makes the `description` 24 | # and `failure_message` of custom matchers include text for helper methods 25 | # defined using `chain`, e.g.: 26 | # be_bigger_than(2).and_smaller_than(4).description 27 | # # => "be bigger than 2 and smaller than 4" 28 | # ...rather than: 29 | # # => "be bigger than 2" 30 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 31 | end 32 | 33 | # rspec-mocks config goes here. You can use an alternate test double 34 | # library (such as bogus or mocha) by changing the `mock_with` option here. 35 | config.mock_with :rspec do |mocks| 36 | # Prevents you from mocking or stubbing a method that does not exist on 37 | # a real object. This is generally recommended, and will default to 38 | # `true` in RSpec 4. 39 | mocks.verify_partial_doubles = true 40 | end 41 | 42 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will 43 | # have no way to turn it off -- the option exists only for backwards 44 | # compatibility in RSpec 3). It causes shared context metadata to be 45 | # inherited by the metadata hash of host groups and examples, rather than 46 | # triggering implicit auto-inclusion in groups with matching metadata. 47 | config.shared_context_metadata_behavior = :apply_to_host_groups 48 | 49 | # The settings below are suggested to provide a good initial experience 50 | # with RSpec, but feel free to customize to your heart's content. 51 | # # This allows you to limit a spec run to individual examples or groups 52 | # # you care about by tagging them with `:focus` metadata. When nothing 53 | # # is tagged with `:focus`, all examples get run. RSpec also provides 54 | # # aliases for `it`, `describe`, and `context` that include `:focus` 55 | # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. 56 | # config.filter_run_when_matching :focus 57 | # 58 | # # Allows RSpec to persist some state between runs in order to support 59 | # # the `--only-failures` and `--next-failure` CLI options. We recommend 60 | # # you configure your source control system to ignore this file. 61 | # config.example_status_persistence_file_path = "spec/examples.txt" 62 | # 63 | # # Limits the available syntax to the non-monkey patched syntax that is 64 | # # recommended. For more details, see: 65 | # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ 66 | # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 67 | # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode 68 | # config.disable_monkey_patching! 69 | # 70 | # # Many RSpec users commonly either run the entire suite or an individual 71 | # # file, and it's useful to allow more verbose output when running an 72 | # # individual spec file. 73 | # if config.files_to_run.one? 74 | # # Use the documentation formatter for detailed output, 75 | # # unless a formatter has already been configured 76 | # # (e.g. via a command-line flag). 77 | # config.default_formatter = "doc" 78 | # end 79 | # 80 | # # Print the 10 slowest examples and example groups at the 81 | # # end of the spec run, to help surface which specs are running 82 | # # particularly slow. 83 | # config.profile_examples = 10 84 | # 85 | # # Run specs in random order to surface order dependencies. If you find an 86 | # # order dependency and want to debug it, you can fix the order by providing 87 | # # the seed, which is printed after each run. 88 | # # --seed 1234 89 | # config.order = :random 90 | # 91 | # # Seed global randomization in this process using the `--seed` CLI option. 92 | # # Setting this allows you to use `--seed` to deterministically reproduce 93 | # # test failures related to randomization by passing the same `--seed` value 94 | # # as the one that triggered the failure. 95 | # Kernel.srand config.seed 96 | end 97 | -------------------------------------------------------------------------------- /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 = true 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 = :cloudinary 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 = "Transactions_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 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (6.0.3.5) 5 | actionpack (= 6.0.3.5) 6 | nio4r (~> 2.0) 7 | websocket-driver (>= 0.6.1) 8 | actionmailbox (6.0.3.5) 9 | actionpack (= 6.0.3.5) 10 | activejob (= 6.0.3.5) 11 | activerecord (= 6.0.3.5) 12 | activestorage (= 6.0.3.5) 13 | activesupport (= 6.0.3.5) 14 | mail (>= 2.7.1) 15 | actionmailer (6.0.3.5) 16 | actionpack (= 6.0.3.5) 17 | actionview (= 6.0.3.5) 18 | activejob (= 6.0.3.5) 19 | mail (~> 2.5, >= 2.5.4) 20 | rails-dom-testing (~> 2.0) 21 | actionpack (6.0.3.5) 22 | actionview (= 6.0.3.5) 23 | activesupport (= 6.0.3.5) 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.3.5) 29 | actionpack (= 6.0.3.5) 30 | activerecord (= 6.0.3.5) 31 | activestorage (= 6.0.3.5) 32 | activesupport (= 6.0.3.5) 33 | nokogiri (>= 1.8.5) 34 | actionview (6.0.3.5) 35 | activesupport (= 6.0.3.5) 36 | builder (~> 3.1) 37 | erubi (~> 1.4) 38 | rails-dom-testing (~> 2.0) 39 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 40 | activejob (6.0.3.5) 41 | activesupport (= 6.0.3.5) 42 | globalid (>= 0.3.6) 43 | activemodel (6.0.3.5) 44 | activesupport (= 6.0.3.5) 45 | activerecord (6.0.3.5) 46 | activemodel (= 6.0.3.5) 47 | activesupport (= 6.0.3.5) 48 | activestorage (6.0.3.5) 49 | actionpack (= 6.0.3.5) 50 | activejob (= 6.0.3.5) 51 | activerecord (= 6.0.3.5) 52 | marcel (~> 0.3.1) 53 | activesupport (6.0.3.5) 54 | concurrent-ruby (~> 1.0, >= 1.0.2) 55 | i18n (>= 0.7, < 2) 56 | minitest (~> 5.1) 57 | tzinfo (~> 1.1) 58 | zeitwerk (~> 2.2, >= 2.2.2) 59 | addressable (2.7.0) 60 | public_suffix (>= 2.0.2, < 5.0) 61 | ast (2.4.2) 62 | autoprefixer-rails (10.2.4.0) 63 | execjs 64 | aws_cf_signer (0.1.3) 65 | bcrypt (3.1.16) 66 | bindex (0.8.1) 67 | bootsnap (1.7.2) 68 | msgpack (~> 1.0) 69 | bootstrap (4.6.0) 70 | autoprefixer-rails (>= 9.1.0) 71 | popper_js (>= 1.14.3, < 2) 72 | sassc-rails (>= 2.0.0) 73 | builder (3.2.4) 74 | byebug (11.1.3) 75 | capybara (3.35.3) 76 | addressable 77 | mini_mime (>= 0.1.3) 78 | nokogiri (~> 1.8) 79 | rack (>= 1.6.0) 80 | rack-test (>= 0.6.3) 81 | regexp_parser (>= 1.5, < 3.0) 82 | xpath (~> 3.2) 83 | childprocess (3.0.0) 84 | cloudinary (1.18.1) 85 | aws_cf_signer 86 | rest-client 87 | concurrent-ruby (1.1.8) 88 | crass (1.0.6) 89 | devise (4.7.3) 90 | bcrypt (~> 3.0) 91 | orm_adapter (~> 0.1) 92 | railties (>= 4.1.0) 93 | responders 94 | warden (~> 1.2.3) 95 | devise-bootstrap-views (1.1.0) 96 | diff-lcs (1.4.4) 97 | domain_name (0.5.20190701) 98 | unf (>= 0.0.5, < 1.0.0) 99 | erubi (1.10.0) 100 | execjs (2.7.0) 101 | ffi (1.14.2) 102 | globalid (0.4.2) 103 | activesupport (>= 4.2.0) 104 | hirb (0.7.3) 105 | http-accept (1.7.0) 106 | http-cookie (1.0.3) 107 | domain_name (~> 0.5) 108 | i18n (1.8.8) 109 | concurrent-ruby (~> 1.0) 110 | jaro_winkler (1.5.4) 111 | jbuilder (2.11.2) 112 | activesupport (>= 5.0.0) 113 | listen (3.4.1) 114 | rb-fsevent (~> 0.10, >= 0.10.3) 115 | rb-inotify (~> 0.9, >= 0.9.10) 116 | loofah (2.9.0) 117 | crass (~> 1.0.2) 118 | nokogiri (>= 1.5.9) 119 | mail (2.7.1) 120 | mini_mime (>= 0.1.1) 121 | marcel (0.3.3) 122 | mimemagic (~> 0.3.2) 123 | method_source (1.0.0) 124 | mime-types (3.3.1) 125 | mime-types-data (~> 3.2015) 126 | mime-types-data (3.2020.1104) 127 | mimemagic (0.3.5) 128 | mini_mime (1.0.2) 129 | minitest (5.14.3) 130 | msgpack (1.4.2) 131 | netrc (0.11.0) 132 | nio4r (2.5.5) 133 | nokogiri (1.11.1-x86_64-linux) 134 | racc (~> 1.4) 135 | orm_adapter (0.5.0) 136 | parallel (1.20.1) 137 | parser (3.0.0.0) 138 | ast (~> 2.4.1) 139 | pg (1.2.3) 140 | popper_js (1.16.0) 141 | public_suffix (4.0.6) 142 | puma (4.3.7) 143 | nio4r (~> 2.0) 144 | racc (1.5.2) 145 | rack (2.2.3) 146 | rack-proxy (0.6.5) 147 | rack 148 | rack-test (1.1.0) 149 | rack (>= 1.0, < 3) 150 | rails (6.0.3.5) 151 | actioncable (= 6.0.3.5) 152 | actionmailbox (= 6.0.3.5) 153 | actionmailer (= 6.0.3.5) 154 | actionpack (= 6.0.3.5) 155 | actiontext (= 6.0.3.5) 156 | actionview (= 6.0.3.5) 157 | activejob (= 6.0.3.5) 158 | activemodel (= 6.0.3.5) 159 | activerecord (= 6.0.3.5) 160 | activestorage (= 6.0.3.5) 161 | activesupport (= 6.0.3.5) 162 | bundler (>= 1.3.0) 163 | railties (= 6.0.3.5) 164 | sprockets-rails (>= 2.0.0) 165 | rails-dom-testing (2.0.3) 166 | activesupport (>= 4.2.0) 167 | nokogiri (>= 1.6) 168 | rails-html-sanitizer (1.3.0) 169 | loofah (~> 2.3) 170 | railties (6.0.3.5) 171 | actionpack (= 6.0.3.5) 172 | activesupport (= 6.0.3.5) 173 | method_source 174 | rake (>= 0.8.7) 175 | thor (>= 0.20.3, < 2.0) 176 | rainbow (3.0.0) 177 | rake (13.0.3) 178 | rb-fsevent (0.10.4) 179 | rb-inotify (0.10.1) 180 | ffi (~> 1.0) 181 | regexp_parser (2.0.3) 182 | responders (3.0.1) 183 | actionpack (>= 5.0) 184 | railties (>= 5.0) 185 | rest-client (2.1.0) 186 | http-accept (>= 1.7.0, < 2.0) 187 | http-cookie (>= 1.0.2, < 2.0) 188 | mime-types (>= 1.16, < 4.0) 189 | netrc (~> 0.8) 190 | rexml (3.2.4) 191 | rspec-core (3.10.1) 192 | rspec-support (~> 3.10.0) 193 | rspec-expectations (3.10.1) 194 | diff-lcs (>= 1.2.0, < 2.0) 195 | rspec-support (~> 3.10.0) 196 | rspec-mocks (3.10.2) 197 | diff-lcs (>= 1.2.0, < 2.0) 198 | rspec-support (~> 3.10.0) 199 | rspec-rails (4.0.2) 200 | actionpack (>= 4.2) 201 | activesupport (>= 4.2) 202 | railties (>= 4.2) 203 | rspec-core (~> 3.10) 204 | rspec-expectations (~> 3.10) 205 | rspec-mocks (~> 3.10) 206 | rspec-support (~> 3.10) 207 | rspec-support (3.10.2) 208 | rubocop (0.81.0) 209 | jaro_winkler (~> 1.5.1) 210 | parallel (~> 1.10) 211 | parser (>= 2.7.0.1) 212 | rainbow (>= 2.2.2, < 4.0) 213 | rexml 214 | ruby-progressbar (~> 1.7) 215 | unicode-display_width (>= 1.4.0, < 2.0) 216 | ruby-progressbar (1.11.0) 217 | rubyzip (2.3.0) 218 | sass-rails (6.0.0) 219 | sassc-rails (~> 2.1, >= 2.1.1) 220 | sassc (2.4.0) 221 | ffi (~> 1.9) 222 | sassc-rails (2.1.2) 223 | railties (>= 4.0.0) 224 | sassc (>= 2.0) 225 | sprockets (> 3.0) 226 | sprockets-rails 227 | tilt 228 | selenium-webdriver (3.142.7) 229 | childprocess (>= 0.5, < 4.0) 230 | rubyzip (>= 1.2.2) 231 | spring (2.1.1) 232 | spring-watcher-listen (2.0.1) 233 | listen (>= 2.7, < 4.0) 234 | spring (>= 1.2, < 3.0) 235 | sprockets (4.0.2) 236 | concurrent-ruby (~> 1.0) 237 | rack (> 1, < 3) 238 | sprockets-rails (3.2.2) 239 | actionpack (>= 4.0) 240 | activesupport (>= 4.0) 241 | sprockets (>= 3.0.0) 242 | thor (1.1.0) 243 | thread_safe (0.3.6) 244 | tilt (2.0.10) 245 | turbolinks (5.2.1) 246 | turbolinks-source (~> 5.2) 247 | turbolinks-source (5.2.0) 248 | tzinfo (1.2.9) 249 | thread_safe (~> 0.1) 250 | unf (0.1.4) 251 | unf_ext 252 | unf_ext (0.0.7.7) 253 | unicode-display_width (1.7.0) 254 | warden (1.2.9) 255 | rack (>= 2.0.9) 256 | web-console (4.1.0) 257 | actionview (>= 6.0.0) 258 | activemodel (>= 6.0.0) 259 | bindex (>= 0.4.0) 260 | railties (>= 6.0.0) 261 | webdrivers (4.5.0) 262 | nokogiri (~> 1.6) 263 | rubyzip (>= 1.3.0) 264 | selenium-webdriver (>= 3.0, < 4.0) 265 | webpacker (4.3.0) 266 | activesupport (>= 4.2) 267 | rack-proxy (>= 0.6.1) 268 | railties (>= 4.2) 269 | websocket-driver (0.7.3) 270 | websocket-extensions (>= 0.1.0) 271 | websocket-extensions (0.1.5) 272 | xpath (3.2.0) 273 | nokogiri (~> 1.8) 274 | zeitwerk (2.4.2) 275 | 276 | PLATFORMS 277 | x86_64-linux 278 | 279 | DEPENDENCIES 280 | bootsnap (>= 1.4.2) 281 | bootstrap 282 | byebug 283 | capybara 284 | cloudinary 285 | devise 286 | devise-bootstrap-views (~> 1.0) 287 | hirb 288 | jbuilder (~> 2.7) 289 | listen (~> 3.2) 290 | pg (>= 0.18, < 2.0) 291 | puma (~> 4.1) 292 | rails (~> 6.0.3, >= 6.0.3.4) 293 | rake 294 | rspec-rails 295 | rubocop (~> 0.81.0) 296 | sass-rails (>= 6) 297 | selenium-webdriver 298 | spring 299 | spring-watcher-listen (~> 2.0.0) 300 | turbolinks (~> 5) 301 | tzinfo-data 302 | web-console (>= 3.3.0) 303 | webdrivers 304 | webpacker (~> 4.0) 305 | 306 | RUBY VERSION 307 | ruby 3.0.0p0 308 | 309 | BUNDLED WITH 310 | 2.2.9 311 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Assuming you have not yet modified this file, each configuration option below 4 | # is set to its default value. Note that some are commented out while others 5 | # are not: uncommented lines are intended to protect your configuration from 6 | # breaking changes in upgrades (i.e., in the event that future versions of 7 | # Devise change the default values for those options). 8 | # 9 | # Use this hook to configure devise mailer, warden hooks and so forth. 10 | # Many of these configuration options can be set straight in your model. 11 | Devise.setup do |config| 12 | # The secret key used by Devise. Devise uses this key to generate 13 | # random tokens. Changing this key will render invalid all existing 14 | # confirmation, reset password and unlock tokens in the database. 15 | # Devise will use the `secret_key_base` as its `secret_key` 16 | # by default. You can change it below and use your own secret key. 17 | # config.secret_key = 'a9701164f000d6967fdc3cd18747b3a80aef63ed0d2ddeccfa90ba4b839116415c91b944c539517ca845e9c8bae46c421af9346dbf2a1456ba751e41cb8e68ca' 18 | 19 | # ==> Controller configuration 20 | # Configure the parent class to the devise controllers. 21 | # config.parent_controller = 'DeviseController' 22 | 23 | # ==> Mailer Configuration 24 | # Configure the e-mail address which will be shown in Devise::Mailer, 25 | # note that it will be overwritten if you use your own mailer class 26 | # with default "from" parameter. 27 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 28 | 29 | # Configure the class responsible to send e-mails. 30 | # config.mailer = 'Devise::Mailer' 31 | 32 | # Configure the parent class responsible to send e-mails. 33 | # config.parent_mailer = 'ActionMailer::Base' 34 | 35 | # ==> ORM configuration 36 | # Load and configure the ORM. Supports :active_record (default) and 37 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 38 | # available as additional gems. 39 | require 'devise/orm/active_record' 40 | 41 | # ==> Configuration for any authentication mechanism 42 | # Configure which keys are used when authenticating a user. The default is 43 | # just :email. You can configure it to use [:username, :subdomain], so for 44 | # authenticating a user, both parameters are required. Remember that those 45 | # parameters are used only when authenticating and not when retrieving from 46 | # session. If you need permissions, you should implement that in a before filter. 47 | # You can also supply a hash where the value is a boolean determining whether 48 | # or not authentication should be aborted when the value is not present. 49 | # config.authentication_keys = [:email] 50 | 51 | # Configure parameters from the request object used for authentication. Each entry 52 | # given should be a request method and it will automatically be passed to the 53 | # find_for_authentication method and considered in your model lookup. For instance, 54 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 55 | # The same considerations mentioned for authentication_keys also apply to request_keys. 56 | # config.request_keys = [] 57 | 58 | # Configure which authentication keys should be case-insensitive. 59 | # These keys will be downcased upon creating or modifying a user and when used 60 | # to authenticate or find a user. Default is :email. 61 | config.case_insensitive_keys = [:email] 62 | 63 | # Configure which authentication keys should have whitespace stripped. 64 | # These keys will have whitespace before and after removed upon creating or 65 | # modifying a user and when used to authenticate or find a user. Default is :email. 66 | config.strip_whitespace_keys = [:email] 67 | 68 | # Tell if authentication through request.params is enabled. True by default. 69 | # It can be set to an array that will enable params authentication only for the 70 | # given strategies, for example, `config.params_authenticatable = [:database]` 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. 78 | # For API-only applications to support authentication "out-of-the-box", you will likely want to 79 | # enable this with :database unless you are using a custom strategy. 80 | # The supported strategies are: 81 | # :database = Support basic authentication with authentication key + password 82 | # config.http_authenticatable = false 83 | 84 | # If 401 status code should be returned for AJAX requests. True by default. 85 | # config.http_authenticatable_on_xhr = true 86 | 87 | # The realm used in Http Basic Authentication. 'Application' by default. 88 | # config.http_authentication_realm = 'Application' 89 | 90 | # It will change confirmation, password recovery and other workflows 91 | # to behave the same regardless if the e-mail provided was right or wrong. 92 | # Does not affect registerable. 93 | # config.paranoid = true 94 | 95 | # By default Devise will store the user in session. You can skip storage for 96 | # particular strategies by setting this option. 97 | # Notice that if you are skipping storage for all authentication paths, you 98 | # may want to disable generating routes to Devise's sessions controller by 99 | # passing skip: :sessions to `devise_for` in your config/routes.rb 100 | config.skip_session_storage = [:http_auth] 101 | 102 | # By default, Devise cleans up the CSRF token on authentication to 103 | # avoid CSRF token fixation attacks. This means that, when using AJAX 104 | # requests for sign in and sign up, you need to get a new CSRF token 105 | # from the server. You can disable this option at your own risk. 106 | # config.clean_up_csrf_token_on_authentication = true 107 | 108 | # When false, Devise will not attempt to reload routes on eager load. 109 | # This can reduce the time taken to boot the app but if your application 110 | # requires the Devise mappings to be loaded during boot time the application 111 | # won't boot properly. 112 | # config.reload_routes = true 113 | 114 | # ==> Configuration for :database_authenticatable 115 | # For bcrypt, this is the cost for hashing the password and defaults to 12. If 116 | # using other algorithms, it sets how many times you want the password to be hashed. 117 | # The number of stretches used for generating the hashed password are stored 118 | # with the hashed password. This allows you to change the stretches without 119 | # invalidating existing passwords. 120 | # 121 | # Limiting the stretches to just one in testing will increase the performance of 122 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 123 | # a value less than 10 in other environments. Note that, for bcrypt (the default 124 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 125 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 126 | config.stretches = Rails.env.test? ? 1 : 12 127 | 128 | # Set up a pepper to generate the hashed password. 129 | # config.pepper = 'dcac4cebddb3822655b9e4196692d5f2f522084b25848d3fde12786d902452897d747ad173afd741e6add625e0b25501702a9d532994b31b469a7e5f5b24f3d8' 130 | 131 | # Send a notification to the original email when the user's email is changed. 132 | # config.send_email_changed_notification = false 133 | 134 | # Send a notification email when the user's password is changed. 135 | # config.send_password_change_notification = false 136 | 137 | # ==> Configuration for :confirmable 138 | # A period that the user is allowed to access the website even without 139 | # confirming their account. For instance, if set to 2.days, the user will be 140 | # able to access the website for two days without confirming their account, 141 | # access will be blocked just in the third day. 142 | # You can also set it to nil, which will allow the user to access the website 143 | # without confirming their account. 144 | # Default is 0.days, meaning the user cannot access the website without 145 | # confirming their account. 146 | # config.allow_unconfirmed_access_for = 2.days 147 | 148 | # A period that the user is allowed to confirm their account before their 149 | # token becomes invalid. For example, if set to 3.days, the user can confirm 150 | # their account within 3 days after the mail was sent, but on the fourth day 151 | # their account can't be confirmed with the token any more. 152 | # Default is nil, meaning there is no restriction on how long a user can take 153 | # before confirming their account. 154 | # config.confirm_within = 3.days 155 | 156 | # If true, requires any email changes to be confirmed (exactly the same way as 157 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 158 | # db field (see migrations). Until confirmed, new email is stored in 159 | # unconfirmed_email column, and copied to email column on successful confirmation. 160 | config.reconfirmable = true 161 | 162 | # Defines which key will be used when confirming an account 163 | # config.confirmation_keys = [:email] 164 | 165 | # ==> Configuration for :rememberable 166 | # The time the user will be remembered without asking for credentials again. 167 | # config.remember_for = 2.weeks 168 | 169 | # Invalidates all the remember me tokens when the user signs out. 170 | config.expire_all_remember_me_on_sign_out = true 171 | 172 | # If true, extends the user's remember period when remembered via cookie. 173 | # config.extend_remember_period = false 174 | 175 | # Options to be passed to the created cookie. For instance, you can set 176 | # secure: true in order to force SSL only cookies. 177 | # config.rememberable_options = {} 178 | 179 | # ==> Configuration for :validatable 180 | # Range for password length. 181 | config.password_length = 6..128 182 | 183 | # Email regex used to validate email formats. It simply asserts that 184 | # one (and only one) @ exists in the given string. This is mainly 185 | # to give user feedback and not to assert the e-mail validity. 186 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 187 | 188 | # ==> Configuration for :timeoutable 189 | # The time you want to timeout the user session without activity. After this 190 | # time the user will be asked for credentials again. Default is 30 minutes. 191 | # config.timeout_in = 30.minutes 192 | 193 | # ==> Configuration for :lockable 194 | # Defines which strategy will be used to lock an account. 195 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 196 | # :none = No lock strategy. You should handle locking by yourself. 197 | # config.lock_strategy = :failed_attempts 198 | 199 | # Defines which key will be used when locking and unlocking an account 200 | # config.unlock_keys = [:email] 201 | 202 | # Defines which strategy will be used to unlock an account. 203 | # :email = Sends an unlock link to the user email 204 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 205 | # :both = Enables both strategies 206 | # :none = No unlock strategy. You should handle unlocking by yourself. 207 | # config.unlock_strategy = :both 208 | 209 | # Number of authentication tries before locking an account if lock_strategy 210 | # is failed attempts. 211 | # config.maximum_attempts = 20 212 | 213 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 214 | # config.unlock_in = 1.hour 215 | 216 | # Warn on the last attempt before the account is locked. 217 | # config.last_attempt_warning = true 218 | 219 | # ==> Configuration for :recoverable 220 | # 221 | # Defines which key will be used when recovering the password for an account 222 | # config.reset_password_keys = [:email] 223 | 224 | # Time interval you can reset your password with a reset password key. 225 | # Don't put a too small interval or your users won't have the time to 226 | # change their passwords. 227 | config.reset_password_within = 6.hours 228 | 229 | # When set to false, does not sign a user in automatically after their password is 230 | # reset. Defaults to true, so a user is signed in automatically after a reset. 231 | # config.sign_in_after_reset_password = true 232 | 233 | # ==> Configuration for :encryptable 234 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 235 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 236 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 237 | # for default behavior) and :restful_authentication_sha1 (then you should set 238 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 239 | # 240 | # Require the `devise-encryptable` gem when using anything other than bcrypt 241 | # config.encryptor = :sha512 242 | 243 | # ==> Scopes configuration 244 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 245 | # "users/sessions/new". It's turned off by default because it's slower if you 246 | # are using only default views. 247 | # config.scoped_views = false 248 | 249 | # Configure the default scope given to Warden. By default it's the first 250 | # devise role declared in your routes (usually :user). 251 | # config.default_scope = :user 252 | 253 | # Set this configuration to false if you want /users/sign_out to sign out 254 | # only the current scope. By default, Devise signs out all scopes. 255 | # config.sign_out_all_scopes = true 256 | 257 | # ==> Navigation configuration 258 | # Lists the formats that should be treated as navigational. Formats like 259 | # :html, should redirect to the sign in page when the user does not have 260 | # access, but formats like :xml or :json, should return 401. 261 | # 262 | # If you have any extra navigational formats, like :iphone or :mobile, you 263 | # should add them to the navigational formats lists. 264 | # 265 | # The "*/*" below is required to match Internet Explorer requests. 266 | # config.navigational_formats = ['*/*', :html] 267 | 268 | # The default HTTP method used to sign out a resource. Default is :delete. 269 | config.sign_out_via = :delete 270 | 271 | # ==> OmniAuth 272 | # Add a new OmniAuth provider. Check the wiki for more information on setting 273 | # up on your models and hooks. 274 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 275 | 276 | # ==> Warden configuration 277 | # If you want to use other strategies, that are not supported by Devise, or 278 | # change the failure app, you can configure them inside the config.warden block. 279 | # 280 | # config.warden do |manager| 281 | # manager.intercept_401 = false 282 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 283 | # end 284 | 285 | # ==> Mountable engine configurations 286 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 287 | # is mountable, there are some extra configurations to be taken into account. 288 | # The following options are available, assuming the engine is mounted as: 289 | # 290 | # mount MyEngine, at: '/my_engine' 291 | # 292 | # The router that invoked `devise_for`, in the example above, would be: 293 | # config.router_name = :my_engine 294 | # 295 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 296 | # so you need to do it manually. For the users scope, it would be: 297 | # config.omniauth_path_prefix = '/my_engine/users/auth' 298 | 299 | # ==> Turbolinks configuration 300 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: 301 | # 302 | # ActiveSupport.on_load(:devise_failure_app) do 303 | # include Turbolinks::Controller 304 | # end 305 | 306 | # ==> Configuration for :registerable 307 | 308 | # When set to false, does not sign a user in automatically after their password is 309 | # changed. Defaults to true, so a user is signed in automatically after changing a password. 310 | # config.sign_in_after_change_password = true 311 | end 312 | --------------------------------------------------------------------------------