├── log └── .keep ├── tmp └── .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 ├── .ruby-version ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── channels │ │ │ └── .keep │ │ ├── application.js │ │ ├── users.coffee │ │ ├── admin │ │ │ ├── skills.coffee │ │ │ ├── users.coffee │ │ │ └── application.coffee │ │ ├── static_pages.coffee │ │ └── cable.js │ ├── config │ │ └── manifest.js │ └── stylesheets │ │ ├── application.scss │ │ ├── users.scss │ │ ├── admin │ │ ├── users.scss │ │ ├── skills.scss │ │ └── application.scss │ │ ├── static_pages.scss │ │ └── custom.scss ├── models │ ├── concerns │ │ └── .keep │ ├── application_record.rb │ ├── skill.rb │ └── user.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── static_pages_controller.rb │ ├── application_controller.rb │ ├── admin │ │ ├── application_controller.rb │ │ ├── skills_controller.rb │ │ └── users_controller.rb │ └── users_controller.rb ├── views │ ├── layouts │ │ ├── mailer.text.erb │ │ ├── mailer.html.erb │ │ └── application.html.erb │ ├── admin │ │ ├── skills │ │ │ ├── index.html.erb │ │ │ └── new.html.erb │ │ ├── application │ │ │ └── index.html.erb │ │ └── users │ │ │ ├── index.html.erb │ │ │ └── edit.html.erb │ ├── users │ │ ├── show.html.erb │ │ └── edit.html.erb │ ├── static_pages │ │ └── home.html.erb │ ├── devise │ │ ├── mailer │ │ │ ├── password_change.html.erb │ │ │ ├── confirmation_instructions.html.erb │ │ │ ├── unlock_instructions.html.erb │ │ │ └── reset_password_instructions.html.erb │ │ ├── passwords │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ ├── unlocks │ │ │ └── new.html.erb │ │ ├── confirmations │ │ │ └── new.html.erb │ │ ├── sessions │ │ │ └── new.html.erb │ │ ├── shared │ │ │ └── _links.html.erb │ │ └── registrations │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ ├── welcome_mailer │ │ ├── welcome_email.text.erb │ │ └── welcome_email.html.erb │ └── shared │ │ └── _navbar.html.erb ├── helpers │ ├── users_helper.rb │ ├── admin │ │ ├── skills_helper.rb │ │ ├── users_helper.rb │ │ └── application_helper.rb │ ├── application_helper.rb │ └── static_pages_helper.rb ├── jobs │ └── application_job.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb └── mailers │ ├── application_mailer.rb │ └── welcome_mailer.rb ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── .rspec ├── spec ├── features │ ├── accessing_admin_home_spec.rb │ ├── admin │ │ ├── deleting_user_spec.rb │ │ ├── editing_a_user_as_admin_spec.rb │ │ ├── adding_a_new_skill_spec.rb │ │ ├── viewing_admin_homepage_spec.rb │ │ └── viewing_users_spec.rb │ ├── user_profile_page_spec.rb │ ├── edit_user_profile_page_spec.rb │ ├── signing_up_spec.rb │ └── logged_in_user_spec.rb ├── support │ ├── factory_girl.rb │ └── database_cleaner.rb ├── controllers │ ├── users_controller_spec.rb │ ├── admin │ │ ├── users_controller_spec.rb │ │ ├── skills_controller_spec.rb │ │ └── application_controller_spec.rb │ └── static_pages_controller_spec.rb ├── views │ ├── admin │ │ ├── users │ │ │ └── index.html.erb_spec.rb │ │ └── application │ │ │ └── index.html.erb_spec.rb │ └── static_pages │ │ └── home.html.erb_spec.rb ├── models │ ├── skill_spec.rb │ └── user_spec.rb ├── mailers │ ├── previews │ │ └── welcome_mailer_preview.rb │ └── welcome_mailer_spec.rb ├── factories │ └── user.rb ├── helpers │ ├── users_helper_spec.rb │ ├── admin │ │ ├── users_helper_spec.rb │ │ ├── skills_helper_spec.rb │ │ └── application_helper_spec.rb │ └── static_pages_helper_spec.rb ├── rails_helper.rb └── spec_helper.rb ├── bin ├── bundle ├── rake ├── rails ├── spring ├── update └── setup ├── config ├── spring.rb ├── boot.rb ├── environment.rb ├── cable.yml ├── initializers │ ├── session_store.rb │ ├── mime_types.rb │ ├── application_controller_renderer.rb │ ├── filter_parameter_logging.rb │ ├── cookies_serializer.rb │ ├── backtrace_silencers.rb │ ├── assets.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ ├── new_framework_defaults.rb │ └── devise.rb ├── routes.rb ├── locales │ ├── en.yml │ └── devise.en.yml ├── application.rb ├── secrets.yml ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb ├── puma.rb └── database.yml ├── config.ru ├── db ├── migrate │ ├── 20170325185436_add_admin_to_users.rb │ ├── 20170809030459_add_country_code_to_users.rb │ ├── 20170516015252_create_skills.rb │ ├── 20170413093153_add_username_to_users.rb │ └── 20170310033200_devise_create_users.rb ├── seeds.rb └── schema.rb ├── Rakefile ├── .gitignore ├── Gemfile ├── README.md ├── mission_statement.md └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.4.0 2 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/admin/skills_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::SkillsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/admin/users_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/static_pages_helper.rb: -------------------------------------------------------------------------------- 1 | module StaticPagesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/admin/application_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/views/admin/skills/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= @skills.each do |skill| %> 2 | <%= skill %> 3 | <% end %> -------------------------------------------------------------------------------- /spec/features/accessing_admin_home_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.feature "Being able to" -------------------------------------------------------------------------------- /spec/support/factory_girl.rb: -------------------------------------------------------------------------------- 1 | RSpec.configure do |config| 2 | config.include FactoryGirl::Syntax::Methods 3 | end 4 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/controllers/static_pages_controller.rb: -------------------------------------------------------------------------------- 1 | class StaticPagesController < ApplicationController 2 | def home 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/models/skill.rb: -------------------------------------------------------------------------------- 1 | class Skill < ApplicationRecord 2 | 3 | validates :name, presence: true, uniqueness: {case_sensitive: false} 4 | end 5 | -------------------------------------------------------------------------------- /spec/controllers/users_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe UsersController, type: :controller do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | @import 'bootstrap-sprockets'; 2 | @import 'bootstrap'; 3 | @import 'font-awesome'; 4 | @import "custom.scss"; 5 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /spec/controllers/admin/users_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Admin::UsersController, type: :controller do 4 | 5 | 6 | end 7 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | 2 | //= require jquery 3 | //= require jquery_ujs 4 | //= require bootstrap-sprockets 5 | //= require turbolinks 6 | //= require_tree . 7 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: redis://localhost:6379/1 10 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_code_connection_session' 4 | -------------------------------------------------------------------------------- /db/migrate/20170325185436_add_admin_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAdminToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :admin, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20170809030459_add_country_code_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddCountryCodeToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :country_code, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /spec/views/admin/users/index.html.erb_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe "users/index.html.erb", type: :view do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/views/static_pages/home.html.erb_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe "static_pages/home.html.erb", type: :view do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/skill_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Skill, type: :model do 4 | it {should validate_presence_of(:name)} 5 | it {should validate_uniqueness_of(:name).case_insensitive} 6 | end 7 | -------------------------------------------------------------------------------- /spec/views/admin/application/index.html.erb_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe "application/index.html.erb", type: :view do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /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: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 | Profile page of <%= @user.username %> 2 | 3 | <%= @user.country_name %> 4 | <% if current_user.id == @user.id %> 5 | <%= link_to "Edit Your Profile", edit_user_path(@user) %> 6 | <% end %> -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/users.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/users controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/skills.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/skills controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/static_pages.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the StaticPages controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /db/migrate/20170516015252_create_skills.rb: -------------------------------------------------------------------------------- 1 | class CreateSkills < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :skills do |t| 4 | t.string :name 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/application.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/application controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/views/static_pages/home.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Welcome to Code Connection

5 |
6 |
7 |
8 |
9 | -------------------------------------------------------------------------------- /app/assets/javascripts/users.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/javascripts/admin/skills.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/admin/users.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/static_pages.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/admin/application.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/views/users/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit Your Profile - <%= @user.username %>

2 | <%= form_for(@user) do |f| %> 3 | 4 | <%= f.label :country_code, "Select Country" %> 5 | <%= f.country_select :country_code %> 6 | 7 | <%= f.submit "Update Profile" %> 8 | <% end %> -------------------------------------------------------------------------------- /spec/mailers/previews/welcome_mailer_preview.rb: -------------------------------------------------------------------------------- 1 | # Preview all emails at http://localhost:3000/rails/mailers/welcome_mailer 2 | class WelcomeMailerPreview < ActionMailer::Preview 3 | def welcome_email 4 | WelcomeMailer.welcome_email(User.first) 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/factories/user.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :user do 3 | sequence(:email) {|n| "test#{n}@email.com"} 4 | password "Password" 5 | sequence(:username) {|n| "user_name#{n}"} 6 | 7 | trait :admin do 8 | admin true 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /app/mailers/welcome_mailer.rb: -------------------------------------------------------------------------------- 1 | class WelcomeMailer < ApplicationMailer 2 | default from: 'notifications@example.com' 3 | 4 | def welcome_email(user) 5 | @user = user 6 | @url = 'http://example.com/login' 7 | mail(to: @user.email, subject: 'Welcome to Code Connection') 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/views/devise/mailer/password_change.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Hello <%= @resource.email %>!

5 | 6 |

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

7 | 8 |
9 |
10 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /app/views/admin/skills/new.html.erb: -------------------------------------------------------------------------------- 1 | <% if @skill.errors.any? %> 2 | <% @skill.errors.full_messages.each do |msg| %> 3 | <%= msg %> 4 | <% end %> 5 | <% end %> 6 | <%= form_for [:admin, @skill] do |f| %> 7 | <%= f.label :name %> 8 | <%= f.text_field :name %> 9 | 10 | <%= f.submit "Add Skill" %> 11 | <% end %> -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/controllers/static_pages_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe StaticPagesController, type: :controller do 4 | 5 | describe "GET #home" do 6 | it "returns http success" do 7 | get :home 8 | expect(response).to have_http_status(:success) 9 | end 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /app/views/admin/application/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Code Connection Admin Home Page

5 |
6 |
7 | 8 |

Admin Links

9 | 12 |
13 |
-------------------------------------------------------------------------------- /db/migrate/20170413093153_add_username_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddUsernameToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | enable_extension 'citext' 4 | 5 | # Using citext to make username unique constraint and search case-insensitive 6 | add_column :users, :username, :citext 7 | add_index :users, :username, unique: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | before_action :configure_permitted_parameters, if: :devise_controller? 4 | 5 | private 6 | 7 | def configure_permitted_parameters 8 | devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :username]) 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /app/controllers/admin/application_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::ApplicationController < ApplicationController 2 | 3 | before_action :check_user 4 | 5 | def index 6 | 7 | end 8 | 9 | private 10 | 11 | def check_user 12 | authenticate_user! 13 | 14 | if !current_user.admin? 15 | redirect_to root_path, alert: "You do not have access to that page!" 16 | end 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Welcome <%= @email %>!

5 | 6 |

You can confirm your account email through the link below:

7 | 8 |

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

9 | 10 |
11 |
12 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | namespace :admin do 3 | root 'application#index' 4 | resources :skills 5 | resources :users 6 | end 7 | 8 | root 'static_pages#home' 9 | 10 | devise_for :users 11 | 12 | resources :users, only: [:show, :edit, :update] 13 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 14 | end 15 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the rails generate channel command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Hello <%= @resource.email %>!

