├── log
└── .keep
├── app
├── mailers
│ ├── .keep
│ ├── contact_mailer.rb
│ └── connection_mailer.rb
├── models
│ ├── .keep
│ ├── concerns
│ │ └── .keep
│ ├── contact.rb
│ ├── admin_user.rb
│ ├── internship.rb
│ ├── connection.rb
│ ├── user.rb
│ └── profile.rb
├── assets
│ ├── images
│ │ ├── .keep
│ │ ├── logo_edit.jpg
│ │ └── logo_edit2.jpg
│ ├── javascripts
│ │ ├── active_admin.js.coffee
│ │ ├── custom.js
│ │ ├── pages.js.coffee
│ │ ├── internships.js.coffee
│ │ ├── application.js
│ │ └── areyousure
│ │ │ └── areyousure.js
│ └── stylesheets
│ │ ├── pages.css.scss
│ │ ├── internships.css.scss
│ │ ├── custom.css.scss
│ │ ├── users.css.scss
│ │ ├── active_admin.scss
│ │ └── application.css.scss
├── controllers
│ ├── concerns
│ │ └── .keep
│ ├── authentication_controller.rb
│ ├── users_controller.rb
│ ├── pages_controller.rb
│ ├── communities_controller.rb
│ ├── application_controller.rb
│ ├── contacts_controller.rb
│ ├── connections_controller.rb
│ ├── profiles_controller.rb
│ └── internships_controller.rb
├── helpers
│ └── application_helper.rb
├── views
│ ├── internships
│ │ ├── show.html.erb
│ │ ├── index.json.jbuilder
│ │ ├── _form.html.erb
│ │ ├── _internship.html.erb
│ │ ├── new.html.erb
│ │ ├── edit.html.erb
│ │ ├── _internships.html.erb
│ │ ├── _my_internships.html.erb
│ │ └── index.html.erb
│ ├── layouts
│ │ ├── _flash_notice.html.erb
│ │ ├── _coc.html.erb
│ │ ├── application.html.erb
│ │ └── _header.html.erb
│ ├── devise
│ │ ├── mailer
│ │ │ ├── confirmation_instructions.html.erb
│ │ │ ├── unlock_instructions.html.erb
│ │ │ └── reset_password_instructions.html.erb
│ │ ├── registrations
│ │ │ ├── new.html.erb
│ │ │ ├── _form.html.erb
│ │ │ └── edit.html.erb
│ │ ├── unlocks
│ │ │ └── new.html.erb
│ │ ├── confirmations
│ │ │ └── new.html.erb
│ │ ├── passwords
│ │ │ ├── new.html.erb
│ │ │ └── edit.html.erb
│ │ ├── sessions
│ │ │ └── new.html.erb
│ │ └── shared
│ │ │ └── _links.html.erb
│ ├── pages
│ │ ├── _mentee_partial.html.erb
│ │ ├── _mentor_partial.html.erb
│ │ ├── _profiles_partial.html.erb
│ │ ├── home.html.erb
│ │ ├── dashboard.html.erb
│ │ └── about.html.erb
│ ├── contact_mailer
│ │ └── contact_email.html.erb
│ ├── profiles
│ │ ├── edit.html.erb
│ │ ├── new.html.erb
│ │ ├── _community_profile.erb
│ │ └── _form.html.erb
│ ├── connection_mailer
│ │ ├── connection_email_copy.erb
│ │ └── connection_email.html.erb
│ ├── contacts
│ │ └── new.html.erb
│ ├── users
│ │ └── show.html.erb
│ └── communities
│ │ └── index.erb
└── admin
│ ├── user.rb
│ ├── admin_user.rb
│ └── dashboard.rb
├── lib
├── assets
│ └── .keep
├── tasks
│ └── .keep
└── templates
│ └── erb
│ └── scaffold
│ └── _form.html.erb
├── public
├── favicon.ico
├── images
│ ├── medium
│ │ └── missing.png
│ ├── thumb
│ │ └── missing.png
│ └── original
│ │ └── missing.png
├── system
│ └── profiles
│ │ └── avatars
│ │ └── 000
│ │ └── 000
│ │ ├── 001
│ │ ├── medium
│ │ │ └── 128.jpg
│ │ ├── square
│ │ │ └── 128.jpg
│ │ ├── thumb
│ │ │ └── 128.jpg
│ │ └── original
│ │ │ └── 128.jpg
│ │ ├── 003
│ │ ├── medium
│ │ │ └── 128.jpg
│ │ ├── thumb
│ │ │ └── 128.jpg
│ │ └── original
│ │ │ └── 128.jpg
│ │ ├── 002
│ │ ├── thumb
│ │ │ ├── 128_(3).jpg
│ │ │ └── 128_(4).jpg
│ │ ├── medium
│ │ │ ├── 128_(3).jpg
│ │ │ └── 128_(4).jpg
│ │ └── original
│ │ │ ├── 128_(3).jpg
│ │ │ └── 128_(4).jpg
│ │ ├── 004
│ │ ├── thumb
│ │ │ └── 128_(1).jpg
│ │ ├── medium
│ │ │ └── 128_(1).jpg
│ │ └── original
│ │ │ └── 128_(1).jpg
│ │ ├── 009
│ │ ├── thumb
│ │ │ └── 128_(2).jpg
│ │ ├── medium
│ │ │ └── 128_(2).jpg
│ │ └── original
│ │ │ └── 128_(2).jpg
│ │ ├── 010
│ │ ├── thumb
│ │ │ └── 128_(4).jpg
│ │ ├── medium
│ │ │ └── 128_(4).jpg
│ │ └── original
│ │ │ └── 128_(4).jpg
│ │ └── 011
│ │ ├── thumb
│ │ └── 128_(5).jpg
│ │ ├── medium
│ │ └── 128_(5).jpg
│ │ └── original
│ │ └── 128_(5).jpg
├── robots.txt
├── 500.html
├── 422.html
└── 404.html
├── .ruby-version
├── vendor
└── assets
│ ├── javascripts
│ └── .keep
│ └── stylesheets
│ └── .keep
├── .rspec
├── Procfile
├── spring-1000
└── 9bf2c1ef1427858dea31cf0a899f0d77.pid
├── .domains.swp
├── spec
├── factories
│ ├── admin_users.rb
│ ├── internships.rb
│ └── factories.rb
├── support
│ ├── factory_girls.rb
│ ├── shoulda_matchers.rb
│ └── database_cleaner.rb
├── models
│ ├── connection_model_spec.rb
│ ├── internship_spec.rb
│ ├── contact_model_spec.rb
│ ├── user_model_spec.rb
│ └── profile_model_spec.rb
├── controllers
│ ├── users_controller_spec.rb
│ ├── pages_controller_spec.rb
│ ├── contacts_controller_spec.rb
│ ├── connections_controller_spec.rb
│ ├── profiles_controller_spec.rb
│ ├── communities_controller_spec.rb
│ └── internships_controller_spec.rb
├── rails_helper.rb
└── spec_helper.rb
├── bin
├── bundle
├── rake
├── rails
├── spring
└── setup
├── config
├── boot.rb
├── initializers
│ ├── cookies_serializer.rb
│ ├── session_store.rb
│ ├── mime_types.rb
│ ├── filter_parameter_logging.rb
│ ├── backtrace_silencers.rb
│ ├── assets.rb
│ ├── wrap_parameters.rb
│ ├── inflections.rb
│ ├── rollbar.rb
│ ├── simple_form_bootstrap.rb
│ ├── simple_form.rb
│ ├── active_admin.rb
│ └── devise.rb
├── environment.rb
├── database.yml
├── locales
│ ├── en.yml
│ ├── simple_form.en.yml
│ └── devise.en.yml
├── routes.rb
├── secrets.yml
├── application.rb
└── environments
│ ├── development.rb
│ ├── test.rb
│ └── production.rb
├── db
├── migrate
│ ├── 20160201183155_drop_connections.rb
│ ├── 20151211024255_add_plan_to_user.rb
│ ├── 20151217163929_add_not_available_to_profiles.rb
│ ├── 20151211022924_create_plans.rb
│ ├── 20151228224438_rename_columns_in_connection_table.rb
│ ├── 20151210231737_create_contacts.rb
│ ├── 20170211204155_connection.rb
│ ├── 20151214015412_add_attachment_avatar_to_profiles.rb
│ ├── 20151227010729_create_connections.rb
│ ├── 20161109170728_create_internships.rb
│ ├── 20170115144700_drop_plans.rb
│ ├── 20151212002425_create_profiles.rb
│ ├── 20160218152625_create_active_admin_comments.rb
│ ├── 20151211020810_devise_create_users.rb
│ └── 20160218152619_devise_create_admin_users.rb
├── seeds.rb
└── schema.rb
├── config.ru
├── Rakefile
├── circle.yml
├── .gitignore
├── Gemfile
├── CONTRIBUTING.md
├── README.md
├── .generators
└── Gemfile.lock
/log/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/mailers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | 2.3.0
2 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.rspec:
--------------------------------------------------------------------------------
1 | --color
2 | --require spec_helper
3 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | release: bundle exec rake db:migrate
2 |
--------------------------------------------------------------------------------
/spring-1000/9bf2c1ef1427858dea31cf0a899f0d77.pid:
--------------------------------------------------------------------------------
1 | 54403
2 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/assets/javascripts/active_admin.js.coffee:
--------------------------------------------------------------------------------
1 | #= require active_admin/base
2 |
--------------------------------------------------------------------------------
/.domains.swp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/.domains.swp
--------------------------------------------------------------------------------
/spec/factories/admin_users.rb:
--------------------------------------------------------------------------------
1 | FactoryGirl.define do
2 | factory :admin_user do
3 |
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/spec/support/factory_girls.rb:
--------------------------------------------------------------------------------
1 | RSpec.configure do |config|
2 | config.include FactoryGirl::Syntax::Methods
3 | end
4 |
--------------------------------------------------------------------------------
/app/assets/images/logo_edit.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/app/assets/images/logo_edit.jpg
--------------------------------------------------------------------------------
/app/assets/images/logo_edit2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/app/assets/images/logo_edit2.jpg
--------------------------------------------------------------------------------
/public/images/medium/missing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/images/medium/missing.png
--------------------------------------------------------------------------------
/public/images/thumb/missing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/images/thumb/missing.png
--------------------------------------------------------------------------------
/public/images/original/missing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/images/original/missing.png
--------------------------------------------------------------------------------
/app/views/internships/show.html.erb:
--------------------------------------------------------------------------------
1 | <%= link_to 'Edit', edit_internship_path(@internship) %> |
2 | <%= link_to 'Back', internships_path %>
3 |
--------------------------------------------------------------------------------
/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/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/app/controllers/authentication_controller.rb:
--------------------------------------------------------------------------------
1 | class AuthenticationController < ApplicationController
2 |
3 | before_action :authenticate_user!
4 |
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20160201183155_drop_connections.rb:
--------------------------------------------------------------------------------
1 | class DropConnections < ActiveRecord::Migration
2 | def change
3 | drop_table :connections
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/db/migrate/20151211024255_add_plan_to_user.rb:
--------------------------------------------------------------------------------
1 | class AddPlanToUser < ActiveRecord::Migration
2 | def change
3 | add_column :users, :plan_id, :integer
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
4 |
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/001/medium/128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/001/medium/128.jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/001/square/128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/001/square/128.jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/001/thumb/128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/001/thumb/128.jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/003/medium/128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/003/medium/128.jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/003/thumb/128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/003/thumb/128.jpg
--------------------------------------------------------------------------------
/app/models/contact.rb:
--------------------------------------------------------------------------------
1 | class Contact < ActiveRecord::Base
2 | validates :name, presence: true
3 | validates :email, presence: true
4 | validates :comments, presence: true
5 | end
6 |
--------------------------------------------------------------------------------
/app/views/internships/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array!(@internships) do |internship|
2 | json.extract! internship, :id
3 | json.url internship_url(internship, format: :json)
4 | end
5 |
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/001/original/128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/001/original/128.jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/002/thumb/128_(3).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/002/thumb/128_(3).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/002/thumb/128_(4).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/002/thumb/128_(4).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/003/original/128.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/003/original/128.jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/004/thumb/128_(1).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/004/thumb/128_(1).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/009/thumb/128_(2).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/009/thumb/128_(2).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/010/thumb/128_(4).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/010/thumb/128_(4).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/011/thumb/128_(5).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/011/thumb/128_(5).jpg
--------------------------------------------------------------------------------
/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: '_workspace_session'
4 |
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/002/medium/128_(3).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/002/medium/128_(3).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/002/medium/128_(4).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/002/medium/128_(4).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/002/original/128_(3).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/002/original/128_(3).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/002/original/128_(4).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/002/original/128_(4).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/004/medium/128_(1).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/004/medium/128_(1).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/004/original/128_(1).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/004/original/128_(1).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/009/medium/128_(2).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/009/medium/128_(2).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/009/original/128_(2).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/009/original/128_(2).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/010/medium/128_(4).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/010/medium/128_(4).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/010/original/128_(4).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/010/original/128_(4).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/011/medium/128_(5).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/011/medium/128_(5).jpg
--------------------------------------------------------------------------------
/public/system/profiles/avatars/000/000/011/original/128_(5).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JrDevMentoring/jr_dev_mentoring/HEAD/public/system/profiles/avatars/000/000/011/original/128_(5).jpg
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/pages.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the pages 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/javascripts/custom.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $('form').areYouSure( {'message':'You have unsaved changes on this page. Do you want to leave this page and discard your changes or stay on this page?'});
3 | });
--------------------------------------------------------------------------------
/db/migrate/20151217163929_add_not_available_to_profiles.rb:
--------------------------------------------------------------------------------
1 | class AddNotAvailableToProfiles < ActiveRecord::Migration
2 | def change
3 | add_column :profiles, :not_available, :boolean, :default => false
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/internships.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the internships controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/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/views/layouts/_flash_notice.html.erb:
--------------------------------------------------------------------------------
1 | <% flash.each do |key, value| %>
2 | <% key = 'success' if key == 'notice' %>
3 | <% key = 'danger' if key == 'alert' %>
4 | <%= content_tag :div, value, class: "alert alert-#{key}" %>
5 | <% end %>
6 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/assets/javascripts/pages.js.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/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/app/assets/javascripts/internships.js.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/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 |
<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
6 |
--------------------------------------------------------------------------------
/db/migrate/20151211022924_create_plans.rb:
--------------------------------------------------------------------------------
1 | class CreatePlans < ActiveRecord::Migration
2 | def change
3 | create_table :plans do |t|
4 | t.string :name
5 | t.decimal :price
6 |
7 | t.timestamps
8 | end
9 |
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/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 File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/app/controllers/users_controller.rb:
--------------------------------------------------------------------------------
1 | class UsersController < AuthenticationController
2 |
3 | def show
4 | @user = User.find( params[:id] )
5 | @connection = current_user.connections.find_by(requester_id: current_user.id, requested_id: @user.id)
6 | end
7 |
8 | end
9 |
--------------------------------------------------------------------------------
/app/controllers/pages_controller.rb:
--------------------------------------------------------------------------------
1 | class PagesController < AuthenticationController
2 |
3 | skip_before_action :authenticate_user!, only: [:home, :about]
4 |
5 | def home
6 | end
7 |
8 | def about
9 | end
10 |
11 | def dashboard
12 | end
13 |
14 | end
15 |
--------------------------------------------------------------------------------
/app/views/pages/_mentee_partial.html.erb:
--------------------------------------------------------------------------------
1 | You have received a message from the Jr. Dev Mentoring site's contact form, from <%= "#{ @name }, #{ @email }." %>
7 | Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 |
5 | You have received a message from the Jr. Dev Mentoring site's connect form
7 | and they would like to connect with <%= "#{ @requested_name }, #{ @requested_email }" %>
9 |
10 |
--------------------------------------------------------------------------------
/app/views/layouts/_coc.html.erb:
--------------------------------------------------------------------------------
1 | <% site_action = current_user ? 'continuing to use' : 'visiting' %>
2 |
3 |
5 | <%- attributes.each do |attribute| -%>
6 | <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
7 | <%- end -%>
8 |
9 |
10 | Someone has requested a link to change your password. You can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/spec/models/connection_model_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | describe Connection do
4 | it { is_expected.to validate_presence_of(:requester) }
5 | it { is_expected.to validate_presence_of(:requested) }
6 | it { is_expected.to validate_uniqueness_of(:requested_id).scoped_to :requester_id }
7 |
8 | it 'should send email and copy when created' do
9 | expect { create(:connection) }
10 | .to change { ActionMailer::Base.deliveries.count }.by 2
11 | end
12 | end
--------------------------------------------------------------------------------
/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 | You have received a message from the Jr. Dev Mentoring site's connect form
7 | and they would like to connect with you.
9 | To connect with <%= @requester_name %>, simply copy this email address ( <%= @requester_email %> ) into a new email message and introduce yourself.
10 |
11 |
--------------------------------------------------------------------------------
/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 |
12 | <%= f.label :password %>
13 | <% if @validatable %>
14 | (<%= @minimum_password_length %> characters minimum)
15 | <% end %>
16 | <%= f.password_field :password, autocomplete: "off", class: 'form-control' %>
17 |
18 |
19 | Do you have an internship position that you'll like to post here? <%= link_to 'Create One', new_internship_path, class: 'btn btn-success' %>
2 |
3 | 1. Search through the profiles to find someone who you'd be interested in working with.
2. Click on their avatar or name to view their complete profile.
3. If this is someone you would like to work with, click on the "Click To Connect" button.
4. An email will be sent to the requested connection, with instructions on next steps.
4 |
5 |
6 |
2 |
3 |
4 | <% if @available_mentees %>
5 | - Mentees
6 | <% end %>
7 |
8 | <% if @available_mentors %>
9 | <% if @available_mentees.nil? %>
10 | - Mentors
11 | <% else %>
12 | - Mentors
13 | <% end %>
14 | <% end %>
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | <%= form_tag communities_path, method: :get, class: 'form-inline language-form' do %>
24 |
25 | <%= text_field_tag :query, params[:query],
26 | placeholder: 'Filter by programming language', type: :search, class: "form-control" %>
27 |
28 | <%= button_tag(type: "submit", class: "btn btn-primary") do %>
29 |
30 | <% end %>
31 | <% end %>
32 |
33 |
34 |
35 | <% if @available_mentees %>
36 |
37 | <%= render 'profiles/community_profile', profiles: @available_mentees, community_type: 'Mentees' %>
38 |
39 | <% end %>
40 |
41 | <% if @available_mentors %>
42 | <% if @available_mentees.nil? %>
43 |
44 | <% else %>
45 |
46 | <% end %>
47 | <%= render 'profiles/community_profile', profiles: @available_mentors, community_type: 'Mentors' %>
48 |
49 | <% end %>
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/controllers/internships_controller.rb:
--------------------------------------------------------------------------------
1 | class InternshipsController < AuthenticationController
2 | before_action :set_internship, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /internships
5 | # GET /internships.json
6 | def index
7 | @active_internships = Internship.active
8 | @expired_internships = Internship.expired
9 | @my_internships = current_user.internships
10 | end
11 |
12 | # GET /internships/new
13 | def new
14 | @internship = current_user.internships.new
15 | end
16 |
17 | # GET /internships/1/edit
18 | def edit
19 | end
20 |
21 | # POST /internships
22 | # POST /internships.json
23 | def create
24 | @internship = current_user.internships.new(internship_params)
25 |
26 | respond_to do |format|
27 | if @internship.save
28 | format.html { redirect_to internships_url, notice: 'Internship was successfully created.' }
29 | else
30 | format.html { render action: 'new' }
31 | format.json { render json: @internship.errors, status: :unprocessable_entity }
32 | end
33 | end
34 | end
35 |
36 | # PATCH/PUT /internships/1
37 | # PATCH/PUT /internships/1.json
38 | def update
39 | respond_to do |format|
40 | if @internship.update(internship_params)
41 | format.html { redirect_to internships_url, notice: 'Internship was successfully updated.' }
42 | else
43 | format.html { render action: 'edit' }
44 | format.json { render json: @internship.errors, status: :unprocessable_entity }
45 | end
46 | end
47 | end
48 |
49 | # DELETE /internships/1
50 | # DELETE /internships/1.json
51 | def destroy
52 | @internship.destroy
53 | respond_to do |format|
54 | format.html { redirect_to internships_url }
55 | format.json { head :no_content }
56 | end
57 | end
58 |
59 | private
60 | # Use callbacks to share common setup or constraints between actions.
61 | def set_internship
62 | @internship = Internship.find(params[:id])
63 | end
64 |
65 | # Never trust parameters from the scary internet, only allow the white list through.
66 | def internship_params
67 | params.require(:internship).permit(:title, :description, :application_link, :deadline)
68 | end
69 | end
70 |
--------------------------------------------------------------------------------
/spec/controllers/profiles_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | describe ProfilesController do
4 |
5 | before :each do
6 | @user = FactoryGirl.create(:user)
7 | @profile_attr = FactoryGirl.attributes_for(:profile)
8 | end
9 | describe "user not signed in" do
10 | it 'should redirect user' do
11 | [:new, :edit].each do |action|
12 | get action, :user_id => @user.id
13 | expect(response.status).to eq 302
14 | end
15 | end
16 | end
17 | describe 'GET #new' do
18 | before do
19 | sign_in @user
20 | get :new, :user_id => @user.id
21 | end
22 | it 'should assign a new instance of Profile as profile' do
23 | expect(assigns(:profile)).to be_a_new(Profile)
24 | end
25 | it 'should assign a user with given id as user' do
26 | expect(assigns(:user)).to eq @user
27 | end
28 | end
29 |
30 | describe 'POST #create' do
31 | describe 'not signed in' do
32 | it 'should redirect user' do
33 | post :create, :user_id => @user.id, profile: @profile_attr
34 | expect(response.status).to eq 302
35 | end
36 | end
37 | end
38 |
39 | describe 'GET #edit' do
40 | before do
41 | sign_in @user
42 | get :edit, :user_id => @user.id
43 | end
44 | it 'should assign a new instance of Profile as profile' do
45 | expect(assigns(:profile)).to be @user.profile
46 | end
47 | it 'should assign a user with given id as user' do
48 | expect(assigns(:user)).to eq @user
49 | end
50 | end
51 |
52 | describe 'PUT #update' do
53 | before do
54 | @profile = FactoryGirl.create(:profile, user: @user)
55 | @new_profile = FactoryGirl.attributes_for(:profile)
56 | end
57 | describe 'not signed in' do
58 | it 'should redirect user' do
59 | put :update, :user_id => @user.id, profile: @new_profile
60 | expect(response.status).to eq 302
61 | end
62 | end
63 | describe 'signed in' do
64 | it 'should redirect to user path' do
65 | sign_in @user
66 | put :update, :user_id => @user.id, profile: @new_profile
67 | expect(response.status).to eq 302
68 | expect(response).to redirect_to(user_path(@user.id))
69 | end
70 | end
71 |
72 | end
73 | end
--------------------------------------------------------------------------------
/config/initializers/rollbar.rb:
--------------------------------------------------------------------------------
1 | Rollbar.configure do |config|
2 | # Without configuration, Rollbar is enabled in all environments.
3 | # To disable in specific environments, set config.enabled=false.
4 |
5 | config.access_token = '52fa8d6794044117910385511cfaee7b'
6 |
7 | # Here we'll disable in 'test':
8 | if Rails.env.test?
9 | config.enabled = false
10 | end
11 |
12 | # And also disable in 'development':
13 | if Rails.env.development?
14 | config.enabled = false
15 | end
16 |
17 | # By default, Rollbar will try to call the `current_user` controller method
18 | # to fetch the logged-in user object, and then call that object's `id`,
19 | # `username`, and `email` methods to fetch those properties. To customize:
20 | # config.person_method = "my_current_user"
21 | # config.person_id_method = "my_id"
22 | # config.person_username_method = "my_username"
23 | # config.person_email_method = "my_email"
24 |
25 | # If you want to attach custom data to all exception and message reports,
26 | # provide a lambda like the following. It should return a hash.
27 | # config.custom_data_method = lambda { {:some_key => "some_value" } }
28 |
29 | # Add exception class names to the exception_level_filters hash to
30 | # change the level that exception is reported at. Note that if an exception
31 | # has already been reported and logged the level will need to be changed
32 | # via the rollbar interface.
33 | # Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
34 | # 'ignore' will cause the exception to not be reported at all.
35 | # config.exception_level_filters.merge!('MyCriticalException' => 'critical')
36 | #
37 | # You can also specify a callable, which will be called with the exception instance.
38 | # config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
39 |
40 | # Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
41 | # is not installed)
42 | # config.use_async = true
43 | # Supply your own async handler:
44 | # config.async_handler = Proc.new { |payload|
45 | # Thread.new { Rollbar.process_from_async_handler(payload) }
46 | # }
47 |
48 | # Enable asynchronous reporting (using sucker_punch)
49 | # config.use_sucker_punch
50 |
51 | # Enable delayed reporting (using Sidekiq)
52 | # config.use_sidekiq
53 | # You can supply custom Sidekiq options:
54 | # config.use_sidekiq 'queue' => 'default'
55 | end
56 |
--------------------------------------------------------------------------------
/app/views/profiles/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @profile, url: user_profile_path, :html => { :multipart => true } do |f| %>
2 |
9 |
10 |
21 |
22 |
23 | <%= f.label :first_name %>
24 | <%= f.text_field :first_name, class: 'form-control' %>
25 |
26 |
27 | <%= f.label :last_name %>
28 | <%= f.text_field :last_name, class: 'form-control' %>
29 |
30 |
31 | <%= f.label :avatar %>
32 | <%= f.file_field :avatar %>
33 |
34 |
35 | <%= f.label :contact_email %>
36 | <%= f.text_field :contact_email, class: 'form-control' %>
37 |
38 |
39 | <%= f.label :city %>
40 | <%= f.text_field :city, class: 'form-control' %>
41 |
42 |
43 | <%= f.label :state %>
44 | <%= f.text_field :state, class: 'form-control' %>
45 |
46 |
47 |
48 | <%= f.label :country %>
49 | <%= f.text_field :country, class: 'form-control' %>
50 |
51 |
52 | <%= f.label :coding_languages, 'What coding languages are you learning? (1000 char. limit)' %>
53 | <%= f.text_area :coding_languages, class: 'form-control' %>
54 |
55 |
56 | <%= f.label :bio, 'Bio (1000 character limit)' %>
57 | <%= f.text_area :bio, class: 'form-control' %>
58 |
59 |
64 |
65 |
66 | <%= f.submit "Update Profile", class: 'btn btn-primary' %>
67 |
68 | <% end %>
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 |
9 | require 'devise'
10 | require 'database_cleaner'
11 | # Add additional requires below this line. Rails is not loaded until this point!
12 |
13 | # Requires supporting ruby files with custom matchers and macros, etc, in
14 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
15 | # run as spec files by default. This means that files in spec/support that end
16 | # in _spec.rb will both be required and run as specs, causing the specs to be
17 | # run twice. It is recommended that you do not name files matching this glob to
18 | # end with _spec.rb. You can configure this pattern with the --pattern
19 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
20 | #
21 | # The following line is provided for convenience purposes. It has the downside
22 | # of increasing the boot-up time by auto-requiring all files in the support
23 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
24 | # require only the support files necessary.
25 | #
26 | Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
27 |
28 | # Checks for pending migration and applies them before tests are run.
29 | # If you are not using ActiveRecord, you can remove this line.
30 | ActiveRecord::Migration.maintain_test_schema!
31 |
32 | RSpec.configure do |config|
33 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
34 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
35 |
36 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
37 | # examples within a transaction, remove the following line or assign false
38 | # instead of true.
39 | config.use_transactional_fixtures = false
40 |
41 | # RSpec Rails can automatically mix in different behaviours to your tests
42 | # based on their file location, for example enabling you to call `get` and
43 | # `post` in specs under `spec/controllers`.
44 | #
45 | # You can disable this behaviour by removing the line below, and instead
46 | # explicitly tag your specs with their type, e.g.:
47 | #
48 | # RSpec.describe UsersController, :type => :controllers do
49 | # # ...
50 | # end
51 | #
52 | # The different available types are documented in the features, such as in
53 | # https://relishapp.com/rspec/rspec-rails/docs
54 | config.infer_spec_type_from_file_location!
55 |
56 | config.include Devise::Test::ControllerHelpers, type: :controller
57 | # Filter lines from Rails gems in backtraces.
58 | config.filter_rails_from_backtrace!
59 | # arbitrary gems may also be filtered via:
60 | # config.filter_gems_from_backtrace("gem name")
61 | end
62 |
--------------------------------------------------------------------------------
/spec/models/user_model_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | describe User do
4 | it "should have a valid factory" do
5 | user = FactoryGirl.build(:user)
6 | expect(user).to be_valid
7 | end
8 |
9 | describe "Validation" do
10 | it { is_expected.to validate_presence_of(:email) }
11 | it { is_expected.to validate_presence_of(:password) }
12 | end
13 |
14 | describe "Association" do
15 | describe "profile" do
16 | it "user has_one" do
17 | profile = FactoryGirl.create(:profile)
18 | user = FactoryGirl.build(:user, profile: profile)
19 | expect(user.profile).to eq profile
20 | end
21 | end
22 | end
23 |
24 | describe '#mentor?' do
25 | it 'is true for user with a mentor profile plan' do
26 | user = create(:profile, :mentor).user
27 | expect(user.mentor?).to be_truthy
28 | end
29 |
30 | it 'is false for user with no mentor profile plan' do
31 | user = create(:profile).user
32 | expect(user.mentor?).to be_falsey
33 | end
34 | end
35 |
36 | describe '#mentee?' do
37 | it 'is true for user with a mentee profile plan' do
38 | user = create(:profile, :mentee).user
39 | expect(user.mentee?).to be_truthy
40 | end
41 |
42 | it 'is false for user with no mentee profile plan' do
43 | user = create(:profile).user
44 | expect(user.mentee?).to be_falsey
45 | end
46 | end
47 |
48 | describe "ClassMethods" do
49 | before :all do
50 | DatabaseCleaner.start
51 | @mentors = create_list(:user, 3)
52 | @mentees = create_list(:user, 4)
53 |
54 | @mentors.each_with_index do |mentor, index|
55 | not_available = (index == 0 ? true : false)
56 | FactoryGirl.create(:profile, :mentor, user: mentor, not_available: not_available)
57 | end
58 |
59 | @mentees.each_with_index do |mentee, index|
60 | not_available = (index == 0 ? true : false)
61 | FactoryGirl.create(:profile, :mentee, user: mentee, not_available: not_available)
62 | end
63 |
64 | @available_mentors = User.mentors
65 | @available_mentees = User.mentees
66 | end
67 |
68 | after :all do
69 | DatabaseCleaner.clean
70 | end
71 |
72 | describe "#Mentors" do
73 | it "lists all available mentors" do
74 | expect(@available_mentors.count).to eq 2
75 | end
76 |
77 | it "doesn't list mentees" do
78 | expect(@available_mentors).not_to include @mentees[0]
79 | end
80 |
81 | it "lists mentors" do
82 | expect(@available_mentors).to include @mentors[1]
83 | end
84 |
85 | it "doesn't list unavailable mentors" do
86 | expect(@available_mentors).not_to include @mentors[0]
87 | end
88 |
89 | end
90 |
91 | describe "#Mentees" do
92 | it "lists all available mentees" do
93 | expect(@available_mentees.count).to eq 3
94 | end
95 |
96 | it "doesn't list mentors" do
97 | expect(@available_mentees).not_to include @mentors[1]
98 | end
99 |
100 | it "lists mentors" do
101 | expect(@available_mentees).to include @mentees[1]
102 | end
103 | it "doesn't list unavailable mentees" do
104 | expect(@available_mentees).not_to include @mentees[0]
105 | end
106 | end
107 | end
108 |
109 | end
--------------------------------------------------------------------------------
/spec/controllers/communities_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | describe CommunitiesController do
4 |
5 | describe 'GET#index' do
6 | describe 'unauthenticated user' do
7 | it 'gets redirected' do
8 | get :index
9 | expect(response).to redirect_to new_user_session_path
10 | end
11 | end
12 |
13 | describe 'for authenticated user, basic search' do
14 | before :each do
15 | mentors = create_list(:user, 3)
16 | mentees = create_list(:user, 4)
17 |
18 | mentors.each do |mentor|
19 | FactoryGirl.create(:profile, :mentor, user: mentor)
20 | end
21 |
22 | mentees.each do |mentee|
23 | FactoryGirl.create(:profile, :mentee, user: mentee)
24 | end
25 |
26 | @available_mentors = Profile.mentors
27 | @available_mentees = Profile.mentees
28 |
29 |
30 | user = create(:profile, plan_types: ['mentor', 'mentee']).user
31 | sign_in user
32 | get :index
33 | end
34 |
35 | it 'is a success' do
36 | expect(response.status).to eq 200
37 | end
38 |
39 | it 'assigns all mentors as "mentors"' do
40 | expect(assigns[:available_mentors]).to eq @available_mentors
41 | end
42 |
43 | it 'assigns all mentees as "mentees"' do
44 | expect(assigns[:available_mentees]).to eq @available_mentees
45 | end
46 | end
47 |
48 | describe 'for authenticated user, language search' do
49 | before :each do
50 | mentors = create_list(:user, 3)
51 | mentees = create_list(:user, 4)
52 |
53 | search_users = create_list(:user, 4)
54 |
55 | mentors.each do |mentor|
56 | FactoryGirl.create(:profile, :mentor, user: mentor)
57 | end
58 |
59 | mentees.each do |mentee|
60 | FactoryGirl.create(:profile, :mentee, user: mentee)
61 | end
62 |
63 | @ruby_mentor = FactoryGirl.create(:profile, :mentor,
64 | user: search_users[0],
65 | coding_languages: "ruby")
66 | @ruby_mentee = FactoryGirl.create(:profile, :mentee,
67 | user: search_users[0],
68 | coding_languages: "ruby")
69 |
70 | @python_mentor = FactoryGirl.create(:profile, :mentor,
71 | user: search_users[2],
72 | coding_languages: "python")
73 | @python_mentee = FactoryGirl.create(:profile, :mentee,
74 | user: search_users[3],
75 | coding_languages: "python")
76 |
77 | @available_mentors = Profile.mentors
78 | @available_mentees = Profile.mentees
79 |
80 |
81 | user = create(:profile, plan_types: ['mentor', 'mentee']).user
82 | sign_in user
83 | get :index, query: 'ruby'
84 | end
85 |
86 | it 'is a success' do
87 | expect(response.status).to eq 200
88 | end
89 |
90 | it 'assigns correct mentors' do
91 | expect(assigns[:available_mentors]).to include @ruby_mentor
92 | end
93 |
94 | it 'does not assign incorrect mentors' do
95 | expect(assigns[:available_mentors]).not_to include @python_mentor
96 | end
97 |
98 | it 'assigns correct mentees' do
99 | expect(assigns[:available_mentees]).to include @ruby_mentee
100 | end
101 |
102 | it 'assigns correct mentors' do
103 | expect(assigns[:available_mentees]).not_to include @python_mentee
104 | end
105 | end
106 |
107 | end
108 | end
109 |
--------------------------------------------------------------------------------
/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 | # Enable Rack::Cache to put a simple HTTP cache in front of your application
18 | # Add `rack-cache` to your Gemfile before enabling this.
19 | # For large-scale production use, consider using a caching reverse proxy like
20 | # NGINX, varnish or squid.
21 | # config.action_dispatch.rack_cache = true
22 |
23 | # Disable serving static files from the `/public` folder by default since
24 | # Apache or NGINX already handles this.
25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26 |
27 | config.paperclip_defaults = {
28 | :storage => :s3,
29 | :s3_credentials => {
30 | :bucket => ENV['S3_BUCKET_NAME'],
31 | :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
32 | :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
33 | }
34 | }
35 | # Compress JavaScripts and CSS.
36 | config.assets.js_compressor = :uglifier
37 | # config.assets.css_compressor = :sass
38 |
39 | # Do not fallback to assets pipeline if a precompiled asset is missed.
40 | config.assets.compile = false
41 |
42 | # Asset digests allow you to set far-future HTTP expiration dates on all assets,
43 | # yet still be able to expire them through the digest params.
44 | config.assets.digest = true
45 |
46 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
47 |
48 | config.assets.precompile += ['active_admin.css']
49 |
50 | # Specifies the header that your server uses for sending files.
51 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
52 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
53 |
54 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
55 | # config.force_ssl = true
56 |
57 | # Use the lowest log level to ensure availability of diagnostic information
58 | # when problems arise.
59 | config.log_level = :debug
60 |
61 | # Prepend all log lines with the following tags.
62 | # config.log_tags = [ :subdomain, :uuid ]
63 |
64 | # Use a different logger for distributed setups.
65 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
66 |
67 | # Use a different cache store in production.
68 | # config.cache_store = :mem_cache_store
69 |
70 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
71 | # config.action_controller.asset_host = 'http://assets.example.com'
72 |
73 | # Ignore bad email addresses and do not raise email delivery errors.
74 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
75 | # config.action_mailer.raise_delivery_errors = false
76 | config.action_mailer.default_url_options = { host: ENV['DEFAULT_URL_OPTIONS'] }
77 |
78 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
79 | # the I18n.default_locale when a translation cannot be found).
80 | config.i18n.fallbacks = true
81 |
82 | # Send deprecation notices to registered listeners.
83 | config.active_support.deprecation = :notify
84 |
85 | # Use default logging formatter so that PID and timestamp are not suppressed.
86 | config.log_formatter = ::Logger::Formatter.new
87 |
88 | # Do not dump schema after migrations.
89 | config.active_record.dump_schema_after_migration = false
90 | end
91 |
--------------------------------------------------------------------------------
/app/views/pages/about.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
<%= image_tag("logo_edit.jpg", :alt => "site logo") %>
5 |
6 |
About Jr. Dev Mentoring
7 |
8 |
9 |
10 |
11 |
12 |
Mission
13 |
14 |
To make sure that everyone new to programming has the opportunity to build at least one strong relationship within the coding community.
15 | _____________________________
16 |
"Corporate mentoring programs have long been recognized as an essential strategy for attracting, developing, and retaining top employees. According to a survey by the American Society for Training and Development, 75% of private sector executives said that mentoring had been critical in helping them reach their current position".
17 |
18 |
19 |
20 |
21 |
22 |
23 |
Vision
24 |
25 |
To become the first resource that those new to programming turn to for the support they need.
26 | _____________________________
27 |
Mentees, this is an opportunity for you to connect with professionals in the programming commmunity to gain the insight, encouragement, and connections that it will take for you to succeed as a junior developer. “Mentors can do a number of things for your career. They can help you build your resume, guide you on a project, and help you identify resources, including referring you to other mentors and important people in your field” - Ken Williams, Director of the New Voices National Fellowship Program
28 |
29 |
30 |
31 |
32 |
33 |
34 |
Goal
35 |
36 |
To match anyone new to programming who wants a mentor, with someone willing to guide them to their first junior developer position.
37 | _____________________________
38 |
Jr. Dev Mentoring, is not intented to replace the various forums, message boards, help groups, etc. that are already available for newbies to use. It is meant to be used as a supplement. Those resources are great for solving problems and answering questons related to specific issues but those new to programming also need to build relationships within the community to be successful.
39 |
40 |
41 |
42 |
43 |
44 |
45 |
Commitment
46 |
47 |
Mentors and Mentees agree to partner for a 12-month time frame, connecting at least twice per month.
48 | _____________________________
49 |
Relationships need to be built before any effective mentoring can take place. An environment of trust and mutuality must be established. It is important for the mentor and mentee to become acquainted with each other (Kutilek & Earnest, 2001; Mincemoyer & Thomson, 1998).
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/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 | omniauth_callbacks:
27 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28 | success: "Successfully authenticated from %{kind} account."
29 | passwords:
30 | 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."
31 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32 | 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."
33 | updated: "Your password has been changed successfully. You are now signed in."
34 | updated_not_active: "Your password has been changed successfully."
35 | registrations:
36 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37 | signed_up: "Welcome! You have signed up successfully."
38 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40 | 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."
41 | 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."
42 | updated: "Your account has been updated successfully."
43 | sessions:
44 | signed_in: "Signed in successfully."
45 | signed_out: "Signed out successfully."
46 | already_signed_out: "Signed out successfully."
47 | unlocks:
48 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51 | errors:
52 | messages:
53 | already_confirmed: "was already confirmed, please try signing in"
54 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55 | expired: "has expired, please request a new one"
56 | not_found: "not found"
57 | not_locked: "was not locked"
58 | not_saved:
59 | one: "1 error prohibited this %{resource} from being saved:"
60 | other: "%{count} errors prohibited this %{resource} from being saved:"
61 |
--------------------------------------------------------------------------------
/spec/controllers/internships_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe InternshipsController, type: :controller do
4 |
5 | let(:valid_attributes) {
6 | attributes_for(:internship)
7 | }
8 |
9 | let(:invalid_attributes) {
10 | attributes_for(:internship, application_link: nil)
11 | }
12 |
13 | before do
14 | @user = create(:user)
15 | sign_in @user
16 | end
17 |
18 | describe "GET #index" do
19 | it "assigns my internships as @my_internships" do
20 | internship = create(:internship, user: @user)
21 | get :index
22 | expect(assigns[:my_internships]).to eq([internship])
23 | end
24 | end
25 |
26 | describe "GET #new" do
27 | it "assigns a new internship as @internship" do
28 | get :new
29 | expect(assigns(:internship)).to be_a_new(Internship)
30 | end
31 | end
32 |
33 | describe "GET #edit" do
34 | it "assigns the requested internship as @internship" do
35 | internship = create(:internship)
36 | get :edit, {:id => internship.to_param}
37 | expect(assigns(:internship)).to eq(internship)
38 | end
39 | end
40 |
41 | describe "POST #create" do
42 | context "with valid params" do
43 | it "creates a new Internship" do
44 | expect {
45 | post :create, {:internship => valid_attributes}
46 | }.to change(Internship, :count).by(1)
47 | end
48 |
49 | it "assigns a newly created internship as @internship" do
50 | post :create, {:internship => valid_attributes}
51 | expect(assigns(:internship)).to be_a(Internship)
52 | expect(assigns(:internship)).to be_persisted
53 | end
54 |
55 | it "redirects to the internships_url" do
56 | post :create, {:internship => valid_attributes}
57 | expect(response).to redirect_to(internships_url)
58 | end
59 | end
60 |
61 | context "with invalid params" do
62 | it "assigns a newly created but unsaved internship as @internship" do
63 | post :create, {:internship => invalid_attributes}
64 | expect(assigns(:internship)).to be_a_new(Internship)
65 | end
66 |
67 | it "re-renders the 'new' template" do
68 | post :create, {:internship => invalid_attributes}
69 | expect(response).to render_template("new")
70 | end
71 | end
72 | end
73 |
74 | describe "PUT #update" do
75 | context "with valid params" do
76 | let(:new_attributes) {
77 | attributes_for(:internship)
78 | }
79 |
80 | it "updates the requested internship" do
81 | internship = create(:internship)
82 | put :update, {:id => internship.to_param, :internship => new_attributes}
83 | internship.reload
84 | expect(internship.title).to eq new_attributes[:title]
85 | end
86 |
87 | it "assigns the requested internship as @internship" do
88 | internship = create(:internship)
89 | put :update, {:id => internship.to_param, :internship => valid_attributes}
90 | expect(assigns(:internship)).to eq(internship)
91 | end
92 |
93 | it "redirects to the internships_url" do
94 | internship = create(:internship)
95 | put :update, {:id => internship.to_param, :internship => valid_attributes}
96 | expect(response).to redirect_to(internships_url)
97 | end
98 | end
99 |
100 | context "with invalid params" do
101 | it "assigns the internship as @internship" do
102 | internship = create(:internship)
103 | put :update, {:id => internship.to_param, :internship => invalid_attributes}
104 | expect(assigns(:internship)).to eq(internship)
105 | end
106 |
107 | it "re-renders the 'edit' template" do
108 | internship = create(:internship)
109 | put :update, {:id => internship.to_param, :internship => invalid_attributes}
110 | expect(response).to render_template("edit")
111 | end
112 | end
113 | end
114 |
115 | describe "DELETE #destroy" do
116 | it "destroys the requested internship" do
117 | internship = create(:internship)
118 | expect {
119 | delete :destroy, {:id => internship.to_param}
120 | }.to change(Internship, :count).by(-1)
121 | end
122 |
123 | it "redirects to the internships list" do
124 | internship = create(:internship)
125 | delete :destroy, {:id => internship.to_param}
126 | expect(response).to redirect_to(internships_url)
127 | end
128 | end
129 |
130 | end
131 |
--------------------------------------------------------------------------------
/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 | require 'simplecov'
20 | SimpleCov.start
21 |
22 | RSpec.configure do |config|
23 | # rspec-expectations config goes here. You can use an alternate
24 | # assertion/expectation library such as wrong or the stdlib/minitest
25 | # assertions if you prefer.
26 | config.expect_with :rspec do |expectations|
27 | # This option will default to `true` in RSpec 4. It makes the `description`
28 | # and `failure_message` of custom matchers include text for helper methods
29 | # defined using `chain`, e.g.:
30 | # be_bigger_than(2).and_smaller_than(4).description
31 | # # => "be bigger than 2 and smaller than 4"
32 | # ...rather than:
33 | # # => "be bigger than 2"
34 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35 | end
36 |
37 | # rspec-mocks config goes here. You can use an alternate test double
38 | # library (such as bogus or mocha) by changing the `mock_with` option here.
39 | config.mock_with :rspec do |mocks|
40 | # Prevents you from mocking or stubbing a method that does not exist on
41 | # a real object. This is generally recommended, and will default to
42 | # `true` in RSpec 4.
43 | mocks.verify_partial_doubles = true
44 | end
45 |
46 | # The settings below are suggested to provide a good initial experience
47 | # with RSpec, but feel free to customize to your heart's content.
48 | =begin
49 | # These two settings work together to allow you to limit a spec run
50 | # to individual examples or groups you care about by tagging them with
51 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples
52 | # get run.
53 | config.filter_run :focus
54 | config.run_all_when_everything_filtered = true
55 |
56 | # Allows RSpec to persist some state between runs in order to support
57 | # the `--only-failures` and `--next-failure` CLI options. We recommend
58 | # you configure your source control system to ignore this file.
59 | config.example_status_persistence_file_path = "spec/examples.txt"
60 |
61 | # Limits the available syntax to the non-monkey patched syntax that is
62 | # recommended. For more details, see:
63 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
64 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
66 | config.disable_monkey_patching!
67 |
68 | # Many RSpec users commonly either run the entire suite or an individual
69 | # file, and it's useful to allow more verbose output when running an
70 | # individual spec file.
71 | if config.files_to_run.one?
72 | # Use the documentation formatter for detailed output,
73 | # unless a formatter has already been configured
74 | # (e.g. via a command-line flag).
75 | config.default_formatter = 'doc'
76 | end
77 |
78 | # Print the 10 slowest examples and example groups at the
79 | # end of the spec run, to help surface which specs are running
80 | # particularly slow.
81 | config.profile_examples = 10
82 |
83 | # Run specs in random order to surface order dependencies. If you find an
84 | # order dependency and want to debug it, you can fix the order by providing
85 | # the seed, which is printed after each run.
86 | # --seed 1234
87 | config.order = :random
88 |
89 | # Seed global randomization in this process using the `--seed` CLI option.
90 | # Setting this allows you to use `--seed` to deterministically reproduce
91 | # test failures related to randomization by passing the same `--seed` value
92 | # as the one that triggered the failure.
93 | Kernel.srand config.seed
94 | =end
95 | end
96 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20170211204155) do
15 |
16 | # These are extensions that must be enabled in order to support this database
17 | enable_extension "plpgsql"
18 |
19 | create_table "active_admin_comments", force: :cascade do |t|
20 | t.string "namespace"
21 | t.text "body"
22 | t.string "resource_id", null: false
23 | t.string "resource_type", null: false
24 | t.integer "author_id"
25 | t.string "author_type"
26 | t.datetime "created_at"
27 | t.datetime "updated_at"
28 | end
29 |
30 | add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree
31 | add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree
32 | add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree
33 |
34 | create_table "admin_users", force: :cascade do |t|
35 | t.string "email", default: "", null: false
36 | t.string "encrypted_password", default: "", null: false
37 | t.string "reset_password_token"
38 | t.datetime "reset_password_sent_at"
39 | t.datetime "remember_created_at"
40 | t.integer "sign_in_count", default: 0, null: false
41 | t.datetime "current_sign_in_at"
42 | t.datetime "last_sign_in_at"
43 | t.inet "current_sign_in_ip"
44 | t.inet "last_sign_in_ip"
45 | t.datetime "created_at"
46 | t.datetime "updated_at"
47 | end
48 |
49 | add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree
50 | add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree
51 |
52 | create_table "connections", force: :cascade do |t|
53 | t.integer "requester_id"
54 | t.integer "requested_id"
55 | t.datetime "created_at", null: false
56 | t.datetime "updated_at", null: false
57 | end
58 |
59 | add_index "connections", ["requested_id"], name: "index_connections_on_requested_id", using: :btree
60 | add_index "connections", ["requester_id"], name: "index_connections_on_requester_id", using: :btree
61 |
62 | create_table "contacts", force: :cascade do |t|
63 | t.string "name"
64 | t.string "email"
65 | t.text "comments"
66 | t.datetime "created_at"
67 | t.datetime "updated_at"
68 | end
69 |
70 | create_table "internships", force: :cascade do |t|
71 | t.string "title"
72 | t.string "description"
73 | t.string "application_link"
74 | t.date "deadline"
75 | t.integer "user_id"
76 | t.datetime "created_at"
77 | t.datetime "updated_at"
78 | end
79 |
80 | add_index "internships", ["user_id"], name: "index_internships_on_user_id", using: :btree
81 |
82 | create_table "profiles", force: :cascade do |t|
83 | t.integer "user_id"
84 | t.string "first_name"
85 | t.string "last_name"
86 | t.string "contact_email"
87 | t.string "city"
88 | t.string "state"
89 | t.string "country"
90 | t.text "coding_languages"
91 | t.text "bio"
92 | t.text "mentoring_needs"
93 | t.datetime "created_at"
94 | t.datetime "updated_at"
95 | t.string "avatar_file_name"
96 | t.string "avatar_content_type"
97 | t.integer "avatar_file_size"
98 | t.datetime "avatar_updated_at"
99 | t.boolean "not_available", default: false
100 | t.string "plan_types", default: [], array: true
101 | end
102 |
103 | create_table "users", force: :cascade do |t|
104 | t.string "email", default: "", null: false
105 | t.string "encrypted_password", default: "", null: false
106 | t.string "reset_password_token"
107 | t.datetime "reset_password_sent_at"
108 | t.datetime "remember_created_at"
109 | t.integer "sign_in_count", default: 0, null: false
110 | t.datetime "current_sign_in_at"
111 | t.datetime "last_sign_in_at"
112 | t.string "current_sign_in_ip"
113 | t.string "last_sign_in_ip"
114 | t.datetime "created_at"
115 | t.datetime "updated_at"
116 | end
117 |
118 | add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
119 | add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
120 |
121 | end
122 |
--------------------------------------------------------------------------------
/config/initializers/simple_form_bootstrap.rb:
--------------------------------------------------------------------------------
1 | # Use this setup block to configure all options available in SimpleForm.
2 | SimpleForm.setup do |config|
3 | config.error_notification_class = 'alert alert-danger'
4 | config.button_class = 'btn btn-default'
5 | config.boolean_label_class = nil
6 |
7 | config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
8 | b.use :html5
9 | b.use :placeholder
10 | b.optional :maxlength
11 | b.optional :pattern
12 | b.optional :min_max
13 | b.optional :readonly
14 | b.use :label, class: 'control-label'
15 |
16 | b.use :input, class: 'form-control'
17 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
18 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
19 | end
20 |
21 | config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
22 | b.use :html5
23 | b.use :placeholder
24 | b.optional :maxlength
25 | b.optional :readonly
26 | b.use :label, class: 'control-label'
27 |
28 | b.use :input
29 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
30 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
31 | end
32 |
33 | config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
34 | b.use :html5
35 | b.optional :readonly
36 |
37 | b.wrapper tag: 'div', class: 'checkbox' do |ba|
38 | ba.use :label_input
39 | end
40 |
41 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
42 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
43 | end
44 |
45 | config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
46 | b.use :html5
47 | b.optional :readonly
48 | b.use :label, class: 'control-label'
49 | b.use :input
50 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
51 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
52 | end
53 |
54 | config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
55 | b.use :html5
56 | b.use :placeholder
57 | b.optional :maxlength
58 | b.optional :pattern
59 | b.optional :min_max
60 | b.optional :readonly
61 | b.use :label, class: 'col-sm-3 control-label'
62 |
63 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
64 | ba.use :input, class: 'form-control'
65 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
66 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
67 | end
68 | end
69 |
70 | config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
71 | b.use :html5
72 | b.use :placeholder
73 | b.optional :maxlength
74 | b.optional :readonly
75 | b.use :label, class: 'col-sm-3 control-label'
76 |
77 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
78 | ba.use :input
79 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
80 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
81 | end
82 | end
83 |
84 | config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
85 | b.use :html5
86 | b.optional :readonly
87 |
88 | b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
89 | wr.wrapper tag: 'div', class: 'checkbox' do |ba|
90 | ba.use :label_input
91 | end
92 |
93 | wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
94 | wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
95 | end
96 | end
97 |
98 | config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
99 | b.use :html5
100 | b.optional :readonly
101 |
102 | b.use :label, class: 'col-sm-3 control-label'
103 |
104 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
105 | ba.use :input
106 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
107 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
108 | end
109 | end
110 |
111 | config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
112 | b.use :html5
113 | b.use :placeholder
114 | b.optional :maxlength
115 | b.optional :pattern
116 | b.optional :min_max
117 | b.optional :readonly
118 | b.use :label, class: 'sr-only'
119 |
120 | b.use :input, class: 'form-control'
121 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
122 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
123 | end
124 |
125 | config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
126 | b.use :html5
127 | b.optional :readonly
128 | b.use :label, class: 'control-label'
129 | b.wrapper tag: 'div', class: 'form-inline' do |ba|
130 | ba.use :input, class: 'form-control'
131 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
132 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
133 | end
134 | end
135 | # Wrappers for forms and inputs using the Bootstrap toolkit.
136 | # Check the Bootstrap docs (http://getbootstrap.com)
137 | # to learn about the different styles for forms and inputs,
138 | # buttons and other elements.
139 | config.default_wrapper = :vertical_form
140 | config.wrapper_mappings = {
141 | check_boxes: :vertical_radio_and_checkboxes,
142 | radio_buttons: :vertical_radio_and_checkboxes,
143 | file: :vertical_file_input,
144 | boolean: :vertical_boolean,
145 | datetime: :multi_select,
146 | date: :multi_select,
147 | time: :multi_select
148 | }
149 | end
150 |
--------------------------------------------------------------------------------
/spec/models/profile_model_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | describe Profile do
4 | it "should have a valid factory" do
5 | profile = FactoryGirl.build(:profile)
6 | puts profile.errors.full_messages
7 | expect(profile).to be_valid
8 | end
9 |
10 | describe "Validation" do
11 | it { is_expected.to validate_presence_of :first_name }
12 | it { is_expected.to validate_presence_of :last_name }
13 | it { is_expected.to validate_presence_of :contact_email }
14 | it { is_expected.to validate_presence_of :bio }
15 |
16 | it "should test to see if mentoring_needs is present for mentees" do
17 | profile = FactoryGirl.build(:profile, :mentee, mentoring_needs: nil)
18 | expect{ profile.save }.not_to change(Profile, :count)
19 | expect(profile.errors[:mentoring_needs]).to be_present
20 | end
21 |
22 | it "should test to see if the user's input for coding_languages meets the required min of 1" do
23 | profile = FactoryGirl.build(:profile, coding_languages: "")
24 | expect{ profile.save }.not_to change(Profile, :count)
25 | expect(profile.errors[:coding_languages]).to be_present
26 | end
27 |
28 | it "should test to see if the user's input for coding_languages meets the required max of 500" do
29 | profile = FactoryGirl.build(:profile, coding_languages: SecureRandom.hex(251) )
30 | expect{ profile.save }.not_to change(Profile, :count)
31 | expect(profile.errors[:coding_languages]).to be_present
32 | end
33 |
34 | it "should test to see if the user's input for mentoring_needs meets the required min of 1" do
35 | profile = FactoryGirl.build(:profile, :mentee, mentoring_needs: "")
36 | expect{ profile.save }.not_to change(Profile, :count)
37 | expect(profile.errors[:mentoring_needs]).to be_present
38 | end
39 |
40 | it "should test to see if the user's input for mentoring_needs meets the required max of 500" do
41 | profile = FactoryGirl.build(:profile, :mentee, mentoring_needs: SecureRandom.hex(251) )
42 | expect{ profile.save }.not_to change(Profile, :count)
43 | expect(profile.errors[:mentoring_needs]).to be_present
44 | end
45 |
46 | it "should test to see if the user's input for bio meets the required min of 1" do
47 | profile = FactoryGirl.build(:profile, bio: "")
48 | expect{ profile.save }.not_to change(Profile, :count)
49 | expect(profile.errors[:bio]).to be_present
50 | end
51 |
52 | it "should test to see if the user's input for bio meets the required max of 1000" do
53 | profile = FactoryGirl.build(:profile, bio: SecureRandom.hex(501) )
54 | expect{ profile.save }.not_to change(Profile, :count)
55 | expect(profile.errors[:bio]).to be_present
56 | end
57 | end
58 |
59 | describe '#mentor?' do
60 | it 'is true for user with a mentor profile plan' do
61 | profile = create(:profile, :mentor)
62 | expect(profile.mentor?).to be_truthy
63 | end
64 |
65 | it 'is false for user with no mentor profile plan' do
66 | profile = create(:profile)
67 | expect(profile.mentor?).to be_falsey
68 | end
69 | end
70 |
71 | describe '#mentee?' do
72 | it 'is true for user with a mentee profile plan' do
73 | profile = create(:profile, :mentee)
74 | expect(profile.mentee?).to be_truthy
75 | end
76 |
77 | it 'is false for user with no mentee profile plan' do
78 | profile = create(:profile)
79 | expect(profile.mentee?).to be_falsey
80 | end
81 | end
82 |
83 | describe "Association" do
84 | describe "profile" do
85 | it 'belong_to a user' do
86 | profile = FactoryGirl.create(:profile)
87 | user = FactoryGirl.build(:user, profile: profile)
88 | expect(user.profile).to eq profile
89 | end
90 | end
91 | end
92 |
93 | describe "ClassMethods" do
94 | before :all do
95 | DatabaseCleaner.start
96 | mentor_users = create_list(:user, 3)
97 | mentee_users = create_list(:user, 4)
98 | @mentors = []
99 | @mentees = []
100 | mentor_users.each_with_index do |mentor, index|
101 | not_available = (index == 0 ? true : false)
102 | @mentors << FactoryGirl.create(:profile, :mentor, user: mentor, not_available: not_available)
103 | end
104 |
105 | mentee_users.each_with_index do |mentee, index|
106 | not_available = (index == 0 ? true : false)
107 | @mentees << FactoryGirl.create(:profile, :mentee, user: mentee, not_available: not_available)
108 | end
109 |
110 | @available_mentors = Profile.mentors
111 | @available_mentees = Profile.mentees
112 | end
113 |
114 | after :all do
115 | DatabaseCleaner.clean
116 | end
117 |
118 | describe "#Mentors" do
119 | it "lists all available mentors" do
120 | expect(@available_mentors.count).to eq 2
121 | end
122 |
123 | it "doesn't list mentees" do
124 | expect(@available_mentors).not_to include @mentees[0]
125 | end
126 |
127 | it "lists mentors" do
128 | expect(@available_mentors).to include @mentors[1]
129 | end
130 |
131 | it "doesn't list unavailable mentors" do
132 | expect(@available_mentors).not_to include @mentors[0]
133 | end
134 |
135 | end
136 |
137 | describe "#Mentees" do
138 | it "lists all available mentees" do
139 | expect(@available_mentees.count).to eq 3
140 | end
141 |
142 | it "doesn't list mentors" do
143 | expect(@available_mentees).not_to include @mentors[1]
144 | end
145 |
146 | it "lists mentors" do
147 | expect(@available_mentees).to include @mentees[1]
148 | end
149 | it "doesn't list unavailable mentees" do
150 | expect(@available_mentees).not_to include @mentees[0]
151 | end
152 | end
153 | end
154 | end
--------------------------------------------------------------------------------
/app/assets/javascripts/areyousure/areyousure.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery Plugin: Are-You-Sure (Dirty Form Detection)
3 | * https://github.com/codedance/jquery.AreYouSure/
4 | *
5 | * Copyright (c) 2012-2014, Chris Dance and PaperCut Software http://www.papercut.com/
6 | * Dual licensed under the MIT or GPL Version 2 licenses.
7 | * http://jquery.org/license
8 | *
9 | * Author: chris.dance@papercut.com
10 | * Version: 1.9.0
11 | * Date: 13th August 2014
12 | */
13 | (function($) {
14 |
15 | $.fn.areYouSure = function(options) {
16 |
17 | var settings = $.extend(
18 | {
19 | 'message' : 'You have unsaved changes!',
20 | 'dirtyClass' : 'dirty',
21 | 'change' : null,
22 | 'silent' : false,
23 | 'addRemoveFieldsMarksDirty' : false,
24 | 'fieldEvents' : 'change keyup propertychange input',
25 | 'fieldSelector': ":input:not(input[type=submit]):not(input[type=button])"
26 | }, options);
27 |
28 | var getValue = function($field) {
29 | if ($field.hasClass('ays-ignore')
30 | || $field.hasClass('aysIgnore')
31 | || $field.attr('data-ays-ignore')
32 | || $field.attr('name') === undefined) {
33 | return null;
34 | }
35 |
36 | if ($field.is(':disabled')) {
37 | return 'ays-disabled';
38 | }
39 |
40 | var val;
41 | var type = $field.attr('type');
42 | if ($field.is('select')) {
43 | type = 'select';
44 | }
45 |
46 | switch (type) {
47 | case 'checkbox':
48 | case 'radio':
49 | val = $field.is(':checked');
50 | break;
51 | case 'select':
52 | val = '';
53 | $field.find('option').each(function(o) {
54 | var $option = $(this);
55 | if ($option.is(':selected')) {
56 | val += $option.val();
57 | }
58 | });
59 | break;
60 | default:
61 | val = $field.val();
62 | }
63 |
64 | return val;
65 | };
66 |
67 | var storeOrigValue = function($field) {
68 | $field.data('ays-orig', getValue($field));
69 | };
70 |
71 | var checkForm = function(evt) {
72 |
73 | var isFieldDirty = function($field) {
74 | var origValue = $field.data('ays-orig');
75 | if (undefined === origValue) {
76 | return false;
77 | }
78 | return (getValue($field) != origValue);
79 | };
80 |
81 | var $form = ($(this).is('form'))
82 | ? $(this)
83 | : $(this).parents('form');
84 |
85 | // Test on the target first as it's the most likely to be dirty
86 | if (isFieldDirty($(evt.target))) {
87 | setDirtyStatus($form, true);
88 | return;
89 | }
90 |
91 | $fields = $form.find(settings.fieldSelector);
92 |
93 | if (settings.addRemoveFieldsMarksDirty) {
94 | // Check if field count has changed
95 | var origCount = $form.data("ays-orig-field-count");
96 | if (origCount != $fields.length) {
97 | setDirtyStatus($form, true);
98 | return;
99 | }
100 | }
101 |
102 | // Brute force - check each field
103 | var isDirty = false;
104 | $fields.each(function() {
105 | $field = $(this);
106 | if (isFieldDirty($field)) {
107 | isDirty = true;
108 | return false; // break
109 | }
110 | });
111 |
112 | setDirtyStatus($form, isDirty);
113 | };
114 |
115 | var initForm = function($form) {
116 | var fields = $form.find(settings.fieldSelector);
117 | $(fields).each(function() { storeOrigValue($(this)); });
118 | $(fields).unbind(settings.fieldEvents, checkForm);
119 | $(fields).bind(settings.fieldEvents, checkForm);
120 | $form.data("ays-orig-field-count", $(fields).length);
121 | setDirtyStatus($form, false);
122 | };
123 |
124 | var setDirtyStatus = function($form, isDirty) {
125 | var changed = isDirty != $form.hasClass(settings.dirtyClass);
126 | $form.toggleClass(settings.dirtyClass, isDirty);
127 |
128 | // Fire change event if required
129 | if (changed) {
130 | if (settings.change) settings.change.call($form, $form);
131 |
132 | if (isDirty) $form.trigger('dirty.areYouSure', [$form]);
133 | if (!isDirty) $form.trigger('clean.areYouSure', [$form]);
134 | $form.trigger('change.areYouSure', [$form]);
135 | }
136 | };
137 |
138 | var rescan = function() {
139 | var $form = $(this);
140 | var fields = $form.find(settings.fieldSelector);
141 | $(fields).each(function() {
142 | var $field = $(this);
143 | if (!$field.data('ays-orig')) {
144 | storeOrigValue($field);
145 | $field.bind(settings.fieldEvents, checkForm);
146 | }
147 | });
148 | // Check for changes while we're here
149 | $form.trigger('checkform.areYouSure');
150 | };
151 |
152 | var reinitialize = function() {
153 | initForm($(this));
154 | }
155 |
156 | if (!settings.silent && !window.aysUnloadSet) {
157 | window.aysUnloadSet = true;
158 | $(window).bind('beforeunload', function() {
159 | $dirtyForms = $("form").filter('.' + settings.dirtyClass);
160 | if ($dirtyForms.length == 0) {
161 | return;
162 | }
163 | // Prevent multiple prompts - seen on Chrome and IE
164 | if (navigator.userAgent.toLowerCase().match(/msie|chrome/)) {
165 | if (window.aysHasPrompted) {
166 | return;
167 | }
168 | window.aysHasPrompted = true;
169 | window.setTimeout(function() {window.aysHasPrompted = false;}, 900);
170 | }
171 | return settings.message;
172 | });
173 | }
174 |
175 | return this.each(function(elem) {
176 | if (!$(this).is('form')) {
177 | return;
178 | }
179 | var $form = $(this);
180 |
181 | $form.submit(function() {
182 | $form.removeClass(settings.dirtyClass);
183 | });
184 | $form.bind('reset', function() { setDirtyStatus($form, false); });
185 | // Add a custom events
186 | $form.bind('rescan.areYouSure', rescan);
187 | $form.bind('reinitialize.areYouSure', reinitialize);
188 | $form.bind('checkform.areYouSure', checkForm);
189 | initForm($form);
190 | });
191 | };
192 | })(jQuery);
--------------------------------------------------------------------------------
/config/initializers/simple_form.rb:
--------------------------------------------------------------------------------
1 | # Use this setup block to configure all options available in SimpleForm.
2 | SimpleForm.setup do |config|
3 | # Wrappers are used by the form builder to generate a
4 | # complete input. You can remove any component from the
5 | # wrapper, change the order or even add your own to the
6 | # stack. The options given below are used to wrap the
7 | # whole input.
8 | config.wrappers :default, class: :input,
9 | hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10 | ## Extensions enabled by default
11 | # Any of these extensions can be disabled for a
12 | # given input by passing: `f.input EXTENSION_NAME => false`.
13 | # You can make any of these extensions optional by
14 | # renaming `b.use` to `b.optional`.
15 |
16 | # Determines whether to use HTML5 (:email, :url, ...)
17 | # and required attributes
18 | b.use :html5
19 |
20 | # Calculates placeholders automatically from I18n
21 | # You can also pass a string as f.input placeholder: "Placeholder"
22 | b.use :placeholder
23 |
24 | ## Optional extensions
25 | # They are disabled unless you pass `f.input EXTENSION_NAME => true`
26 | # to the input. If so, they will retrieve the values from the model
27 | # if any exists. If you want to enable any of those
28 | # extensions by default, you can change `b.optional` to `b.use`.
29 |
30 | # Calculates maxlength from length validations for string inputs
31 | b.optional :maxlength
32 |
33 | # Calculates pattern from format validations for string inputs
34 | b.optional :pattern
35 |
36 | # Calculates min and max from length validations for numeric inputs
37 | b.optional :min_max
38 |
39 | # Calculates readonly automatically from readonly attributes
40 | b.optional :readonly
41 |
42 | ## Inputs
43 | b.use :label_input
44 | b.use :hint, wrap_with: { tag: :span, class: :hint }
45 | b.use :error, wrap_with: { tag: :span, class: :error }
46 |
47 | ## full_messages_for
48 | # If you want to display the full error message for the attribute, you can
49 | # use the component :full_error, like:
50 | #
51 | # b.use :full_error, wrap_with: { tag: :span, class: :error }
52 | end
53 |
54 | # The default wrapper to be used by the FormBuilder.
55 | config.default_wrapper = :default
56 |
57 | # Define the way to render check boxes / radio buttons with labels.
58 | # Defaults to :nested for bootstrap config.
59 | # inline: input + label
60 | # nested: label > input
61 | config.boolean_style = :nested
62 |
63 | # Default class for buttons
64 | config.button_class = 'btn'
65 |
66 | # Method used to tidy up errors. Specify any Rails Array method.
67 | # :first lists the first message for each field.
68 | # Use :to_sentence to list all errors for each field.
69 | # config.error_method = :first
70 |
71 | # Default tag used for error notification helper.
72 | config.error_notification_tag = :div
73 |
74 | # CSS class to add for error notification helper.
75 | config.error_notification_class = 'error_notification'
76 |
77 | # ID to add for error notification helper.
78 | # config.error_notification_id = nil
79 |
80 | # Series of attempts to detect a default label method for collection.
81 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
82 |
83 | # Series of attempts to detect a default value method for collection.
84 | # config.collection_value_methods = [ :id, :to_s ]
85 |
86 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
87 | # config.collection_wrapper_tag = nil
88 |
89 | # You can define the class to use on all collection wrappers. Defaulting to none.
90 | # config.collection_wrapper_class = nil
91 |
92 | # You can wrap each item in a collection of radio/check boxes with a tag,
93 | # defaulting to :span.
94 | # config.item_wrapper_tag = :span
95 |
96 | # You can define a class to use in all item wrappers. Defaulting to none.
97 | # config.item_wrapper_class = nil
98 |
99 | # How the label text should be generated altogether with the required text.
100 | # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
101 |
102 | # You can define the class to use on all labels. Default is nil.
103 | # config.label_class = nil
104 |
105 | # You can define the default class to be used on forms. Can be overriden
106 | # with `html: { :class }`. Defaulting to none.
107 | # config.default_form_class = nil
108 |
109 | # You can define which elements should obtain additional classes
110 | # config.generate_additional_classes_for = [:wrapper, :label, :input]
111 |
112 | # Whether attributes are required by default (or not). Default is true.
113 | # config.required_by_default = true
114 |
115 | # Tell browsers whether to use the native HTML5 validations (novalidate form option).
116 | # These validations are enabled in SimpleForm's internal config but disabled by default
117 | # in this configuration, which is recommended due to some quirks from different browsers.
118 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
119 | # change this configuration to true.
120 | config.browser_validations = false
121 |
122 | # Collection of methods to detect if a file type was given.
123 | # config.file_methods = [ :mounted_as, :file?, :public_filename ]
124 |
125 | # Custom mappings for input types. This should be a hash containing a regexp
126 | # to match as key, and the input type that will be used when the field name
127 | # matches the regexp as value.
128 | # config.input_mappings = { /count/ => :integer }
129 |
130 | # Custom wrappers for input types. This should be a hash containing an input
131 | # type as key and the wrapper that will be used for all inputs with specified type.
132 | # config.wrapper_mappings = { string: :prepend }
133 |
134 | # Namespaces where SimpleForm should look for custom input classes that
135 | # override default inputs.
136 | # config.custom_inputs_namespaces << "CustomInputs"
137 |
138 | # Default priority for time_zone inputs.
139 | # config.time_zone_priority = nil
140 |
141 | # Default priority for country inputs.
142 | # config.country_priority = nil
143 |
144 | # When false, do not use translations for labels.
145 | # config.translate_labels = true
146 |
147 | # Automatically discover new inputs in Rails' autoload path.
148 | # config.inputs_discovery = true
149 |
150 | # Cache SimpleForm inputs discovery
151 | # config.cache_discovery = !Rails.env.development?
152 |
153 | # Default class for inputs
154 | # config.input_class = nil
155 |
156 | # Define the default class of the input wrapper of the boolean input.
157 | config.boolean_label_class = 'checkbox'
158 |
159 | # Defines if the default input wrapper class should be included in radio
160 | # collection wrappers.
161 | # config.include_default_input_wrapper_class = true
162 |
163 | # Defines which i18n scope will be used in Simple Form.
164 | # config.i18n_scope = 'simple_form'
165 | end
166 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actionmailer (4.2.7)
5 | actionpack (= 4.2.7)
6 | actionview (= 4.2.7)
7 | activejob (= 4.2.7)
8 | mail (~> 2.5, >= 2.5.4)
9 | rails-dom-testing (~> 1.0, >= 1.0.5)
10 | actionpack (4.2.7)
11 | actionview (= 4.2.7)
12 | activesupport (= 4.2.7)
13 | rack (~> 1.6)
14 | rack-test (~> 0.6.2)
15 | rails-dom-testing (~> 1.0, >= 1.0.5)
16 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
17 | actionview (4.2.7)
18 | activesupport (= 4.2.7)
19 | builder (~> 3.1)
20 | erubis (~> 2.7.0)
21 | rails-dom-testing (~> 1.0, >= 1.0.5)
22 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
23 | activeadmin (1.0.0)
24 | arbre (>= 1.1.1)
25 | bourbon
26 | coffee-rails
27 | formtastic (~> 3.1)
28 | formtastic_i18n
29 | inherited_resources (~> 1.7)
30 | jquery-rails
31 | jquery-ui-rails
32 | kaminari (>= 0.15, < 2.0)
33 | railties (>= 4.2, < 5.2)
34 | ransack (~> 1.3)
35 | sass-rails
36 | sprockets (< 4.1)
37 | activejob (4.2.7)
38 | activesupport (= 4.2.7)
39 | globalid (>= 0.3.0)
40 | activemodel (4.2.7)
41 | activesupport (= 4.2.7)
42 | builder (~> 3.1)
43 | activerecord (4.2.7)
44 | activemodel (= 4.2.7)
45 | activesupport (= 4.2.7)
46 | arel (~> 6.0)
47 | activesupport (4.2.7)
48 | i18n (~> 0.7)
49 | json (~> 1.7, >= 1.7.7)
50 | minitest (~> 5.1)
51 | thread_safe (~> 0.3, >= 0.3.4)
52 | tzinfo (~> 1.1)
53 | addressable (2.5.1)
54 | public_suffix (~> 2.0, >= 2.0.2)
55 | arbre (1.1.1)
56 | activesupport (>= 3.0.0)
57 | arel (6.0.4)
58 | autoprefixer-rails (7.1.2.3)
59 | execjs
60 | aws-sdk (1.66.0)
61 | aws-sdk-v1 (= 1.66.0)
62 | aws-sdk-v1 (1.66.0)
63 | json (~> 1.4)
64 | nokogiri (>= 1.4.4)
65 | bcrypt (3.1.11)
66 | bootstrap-sass (3.3.7)
67 | autoprefixer-rails (>= 5.2.1)
68 | sass (>= 3.3.4)
69 | bourbon (4.3.4)
70 | sass (~> 3.4)
71 | thor (~> 0.19)
72 | builder (3.2.3)
73 | climate_control (0.2.0)
74 | cocaine (0.5.8)
75 | climate_control (>= 0.0.3, < 1.0)
76 | coderay (1.1.1)
77 | coffee-rails (4.2.2)
78 | coffee-script (>= 2.2.0)
79 | railties (>= 4.0.0)
80 | coffee-script (2.4.1)
81 | coffee-script-source
82 | execjs
83 | coffee-script-source (1.12.2)
84 | concurrent-ruby (1.0.5)
85 | database_cleaner (1.6.1)
86 | devise (4.3.0)
87 | bcrypt (~> 3.0)
88 | orm_adapter (~> 0.1)
89 | railties (>= 4.1.0, < 5.2)
90 | responders
91 | warden (~> 1.2.3)
92 | diff-lcs (1.3)
93 | docile (1.1.5)
94 | erubis (2.7.0)
95 | execjs (2.7.0)
96 | factory_girl (4.8.0)
97 | activesupport (>= 3.0.0)
98 | factory_girl_rails (4.8.0)
99 | factory_girl (~> 4.8.0)
100 | railties (>= 3.0.0)
101 | faker (1.8.4)
102 | i18n (~> 0.5)
103 | ffi (1.9.18)
104 | figaro (1.1.1)
105 | thor (~> 0.14)
106 | formtastic (3.1.5)
107 | actionpack (>= 3.2.13)
108 | formtastic_i18n (0.6.0)
109 | globalid (0.4.0)
110 | activesupport (>= 4.2.0)
111 | has_scope (0.7.1)
112 | actionpack (>= 4.1, < 5.2)
113 | activesupport (>= 4.1, < 5.2)
114 | i18n (0.8.6)
115 | inherited_resources (1.7.2)
116 | actionpack (>= 3.2, < 5.2.x)
117 | has_scope (~> 0.6)
118 | railties (>= 3.2, < 5.2.x)
119 | responders
120 | jquery-rails (4.3.1)
121 | rails-dom-testing (>= 1, < 3)
122 | railties (>= 4.2.0)
123 | thor (>= 0.14, < 2.0)
124 | jquery-ui-rails (6.0.1)
125 | railties (>= 3.2.16)
126 | json (1.8.6)
127 | kaminari (1.0.1)
128 | activesupport (>= 4.1.0)
129 | kaminari-actionview (= 1.0.1)
130 | kaminari-activerecord (= 1.0.1)
131 | kaminari-core (= 1.0.1)
132 | kaminari-actionview (1.0.1)
133 | actionview
134 | kaminari-core (= 1.0.1)
135 | kaminari-activerecord (1.0.1)
136 | activerecord
137 | kaminari-core (= 1.0.1)
138 | kaminari-core (1.0.1)
139 | launchy (2.4.3)
140 | addressable (~> 2.3)
141 | letter_opener (1.4.1)
142 | launchy (~> 2.2)
143 | loofah (2.0.3)
144 | nokogiri (>= 1.5.9)
145 | mail (2.6.6)
146 | mime-types (>= 1.16, < 4)
147 | method_source (0.8.2)
148 | mime-types (3.1)
149 | mime-types-data (~> 3.2015)
150 | mime-types-data (3.2016.0521)
151 | mini_portile2 (2.2.0)
152 | minitest (5.10.3)
153 | multi_json (1.12.1)
154 | nokogiri (1.8.0)
155 | mini_portile2 (~> 2.2.0)
156 | orm_adapter (0.5.0)
157 | paperclip (4.2.1)
158 | activemodel (>= 3.0.0)
159 | activesupport (>= 3.0.0)
160 | cocaine (~> 0.5.3)
161 | mime-types
162 | pg (0.21.0)
163 | pg_search (2.1.0)
164 | activerecord (>= 4.2)
165 | activesupport (>= 4.2)
166 | arel (>= 6)
167 | polyamorous (1.3.1)
168 | activerecord (>= 3.0)
169 | pry (0.10.4)
170 | coderay (~> 1.1.0)
171 | method_source (~> 0.8.1)
172 | slop (~> 3.4)
173 | public_suffix (2.0.5)
174 | rack (1.6.8)
175 | rack-test (0.6.3)
176 | rack (>= 1.0)
177 | rails (4.2.7)
178 | actionmailer (= 4.2.7)
179 | actionpack (= 4.2.7)
180 | actionview (= 4.2.7)
181 | activejob (= 4.2.7)
182 | activemodel (= 4.2.7)
183 | activerecord (= 4.2.7)
184 | activesupport (= 4.2.7)
185 | bundler (>= 1.3.0, < 2.0)
186 | railties (= 4.2.7)
187 | sprockets-rails
188 | rails-deprecated_sanitizer (1.0.3)
189 | activesupport (>= 4.2.0.alpha)
190 | rails-dom-testing (1.0.8)
191 | activesupport (>= 4.2.0.beta, < 5.0)
192 | nokogiri (~> 1.6)
193 | rails-deprecated_sanitizer (>= 1.0.1)
194 | rails-html-sanitizer (1.0.3)
195 | loofah (~> 2.0)
196 | rails_12factor (0.0.3)
197 | rails_serve_static_assets
198 | rails_stdout_logging
199 | rails_serve_static_assets (0.0.5)
200 | rails_stdout_logging (0.0.5)
201 | railties (4.2.7)
202 | actionpack (= 4.2.7)
203 | activesupport (= 4.2.7)
204 | rake (>= 0.8.7)
205 | thor (>= 0.18.1, < 2.0)
206 | rake (12.0.0)
207 | ransack (1.8.3)
208 | actionpack (>= 3.0)
209 | activerecord (>= 3.0)
210 | activesupport (>= 3.0)
211 | i18n
212 | polyamorous (~> 1.3)
213 | rb-fsevent (0.10.2)
214 | rb-inotify (0.9.10)
215 | ffi (>= 0.5.0, < 2)
216 | responders (2.4.0)
217 | actionpack (>= 4.2.0, < 5.3)
218 | railties (>= 4.2.0, < 5.3)
219 | rollbar (2.15.0)
220 | multi_json
221 | rspec-core (3.6.0)
222 | rspec-support (~> 3.6.0)
223 | rspec-expectations (3.6.0)
224 | diff-lcs (>= 1.2.0, < 2.0)
225 | rspec-support (~> 3.6.0)
226 | rspec-mocks (3.6.0)
227 | diff-lcs (>= 1.2.0, < 2.0)
228 | rspec-support (~> 3.6.0)
229 | rspec-rails (3.6.0)
230 | actionpack (>= 3.0)
231 | activesupport (>= 3.0)
232 | railties (>= 3.0)
233 | rspec-core (~> 3.6.0)
234 | rspec-expectations (~> 3.6.0)
235 | rspec-mocks (~> 3.6.0)
236 | rspec-support (~> 3.6.0)
237 | rspec-support (3.6.0)
238 | sass (3.5.1)
239 | sass-listen (~> 4.0.0)
240 | sass-listen (4.0.0)
241 | rb-fsevent (~> 0.9, >= 0.9.4)
242 | rb-inotify (~> 0.9, >= 0.9.7)
243 | sass-rails (5.0.6)
244 | railties (>= 4.0.0, < 6)
245 | sass (~> 3.1)
246 | sprockets (>= 2.8, < 4.0)
247 | sprockets-rails (>= 2.0, < 4.0)
248 | tilt (>= 1.1, < 3)
249 | shoulda-matchers (3.1.2)
250 | activesupport (>= 4.0.0)
251 | simple_form (3.5.0)
252 | actionpack (> 4, < 5.2)
253 | activemodel (> 4, < 5.2)
254 | simplecov (0.14.1)
255 | docile (~> 1.1.0)
256 | json (>= 1.8, < 3)
257 | simplecov-html (~> 0.10.0)
258 | simplecov-html (0.10.1)
259 | slop (3.6.0)
260 | sprockets (3.7.1)
261 | concurrent-ruby (~> 1.0)
262 | rack (> 1, < 3)
263 | sprockets-rails (3.2.0)
264 | actionpack (>= 4.0)
265 | activesupport (>= 4.0)
266 | sprockets (>= 3.0.0)
267 | thor (0.19.4)
268 | thread_safe (0.3.6)
269 | tilt (2.0.8)
270 | tzinfo (1.2.3)
271 | thread_safe (~> 0.1)
272 | uglifier (3.2.0)
273 | execjs (>= 0.3.0, < 3)
274 | warden (1.2.7)
275 | rack (>= 1.0)
276 |
277 | PLATFORMS
278 | ruby
279 |
280 | DEPENDENCIES
281 | activeadmin (~> 1.0.0.pre1)
282 | autoprefixer-rails
283 | aws-sdk (< 2.0)
284 | bootstrap-sass (~> 3.3.6)
285 | coffee-rails
286 | database_cleaner
287 | devise
288 | factory_girl_rails
289 | faker
290 | figaro
291 | jquery-rails
292 | letter_opener
293 | paperclip (= 4.2.1)
294 | pg
295 | pg_search
296 | pry
297 | rails (= 4.2.7)
298 | rails_12factor
299 | rollbar
300 | rspec-rails (~> 3.0)
301 | sass-rails (>= 3.2)
302 | shoulda-matchers (~> 3.1)
303 | simple_form
304 | simplecov
305 | uglifier
306 |
307 | RUBY VERSION
308 | ruby 2.3.0p0
309 |
310 | BUNDLED WITH
311 | 1.14.3
312 |
--------------------------------------------------------------------------------
/config/initializers/active_admin.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.setup do |config|
2 | # == Site Title
3 | #
4 | # Set the title that is displayed on the main layout
5 | # for each of the active admin pages.
6 | #
7 | config.site_title = "Workspace"
8 |
9 | # Set the link url for the title. For example, to take
10 | # users to your main site. Defaults to no link.
11 | #
12 | # config.site_title_link = "/"
13 |
14 | # Set an optional image to be displayed for the header
15 | # instead of a string (overrides :site_title)
16 | #
17 | # Note: Aim for an image that's 21px high so it fits in the header.
18 | #
19 | # config.site_title_image = "logo.png"
20 |
21 | # == Default Namespace
22 | #
23 | # Set the default namespace each administration resource
24 | # will be added to.
25 | #
26 | # eg:
27 | # config.default_namespace = :hello_world
28 | #
29 | # This will create resources in the HelloWorld module and
30 | # will namespace routes to /hello_world/*
31 | #
32 | # To set no namespace by default, use:
33 | # config.default_namespace = false
34 | #
35 | # Default:
36 | # config.default_namespace = :admin
37 | #
38 | # You can customize the settings for each namespace by using
39 | # a namespace block. For example, to change the site title
40 | # within a namespace:
41 | #
42 | # config.namespace :admin do |admin|
43 | # admin.site_title = "Custom Admin Title"
44 | # end
45 | #
46 | # This will ONLY change the title for the admin section. Other
47 | # namespaces will continue to use the main "site_title" configuration.
48 |
49 | # == User Authentication
50 | #
51 | # Active Admin will automatically call an authentication
52 | # method in a before filter of all controller actions to
53 | # ensure that there is a currently logged in admin user.
54 | #
55 | # This setting changes the method which Active Admin calls
56 | # within the application controller.
57 | config.authentication_method = :authenticate_admin_user!
58 |
59 | # == User Authorization
60 | #
61 | # Active Admin will automatically call an authorization
62 | # method in a before filter of all controller actions to
63 | # ensure that there is a user with proper rights. You can use
64 | # CanCanAdapter or make your own. Please refer to documentation.
65 | # config.authorization_adapter = ActiveAdmin::CanCanAdapter
66 |
67 | # In case you prefer Pundit over other solutions you can here pass
68 | # the name of default policy class. This policy will be used in every
69 | # case when Pundit is unable to find suitable policy.
70 | # config.pundit_default_policy = "MyDefaultPunditPolicy"
71 |
72 | # You can customize your CanCan Ability class name here.
73 | # config.cancan_ability_class = "Ability"
74 |
75 | # You can specify a method to be called on unauthorized access.
76 | # This is necessary in order to prevent a redirect loop which happens
77 | # because, by default, user gets redirected to Dashboard. If user
78 | # doesn't have access to Dashboard, he'll end up in a redirect loop.
79 | # Method provided here should be defined in application_controller.rb.
80 | # config.on_unauthorized_access = :access_denied
81 |
82 | # == Current User
83 | #
84 | # Active Admin will associate actions with the current
85 | # user performing them.
86 | #
87 | # This setting changes the method which Active Admin calls
88 | # (within the application controller) to return the currently logged in user.
89 | config.current_user_method = :current_admin_user
90 |
91 | # == Logging Out
92 | #
93 | # Active Admin displays a logout link on each screen. These
94 | # settings configure the location and method used for the link.
95 | #
96 | # This setting changes the path where the link points to. If it's
97 | # a string, the strings is used as the path. If it's a Symbol, we
98 | # will call the method to return the path.
99 | #
100 | # Default:
101 | config.logout_link_path = :destroy_admin_user_session_path
102 |
103 | # This setting changes the http method used when rendering the
104 | # link. For example :get, :delete, :put, etc..
105 | #
106 | # Default:
107 | # config.logout_link_method = :get
108 |
109 | # == Root
110 | #
111 | # Set the action to call for the root path. You can set different
112 | # roots for each namespace.
113 | #
114 | # Default:
115 | # config.root_to = 'dashboard#index'
116 |
117 | # == Admin Comments
118 | #
119 | # This allows your users to comment on any resource registered with Active Admin.
120 | #
121 | # You can completely disable comments:
122 | # config.comments = false
123 | #
124 | # You can disable the menu item for the comments index page:
125 | # config.show_comments_in_menu = false
126 | #
127 | # You can change the name under which comments are registered:
128 | # config.comments_registration_name = 'AdminComment'
129 | #
130 | # You can change the order for the comments and you can change the column
131 | # to be used for ordering
132 | # config.comments_order = 'created_at ASC'
133 |
134 | # == Batch Actions
135 | #
136 | # Enable and disable Batch Actions
137 | #
138 | config.batch_actions = true
139 |
140 | # == Controller Filters
141 | #
142 | # You can add before, after and around filters to all of your
143 | # Active Admin resources and pages from here.
144 | #
145 | # config.before_filter :do_something_awesome
146 |
147 | # == Localize Date/Time Format
148 | #
149 | # Set the localize format to display dates and times.
150 | # To understand how to localize your app with I18n, read more at
151 | # https://github.com/svenfuchs/i18n/blob/master/lib%2Fi18n%2Fbackend%2Fbase.rb#L52
152 | #
153 | config.localize_format = :long
154 |
155 | # == Setting a Favicon
156 | #
157 | # config.favicon = 'favicon.ico'
158 |
159 | # == Meta Tags
160 | #
161 | # Add additional meta tags to the head element of active admin pages.
162 | #
163 | # Add tags to all pages logged in users see:
164 | # config.meta_tags = { author: 'My Company' }
165 |
166 | # By default, sign up/sign in/recover password pages are excluded
167 | # from showing up in search engine results by adding a robots meta
168 | # tag. You can reset the hash of meta tags included in logged out
169 | # pages:
170 | # config.meta_tags_for_logged_out_pages = {}
171 |
172 | # == Removing Breadcrumbs
173 | #
174 | # Breadcrumbs are enabled by default. You can customize them for individual
175 | # resources or you can disable them globally from here.
176 | #
177 | # config.breadcrumb = false
178 |
179 | # == Register Stylesheets & Javascripts
180 | #
181 | # We recommend using the built in Active Admin layout and loading
182 | # up your own stylesheets / javascripts to customize the look
183 | # and feel.
184 | #
185 | # To load a stylesheet:
186 | # config.register_stylesheet 'my_stylesheet.css'
187 | #
188 | # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
189 | # config.register_stylesheet 'my_print_stylesheet.css', media: :print
190 | #
191 | # To load a javascript file:
192 | # config.register_javascript 'my_javascript.js'
193 |
194 | # == CSV options
195 | #
196 | # Set the CSV builder separator
197 | # config.csv_options = { col_sep: ';' }
198 | #
199 | # Force the use of quotes
200 | # config.csv_options = { force_quotes: true }
201 |
202 | # == Menu System
203 | #
204 | # You can add a navigation menu to be used in your application, or configure a provided menu
205 | #
206 | # To change the default utility navigation to show a link to your website & a logout btn
207 | #
208 | # config.namespace :admin do |admin|
209 | # admin.build_menu :utility_navigation do |menu|
210 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
211 | # admin.add_logout_button_to_menu menu
212 | # end
213 | # end
214 | #
215 | # If you wanted to add a static menu item to the default menu provided:
216 | #
217 | # config.namespace :admin do |admin|
218 | # admin.build_menu :default do |menu|
219 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
220 | # end
221 | # end
222 |
223 | # == Download Links
224 | #
225 | # You can disable download links on resource listing pages,
226 | # or customize the formats shown per namespace/globally
227 | #
228 | # To disable/customize for the :admin namespace:
229 | #
230 | # config.namespace :admin do |admin|
231 | #
232 | # # Disable the links entirely
233 | # admin.download_links = false
234 | #
235 | # # Only show XML & PDF options
236 | # admin.download_links = [:xml, :pdf]
237 | #
238 | # # Enable/disable the links based on block
239 | # # (for example, with cancan)
240 | # admin.download_links = proc { can?(:view_download_links) }
241 | #
242 | # end
243 |
244 | # == Pagination
245 | #
246 | # Pagination is enabled by default for all resources.
247 | # You can control the default per page count for all resources here.
248 | #
249 | # config.default_per_page = 30
250 | #
251 | # You can control the max per page count too.
252 | #
253 | # config.max_per_page = 10_000
254 |
255 | # == Filters
256 | #
257 | # By default the index screen includes a "Filters" sidebar on the right
258 | # hand side with a filter for each attribute of the registered model.
259 | # You can enable or disable them for all resources here.
260 | #
261 | # config.filters = true
262 | end
263 |
--------------------------------------------------------------------------------
/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 | # config.secret_key = '375afc90410724546cfd4aaf3af2206706fce2790391eb68670e4fdf95159e5efbd163e27a22ca21e511f44d0eafd90dda19b176a59e7d28076249cecf662f71'
8 |
9 | # ==> Mailer Configuration
10 | # Configure the e-mail address which will be shown in Devise::Mailer,
11 | # note that it will be overwritten if you use your own mailer class
12 | # with default "from" parameter.
13 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
14 |
15 | # Configure the class responsible to send e-mails.
16 | # config.mailer = 'Devise::Mailer'
17 |
18 | # ==> ORM configuration
19 | # Load and configure the ORM. Supports :active_record (default) and
20 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
21 | # available as additional gems.
22 | require 'devise/orm/active_record'
23 |
24 | # ==> Configuration for any authentication mechanism
25 | # Configure which keys are used when authenticating a user. The default is
26 | # just :email. You can configure it to use [:username, :subdomain], so for
27 | # authenticating a user, both parameters are required. Remember that those
28 | # parameters are used only when authenticating and not when retrieving from
29 | # session. If you need permissions, you should implement that in a before filter.
30 | # You can also supply a hash where the value is a boolean determining whether
31 | # or not authentication should be aborted when the value is not present.
32 | # config.authentication_keys = [ :email ]
33 |
34 | # Configure parameters from the request object used for authentication. Each entry
35 | # given should be a request method and it will automatically be passed to the
36 | # find_for_authentication method and considered in your model lookup. For instance,
37 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38 | # The same considerations mentioned for authentication_keys also apply to request_keys.
39 | # config.request_keys = []
40 |
41 | # Configure which authentication keys should be case-insensitive.
42 | # These keys will be downcased upon creating or modifying a user and when used
43 | # to authenticate or find a user. Default is :email.
44 | config.case_insensitive_keys = [ :email ]
45 |
46 | # Configure which authentication keys should have whitespace stripped.
47 | # These keys will have whitespace before and after removed upon creating or
48 | # modifying a user and when used to authenticate or find a user. Default is :email.
49 | config.strip_whitespace_keys = [ :email ]
50 |
51 | # Tell if authentication through request.params is enabled. True by default.
52 | # It can be set to an array that will enable params authentication only for the
53 | # given strategies, for example, `config.params_authenticatable = [:database]` will
54 | # enable it only for database (email + password) authentication.
55 | # config.params_authenticatable = true
56 |
57 | # Tell if authentication through HTTP Auth is enabled. False by default.
58 | # It can be set to an array that will enable http authentication only for the
59 | # given strategies, for example, `config.http_authenticatable = [:database]` will
60 | # enable it only for database authentication. The supported strategies are:
61 | # :database = Support basic authentication with authentication key + password
62 | # config.http_authenticatable = false
63 |
64 | # If 401 status code should be returned for AJAX requests. True by default.
65 | # config.http_authenticatable_on_xhr = true
66 |
67 | # The realm used in Http Basic Authentication. 'Application' by default.
68 | # config.http_authentication_realm = 'Application'
69 |
70 | # It will change confirmation, password recovery and other workflows
71 | # to behave the same regardless if the e-mail provided was right or wrong.
72 | # Does not affect registerable.
73 | # config.paranoid = true
74 |
75 | # By default Devise will store the user in session. You can skip storage for
76 | # particular strategies by setting this option.
77 | # Notice that if you are skipping storage for all authentication paths, you
78 | # may want to disable generating routes to Devise's sessions controller by
79 | # passing skip: :sessions to `devise_for` in your config/routes.rb
80 | config.skip_session_storage = [:http_auth]
81 |
82 | # By default, Devise cleans up the CSRF token on authentication to
83 | # avoid CSRF token fixation attacks. This means that, when using AJAX
84 | # requests for sign in and sign up, you need to get a new CSRF token
85 | # from the server. You can disable this option at your own risk.
86 | # config.clean_up_csrf_token_on_authentication = true
87 |
88 | # ==> Configuration for :database_authenticatable
89 | # For bcrypt, this is the cost for hashing the password and defaults to 10. If
90 | # using other encryptors, it sets how many times you want the password re-encrypted.
91 | #
92 | # Limiting the stretches to just one in testing will increase the performance of
93 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
94 | # a value less than 10 in other environments. Note that, for bcrypt (the default
95 | # encryptor), the cost increases exponentially with the number of stretches (e.g.
96 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
97 | config.stretches = Rails.env.test? ? 1 : 10
98 |
99 | # Setup a pepper to generate the encrypted password.
100 | # config.pepper = 'ada4428892fbcae2de37d11aad04fd2177e65dec8b2b049ac8f48402731080424a3f8ffc66662b8409e5a6d65e12b5c626c00b72e1c66dcb85fd540987df67bb'
101 |
102 | # ==> Configuration for :confirmable
103 | # A period that the user is allowed to access the website even without
104 | # confirming their account. For instance, if set to 2.days, the user will be
105 | # able to access the website for two days without confirming their account,
106 | # access will be blocked just in the third day. Default is 0.days, meaning
107 | # the user cannot access the website without confirming their account.
108 | # config.allow_unconfirmed_access_for = 2.days
109 |
110 | # A period that the user is allowed to confirm their account before their
111 | # token becomes invalid. For example, if set to 3.days, the user can confirm
112 | # their account within 3 days after the mail was sent, but on the fourth day
113 | # their account can't be confirmed with the token any more.
114 | # Default is nil, meaning there is no restriction on how long a user can take
115 | # before confirming their account.
116 | # config.confirm_within = 3.days
117 |
118 | # If true, requires any email changes to be confirmed (exactly the same way as
119 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
120 | # db field (see migrations). Until confirmed, new email is stored in
121 | # unconfirmed_email column, and copied to email column on successful confirmation.
122 | config.reconfirmable = true
123 |
124 | # Defines which key will be used when confirming an account
125 | # config.confirmation_keys = [ :email ]
126 |
127 | # ==> Configuration for :rememberable
128 | # The time the user will be remembered without asking for credentials again.
129 | # config.remember_for = 2.weeks
130 |
131 | # Invalidates all the remember me tokens when the user signs out.
132 | config.expire_all_remember_me_on_sign_out = true
133 |
134 | # If true, extends the user's remember period when remembered via cookie.
135 | # config.extend_remember_period = false
136 |
137 | # Options to be passed to the created cookie. For instance, you can set
138 | # secure: true in order to force SSL only cookies.
139 | # config.rememberable_options = {}
140 |
141 | # ==> Configuration for :validatable
142 | # Range for password length.
143 | config.password_length = 8..128
144 |
145 | # Email regex used to validate email formats. It simply asserts that
146 | # one (and only one) @ exists in the given string. This is mainly
147 | # to give user feedback and not to assert the e-mail validity.
148 | # config.email_regexp = /\A[^@]+@[^@]+\z/
149 |
150 | # ==> Configuration for :timeoutable
151 | # The time you want to timeout the user session without activity. After this
152 | # time the user will be asked for credentials again. Default is 30 minutes.
153 | # config.timeout_in = 30.minutes
154 |
155 | # If true, expires auth token on session timeout.
156 | # config.expire_auth_token_on_timeout = false
157 |
158 | # ==> Configuration for :lockable
159 | # Defines which strategy will be used to lock an account.
160 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
161 | # :none = No lock strategy. You should handle locking by yourself.
162 | # config.lock_strategy = :failed_attempts
163 |
164 | # Defines which key will be used when locking and unlocking an account
165 | # config.unlock_keys = [ :email ]
166 |
167 | # Defines which strategy will be used to unlock an account.
168 | # :email = Sends an unlock link to the user email
169 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
170 | # :both = Enables both strategies
171 | # :none = No unlock strategy. You should handle unlocking by yourself.
172 | # config.unlock_strategy = :both
173 |
174 | # Number of authentication tries before locking an account if lock_strategy
175 | # is failed attempts.
176 | # config.maximum_attempts = 20
177 |
178 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
179 | # config.unlock_in = 1.hour
180 |
181 | # Warn on the last attempt before the account is locked.
182 | # config.last_attempt_warning = true
183 |
184 | # ==> Configuration for :recoverable
185 | #
186 | # Defines which key will be used when recovering the password for an account
187 | # config.reset_password_keys = [ :email ]
188 |
189 | # Time interval you can reset your password with a reset password key.
190 | # Don't put a too small interval or your users won't have the time to
191 | # change their passwords.
192 | config.reset_password_within = 6.hours
193 |
194 | # ==> Configuration for :encryptable
195 | # Allow you to use another encryption algorithm besides bcrypt (default). You can use
196 | # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
197 | # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
198 | # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
199 | # REST_AUTH_SITE_KEY to pepper).
200 | #
201 | # Require the `devise-encryptable` gem when using anything other than bcrypt
202 | # config.encryptor = :sha512
203 |
204 | # ==> Scopes configuration
205 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
206 | # "users/sessions/new". It's turned off by default because it's slower if you
207 | # are using only default views.
208 | # config.scoped_views = false
209 |
210 | # Configure the default scope given to Warden. By default it's the first
211 | # devise role declared in your routes (usually :user).
212 | # config.default_scope = :user
213 |
214 | # Set this configuration to false if you want /users/sign_out to sign out
215 | # only the current scope. By default, Devise signs out all scopes.
216 | # config.sign_out_all_scopes = true
217 |
218 | # ==> Navigation configuration
219 | # Lists the formats that should be treated as navigational. Formats like
220 | # :html, should redirect to the sign in page when the user does not have
221 | # access, but formats like :xml or :json, should return 401.
222 | #
223 | # If you have any extra navigational formats, like :iphone or :mobile, you
224 | # should add them to the navigational formats lists.
225 | #
226 | # The "*/*" below is required to match Internet Explorer requests.
227 | # config.navigational_formats = ['*/*', :html]
228 |
229 | # The default HTTP method used to sign out a resource. Default is :delete.
230 | config.sign_out_via = :delete
231 |
232 | # ==> OmniAuth
233 | # Add a new OmniAuth provider. Check the wiki for more information on setting
234 | # up on your models and hooks.
235 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
236 |
237 | # ==> Warden configuration
238 | # If you want to use other strategies, that are not supported by Devise, or
239 | # change the failure app, you can configure them inside the config.warden block.
240 | #
241 | # config.warden do |manager|
242 | # manager.intercept_401 = false
243 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
244 | # end
245 |
246 | # ==> Mountable engine configurations
247 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
248 | # is mountable, there are some extra configurations to be taken into account.
249 | # The following options are available, assuming the engine is mounted as:
250 | #
251 | # mount MyEngine, at: '/my_engine'
252 | #
253 | # The router that invoked `devise_for`, in the example above, would be:
254 | # config.router_name = :my_engine
255 | #
256 | # When using omniauth, Devise cannot automatically set Omniauth path,
257 | # so you need to do it manually. For the users scope, it would be:
258 | # config.omniauth_path_prefix = '/my_engine/users/auth'
259 | end
260 |
--------------------------------------------------------------------------------