5 | 6 |

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

7 | 8 |

Click the link below to unlock your account:

9 | 10 |

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

11 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /app/views/admin/users/index.html.erb: -------------------------------------------------------------------------------- 1 |

List of Users

2 | 15 | -------------------------------------------------------------------------------- /spec/helpers/users_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the UsersHelper. For example: 5 | # 6 | # describe UsersHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe UsersHelper, type: :helper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/custom.scss: -------------------------------------------------------------------------------- 1 | .title { 2 | text-align: center; 3 | font-size: 60px; 4 | font-weight: bold; 5 | font-family:'Kranky', cursive; 6 | 7 | } 8 | 9 | .headline { 10 | margin-top: 155px; 11 | font-family: 'Luckiest Guy', cursive; 12 | } 13 | 14 | .navbar-default.navbar-static-top { 15 | background: none; 16 | font-weight: bold; 17 | font-size: 20px; 18 | margin-bottom: 10px; 19 | font-family: 'Kranky', cursive; 20 | } 21 | 22 | #icon { 23 | height:40px; 24 | margin-top: -10px; 25 | } 26 | -------------------------------------------------------------------------------- /.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 Byebug command history file. 17 | .byebug_history 18 | -------------------------------------------------------------------------------- /spec/helpers/admin/users_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::UsersHelper. For example: 5 | # 6 | # describe Admin::UsersHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe Admin::UsersHelper, type: :helper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/static_pages_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the StaticPagesHelper. For example: 5 | # 6 | # describe StaticPagesHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe StaticPagesHelper, type: :helper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /spec/helpers/admin/skills_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::SkillsHelper. For example: 5 | # 6 | # describe Admin::SkillsHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe Admin::SkillsHelper, type: :helper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/admin/application_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::ApplicationHelper. For example: 5 | # 6 | # describe Admin::ApplicationHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # expect(helper.concat_strings("this","that")).to eq("this that") 10 | # end 11 | # end 12 | # end 13 | RSpec.describe Admin::ApplicationHelper, type: :helper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /app/views/admin/users/edit.html.erb: -------------------------------------------------------------------------------- 1 | <% if @user.errors.any? %> 2 | <% @user.errors.full_messages.each do |msg| %> 3 | <%= msg %> 4 | <% end %> 5 | <% end %> 6 | 7 | <%= form_for [:admin, @user] do |f| %> 8 | 9 |
10 | <%= f.email_field :email, autofocus: true, :class => 'form-control', :placeholder => 'Email' %> 11 |
12 | 13 |
14 | <%= f.text_field :username, :class => 'form-control', :placeholder => 'Username' %> 15 |
16 | 17 |
18 | <%= f.submit "Update User" %> 19 |
20 | <% end %> -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" } 12 | if spring 13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 14 | gem 'spring', spring.version 15 | require 'spring/binstub' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/controllers/admin/skills_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::SkillsController < Admin::ApplicationController 2 | 3 | def index 4 | @skills = Skill.all 5 | end 6 | 7 | def new 8 | @skill = Skill.new 9 | end 10 | 11 | def create 12 | @skill = Skill.new(skills_params) 13 | if @skill.save 14 | flash[:success] = "The skill was added" 15 | redirect_to admin_skills_path 16 | else 17 | flash[:warning] = "The skill was not added" 18 | render 'new' 19 | end 20 | end 21 | 22 | private 23 | def skills_params 24 | params.require(:skill).permit(:name) 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /spec/controllers/admin/skills_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Admin::SkillsController, type: :controller do 4 | let(:user) {create(:user)} 5 | 6 | before do 7 | allow(controller).to receive(:current_user).and_return(user) 8 | allow(controller).to receive(:authenticate_user!) 9 | end 10 | 11 | context "Users who are not admins" do 12 | it "are not able to access the admin root path (admin#index)" do 13 | get :index 14 | expect(response).to redirect_to "/" 15 | expect(flash[:alert]).to eq "You do not have access to that page!" 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Hello <%= @resource.email %>!

5 | 6 |

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

7 | 8 |

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

9 | 10 |

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

11 |

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

12 | 13 |
14 |
15 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Forgot your password?

5 | 6 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 7 | <%= devise_error_messages! %> 8 | 9 |
10 | <%= f.email_field :email, autofocus: true, :class => "form-control", :placeholder => "Email" %> 11 |
12 | 13 | <%= f.submit "Send me reset password instructions", :class => "btn btn-danger" %> 14 | <% end %> 15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /spec/features/admin/deleting_user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.feature "Deleting a User" do 4 | 5 | let(:admin) {create(:user, admin: true)} 6 | let!(:user) {create(:user)} 7 | let!(:user2) {create(:user)} 8 | 9 | before do 10 | login_as(admin) 11 | visit admin_users_path 12 | end 13 | 14 | scenario "Works Properly" do 15 | 16 | within("div##{user.id}") do 17 | click_link "Delete User" 18 | end 19 | 20 | expect(page).to have_content "User Successfully Deleted!" 21 | expect(page).to have_content user2.username 22 | expect(page).to_not have_content user.username 23 | end 24 | end -------------------------------------------------------------------------------- /spec/controllers/admin/application_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Admin::ApplicationController, type: :controller do 4 | let(:user) {create(:user)} 5 | 6 | before do 7 | allow(controller).to receive(:current_user).and_return(user) 8 | allow(controller).to receive(:authenticate_user!) 9 | end 10 | 11 | context "Users who are not admins" do 12 | it "are not able to access the admin root path (admin#index)" do 13 | get :index 14 | expect(response).to redirect_to "/" 15 | expect(flash[:alert]).to eq "You do not have access to that page!" 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | 3 | def show 4 | @user = User.find(params[:id]) 5 | end 6 | 7 | def edit 8 | if current_user.id == params[:id].to_i 9 | @user = User.find(params[:id]) 10 | else 11 | flash[:danger] = "You don't have access to that page" 12 | redirect_to root_path 13 | end 14 | end 15 | 16 | def update 17 | @user = User.find(params[:id]) 18 | @user.update_attributes(user_params) 19 | flash[:success] = "Your profile has been updated" 20 | redirect_to @user 21 | end 22 | 23 | private 24 | 25 | def user_params 26 | params.require(:user).permit(:country_code) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Resend unlock instructions

5 | 6 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 7 | <%= devise_error_messages! %> 8 | 9 |
10 | <%= f.label :email %>
11 | <%= f.email_field :email, autofocus: true %> 12 |
13 | 14 |
15 | <%= f.submit "Resend unlock instructions" %> 16 |
17 | <% end %> 18 | 19 | <%= render "devise/shared/links" %> 20 | 21 |
22 |
23 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /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 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeConnection 5 | <%= csrf_meta_tags %> 6 | 7 | 8 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 9 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 10 | 11 | 12 | 13 | <% flash.each do |type, value| %> 14 | <%= value %> 15 | <% end %> 16 | <%= render 'shared/navbar' %> 17 | 18 | 19 |
20 | <%= yield %> 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Resend confirmation instructions

5 | 6 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 7 | <%= devise_error_messages! %> 8 | 9 |
10 | <%= f.label :email %>
11 | <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> 12 |
13 | 14 |
15 | <%= f.submit "Resend confirmation instructions" %> 16 |
17 | <% end %> 18 | 19 | <%= render "devise/shared/links" %> 20 |
21 |
22 | -------------------------------------------------------------------------------- /spec/features/user_profile_page_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | RSpec.feature "The User Profile Page" do 4 | 5 | let!(:user) {FactoryGirl.create(:user)} 6 | let!(:user2) {FactoryGirl.create(:user)} 7 | 8 | context "Logged in as the right user" do 9 | 10 | before {login_as(user)} 11 | 12 | scenario "can be viewed" do 13 | 14 | visit user_path(user) 15 | 16 | expect(page).to have_content("Profile page of #{user.username}") 17 | expect(page).to have_link("Edit Your Profile") 18 | end 19 | end 20 | 21 | context "Logged in as another user" do 22 | 23 | before {login_as(user2)} 24 | 25 | scenario "can not view edit link" do 26 | 27 | visit user_path(user) 28 | expect(page).to have_content("Profile page of #{user.username}") 29 | expect(page).to_not have_link("Edit Your Profile") 30 | end 31 | end 32 | end -------------------------------------------------------------------------------- /app/controllers/admin/users_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::UsersController < Admin::ApplicationController 2 | 3 | before_action :get_user, only: [:edit, :destroy, :update] 4 | 5 | def index 6 | @users = User.all 7 | end 8 | 9 | def edit 10 | end 11 | 12 | def destroy 13 | @user.destroy 14 | flash[:success] = "User Successfully Deleted!" 15 | redirect_to admin_users_path 16 | end 17 | 18 | def update 19 | if @user.update(user_params) 20 | flash[:success] = "User Successfully Updated!" 21 | redirect_to admin_root_path 22 | else 23 | flash[:warning] = "User Not Updated" 24 | render "edit" 25 | end 26 | end 27 | 28 | private 29 | 30 | def user_params 31 | params.require(:user).permit(:email, :username) 32 | end 33 | 34 | def get_user 35 | @user = User.find(params[:id]) 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Change your password

5 | 6 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 7 | <%= devise_error_messages! %> 8 | <%= f.hidden_field :reset_password_token %> 9 | 10 |
11 | <%= f.password_field :password, autofocus: true, autocomplete: "off", :class => "form-control", :placeholder => "New Password" %> 12 |
13 | 14 |
15 | <%= f.password_field :password_confirmation, autocomplete: "off", :class => "form-control", :placeholder => "Confirm New Password" %> 16 |
17 | 18 | <%= f.submit "Change my password", :class => "btn btn-danger" %> 19 | <% end %> 20 | 21 |
22 |
23 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require "rails" 4 | # Pick the frameworks you want: 5 | require "active_model/railtie" 6 | require "active_job/railtie" 7 | require "active_record/railtie" 8 | require "action_controller/railtie" 9 | require "action_mailer/railtie" 10 | require "action_view/railtie" 11 | require "action_cable/engine" 12 | require "sprockets/railtie" 13 | # require "rails/test_unit/railtie" 14 | 15 | # Require the gems listed in Gemfile, including any gems 16 | # you've limited to :test, :development, or :production. 17 | Bundler.require(*Rails.groups) 18 | 19 | module CodeConnection 20 | class Application < Rails::Application 21 | # Settings in config/environments/* take precedence over those specified here. 22 | # Application configuration should go into files in config/initializers 23 | # -- all .rb files in that directory are automatically loaded. 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/features/admin/editing_a_user_as_admin_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | RSpec.feature "Admin editing of a user" do 4 | 5 | let(:admin) {create(:user, admin: true)} 6 | let!(:user) {create(:user)} 7 | let!(:user2) {create(:user)} 8 | 9 | before do 10 | login_as(admin) 11 | visit admin_users_path 12 | within("div##{user2.id}") do 13 | click_link "Edit User" 14 | end 15 | end 16 | 17 | scenario "works properly" do 18 | fill_in "user[username]", with: "NewUserName" 19 | 20 | click_button "Update User" 21 | 22 | expect(page).to have_content("User Successfully Updated") 23 | expect(current_url).to eq admin_root_url 24 | end 25 | 26 | scenario "errors properly when necessary" do 27 | fill_in "user[username]", with: user.username 28 | 29 | click_button "Update User" 30 | 31 | expect(page).to have_content("User Not Updated") 32 | expect(page).to have_content("Username has already been taken") 33 | end 34 | 35 | 36 | end -------------------------------------------------------------------------------- /spec/features/admin/adding_a_new_skill_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.feature "Adding a new skill" do 4 | 5 | let(:admin) {create(:user, admin: true)} 6 | 7 | before do 8 | login_as(admin) 9 | visit new_admin_skill_path 10 | end 11 | 12 | scenario "Creating a new skill" do 13 | 14 | fill_in "skill[name]", with: "Ruby on Rails" 15 | 16 | click_button "Add Skill" 17 | 18 | expect(page).to have_content("The skill was added") 19 | expect(page).to have_content("Ruby on Rails") 20 | end 21 | 22 | scenario "Submitting a blank name" do 23 | 24 | click_button "Add Skill" 25 | 26 | expect(page).to have_content("The skill was not added") 27 | expect(page).to have_content("Name can't be blank") 28 | end 29 | 30 | scenario "Submitting a name that already exists" do 31 | Skill.create(name: "PyTHon") 32 | 33 | fill_in "skill[name]", with: "pytHON" 34 | click_button "Add Skill" 35 | expect(page).to have_content("The skill was not added") 36 | expect(page).to have_content("Name has already been taken") 37 | end 38 | end -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: ae302ca981c056b859b36e9df72fbe2791585f66c10c27a8ca5463ff560a29a312517eebf07c91810f2b42ba2f81f5fdef02226a89fb49c03ffb0e400c8e20cd 15 | 16 | test: 17 | secret_key_base: d6137e436924ad78003a6a8963228d073a08d8ff0ca0704cd4900080749b3bbeb02ec35980190f90a28c7f358ef90338cad0f30ab2a7b18e9d785e95d65c8589 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # puts "\n== Copying sample files ==" 22 | # unless File.exist?('config/database.yml') 23 | # cp 'config/database.yml.sample', 'config/database.yml' 24 | # end 25 | 26 | puts "\n== Preparing database ==" 27 | system! 'bin/rails db:setup' 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! 'bin/rails log:clear tmp:clear' 31 | 32 | puts "\n== Restarting application server ==" 33 | system! 'bin/rails restart' 34 | end 35 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Log In

5 | 6 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 7 | <%= devise_error_messages! %> 8 | 9 |
10 | <%= f.text_field :login, :class => 'form-control', :placeholder => 'Email or Username' %> 11 |
12 | 13 |
14 | <%= f.password_field :password, :class => 'form-control', :placeholder => 'Password', autocomplete: "off" %> 15 |
16 | 17 | <% if devise_mapping.rememberable? %> 18 |
19 | <%= f.check_box :remember_me %> Remember Me 20 |
21 | <% end %> 22 | 23 |
24 | <%= f.submit "Log In", :class => "btn btn-primary" %> 25 | <%= link_to "Forgot Password", new_user_password_path, :class => "btn btn-primary" %> 26 |
27 | <% end %> 28 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /spec/features/admin/viewing_admin_homepage_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.feature "Testing Access to the admin homepage" do 4 | 5 | let!(:user) {FactoryGirl.create(:user)} 6 | let!(:admin) {FactoryGirl.create(:user, admin: true)} 7 | 8 | context "when logged in as the user" do 9 | 10 | before {login_as(user)} 11 | 12 | scenario "Can't visit the admin homepage" do 13 | 14 | visit admin_root_path 15 | 16 | expect(current_path).to eq root_path 17 | expect(page).to have_content("You do not have access to that page!") 18 | end 19 | end 20 | 21 | context "When logged in as the admin" do 22 | 23 | before {login_as(admin)} 24 | 25 | scenario "Can access the home page" do 26 | 27 | visit admin_root_path 28 | 29 | expect(current_path).to eq admin_root_path 30 | expect(page).to_not have_content("You do not have access to that page!") 31 | end 32 | end 33 | 34 | context "When not logged in at all" do 35 | 36 | scenario "Gets sent to the sign in page" do 37 | 38 | visit admin_root_path 39 | 40 | expect(current_path).to eq new_user_session_path 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :database_authenticatable, :registerable, 5 | :recoverable, :rememberable, :trackable, :validatable 6 | 7 | attr_accessor :login 8 | 9 | after_create :send_welcome_email 10 | 11 | validates :username, presence: true, uniqueness: { case_sensitive: false }, 12 | format: { with: /\A[a-zA-Z0-9_\.]*\z/ }, 13 | length: { minimum: 6, allow_blank: true } 14 | 15 | def country_name 16 | country = ISO3166::Country[country_code] 17 | country.translations[I18n.locale.to_s] || country.name 18 | end 19 | 20 | private 21 | 22 | def send_welcome_email 23 | WelcomeMailer.welcome_email(self).deliver 24 | end 25 | 26 | def self.find_for_database_authentication(warden_conditions) 27 | conditions = warden_conditions.dup 28 | if login = conditions.delete(:login) 29 | query = 'lower(username) = :value OR lower(email) = :value' 30 | where(conditions.to_h).where(query, { value: login.downcase }).first 31 | end 32 | end 33 | 34 | 35 | end 36 | -------------------------------------------------------------------------------- /spec/mailers/welcome_mailer_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | require "rails_helper" 3 | 4 | RSpec.describe WelcomeMailer, type: :mailer do 5 | 6 | describe "welcome_email" do 7 | let(:user) {FactoryGirl.create(:user)} 8 | let(:mail) { WelcomeMailer.welcome_email(user) } 9 | 10 | it "should have the correct subject" do 11 | expect(mail).to have_subject('Welcome to Code Connection') 12 | end 13 | 14 | it "sends from the default email" do 15 | expect(mail).to be_delivered_from('notifications@example.com') 16 | end 17 | 18 | it "delivers to the email passed in" do 19 | expect(mail).to deliver_to(user.email) 20 | end 21 | 22 | it "should have the text 'Welcome to Code Connection' in the body" do 23 | expect(mail).to have_body_text('Welcome to Code Connection') 24 | end 25 | 26 | it "should have the text 'You have successfully signed up to codeconnection.com' in the body"do 27 | expect(mail).to have_body_text('You have successfully signed up to codeconnection.com') 28 | end 29 | 30 | it "should have a link to the home page" do 31 | expect(mail).to have_body_text(root_url) 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /spec/features/edit_user_profile_page_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.feature "Edting a users profile" do 4 | 5 | let(:user) {FactoryGirl.create(:user)} 6 | let(:user2) {FactoryGirl.create(:user)} 7 | 8 | context "Logged in as the proper user" do 9 | 10 | before do 11 | login_as(user) 12 | visit edit_user_path(user) 13 | end 14 | 15 | scenario "can access the edit page" do 16 | visit edit_user_path(user) 17 | expect(page).to have_content("Edit Your Profile - #{user.username}") 18 | end 19 | 20 | scenario "can change their country location" do 21 | find("select#user_country_code").find("option[value='US']").select_option 22 | click_button "Update Profile" 23 | expect(page).to have_content("Your profile has been updated") 24 | expect(page).to have_content("United States") 25 | end 26 | end 27 | 28 | context "Logged in as the improper user" do 29 | before {login_as(user2)} 30 | 31 | scenario "can not acess the users edit page" do 32 | 33 | visit edit_user_path(user) 34 | 35 | expect(page).to have_content("You don't have access to that page") 36 | expect(page).to_not have_content(user.username) 37 | expect(current_path).to eq root_path 38 | end 39 | end 40 | end -------------------------------------------------------------------------------- /config/initializers/new_framework_defaults.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains migration options to ease your Rails 5.0 upgrade. 4 | # 5 | # Read the Guide for Upgrading Ruby on Rails for more info on each option. 6 | 7 | # Enable per-form CSRF tokens. Previous versions had false. 8 | Rails.application.config.action_controller.per_form_csrf_tokens = true 9 | 10 | # Enable origin-checking CSRF mitigation. Previous versions had false. 11 | Rails.application.config.action_controller.forgery_protection_origin_check = true 12 | 13 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. 14 | # Previous versions had false. 15 | ActiveSupport.to_time_preserves_timezone = true 16 | 17 | # Require `belongs_to` associations by default. Previous versions had false. 18 | Rails.application.config.active_record.belongs_to_required_by_default = true 19 | 20 | # Do not halt callback chains when a callback returns false. Previous versions had true. 21 | ActiveSupport.halt_callback_chains_on_return_false = false 22 | 23 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false. 24 | Rails.application.config.ssl_options = { hsts: { subdomains: true } } 25 | -------------------------------------------------------------------------------- /spec/features/admin/viewing_users_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | RSpec.feature "Viewing the Users Index" do 4 | 5 | let(:admin) {create(:user, admin: true)} 6 | let!(:user) {create(:user)} 7 | let!(:admin2) {create(:user, admin: true)} 8 | 9 | before do 10 | login_as(admin) 11 | visit admin_root_path 12 | click_link "Users Index" 13 | end 14 | 15 | scenario "From the admin root page" do 16 | 17 | visit admin_root_path 18 | 19 | click_link "Users Index" 20 | expect(current_path).to eq admin_users_path 21 | expect(page).to have_content("List of Users") 22 | expect(page).to have_content(user.username) 23 | expect(page).to have_content(admin.username) 24 | end 25 | 26 | scenario "THere is a delete link for non admin users" do 27 | 28 | within("div##{user.id}") do 29 | expect(page).to have_link "Delete User" 30 | end 31 | end 32 | 33 | scenario "There is not a delete link for logged in admin user" do 34 | 35 | within("div##{admin.id}") do 36 | expect(page).to_not have_content("Delete User") 37 | end 38 | end 39 | 40 | scenario "There is not a delete link for not logged in admin user" do 41 | 42 | within("div##{admin2.id}") do 43 | expect(page).to_not have_content("Delete User") 44 | end 45 | end 46 | end 47 | 48 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%> 25 | <% end -%> 26 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

Sign Up

5 | 6 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 7 | <%= devise_error_messages! %> 8 | 9 |
10 | <%= f.email_field :email, autofocus: true, :class => 'form-control', :placeholder => 'Email' %> 11 |
12 | 13 |
14 | <%= f.text_field :username, :class => 'form-control', :placeholder => 'Username' %> 15 |
16 | 17 |
18 | <% if @validatable %> 19 | (<%= @minimum_password_length %> characters minimum) 20 | <% end %>
21 | <%= f.password_field :password, autocomplete: "off", :class => 'form-control', :placeholder => 'Password' %> 22 |
23 | 24 |
25 | <%= f.password_field :password_confirmation, autocomplete: "off", :class => 'form-control', :placeholder => 'Confirm Password' %> 26 |
27 | 28 |
29 | <%= f.submit "Sign up", :class => "btn btn-primary" %> 30 |
31 | <% end %> 32 | 33 | <%= render "devise/shared/links" %> 34 |
35 |
36 | -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe User, type: :model do 4 | it {should validate_presence_of(:email)} 5 | it {should validate_presence_of(:username)} 6 | 7 | describe "Admin default value should be false" do 8 | 9 | let(:user) {User.new} 10 | 11 | it "should have a default admin of false" do 12 | expect(user.admin).to eq false 13 | end 14 | end 15 | 16 | describe "Username validation" do 17 | let!(:existing_user) { create(:user, username: 'user_1') } 18 | let(:user) { build(:user, email: 'u@u.com') } 19 | 20 | it "should be unique" do 21 | user.username = 'unique_user' 22 | expect(user).to be_valid 23 | end 24 | 25 | it "should be invalid when username exists" do 26 | user.username = 'user_1' 27 | expect(user).not_to be_valid 28 | end 29 | 30 | it "should be case insensitive" do 31 | user.username = 'USER_1' 32 | expect(user).not_to be_valid 33 | end 34 | 35 | it "should consist of letters, numbers and underscores" do 36 | user.username = 'user name' 37 | expect(user).not_to be_valid 38 | 39 | user.username = 'user$name' 40 | expect(user).not_to be_valid 41 | end 42 | 43 | it "should be at least 6 characters" do 44 | user.username = 'user' 45 | expect(user).not_to be_valid 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /app/views/welcome_mailer/welcome_email.text.erb: -------------------------------------------------------------------------------- 1 | Welcome to Code Connection, 2 | 3 | =============================================== 4 | 5 | You have successfully signed up to codeconnection.com, 6 | your username is: 7 | 8 | 9 | To login to the site, just follow this link: <%=@url%> 10 | 11 | But first, let me tell you a little bit more about Code Connection: 12 | 13 | The idea behind Code Connection came to life during one of the weekly Twitter chats hosted by <%= link_to "CodeNewbie.org", "http://www.codenewbie.org/", :target => "_blank" %>. 14 | 15 | It is well known about the importance of pair programming and code reviews while coding, especially for those who are just starting to code. However, sometimes, it's quite difficult to find someone to code with. Our mission is to create a safe environment where people can connect through code, exchange ideas, find people to work with, etc. 16 | 17 | So... How does Code Connection work? Well, it is fairly easy, you only have to create a user profile where you specify your coding skills and your specific needs (Whether you are looking for someone to work with on specific projects or if you are looking to share your knowledge with others by becoming a mentor, etc.) 18 | 19 | We can't wait to hear from you! 20 | 21 | So <%= link_to "Lets get started", root_url %> 22 | 23 | Have a great day! 24 | 25 | Code Connection team. 26 | -------------------------------------------------------------------------------- /db/migrate/20170310033200_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :users do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.inet :current_sign_in_ip 20 | t.inet :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | 34 | t.timestamps null: false 35 | end 36 | 37 | add_index :users, :email, unique: true 38 | add_index :users, :reset_password_token, unique: true 39 | # add_index :users, :confirmation_token, unique: true 40 | # add_index :users, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /app/views/shared/_navbar.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 34 | -------------------------------------------------------------------------------- /spec/features/signing_up_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.feature "Testing the Sign Up Function of Devise" do 4 | 5 | before {visit new_user_registration_path} 6 | 7 | context "with a unique email address" do 8 | 9 | scenario "successfully signs up" do 10 | 11 | fill_in "user[email]", with: "test@example.com" 12 | fill_in "user[username]", with: "test_user" 13 | fill_in "user[password]", with: "password" 14 | fill_in "user[password_confirmation]", with: "password" 15 | 16 | click_button "Sign up" 17 | 18 | expect(page).to have_content("You have signed up successfully") 19 | expect(current_url).to eq root_url 20 | end 21 | end 22 | 23 | context "with already exiisting user information" do 24 | let!(:user) {FactoryGirl.create(:user)} 25 | 26 | scenario "fails the sign up without a unique email" do 27 | 28 | fill_in "user[email]", with: user.email 29 | fill_in "user[password]", with: "password" 30 | fill_in "user[password_confirmation]", with: "password" 31 | 32 | click_button "Sign up" 33 | 34 | expect(page).to have_content("Email has already been taken") 35 | expect(current_url).to_not eq root_url 36 | end 37 | 38 | scenario "fails the sign up without a unique username" do 39 | 40 | fill_in "user[email]", with: "totally_random@exampleworld.com" 41 | fill_in "user[username]", with: user.username 42 | fill_in "user[password]", with: "password" 43 | fill_in "user[password_confirmation]", with: "password" 44 | 45 | click_button "Sign up" 46 | 47 | expect(page).to have_content("Username has already been taken") 48 | expect(current_url).to_not eq root_url 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /spec/features/logged_in_user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.feature "Home Page Display" do 4 | 5 | let!(:user) { create(:user) } 6 | let!(:admin) { create(:user, :admin)} 7 | 8 | scenario "Displays properly for non logged in users" do 9 | 10 | visit root_path 11 | expect(page).to have_content("Log In") 12 | expect(page).to have_content("Sign Up") 13 | end 14 | 15 | scenario "Displays properly for logged in user" do 16 | login_as(user) 17 | visit root_path 18 | 19 | expect(page).to_not have_content("Log In") 20 | expect(page).to_not have_content("Sign Up") 21 | expect(page).to have_content("Log out") 22 | expect(page).to have_content(user.username) 23 | expect(page).to_not have_content "Admin Home" 24 | end 25 | 26 | scenario "User logs in using email" do 27 | visit new_user_session_path 28 | 29 | fill_in "user[login]", with: user.email 30 | fill_in "user[password]", with: 'Password' 31 | click_button "Log In" 32 | 33 | expect(page).to have_content("Log out") 34 | end 35 | 36 | scenario "User logs in using username" do 37 | visit new_user_session_path 38 | 39 | fill_in "user[login]", with: user.username 40 | fill_in "user[password]", with: 'Password' 41 | click_button "Log In" 42 | 43 | expect(page).to have_content("Log out") 44 | end 45 | 46 | scenario "Admin sees link to admin home page" do 47 | visit new_user_session_path 48 | 49 | fill_in "user[login]", with: admin.username 50 | fill_in "user[password]", with: "Password" 51 | click_button "Log In" 52 | 53 | expect(current_url).to eq root_url 54 | expect(page).to have_link "Admin Home" 55 | end 56 | 57 | end 58 | -------------------------------------------------------------------------------- /spec/support/database_cleaner.rb: -------------------------------------------------------------------------------- 1 | RSpec.configure do |config| 2 | 3 | config.use_transactional_fixtures = false 4 | 5 | config.before(:suite) do 6 | if config.use_transactional_fixtures? 7 | raise(<<-MSG) 8 | Delete line `config.use_transactional_fixtures = true` from rails_helper.rb 9 | (or set it to false) to prevent uncommitted transactions being used in 10 | JavaScript-dependent specs. 11 | 12 | During testing, the app-under-test that the browser driver connects to 13 | uses a different database connection to the database connection used by 14 | the spec. The app's database connection would not be able to access 15 | uncommitted transaction data setup over the spec's database connection. 16 | MSG 17 | end 18 | DatabaseCleaner.clean_with(:truncation) 19 | end 20 | 21 | config.before(:each) do 22 | DatabaseCleaner.strategy = :transaction 23 | end 24 | 25 | config.before(:each, type: :feature) do 26 | # :rack_test driver's Rack app under test shares database connection 27 | # with the specs, so continue to use transaction strategy for speed. 28 | driver_shares_db_connection_with_specs = Capybara.current_driver == :rack_test 29 | 30 | if !driver_shares_db_connection_with_specs 31 | # Driver is probably for an external browser with an app 32 | # under test that does *not* share a database connection with the 33 | # specs, so use truncation strategy. 34 | DatabaseCleaner.strategy = :truncation 35 | end 36 | end 37 | 38 | config.before(:each) do 39 | DatabaseCleaner.start 40 | end 41 | 42 | config.append_after(:each) do 43 | DatabaseCleaner.clean 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

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

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Edit Profile

4 | 5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 6 | <%= devise_error_messages! %> 7 | 8 |
9 | <%= f.email_field :email, autofocus: true, :class => 'form-control', :placeholder => "Email" %> 10 |
11 | 12 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 13 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
14 | <% end %> 15 | 16 |
17 | <%= f.password_field :password, autocomplete: "off", :placeholder => "New Password (leave blank if you don't want to change it)", :class => 'form-control' %> 18 |
19 | 20 |
21 | <%= f.password_field :password_confirmation, autocomplete: "off", :class => 'form-control', :placeholder => "Confirm Password" %> 22 |
23 | 24 |
25 | <%= f.password_field :current_password, autocomplete: "off", :placeholder => "Type current password to confirm your change", :class => 'form-control' %> 26 |
27 | 28 |
29 | <%= f.submit "Save", :class => "btn btn-primary" %> 30 |
31 | <% end %> 32 |
33 |

Unhappy?

34 | 35 | <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" },:class => "btn btn-danger", method: :delete %> 36 |
37 |
38 | 39 |
40 | <%= button_to "Back", :back, :class => "btn btn-default", :method => :get %> 41 |
42 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

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

63 |
64 |

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

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

The page you were looking for doesn't exist.

62 |

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

63 |
64 |

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

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /app/views/welcome_mailer/welcome_email.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Welcome to Code Connection

8 | 9 | 10 |

11 | You have successfully signed up to codeconnection.com, 12 | your username is: 13 | 14 |
15 |

16 |

17 | To login to the site, just follow this link:<%= @url %>. 18 |

19 | 20 |

But first, let me tell you a little bit more about Code Connection: 21 | The idea behind Code Connection came to life during one of the weekly Twitter chats hosted by <%= link_to "CodeNewbie.org", "http://www.codenewbie.org/", :target => "_blank" %>.

22 | 23 |

It is well known about the importance of pair programming and code reviews while coding, especially for those who are just starting to code. However, sometimes, it's quite difficult to find someone to code with. Our mission is to create a safe environment where people can connect through code, exchange ideas, find people to work with, etc.

24 | 25 |

So... How does Code Connection work? Well, it is fairly easy, you only have to create a user profile where you specify your coding skills and your specific needs (Whether you are looking for someone to work with on specific projects or if you are looking to share your knowledge with others by becoming a mentor, etc.)

26 |
27 | 28 |

Thanks for joining and have a great day!

29 | 30 | So <%= link_to "Lets get started", root_url %> 31 | 32 |

Code Connection team

33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => 'public, max-age=3600' 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | config.action_mailer.default_url_options = { :host => 'localhost:3000' } 37 | 38 | # Print deprecation notices to the stderr. 39 | config.active_support.deprecation = :stderr 40 | 41 | # Raises error for missing translations 42 | # config.action_view.raise_on_missing_translations = true 43 | end 44 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum, this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. If you use this option 30 | # you need to make sure to reconnect any threads in the `on_worker_boot` 31 | # block. 32 | # 33 | # preload_app! 34 | 35 | # The code in the `on_worker_boot` will be called if you are using 36 | # clustered mode by specifying a number of `workers`. After each worker 37 | # process is booted this block will be run, if you are using `preload_app!` 38 | # option you will want to use this block to reconnect to any threads 39 | # or connections that may have been created at application boot, Ruby 40 | # cannot share connections between processes. 41 | # 42 | # on_worker_boot do 43 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 44 | # end 45 | 46 | # Allow puma to be restarted by `rails restart` command. 47 | plugin :tmp_restart 48 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | if Rails.root.join('tmp/caching-dev.txt').exist? 17 | config.action_controller.perform_caching = true 18 | 19 | config.cache_store = :memory_store 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => 'public, max-age=172800' 22 | } 23 | else 24 | config.action_controller.perform_caching = false 25 | 26 | config.cache_store = :null_store 27 | end 28 | 29 | # Don't care if the mailer can't send. 30 | config.action_mailer.raise_delivery_errors = false 31 | 32 | config.action_mailer.perform_caching = false 33 | 34 | # Print deprecation notices to the Rails logger. 35 | config.active_support.deprecation = :log 36 | 37 | # Raise an error on page load if there are pending migrations. 38 | config.active_record.migration_error = :page_load 39 | 40 | # Debug mode disables concatenation and preprocessing of assets. 41 | # This option may cause significant delays in view rendering with a large 42 | # number of complex assets. 43 | config.assets.debug = true 44 | 45 | # Suppress logger output for asset requests. 46 | config.assets.quiet = true 47 | 48 | # Raises error for missing translations 49 | # config.action_view.raise_on_missing_translations = true 50 | 51 | # Use an evented file watcher to asynchronously detect changes in source code, 52 | # routes, locales, etc. This feature depends on the listen gem. 53 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 54 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 55 | end 56 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 20170809030459) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | enable_extension "citext" 18 | 19 | create_table "skills", force: :cascade do |t| 20 | t.string "name" 21 | t.datetime "created_at", null: false 22 | t.datetime "updated_at", null: false 23 | end 24 | 25 | create_table "users", force: :cascade do |t| 26 | t.string "email", default: "", null: false 27 | t.string "encrypted_password", default: "", null: false 28 | t.string "reset_password_token" 29 | t.datetime "reset_password_sent_at" 30 | t.datetime "remember_created_at" 31 | t.integer "sign_in_count", default: 0, null: false 32 | t.datetime "current_sign_in_at" 33 | t.datetime "last_sign_in_at" 34 | t.inet "current_sign_in_ip" 35 | t.inet "last_sign_in_ip" 36 | t.datetime "created_at", null: false 37 | t.datetime "updated_at", null: false 38 | t.boolean "admin", default: false 39 | t.citext "username" 40 | t.string "country_code" 41 | t.index ["email"], name: "index_users_on_email", unique: true, using: :btree 42 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree 43 | t.index ["username"], name: "index_users_on_username", unique: true, using: :btree 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | ruby '2.4.0' 2 | source 'https://rubygems.org' 3 | 4 | git_source(:github) do |repo_name| 5 | repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 6 | "https://github.com/#{repo_name}.git" 7 | end 8 | 9 | 10 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 11 | gem 'rails', '~> 5.0.1' 12 | # Use postgresql as the database for Active Record 13 | gem 'pg', '~> 0.18' 14 | # Use Puma as the app server 15 | gem 'puma', '~> 3.0' 16 | # Use SCSS for stylesheets 17 | gem 'sass-rails', '~> 5.0' 18 | gem 'bootstrap-sass', '~> 3.3', '>= 3.3.7' 19 | gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.1' 20 | gem 'country_select' 21 | # Use Uglifier as compressor for JavaScript assets 22 | gem 'uglifier', '>= 1.3.0' 23 | # Use CoffeeScript for .coffee assets and views 24 | gem 'coffee-rails', '~> 4.2' 25 | # See https://github.com/rails/execjs#readme for more supported runtimes 26 | # gem 'therubyracer', platforms: :ruby 27 | gem 'devise', '~> 4.2' 28 | 29 | # Use jquery as the JavaScript library 30 | gem 'jquery-rails' 31 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 32 | gem 'turbolinks', '~> 5' 33 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 34 | gem 'jbuilder', '~> 2.5' 35 | # Use Redis adapter to run Action Cable in production 36 | # gem 'redis', '~> 3.0' 37 | # Use ActiveModel has_secure_password 38 | # gem 'bcrypt', '~> 3.1.7' 39 | 40 | # Use Capistrano for deployment 41 | # gem 'capistrano-rails', group: :development 42 | 43 | group :development, :test do 44 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 45 | gem 'byebug', platform: :mri 46 | gem 'rspec-rails', '~> 3.5', '>= 3.5.2' 47 | gem 'pry-rails', '~> 0.3.5' 48 | end 49 | 50 | group :development do 51 | # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 52 | gem 'web-console', '>= 3.3.0' 53 | gem 'listen', '~> 3.0.5' 54 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 55 | gem 'spring' 56 | gem 'spring-watcher-listen', '~> 2.0.0' 57 | end 58 | 59 | group :test do 60 | gem 'capybara', '~> 2.12', '>= 2.12.1' 61 | gem 'factory_girl_rails', '~> 4.8' 62 | gem 'shoulda-matchers', '~> 3.1', '>= 3.1.1' 63 | gem 'database_cleaner' 64 | gem 'email_spec' 65 | end 66 | 67 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 68 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 69 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV['RAILS_ENV'] ||= 'test' 3 | require File.expand_path('../../config/environment', __FILE__) 4 | # Prevent database truncation if the environment is production 5 | abort("The Rails environment is running in production mode!") if Rails.env.production? 6 | require 'spec_helper' 7 | require 'rspec/rails' 8 | # Add additional requires below this line. Rails is not loaded until this point! 9 | 10 | # Requires supporting ruby files with custom matchers and macros, etc, in 11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 12 | # run as spec files by default. This means that files in spec/support that end 13 | # in _spec.rb will both be required and run as specs, causing the specs to be 14 | # run twice. It is recommended that you do not name files matching this glob to 15 | # end with _spec.rb. You can configure this pattern with the --pattern 16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 17 | # 18 | # The following line is provided for convenience purposes. It has the downside 19 | # of increasing the boot-up time by auto-requiring all files in the support 20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 21 | # require only the support files necessary. 22 | # 23 | Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } 24 | 25 | # Checks for pending migration and applies them before tests are run. 26 | # If you are not using ActiveRecord, you can remove this line. 27 | ActiveRecord::Migration.maintain_test_schema! 28 | 29 | RSpec.configure do |config| 30 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 31 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 32 | 33 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 34 | # examples within a transaction, remove the following line or assign false 35 | # instead of true. 36 | config.use_transactional_fixtures = false 37 | 38 | # RSpec Rails can automatically mix in different behaviours to your tests 39 | # based on their file location, for example enabling you to call `get` and 40 | # `post` in specs under `spec/controllers`. 41 | # 42 | # You can disable this behaviour by removing the line below, and instead 43 | # explicitly tag your specs with their type, e.g.: 44 | # 45 | # RSpec.describe UsersController, :type => :controller do 46 | # # ... 47 | # end 48 | # 49 | # The different available types are documented in the features, such as in 50 | # https://relishapp.com/rspec/rspec-rails/docs 51 | config.infer_spec_type_from_file_location! 52 | 53 | # Filter lines from Rails gems in backtraces. 54 | config.filter_rails_from_backtrace! 55 | # arbitrary gems may also be filtered via: 56 | # config.filter_gems_from_backtrace("gem name") 57 | config.include Warden::Test::Helpers, type: :feature 58 | config.after(type: :feature) { Warden.test_reset!} 59 | 60 | config.include(EmailSpec::Helpers) 61 | config.include(EmailSpec::Matchers) 62 | end 63 | 64 | Shoulda::Matchers.configure do |config| 65 | config.integrate do |with| 66 | with.test_framework :rspec 67 | with.library :rails 68 | end 69 | end -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.1 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see rails configuration guide 21 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: code_connection_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: code_connection 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: code_connection_test 61 | 62 | # As with config/secrets.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: code_connection_production 84 | username: code_connection 85 | password: <%= ENV['CODE_CONNECTION_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Disable serving static files from the `/public` folder by default since 18 | # Apache or NGINX already handles this. 19 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 20 | 21 | # Compress JavaScripts and CSS. 22 | config.assets.js_compressor = :uglifier 23 | # config.assets.css_compressor = :sass 24 | 25 | # Do not fallback to assets pipeline if a precompiled asset is missed. 26 | config.assets.compile = false 27 | 28 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 29 | 30 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 31 | # config.action_controller.asset_host = 'http://assets.example.com' 32 | 33 | # Specifies the header that your server uses for sending files. 34 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 35 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 36 | 37 | # Mount Action Cable outside main process or domain 38 | # config.action_cable.mount_path = nil 39 | # config.action_cable.url = 'wss://example.com/cable' 40 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 41 | 42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 43 | # config.force_ssl = true 44 | 45 | # Use the lowest log level to ensure availability of diagnostic information 46 | # when problems arise. 47 | config.log_level = :debug 48 | 49 | # Prepend all log lines with the following tags. 50 | config.log_tags = [ :request_id ] 51 | 52 | # Use a different cache store in production. 53 | # config.cache_store = :mem_cache_store 54 | 55 | # Use a real queuing backend for Active Job (and separate queues per environment) 56 | # config.active_job.queue_adapter = :resque 57 | # config.active_job.queue_name_prefix = "code_connection_#{Rails.env}" 58 | config.action_mailer.perform_caching = false 59 | 60 | # Ignore bad email addresses and do not raise email delivery errors. 61 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 62 | # config.action_mailer.raise_delivery_errors = false 63 | 64 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 65 | # the I18n.default_locale when a translation cannot be found). 66 | config.i18n.fallbacks = true 67 | 68 | # Send deprecation notices to registered listeners. 69 | config.active_support.deprecation = :notify 70 | 71 | # Use default logging formatter so that PID and timestamp are not suppressed. 72 | config.log_formatter = ::Logger::Formatter.new 73 | 74 | # Use a different logger for distributed setups. 75 | # require 'syslog/logger' 76 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 77 | 78 | if ENV["RAILS_LOG_TO_STDOUT"].present? 79 | logger = ActiveSupport::Logger.new(STDOUT) 80 | logger.formatter = config.log_formatter 81 | config.logger = ActiveSupport::TaggedLogging.new(logger) 82 | end 83 | 84 | # Do not dump schema after migrations. 85 | config.active_record.dump_schema_after_migration = false 86 | end 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Code Connection Logo](https://cloud.githubusercontent.com/assets/25189972/23142797/c240f1d6-f78b-11e6-8a86-24c99b6b2e3a.png) 2 | > An attempt to bring scattered coders of all skiil levels and languages together to find people to learn from, work with, or projects to work on 3 | 4 | ## Where'd you get the idea? 5 | 6 | Participating in a weekly twitter chat by [Code Newbie](http://www.codenewbie.org), someone mentioned the dificulty finding people to work with for a reason specific to them. That started me thinking how most of the time I'm working/learning on my own. A variety of factors contribute to this on my end, but I realized that there might be others who have their own issues in regards to finding people to work with. It could be geography, availability (some of us learning to code are doing so while also working full-time jobs and/or dealing with other obligations), skill level, language base, any number of things. Thus I mentioned an idea to the chat folk regarding the idea of a web site where people could perhaps *register* to find others to work with based on whatever criteria was required. It was an idea that stuck with me, and I decided to give it a try. I created this repository to store what is now a [mission statement](https://github.com/jemagee/code_connection/blob/master/mission_statement.md) but was originally the README.md document of the repository. If you want a deep insight into what I was thinking hopefully that helps. 7 | 8 | ### Platform 9 | 10 | Code Connection is currently set up in the enviornment that I know best: 11 | 12 | * Rails 5 / Ruby 2.4.0 13 | * Postgres Database 14 | * RSpec / Capybara for testing 15 | * Bootstrap for Responsive Layout 16 | * Devise for User Creation foundation (to be added) 17 | 18 | As I said, these are currently being used because I know them best, if you are interested in contributing but work better with something different, please feel free to suggest it. 19 | 20 | ### Contributing 21 | 22 | Please, contribute. Anyone who wants to contribute is welcome. Use the Issues (or the new Projects tab if you want) as a way to make suggestions that you want to see or even want to create. This is the initial README doc and as such the application doesn't have much, but as you can see above, we do have a great logo. As such, the application is open to things, please read the mission statement, check the issues, and projects, and see what you might want to work on, or create a new idea for us to work on. 23 | 24 | As I want code connection to follow the principles of test-driven development (as I understand them), please ensure that you've written tests to ensure your additions do what you wish them to do, and that you've run the whole test suite to make sure all existing tests pass. 25 | 26 | 27 | 28 | ### Getting Started 29 | 30 | * Fork this repository 31 | * Clone the fork to your local machine 32 | * Navigate into the folder on your local machine that has your cloned fork 33 | * Create an upstream remote that stays synched with this repository 34 | 35 | If you aren't sure how to accomplish any of those steps above (the upstream one always gets me) this [Tutorial](https://help.github.com/articles/fork-a-repo/) by the good folks at GitHub should walk you through it 36 | 37 | Within the folder on your local machine that contains your cloned fork: 38 | 39 | * If not your standard version, set the local ruby version to 2.4.0 40 | * Type bundle and hit enter to install all gems 41 | * Use postgres command line CREATEDB to create code_connection_test & code_connection_development 42 | * Type rails db:migrate and hit enter to create any database tables that might exist (reminder, don't forget to do this any time you synch with upstream in case new information is available) 43 | * Type rspec and hit enter to make sure all tests are passing 44 | 45 | 46 | ### Code of Conduct 47 | 48 | The purpose of this project is to bring coders of all stripes together, and in that vein, be nice, be kind, be constructive, and be helpful. It is my hope that coders from multiple coding ecosystems, countries, and levels will participant. Treat everyone with respect. Right? 49 | 50 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | password_change: 27 | subject: "Password Changed" 28 | omniauth_callbacks: 29 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 30 | success: "Successfully authenticated from %{kind} account." 31 | passwords: 32 | 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." 33 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 34 | 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." 35 | updated: "Your password has been changed successfully. You are now signed in." 36 | updated_not_active: "Your password has been changed successfully." 37 | registrations: 38 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 39 | signed_up: "Welcome! You have signed up successfully." 40 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 41 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 42 | 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." 43 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." 44 | updated: "Your account has been updated successfully." 45 | sessions: 46 | signed_in: "Signed in successfully." 47 | signed_out: "Signed out successfully." 48 | already_signed_out: "Signed out successfully." 49 | unlocks: 50 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 51 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 52 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 53 | errors: 54 | messages: 55 | already_confirmed: "was already confirmed, please try signing in" 56 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 57 | expired: "has expired, please request a new one" 58 | not_found: "not found" 59 | not_locked: "was not locked" 60 | not_saved: 61 | one: "1 error prohibited this %{resource} from being saved:" 62 | other: "%{count} errors prohibited this %{resource} from being saved:" 63 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all 2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 3 | # The generated `.rspec` file contains `--require spec_helper` which will cause 4 | # this file to always be loaded, without a need to explicitly require it in any 5 | # files. 6 | # 7 | # Given that it is always loaded, you are encouraged to keep this file as 8 | # light-weight as possible. Requiring heavyweight dependencies from this file 9 | # will add to the boot time of your test suite on EVERY test run, even for an 10 | # individual file that may not need all of that loaded. Instead, consider making 11 | # a separate helper file that requires the additional dependencies and performs 12 | # the additional setup, and require it from the spec files that actually need 13 | # it. 14 | # 15 | # The `.rspec` file also contains a few flags that are not defaults but that 16 | # users commonly want. 17 | # 18 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 19 | RSpec.configure do |config| 20 | # rspec-expectations config goes here. You can use an alternate 21 | # assertion/expectation library such as wrong or the stdlib/minitest 22 | # assertions if you prefer. 23 | config.expect_with :rspec do |expectations| 24 | # This option will default to `true` in RSpec 4. It makes the `description` 25 | # and `failure_message` of custom matchers include text for helper methods 26 | # defined using `chain`, e.g.: 27 | # be_bigger_than(2).and_smaller_than(4).description 28 | # # => "be bigger than 2 and smaller than 4" 29 | # ...rather than: 30 | # # => "be bigger than 2" 31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 32 | end 33 | 34 | # rspec-mocks config goes here. You can use an alternate test double 35 | # library (such as bogus or mocha) by changing the `mock_with` option here. 36 | config.mock_with :rspec do |mocks| 37 | # Prevents you from mocking or stubbing a method that does not exist on 38 | # a real object. This is generally recommended, and will default to 39 | # `true` in RSpec 4. 40 | mocks.verify_partial_doubles = true 41 | end 42 | 43 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will 44 | # have no way to turn it off -- the option exists only for backwards 45 | # compatibility in RSpec 3). It causes shared context metadata to be 46 | # inherited by the metadata hash of host groups and examples, rather than 47 | # triggering implicit auto-inclusion in groups with matching metadata. 48 | config.shared_context_metadata_behavior = :apply_to_host_groups 49 | 50 | # The settings below are suggested to provide a good initial experience 51 | # with RSpec, but feel free to customize to your heart's content. 52 | =begin 53 | # This allows you to limit a spec run to individual examples or groups 54 | # you care about by tagging them with `:focus` metadata. When nothing 55 | # is tagged with `:focus`, all examples get run. RSpec also provides 56 | # aliases for `it`, `describe`, and `context` that include `:focus` 57 | # metadata: `fit`, `fdescribe` and `fcontext`, respectively. 58 | config.filter_run_when_matching :focus 59 | 60 | # Allows RSpec to persist some state between runs in order to support 61 | # the `--only-failures` and `--next-failure` CLI options. We recommend 62 | # you configure your source control system to ignore this file. 63 | config.example_status_persistence_file_path = "spec/examples.txt" 64 | 65 | # Limits the available syntax to the non-monkey patched syntax that is 66 | # recommended. For more details, see: 67 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ 68 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 69 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode 70 | config.disable_monkey_patching! 71 | 72 | # Many RSpec users commonly either run the entire suite or an individual 73 | # file, and it's useful to allow more verbose output when running an 74 | # individual spec file. 75 | if config.files_to_run.one? 76 | # Use the documentation formatter for detailed output, 77 | # unless a formatter has already been configured 78 | # (e.g. via a command-line flag). 79 | config.default_formatter = 'doc' 80 | end 81 | 82 | # Print the 10 slowest examples and example groups at the 83 | # end of the spec run, to help surface which specs are running 84 | # particularly slow. 85 | config.profile_examples = 10 86 | 87 | # Run specs in random order to surface order dependencies. If you find an 88 | # order dependency and want to debug it, you can fix the order by providing 89 | # the seed, which is printed after each run. 90 | # --seed 1234 91 | config.order = :random 92 | 93 | # Seed global randomization in this process using the `--seed` CLI option. 94 | # Setting this allows you to use `--seed` to deterministically reproduce 95 | # test failures related to randomization by passing the same `--seed` value 96 | # as the one that triggered the failure. 97 | Kernel.srand config.seed 98 | =end 99 | end 100 | -------------------------------------------------------------------------------- /mission_statement.md: -------------------------------------------------------------------------------- 1 | # What is Code Connection? 2 | 3 | ## *Seeking Input and Potential Contributors* 4 | 5 | ### What is Code Connection 6 | 7 | Code Connection is an idea that spawned from a weekly Twitter chat hosted by [CodeNewbie.org](http://www.codenewbie.org). Simply put, I see code connection as a way for people who code independently to find others to learn with, build projects with, bounce ideas off of, or whatever else you need to build up your code chops and/or projects. 8 | 9 | ### Why Do I Think There is a Need for Code Connection? 10 | 11 | I have been working on learning how to code, in one way or another, for over 20 years. I've done it mostly on my own, at home, but have taken a few courses at the local community college. I attend Meetups locally but find them not that helpful in what I'm looking for, somewhat intimidating, or the groups in my area are barely active (The local Rails meetup has met twice in the past year for instance). 12 | 13 | I'm in my 40s. I work 40+ hours per week, I'm married, I have a dog and four cats. The time I have to work on my coding projects is limited to a few hours after work and weekend hours, but let's not forget a person needs to have a life, and if I want to keep my wife, I have to pay attention to her. 14 | 15 | A blog post on [Firehose Project](http://blog.thefirehoseproject.com/posts/this-23-step-framework-will-help-you-finally-launch-your-side-project/) led me to start my [Twitter Account](http://www.twitter.com/mageeworld), and that has been very helpful. I've connected with some people who are great, but it still doesn't fill the need(s), I've found that I'm looking for, but it has shown me that there are a plethora of people out there working to code, in so many languages or libraries, of all experience levels, age groups, desires, project goals, geographic locations etc...and, well, I think maybe there might be way to harness all that potential, no matter where it's located into building things that any of us want to build. 16 | 17 | Thus the idea for this project came into my head. 18 | 19 | The name Code Connection is not fixed, it is just the first name I came up with. 20 | 21 | ### What Do I want Code Connection to do? 22 | 23 | I think it's pretty simple. I want Code Connection to connect people. I want people to be able to fill out not only a profile of their traits, qualities, but a profile of traits qualities they're looking for. 24 | 25 | Whether you need people to learn with who are learning the same code base as you, or someone more experienced than you in a different code base to help you solve a specific problem, or to learn that code base, you might be able to find someone available when you're available. 26 | 27 | Perhaps like me, you're much better at back end work than front end work, but you want some help on the front end design of your proejct, put it out there for as little or as much as you want help with. Maybe someone will guide you through wire framing, maybe someone will help you work through the concept of responsive design in bootstrap or flexbox. 28 | 29 | Maybe, also like me, you've got big ideas for big projects (perhaps an SaaS system, perhaps a distributed social network with no owner, who knows), but you're still learning your ropes through deploying your application and haven't yet leared how to use ActionMailer (yeah, that's me right now), and you want to make connections with people who have different chops (but also have holes) who are looking for something to work on as well. 30 | 31 | I could go on, but I think you get the general idea. 32 | 33 | 34 | ### That's a Great Idea but How Would It Work? 35 | 36 | Right now, this is just a kernel of an idea, but it's an idea I want to pursue, so I only have some broad strokes, but the idea works out something like this. 37 | 38 | 1. Users Create a Profile and tell other users about themselves, but not any personal stuff, but more about you as a coder: 39 | * Libraries/Languges/Applications you know and the level you are at (be it Ember, Rails, or Adobe Illustrator, all skills would be welcome) 40 | * Methodologies you work in (or want to work in) (TDD, AGILE, others that I don't know the name off off the top of my head) 41 | * Avaiability in terms of days / time / etc... 42 | * Looking for categories (study buddies to work with, projects to do, layouts to help with, whatever) 43 | * And more would show up over time I'm sure 44 | 45 | 2. *Searches* would be posted by users 46 | * I'm looking for people looking to learn Rails using Cucumber (that's a thing I promise) who are available M-F from 9-11 AM Pacific Daylight Time 47 | * I'm looking for UI/UX beginners who want to practice their chops on my project whose back end I'm in love with, but whose front end looks like a dog built it 48 | * Other stuff would evolve during the planning stage too 49 | 50 | 51 | 3. Other Things - As They Occur to Me 52 | 53 | ### Some things I would want this to be 54 | 55 | Free - this isn't about jobs or paid projects - I want people to find people they want to work with on Code Connection because they can't find the connection they need in a more traditional way 56 | Inclusive - I know language translation stuff exists, and I don't know how to use it, but the more languages the application could speak the better. 57 | Kind - There would be a very strict code of conduct and word usage filter - and violators would not be tolerated. 58 | 59 | ### What Do I Need? 60 | 61 | Well that is a pretty easy question. I need help. Heck, perhaps this already exists and I haven't found it in my web trails. If it does, just send me the link on [Twitter](http://www.twitter.com/mageeworld), but if it doesn't and this sounds like a good idea to you, then still contact me on Twitter. Let me know if you want to be included in any way shape or form. If you just want to participate in helping set up the guidelines, please, the more input the better. If you want to write some code, front or back end, let me know. If you have some suggestions about how to build this, that would be great too. I'm mostly a Rails, SQL guy...but I know there's a lot of different ideas and ways to peel a lemon out there (sorry, no cat skinning, like I said, I have 4 of them, and it really is an awful saying isn't it?), and I'm open to them all. 62 | 63 | Heck, if you have resources you think might be helpful let me know (for instance, it would be great if we could not only help people connect but give them a place to talk, or chat, or track their progress or projects, without little to now costs). 64 | 65 | Ok, I think I've gone on long enough. If you are interested, or want to know more, you can find me on Twitter or you can email me directly at . 66 | 67 | Thanks for *listening* 68 | 69 | If you have made it all the way to the bottom, I created a [typeform](https://mageeworld.typeform.com/to/kL9gru) to gauge levels of interest in the idea, and some info regarding how to build it. Please fill it out if you get the change. 70 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (5.0.2) 5 | actionpack (= 5.0.2) 6 | nio4r (>= 1.2, < 3.0) 7 | websocket-driver (~> 0.6.1) 8 | actionmailer (5.0.2) 9 | actionpack (= 5.0.2) 10 | actionview (= 5.0.2) 11 | activejob (= 5.0.2) 12 | mail (~> 2.5, >= 2.5.4) 13 | rails-dom-testing (~> 2.0) 14 | actionpack (5.0.2) 15 | actionview (= 5.0.2) 16 | activesupport (= 5.0.2) 17 | rack (~> 2.0) 18 | rack-test (~> 0.6.3) 19 | rails-dom-testing (~> 2.0) 20 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 21 | actionview (5.0.2) 22 | activesupport (= 5.0.2) 23 | builder (~> 3.1) 24 | erubis (~> 2.7.0) 25 | rails-dom-testing (~> 2.0) 26 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 27 | activejob (5.0.2) 28 | activesupport (= 5.0.2) 29 | globalid (>= 0.3.6) 30 | activemodel (5.0.2) 31 | activesupport (= 5.0.2) 32 | activerecord (5.0.2) 33 | activemodel (= 5.0.2) 34 | activesupport (= 5.0.2) 35 | arel (~> 7.0) 36 | activesupport (5.0.2) 37 | concurrent-ruby (~> 1.0, >= 1.0.2) 38 | i18n (~> 0.7) 39 | minitest (~> 5.1) 40 | tzinfo (~> 1.1) 41 | addressable (2.5.0) 42 | public_suffix (~> 2.0, >= 2.0.2) 43 | arel (7.1.4) 44 | autoprefixer-rails (6.7.6) 45 | execjs 46 | bcrypt (3.1.11) 47 | bootstrap-sass (3.3.7) 48 | autoprefixer-rails (>= 5.2.1) 49 | sass (>= 3.3.4) 50 | builder (3.2.3) 51 | byebug (9.0.6) 52 | capybara (2.12.1) 53 | addressable 54 | mime-types (>= 1.16) 55 | nokogiri (>= 1.3.3) 56 | rack (>= 1.0.0) 57 | rack-test (>= 0.5.4) 58 | xpath (~> 2.0) 59 | coderay (1.1.1) 60 | coffee-rails (4.2.1) 61 | coffee-script (>= 2.2.0) 62 | railties (>= 4.0.0, < 5.2.x) 63 | coffee-script (2.4.1) 64 | coffee-script-source 65 | execjs 66 | coffee-script-source (1.12.2) 67 | concurrent-ruby (1.0.5) 68 | countries (2.1.2) 69 | i18n_data (~> 0.8.0) 70 | money (~> 6.9) 71 | sixarm_ruby_unaccent (~> 1.1) 72 | unicode_utils (~> 1.4) 73 | country_select (3.1.0) 74 | countries (~> 2.0) 75 | sort_alphabetical (~> 1.0) 76 | database_cleaner (1.5.3) 77 | debug_inspector (0.0.2) 78 | devise (4.2.0) 79 | bcrypt (~> 3.0) 80 | orm_adapter (~> 0.1) 81 | railties (>= 4.1.0, < 5.1) 82 | responders 83 | warden (~> 1.2.3) 84 | diff-lcs (1.3) 85 | email_spec (2.1.0) 86 | htmlentities (~> 4.3.3) 87 | launchy (~> 2.1) 88 | mail (~> 2.6.3) 89 | erubis (2.7.0) 90 | execjs (2.7.0) 91 | factory_girl (4.8.0) 92 | activesupport (>= 3.0.0) 93 | factory_girl_rails (4.8.0) 94 | factory_girl (~> 4.8.0) 95 | railties (>= 3.0.0) 96 | ffi (1.9.18) 97 | font-awesome-rails (4.7.0.1) 98 | railties (>= 3.2, < 5.1) 99 | globalid (0.3.7) 100 | activesupport (>= 4.1.0) 101 | htmlentities (4.3.4) 102 | i18n (0.8.1) 103 | i18n_data (0.8.0) 104 | jbuilder (2.6.3) 105 | activesupport (>= 3.0.0, < 5.2) 106 | multi_json (~> 1.2) 107 | jquery-rails (4.2.2) 108 | rails-dom-testing (>= 1, < 3) 109 | railties (>= 4.2.0) 110 | thor (>= 0.14, < 2.0) 111 | launchy (2.4.3) 112 | addressable (~> 2.3) 113 | listen (3.0.8) 114 | rb-fsevent (~> 0.9, >= 0.9.4) 115 | rb-inotify (~> 0.9, >= 0.9.7) 116 | loofah (2.0.3) 117 | nokogiri (>= 1.5.9) 118 | mail (2.6.4) 119 | mime-types (>= 1.16, < 4) 120 | method_source (0.8.2) 121 | mime-types (3.1) 122 | mime-types-data (~> 3.2015) 123 | mime-types-data (3.2016.0521) 124 | mini_portile2 (2.1.0) 125 | minitest (5.10.1) 126 | money (6.9.0) 127 | i18n (>= 0.6.4, < 0.9) 128 | multi_json (1.12.1) 129 | nio4r (2.0.0) 130 | nokogiri (1.7.0.1) 131 | mini_portile2 (~> 2.1.0) 132 | orm_adapter (0.5.0) 133 | pg (0.19.0) 134 | pry (0.10.4) 135 | coderay (~> 1.1.0) 136 | method_source (~> 0.8.1) 137 | slop (~> 3.4) 138 | pry-rails (0.3.5) 139 | pry (>= 0.9.10) 140 | public_suffix (2.0.5) 141 | puma (3.7.1) 142 | rack (2.0.1) 143 | rack-test (0.6.3) 144 | rack (>= 1.0) 145 | rails (5.0.2) 146 | actioncable (= 5.0.2) 147 | actionmailer (= 5.0.2) 148 | actionpack (= 5.0.2) 149 | actionview (= 5.0.2) 150 | activejob (= 5.0.2) 151 | activemodel (= 5.0.2) 152 | activerecord (= 5.0.2) 153 | activesupport (= 5.0.2) 154 | bundler (>= 1.3.0, < 2.0) 155 | railties (= 5.0.2) 156 | sprockets-rails (>= 2.0.0) 157 | rails-dom-testing (2.0.2) 158 | activesupport (>= 4.2.0, < 6.0) 159 | nokogiri (~> 1.6) 160 | rails-html-sanitizer (1.0.3) 161 | loofah (~> 2.0) 162 | railties (5.0.2) 163 | actionpack (= 5.0.2) 164 | activesupport (= 5.0.2) 165 | method_source 166 | rake (>= 0.8.7) 167 | thor (>= 0.18.1, < 2.0) 168 | rake (12.0.0) 169 | rb-fsevent (0.9.8) 170 | rb-inotify (0.9.8) 171 | ffi (>= 0.5.0) 172 | responders (2.3.0) 173 | railties (>= 4.2.0, < 5.1) 174 | rspec-core (3.5.4) 175 | rspec-support (~> 3.5.0) 176 | rspec-expectations (3.5.0) 177 | diff-lcs (>= 1.2.0, < 2.0) 178 | rspec-support (~> 3.5.0) 179 | rspec-mocks (3.5.0) 180 | diff-lcs (>= 1.2.0, < 2.0) 181 | rspec-support (~> 3.5.0) 182 | rspec-rails (3.5.2) 183 | actionpack (>= 3.0) 184 | activesupport (>= 3.0) 185 | railties (>= 3.0) 186 | rspec-core (~> 3.5.0) 187 | rspec-expectations (~> 3.5.0) 188 | rspec-mocks (~> 3.5.0) 189 | rspec-support (~> 3.5.0) 190 | rspec-support (3.5.0) 191 | sass (3.4.23) 192 | sass-rails (5.0.6) 193 | railties (>= 4.0.0, < 6) 194 | sass (~> 3.1) 195 | sprockets (>= 2.8, < 4.0) 196 | sprockets-rails (>= 2.0, < 4.0) 197 | tilt (>= 1.1, < 3) 198 | shoulda-matchers (3.1.1) 199 | activesupport (>= 4.0.0) 200 | sixarm_ruby_unaccent (1.1.2) 201 | slop (3.6.0) 202 | sort_alphabetical (1.1.0) 203 | unicode_utils (>= 1.2.2) 204 | spring (2.0.1) 205 | activesupport (>= 4.2) 206 | spring-watcher-listen (2.0.1) 207 | listen (>= 2.7, < 4.0) 208 | spring (>= 1.2, < 3.0) 209 | sprockets (3.7.1) 210 | concurrent-ruby (~> 1.0) 211 | rack (> 1, < 3) 212 | sprockets-rails (3.2.0) 213 | actionpack (>= 4.0) 214 | activesupport (>= 4.0) 215 | sprockets (>= 3.0.0) 216 | thor (0.19.4) 217 | thread_safe (0.3.6) 218 | tilt (2.0.6) 219 | turbolinks (5.0.1) 220 | turbolinks-source (~> 5) 221 | turbolinks-source (5.0.0) 222 | tzinfo (1.2.2) 223 | thread_safe (~> 0.1) 224 | uglifier (3.1.5) 225 | execjs (>= 0.3.0, < 3) 226 | unicode_utils (1.4.0) 227 | warden (1.2.7) 228 | rack (>= 1.0) 229 | web-console (3.4.0) 230 | actionview (>= 5.0) 231 | activemodel (>= 5.0) 232 | debug_inspector 233 | railties (>= 5.0) 234 | websocket-driver (0.6.5) 235 | websocket-extensions (>= 0.1.0) 236 | websocket-extensions (0.1.2) 237 | xpath (2.0.0) 238 | nokogiri (~> 1.3) 239 | 240 | PLATFORMS 241 | ruby 242 | 243 | DEPENDENCIES 244 | bootstrap-sass (~> 3.3, >= 3.3.7) 245 | byebug 246 | capybara (~> 2.12, >= 2.12.1) 247 | coffee-rails (~> 4.2) 248 | country_select 249 | database_cleaner 250 | devise (~> 4.2) 251 | email_spec 252 | factory_girl_rails (~> 4.8) 253 | font-awesome-rails (~> 4.7, >= 4.7.0.1) 254 | jbuilder (~> 2.5) 255 | jquery-rails 256 | listen (~> 3.0.5) 257 | pg (~> 0.18) 258 | pry-rails (~> 0.3.5) 259 | puma (~> 3.0) 260 | rails (~> 5.0.1) 261 | rspec-rails (~> 3.5, >= 3.5.2) 262 | sass-rails (~> 5.0) 263 | shoulda-matchers (~> 3.1, >= 3.1.1) 264 | spring 265 | spring-watcher-listen (~> 2.0.0) 266 | turbolinks (~> 5) 267 | tzinfo-data 268 | uglifier (>= 1.3.0) 269 | web-console (>= 3.3.0) 270 | 271 | RUBY VERSION 272 | ruby 2.4.0p0 273 | 274 | BUNDLED WITH 275 | 1.14.6 276 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # Use this hook to configure devise mailer, warden hooks and so forth. 2 | # Many of these configuration options can be set straight in your model. 3 | Devise.setup do |config| 4 | # The secret key used by Devise. Devise uses this key to generate 5 | # random tokens. Changing this key will render invalid all existing 6 | # confirmation, reset password and unlock tokens in the database. 7 | # Devise will use the `secret_key_base` as its `secret_key` 8 | # by default. You can change it below and use your own secret key. 9 | # config.secret_key = 'e52ed2b4ecbdcc1e2873da522da647c33e872787fef251dbda7fe26d0cfd55369b7f72b57c2be120f490dedddccbe6fdd1636592d63fbe11da9c579ebbc67ccf' 10 | 11 | # ==> Mailer Configuration 12 | # Configure the e-mail address which will be shown in Devise::Mailer, 13 | # note that it will be overwritten if you use your own mailer class 14 | # with default "from" parameter. 15 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 16 | 17 | # Configure the class responsible to send e-mails. 18 | # config.mailer = 'Devise::Mailer' 19 | 20 | # Configure the parent class responsible to send e-mails. 21 | # config.parent_mailer = 'ActionMailer::Base' 22 | 23 | # ==> ORM configuration 24 | # Load and configure the ORM. Supports :active_record (default) and 25 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 26 | # available as additional gems. 27 | require 'devise/orm/active_record' 28 | 29 | # ==> Configuration for any authentication mechanism 30 | # Configure which keys are used when authenticating a user. The default is 31 | # just :email. You can configure it to use [:username, :subdomain], so for 32 | # authenticating a user, both parameters are required. Remember that those 33 | # parameters are used only when authenticating and not when retrieving from 34 | # session. If you need permissions, you should implement that in a before filter. 35 | # You can also supply a hash where the value is a boolean determining whether 36 | # or not authentication should be aborted when the value is not present. 37 | config.authentication_keys = [:login] 38 | 39 | # Configure parameters from the request object used for authentication. Each entry 40 | # given should be a request method and it will automatically be passed to the 41 | # find_for_authentication method and considered in your model lookup. For instance, 42 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 43 | # The same considerations mentioned for authentication_keys also apply to request_keys. 44 | # config.request_keys = [] 45 | 46 | # Configure which authentication keys should be case-insensitive. 47 | # These keys will be downcased upon creating or modifying a user and when used 48 | # to authenticate or find a user. Default is :email. 49 | config.case_insensitive_keys = [:email] 50 | 51 | # Configure which authentication keys should have whitespace stripped. 52 | # These keys will have whitespace before and after removed upon creating or 53 | # modifying a user and when used to authenticate or find a user. Default is :email. 54 | config.strip_whitespace_keys = [:email] 55 | 56 | # Tell if authentication through request.params is enabled. True by default. 57 | # It can be set to an array that will enable params authentication only for the 58 | # given strategies, for example, `config.params_authenticatable = [:database]` will 59 | # enable it only for database (email + password) authentication. 60 | # config.params_authenticatable = true 61 | 62 | # Tell if authentication through HTTP Auth is enabled. False by default. 63 | # It can be set to an array that will enable http authentication only for the 64 | # given strategies, for example, `config.http_authenticatable = [:database]` will 65 | # enable it only for database authentication. The supported strategies are: 66 | # :database = Support basic authentication with authentication key + password 67 | # config.http_authenticatable = false 68 | 69 | # If 401 status code should be returned for AJAX requests. True by default. 70 | # config.http_authenticatable_on_xhr = true 71 | 72 | # The realm used in Http Basic Authentication. 'Application' by default. 73 | # config.http_authentication_realm = 'Application' 74 | 75 | # It will change confirmation, password recovery and other workflows 76 | # to behave the same regardless if the e-mail provided was right or wrong. 77 | # Does not affect registerable. 78 | # config.paranoid = true 79 | 80 | # By default Devise will store the user in session. You can skip storage for 81 | # particular strategies by setting this option. 82 | # Notice that if you are skipping storage for all authentication paths, you 83 | # may want to disable generating routes to Devise's sessions controller by 84 | # passing skip: :sessions to `devise_for` in your config/routes.rb 85 | config.skip_session_storage = [:http_auth] 86 | 87 | # By default, Devise cleans up the CSRF token on authentication to 88 | # avoid CSRF token fixation attacks. This means that, when using AJAX 89 | # requests for sign in and sign up, you need to get a new CSRF token 90 | # from the server. You can disable this option at your own risk. 91 | # config.clean_up_csrf_token_on_authentication = true 92 | 93 | # When false, Devise will not attempt to reload routes on eager load. 94 | # This can reduce the time taken to boot the app but if your application 95 | # requires the Devise mappings to be loaded during boot time the application 96 | # won't boot properly. 97 | # config.reload_routes = true 98 | 99 | # ==> Configuration for :database_authenticatable 100 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If 101 | # using other algorithms, it sets how many times you want the password to be hashed. 102 | # 103 | # Limiting the stretches to just one in testing will increase the performance of 104 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 105 | # a value less than 10 in other environments. Note that, for bcrypt (the default 106 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 107 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 108 | config.stretches = Rails.env.test? ? 1 : 11 109 | 110 | # Set up a pepper to generate the hashed password. 111 | # config.pepper = '2c6759fe24286b48012f4fb4ffe9cdb1a7efcc4d97ec01dc702137df3a0b5ee5caa3a3face7077101593816508d193364d4207665b569573c7794fb1503b1c94' 112 | 113 | # Send a notification email when the user's password is changed 114 | # config.send_password_change_notification = false 115 | 116 | # ==> Configuration for :confirmable 117 | # A period that the user is allowed to access the website even without 118 | # confirming their account. For instance, if set to 2.days, the user will be 119 | # able to access the website for two days without confirming their account, 120 | # access will be blocked just in the third day. Default is 0.days, meaning 121 | # the user cannot access the website without confirming their account. 122 | # config.allow_unconfirmed_access_for = 2.days 123 | 124 | # A period that the user is allowed to confirm their account before their 125 | # token becomes invalid. For example, if set to 3.days, the user can confirm 126 | # their account within 3 days after the mail was sent, but on the fourth day 127 | # their account can't be confirmed with the token any more. 128 | # Default is nil, meaning there is no restriction on how long a user can take 129 | # before confirming their account. 130 | # config.confirm_within = 3.days 131 | 132 | # If true, requires any email changes to be confirmed (exactly the same way as 133 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 134 | # db field (see migrations). Until confirmed, new email is stored in 135 | # unconfirmed_email column, and copied to email column on successful confirmation. 136 | config.reconfirmable = true 137 | 138 | # Defines which key will be used when confirming an account 139 | # config.confirmation_keys = [:email] 140 | 141 | # ==> Configuration for :rememberable 142 | # The time the user will be remembered without asking for credentials again. 143 | # config.remember_for = 2.weeks 144 | 145 | # Invalidates all the remember me tokens when the user signs out. 146 | config.expire_all_remember_me_on_sign_out = true 147 | 148 | # If true, extends the user's remember period when remembered via cookie. 149 | # config.extend_remember_period = false 150 | 151 | # Options to be passed to the created cookie. For instance, you can set 152 | # secure: true in order to force SSL only cookies. 153 | # config.rememberable_options = {} 154 | 155 | # ==> Configuration for :validatable 156 | # Range for password length. 157 | config.password_length = 6..128 158 | 159 | # Email regex used to validate email formats. It simply asserts that 160 | # one (and only one) @ exists in the given string. This is mainly 161 | # to give user feedback and not to assert the e-mail validity. 162 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 163 | 164 | # ==> Configuration for :timeoutable 165 | # The time you want to timeout the user session without activity. After this 166 | # time the user will be asked for credentials again. Default is 30 minutes. 167 | # config.timeout_in = 30.minutes 168 | 169 | # ==> Configuration for :lockable 170 | # Defines which strategy will be used to lock an account. 171 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 172 | # :none = No lock strategy. You should handle locking by yourself. 173 | # config.lock_strategy = :failed_attempts 174 | 175 | # Defines which key will be used when locking and unlocking an account 176 | # config.unlock_keys = [:email] 177 | 178 | # Defines which strategy will be used to unlock an account. 179 | # :email = Sends an unlock link to the user email 180 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 181 | # :both = Enables both strategies 182 | # :none = No unlock strategy. You should handle unlocking by yourself. 183 | # config.unlock_strategy = :both 184 | 185 | # Number of authentication tries before locking an account if lock_strategy 186 | # is failed attempts. 187 | # config.maximum_attempts = 20 188 | 189 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 190 | # config.unlock_in = 1.hour 191 | 192 | # Warn on the last attempt before the account is locked. 193 | # config.last_attempt_warning = true 194 | 195 | # ==> Configuration for :recoverable 196 | # 197 | # Defines which key will be used when recovering the password for an account 198 | # config.reset_password_keys = [:email] 199 | 200 | # Time interval you can reset your password with a reset password key. 201 | # Don't put a too small interval or your users won't have the time to 202 | # change their passwords. 203 | config.reset_password_within = 6.hours 204 | 205 | # When set to false, does not sign a user in automatically after their password is 206 | # reset. Defaults to true, so a user is signed in automatically after a reset. 207 | # config.sign_in_after_reset_password = true 208 | 209 | # ==> Configuration for :encryptable 210 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 211 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 212 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 213 | # for default behavior) and :restful_authentication_sha1 (then you should set 214 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 215 | # 216 | # Require the `devise-encryptable` gem when using anything other than bcrypt 217 | # config.encryptor = :sha512 218 | 219 | # ==> Scopes configuration 220 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 221 | # "users/sessions/new". It's turned off by default because it's slower if you 222 | # are using only default views. 223 | # config.scoped_views = false 224 | 225 | # Configure the default scope given to Warden. By default it's the first 226 | # devise role declared in your routes (usually :user). 227 | # config.default_scope = :user 228 | 229 | # Set this configuration to false if you want /users/sign_out to sign out 230 | # only the current scope. By default, Devise signs out all scopes. 231 | # config.sign_out_all_scopes = true 232 | 233 | # ==> Navigation configuration 234 | # Lists the formats that should be treated as navigational. Formats like 235 | # :html, should redirect to the sign in page when the user does not have 236 | # access, but formats like :xml or :json, should return 401. 237 | # 238 | # If you have any extra navigational formats, like :iphone or :mobile, you 239 | # should add them to the navigational formats lists. 240 | # 241 | # The "*/*" below is required to match Internet Explorer requests. 242 | # config.navigational_formats = ['*/*', :html] 243 | 244 | # The default HTTP method used to sign out a resource. Default is :delete. 245 | config.sign_out_via = :delete 246 | 247 | # ==> OmniAuth 248 | # Add a new OmniAuth provider. Check the wiki for more information on setting 249 | # up on your models and hooks. 250 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 251 | 252 | # ==> Warden configuration 253 | # If you want to use other strategies, that are not supported by Devise, or 254 | # change the failure app, you can configure them inside the config.warden block. 255 | # 256 | # config.warden do |manager| 257 | # manager.intercept_401 = false 258 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 259 | # end 260 | 261 | # ==> Mountable engine configurations 262 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 263 | # is mountable, there are some extra configurations to be taken into account. 264 | # The following options are available, assuming the engine is mounted as: 265 | # 266 | # mount MyEngine, at: '/my_engine' 267 | # 268 | # The router that invoked `devise_for`, in the example above, would be: 269 | # config.router_name = :my_engine 270 | # 271 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 272 | # so you need to do it manually. For the users scope, it would be: 273 | # config.omniauth_path_prefix = '/my_engine/users/auth' 274 | end 275 | --------------------------------------------------------------------------------