├── 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 |

Welcome <%= @email %>!

2 | 3 |

You can confirm your account email through the link below:

4 | 5 |

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

6 | -------------------------------------------------------------------------------- /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 |
2 |

Mentor Community

3 |

Get the support you need.

4 |
<%= link_to 'Find a Mentor', communities_path, class: 'btn btn-default btn-lg btn-block' %> 5 |
-------------------------------------------------------------------------------- /db/migrate/20151228224438_rename_columns_in_connection_table.rb: -------------------------------------------------------------------------------- 1 | class RenameColumnsInConnectionTable < ActiveRecord::Migration 2 | def change 3 | rename_column :connections, :mentors_name, :connections_name 4 | remove_column :connections, :mentees_name 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/views/pages/_mentor_partial.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Mentee Community

3 |

Give the support that's needed.

4 |
<%= link_to 'Find a Mentee', communities_path, class: 'btn btn-default btn-lg btn-block' %> 5 |
-------------------------------------------------------------------------------- /app/views/contact_mailer/contact_email.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

You have received a message from the Jr. Dev Mentoring site's contact form, from <%= "#{ @name }, #{ @email }." %>

7 |

<%= @body %>

8 | 9 | -------------------------------------------------------------------------------- /db/migrate/20151210231737_create_contacts.rb: -------------------------------------------------------------------------------- 1 | class CreateContacts < ActiveRecord::Migration 2 | def change 3 | create_table :contacts do |t| 4 | t.string :name 5 | t.string :email 6 | t.text :comments 7 | 8 | t.timestamps 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /app/models/admin_user.rb: -------------------------------------------------------------------------------- 1 | class AdminUser < ActiveRecord::Base 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :database_authenticatable, 5 | :recoverable, :rememberable, :trackable, :validatable 6 | end 7 | -------------------------------------------------------------------------------- /app/views/internships/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= simple_form_for @internship do |f| %> 2 | <%= f.input :title %> 3 | <%= f.input :description, as: :text %> 4 | <%= f.input :application_link, label: 'Link to application page' %> 5 | <%= f.input :deadline %> 6 | <%= f.button :submit, 'Post' %> 7 | <% end %> 8 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | test: 2 | pre: 3 | - bundle exec rake db:migrate 4 | 5 | general: 6 | artifacts: 7 | - "coverage" 8 | 9 | deployment: 10 | production: 11 | branch: master 12 | commands: 13 | - git push git@heroku.com:jr-dev-mentoring.git $CIRCLE_SHA1:refs/heads/master 14 | 15 | -------------------------------------------------------------------------------- /spec/support/shoulda_matchers.rb: -------------------------------------------------------------------------------- 1 | Shoulda::Matchers.configure do |config| 2 | config.integrate do |with| 3 | # Choose a test framework: 4 | with.test_framework :rspec 5 | 6 | # Or, choose the following (which implies all of the above): 7 | with.library :rails 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/admin/user.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register User do 2 | 3 | actions :index, :show, :destroy 4 | 5 | index do 6 | selectable_column 7 | id_column 8 | column :email 9 | column :last_sign_in_at 10 | column :created_at 11 | column :updated_at 12 | actions 13 | end 14 | 15 | 16 | end 17 | -------------------------------------------------------------------------------- /app/mailers/contact_mailer.rb: -------------------------------------------------------------------------------- 1 | class ContactMailer < ActionMailer::Base 2 | default to: 'info@jrdevmentoring.com' 3 | def contact_email(name, email, body) 4 | @name = name 5 | @email = email 6 | @body = body 7 | mail(from: email, subject: 'Jr. Dev Mentoring Contact Form Message') 8 | end 9 | end -------------------------------------------------------------------------------- /db/migrate/20170211204155_connection.rb: -------------------------------------------------------------------------------- 1 | class Connection < ActiveRecord::Migration 2 | def change 3 | create_table :connections do |t| 4 | t.references :requester, index: true 5 | t.references :requested, index: true 6 | 7 | t.timestamps null: false 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/factories/internships.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :internship do 3 | title { Faker::Lorem.word } 4 | description { Faker::Lorem.sentence } 5 | application_link { Faker::Internet.url } 6 | deadline { Faker::Date.between(Date.today, 2.months.from_now) } 7 | user 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20151214015412_add_attachment_avatar_to_profiles.rb: -------------------------------------------------------------------------------- 1 | class AddAttachmentAvatarToProfiles < ActiveRecord::Migration 2 | def self.up 3 | change_table :profiles do |t| 4 | t.attachment :avatar 5 | end 6 | end 7 | 8 | def self.down 9 | remove_attachment :profiles, :avatar 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/assets/stylesheets/custom.css.scss: -------------------------------------------------------------------------------- 1 | @import "bootstrap-sprockets"; 2 | @import "bootstrap"; 3 | 4 | .alert-notice { 5 | color: #8a6d3b; 6 | background-color: #fcf8e3; 7 | border-color: #faebcc; 8 | } 9 | 10 | .language-form { 11 | display: inline; 12 | float: none; 13 | } 14 | 15 | #query { 16 | width: 250px; 17 | } -------------------------------------------------------------------------------- /app/views/internships/_internship.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= internship.title %> 3 | <%= internship.description %> 4 | <%= internship.deadline %> 5 | 6 | <% if internship.active? %> 7 | <%= link_to 'View to apply', internship.application_link, target: '_blank' %> 8 | <% end %> 9 | 10 | -------------------------------------------------------------------------------- /app/views/profiles/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Edit Your Profile

4 |

Be a part of the Jr. Dev Mentoring by keeping your profile up to date!

5 |
6 | <%= render 'form' %> 7 |
8 |
9 |
-------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

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

4 | 5 |

Click the link below to unlock your account:

6 | 7 |

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

8 | -------------------------------------------------------------------------------- /db/migrate/20151227010729_create_connections.rb: -------------------------------------------------------------------------------- 1 | class CreateConnections < ActiveRecord::Migration 2 | def change 3 | create_table :connections do |t| 4 | t.string :your_name 5 | t.string :email 6 | t.text :mentors_name 7 | t.text :mentees_name 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/pages/_profiles_partial.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Your Profile

3 | <%= link_to 'Edit your profile', edit_user_profile_path(user_id: current_user.id), class: 'btn btn-default btn-lg btn-block' %> 4 | <%= link_to 'View your profile', user_path(current_user), class: 'btn btn-default btn-lg btn-block' %> 5 |
-------------------------------------------------------------------------------- /app/views/internships/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

New internship position

4 |
5 | <%= render 'form' %> 6 |
7 |
8 |
9 | 10 |
<%= link_to 'Back', internships_path, class: 'btn btn-primary' %>
11 | -------------------------------------------------------------------------------- /app/views/internships/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Edit internship position

4 |
5 | <%= render 'form' %> 6 |
7 |
8 |
9 | 10 |
<%= link_to 'Back', internships_path, class: 'btn btn-primary' %>
11 | 12 | -------------------------------------------------------------------------------- /app/models/internship.rb: -------------------------------------------------------------------------------- 1 | class Internship < ActiveRecord::Base 2 | belongs_to :user 3 | 4 | validates_presence_of :title, :description, :deadline, :application_link, :user 5 | 6 | scope :active, -> { where('deadline > ?', Date.today) } 7 | scope :expired, -> { where('deadline < ?', Date.today) } 8 | 9 | def active? 10 | deadline > Date.today 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/profiles/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Welcome to the Jr. Dev Mentoring community.

4 |

Developers must fill out a profile in order to be visible in the community.

5 |
6 | <%= render 'form' %> 7 |
8 |
9 |
10 | -------------------------------------------------------------------------------- /db/migrate/20161109170728_create_internships.rb: -------------------------------------------------------------------------------- 1 | class CreateInternships < ActiveRecord::Migration 2 | def change 3 | create_table :internships do |t| 4 | t.string :title 5 | t.string :description 6 | t.string :application_link 7 | t.date :deadline 8 | t.references :user, index: true 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/views/connection_mailer/connection_email_copy.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

You have received a message from the Jr. Dev Mentoring site's connect form

7 |

from <%= "#{ @requester_name }, #{ @requester_email }." %>

8 |

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 |
4 | Note! By <%= site_action %> this site, you agree to abide by the code of conduct. Thanks 5 | × 6 |
-------------------------------------------------------------------------------- /lib/templates/erb/scaffold/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%%= simple_form_for(@<%= singular_table_name %>) do |f| %> 2 | <%%= f.error_notification %> 3 | 4 |
5 | <%- attributes.each do |attribute| -%> 6 | <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> 7 | <%- end -%> 8 |
9 | 10 |
11 | <%%= f.button :submit %> 12 |
13 | <%% end %> 14 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

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

4 | 5 |

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

6 | 7 |

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

8 |

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

9 | -------------------------------------------------------------------------------- /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 |
2 |
3 |

Sign Up

4 |

Sign up for free. Lend your expertise and support! as well as gain access to our community of mentors.

5 |
6 |
7 |
8 |

Sign up

9 | <%= render "form" %> 10 | <%= render "devise/shared/links" %> 11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | 7 | ActionMailer::Base.smtp_settings = { 8 | :address => 'smtp.sendgrid.net', 9 | :port => '587', 10 | :authentication => :plain, 11 | :user_name => ENV['SENDGRID_USERNAME'], 12 | :password => ENV['SENDGRID_PASSWORD'], 13 | :domain => 'heroku.com', 14 | :enable_startstls_auto => true 15 | } -------------------------------------------------------------------------------- /db/migrate/20170115144700_drop_plans.rb: -------------------------------------------------------------------------------- 1 | class DropPlans < ActiveRecord::Migration 2 | def change 3 | add_column :profiles, :plan_types, :string, array: true, default: [] 4 | 5 | # User.find_in_batches do |users| 6 | # users.each do |user| 7 | # next unless user.profile 8 | # user.profile.update_column(:plan_types, [user.plan.name]) 9 | # end 10 | # end 11 | 12 | drop_table :plans 13 | remove_column :users, :plan_id 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/users.css.scss: -------------------------------------------------------------------------------- 1 | /* Users Show Page Styles */ 2 | .user-show-avatar { 3 | height: 128px; 4 | width: 128px; 5 | } 6 | .well.profile-description { 7 | background-color: #5cb85c; 8 | border-color: #4cae4c; 9 | h4 { 10 | margin-top: 0; 11 | } 12 | } 13 | // .btn btn-primary.btn-lg btn-block active { 14 | // color: white; 15 | // } 16 | /* Users Index Page Styles */ 17 | .user-index-avatar { 18 | border-radius: 50%; 19 | } 20 | .well.white-bg { 21 | background-color: white; 22 | } -------------------------------------------------------------------------------- /app/controllers/communities_controller.rb: -------------------------------------------------------------------------------- 1 | class CommunitiesController < AuthenticationController 2 | def index 3 | if params[:query].present? 4 | @available_mentors = Profile.mentors.search_for(params[:query]) if current_user.mentee? 5 | @available_mentees = Profile.mentees.search_for(params[:query]) if current_user.mentor? 6 | else 7 | @available_mentors = Profile.mentors if current_user.mentee? 8 | @available_mentees = Profile.mentees if current_user.mentor? 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /db/migrate/20151212002425_create_profiles.rb: -------------------------------------------------------------------------------- 1 | class CreateProfiles < ActiveRecord::Migration 2 | def change 3 | create_table :profiles do |t| 4 | t.integer :user_id 5 | t.string :first_name 6 | t.string :last_name 7 | t.string :contact_email 8 | t.string :city 9 | t.string :state 10 | t.string :country 11 | t.text :coding_languages 12 | t.text :bio 13 | t.text :mentoring_needs 14 | 15 | t.timestamps 16 | end 17 | end 18 | end -------------------------------------------------------------------------------- /spec/support/database_cleaner.rb: -------------------------------------------------------------------------------- 1 | RSpec.configure do |config| 2 | 3 | config.before(:suite) do 4 | DatabaseCleaner.clean_with(:truncation) 5 | end 6 | 7 | config.before(:each) do 8 | DatabaseCleaner.strategy = :transaction 9 | end 10 | 11 | config.before(:each, :js => true) do 12 | DatabaseCleaner.strategy = :truncation 13 | end 14 | 15 | config.before(:each) do 16 | DatabaseCleaner.start 17 | end 18 | 19 | config.after(:each) do 20 | DatabaseCleaner.clean 21 | end 22 | 23 | end -------------------------------------------------------------------------------- /app/views/connection_mailer/connection_email.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

You have received a message from the Jr. Dev Mentoring site's connect form

7 |

from <%= "#{ @requester_name }, #{ @requester_email }." %>

8 |

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 |

Resend unlock instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %> 9 |
10 | 11 |
12 | <%= f.submit "Resend unlock instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require "rubygems" 8 | require "bundler" 9 | 10 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) 11 | Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } 12 | gem "spring", match[1] 13 | require "spring/binstub" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | 9 | 10 | unless AdminUser.count != 0 11 | AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') 12 | end 13 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend confirmation instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %> 9 |
10 | 11 |
12 | <%= f.submit "Resend confirmation instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | 6 | def routing_error(error = 'Routing error', status = :not_found, exception=nil) 7 | render json: "Unknown route, Routing Error", status: 404 8 | end 9 | 10 | def action_missing(m, *args, &block) 11 | Rails.logger.error(m) 12 | redirect_to '/*path' 13 | end 14 | 15 | end 16 | 17 | 18 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /app/views/pages/home.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Welcome to Jr. Dev Mentoring

3 |

Harnessing the Power of Mentorship
To Build A Community of Work Ready Jr. Devs.

4 |
5 |
6 |
7 |
8 |

Sign up to gain FREE access to our community of mentors, mentees, and internships.

9 |
10 | <%= link_to "Sign Up", new_user_registration_path, class: 'btn btn-primary btn-lg btn-block' %> 11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /app/views/internships/_internships.html.erb: -------------------------------------------------------------------------------- 1 | <% if internships.empty? %> 2 |
No internships available in this category
3 | <% else %> 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | <%= render partial: 'internship', collection: internships %> 16 | 17 |
TitleDescriptionDeadline
18 |
19 | <% end %> 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | !/log/.keep 17 | /tmp 18 | coverage 19 | .idea 20 | # Ignore application configuration 21 | /config/application.yml 22 | -------------------------------------------------------------------------------- /app/admin/admin_user.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register AdminUser do 2 | permit_params :email, :password, :password_confirmation 3 | 4 | index do 5 | selectable_column 6 | id_column 7 | column :email 8 | column :current_sign_in_at 9 | column :sign_in_count 10 | column :created_at 11 | actions 12 | end 13 | 14 | filter :email 15 | filter :current_sign_in_at 16 | filter :sign_in_count 17 | filter :created_at 18 | 19 | form do |f| 20 | f.inputs "Admin Details" do 21 | f.input :email 22 | f.input :password 23 | f.input :password_confirmation 24 | end 25 | f.actions 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /app/models/connection.rb: -------------------------------------------------------------------------------- 1 | class Connection < ActiveRecord::Base 2 | 3 | belongs_to :requester, class_name: 'User', inverse_of: :connections 4 | belongs_to :requested, class_name: 'User', inverse_of: :connection_requests 5 | 6 | validates_presence_of :requester, :requested 7 | validates_uniqueness_of :requested_id, scope: :requester_id 8 | 9 | before_create :send_connection_request 10 | 11 | def send_connection_request 12 | return unless requester && requested 13 | 14 | ConnectionMailer.connection_email(requester, requested).deliver_now 15 | ConnectionMailer.connection_email_copy(requester, requested).deliver_now 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/assets/stylesheets/active_admin.scss: -------------------------------------------------------------------------------- 1 | // SASS variable overrides must be declared before loading up Active Admin's styles. 2 | // 3 | // To view the variables that Active Admin provides, take a look at 4 | // `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the 5 | // Active Admin source. 6 | // 7 | // For example, to change the sidebar width: 8 | // $sidebar-width: 242px; 9 | 10 | // Active Admin's got SASS! 11 | @import "active_admin/mixins"; 12 | @import "active_admin/base"; 13 | 14 | // Overriding any non-variable SASS must be done after the fact. 15 | // For example, to change the default status-tag color: 16 | // 17 | // .status_tag { background: #6090DB; } 18 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JrDevMentoring 5 | 6 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 7 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 8 | <%= csrf_meta_tags %> 9 | 10 | 11 | <%= render 'layouts/header' %> 12 |
13 | <%= render 'layouts/flash_notice', flash: flash %> 14 |
15 | <%= render 'layouts/coc' %> 16 |
17 | 18 | <%= yield %> 19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /db/migrate/20160218152625_create_active_admin_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateActiveAdminComments < ActiveRecord::Migration 2 | def self.up 3 | create_table :active_admin_comments do |t| 4 | t.string :namespace 5 | t.text :body 6 | t.string :resource_id, null: false 7 | t.string :resource_type, null: false 8 | t.references :author, polymorphic: true 9 | t.timestamps 10 | end 11 | add_index :active_admin_comments, [:namespace] 12 | add_index :active_admin_comments, [:author_type, :author_id] 13 | add_index :active_admin_comments, [:resource_type, :resource_id] 14 | end 15 | 16 | def self.down 17 | drop_table :active_admin_comments 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: postgresql 9 | encoding: unicode 10 | pool: 5 11 | timeout: 5000 12 | 13 | development: 14 | <<: *default 15 | database: jr_dev_mentoring_dev 16 | 17 | # Warning: The database defined as "test" will be erased and 18 | # re-generated from your development database when you run "rake". 19 | # Do not set this db to the same as development or production. 20 | ####### 21 | ## TO LOAD PG: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 22 | ####### 23 | test: 24 | <<: *default 25 | database: jr_dev_mentoring_test 26 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Forgot your password?

5 | 6 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 7 | <%= devise_error_messages! %> 8 | 9 |
10 | <%= f.label :email, "Please provide your email." %>
11 | <%= f.email_field :email, autofocus: true, class: 'form-control' %> 12 |
13 | 14 |
15 | <%= f.submit "Send me reset password instructions", class: 'btn btn-primary' %> 16 |
17 | <% end %> 18 | 19 | <%= render "devise/shared/links" %> 20 |
21 |
22 |
-------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | resources :internships, except: :show 3 | 4 | devise_for :admin_users, ActiveAdmin::Devise.config 5 | ActiveAdmin.routes(self) 6 | devise_for :users 7 | 8 | resources :users do 9 | resource :profile 10 | end 11 | 12 | get '/connections/new/:profile_id' => "connections#new", as: :new_connections 13 | resources :contacts 14 | resources :communities, only: :index 15 | get '/about' => 'pages#about' 16 | get "/jrdevslack" => redirect("https://slackpass.io/jr-dev-mentoring") 17 | 18 | authenticated :user do 19 | root 'pages#dashboard', as: :authenticated_root 20 | end 21 | 22 | root 'pages#home' 23 | 24 | 25 | 26 | 27 | 28 | match '*path', :to => 'application#routing_error', via: [:get, :post] 29 | end 30 | -------------------------------------------------------------------------------- /spec/models/internship_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Internship, type: :model do 4 | it { is_expected.to validate_presence_of(:title) } 5 | it { is_expected.to validate_presence_of(:description) } 6 | it { is_expected.to validate_presence_of(:application_link) } 7 | it { is_expected.to validate_presence_of(:deadline) } 8 | it { is_expected.to validate_presence_of(:user) } 9 | 10 | describe '#active?' do 11 | it 'is true for active internships' do 12 | internship = create(:internship) 13 | expect(internship.active?).to be_truthy 14 | end 15 | 16 | it 'is false for active internships' do 17 | internship = create(:internship, deadline: Date.yesterday) 18 | expect(internship.active?).to be_falsey 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require bootstrap-sprockets 16 | //= require areyousure/areyousure 17 | //= require_tree . 18 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Change your password

2 | 3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= devise_error_messages! %> 5 | <%= f.hidden_field :reset_password_token %> 6 | 7 |
8 | <%= f.label :password, "New password" %>
9 | <%= f.password_field :password, autofocus: true, autocomplete: "off" %> 10 |
11 | 12 |
13 | <%= f.label :password_confirmation, "Confirm new password" %>
14 | <%= f.password_field :password_confirmation, autocomplete: "off" %> 15 |
16 | 17 |
18 | <%= f.submit "Change my password" %> 19 |
20 | <% end %> 21 | 22 | <%= render "devise/shared/links" %> 23 | -------------------------------------------------------------------------------- /spec/controllers/users_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | 4 | describe UsersController do 5 | before :each do 6 | @user = FactoryGirl.create(:user) 7 | end 8 | describe 'GET #show' do 9 | describe 'not signed in' do 10 | it 'should redirect user' do 11 | get :show, id: @user.id 12 | expect(response.status).to eq 302 13 | end 14 | end 15 | describe 'signed in' do 16 | before :each do 17 | sign_in(@user) 18 | get :show, id: @user.id 19 | 20 | end 21 | it 'should return a success status' do 22 | expect(response.status).to eq 200 23 | end 24 | it 'should assign user with given id as user' do 25 | expect(assigns(:user)).to eq @user 26 | end 27 | end 28 | end 29 | 30 | end -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require custom 14 | *= require pages 15 | *= require users 16 | *= require_self 17 | */ 18 | 19 | -------------------------------------------------------------------------------- /app/views/contacts/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Contact Us

4 |

Reach out if you have any questions or comments.

5 |
6 | <%= form_for @contact do |f| %> 7 |
8 | <%= f.label :name %> 9 | <%= f.text_field :name, class: 'form-control' %> 10 |
11 |
12 | <%= f.label :email %> 13 | <%= f.email_field :email, class: 'form-control' %> 14 |
15 |
16 | <%= f.label :comments %> 17 | <%= f.text_area :comments, class: 'form-control' %> 18 |
19 | <%= f.submit 'Submit', class: 'btn btn-default' %> 20 | <% end %> 21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts "== Installing dependencies ==" 12 | system "gem install bundler --conservative" 13 | system "bundle check || bundle install" 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system "bin/rake db:setup" 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system "rm -f log/*" 25 | system "rm -rf tmp/cache" 26 | 27 | puts "\n== Restarting application server ==" 28 | system "touch tmp/restart.txt" 29 | end 30 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | ####Gemfile 2 | source 'https://rubygems.org' 3 | ruby '2.3.0' 4 | gem 'rails', '4.2.7' 5 | gem 'bootstrap-sass', '~> 3.3.6' 6 | gem 'sass-rails', '>= 3.2' 7 | gem 'autoprefixer-rails' 8 | gem 'rollbar' 9 | gem 'uglifier' 10 | gem 'coffee-rails' 11 | gem 'jquery-rails' 12 | gem 'devise' 13 | gem 'paperclip', '4.2.1' 14 | # update aws-sdk only for paperclip > 5.0 15 | gem 'aws-sdk', '< 2.0' 16 | gem 'figaro' 17 | gem 'activeadmin', '~> 1.0.0.pre1' 18 | gem 'pg' 19 | gem 'pg_search' 20 | gem 'simple_form' 21 | 22 | group :development, :test do 23 | gem 'rspec-rails', '~> 3.0' 24 | gem 'simplecov', :require => false 25 | gem 'factory_girl_rails' 26 | gem 'faker' 27 | gem 'pry' 28 | end 29 | 30 | group :development do 31 | gem 'letter_opener' 32 | end 33 | 34 | group :test do 35 | gem 'shoulda-matchers', '~> 3.1' 36 | gem 'database_cleaner' 37 | end 38 | 39 | group :production do 40 | gem 'rails_12factor' 41 | end 42 | -------------------------------------------------------------------------------- /app/controllers/contacts_controller.rb: -------------------------------------------------------------------------------- 1 | class ContactsController < AuthenticationController 2 | 3 | skip_before_action :authenticate_user! 4 | 5 | def new 6 | @contact = Contact.new 7 | end 8 | 9 | def create 10 | @contact = Contact.new(contact_params) 11 | if @contact.save 12 | name = params[:contact][:name] 13 | email = params[:contact][:email] 14 | body = params[:contact][:comments] 15 | 16 | ContactMailer.contact_email(name, email, body).deliver_now 17 | flash[:success] = "Message sent. Someone at Jr. Dev Mentoring will respond to your message soon. Thank you." 18 | redirect_to new_contact_path 19 | else 20 | flash[:danger] = "Error occured, message has not been sent. You must complete all form fields" 21 | redirect_to new_contact_path 22 | end 23 | end 24 | private 25 | def contact_params 26 | params.require(:contact).permit(:name, :email, :comments) 27 | end 28 | end -------------------------------------------------------------------------------- /app/mailers/connection_mailer.rb: -------------------------------------------------------------------------------- 1 | class ConnectionMailer < ActionMailer::Base 2 | 3 | def connection_email(requester, requested) 4 | @requester_name = requester.profile.first_name + ' ' + requester.profile.last_name 5 | @requester_email = requester.email 6 | @requested_name = requested.profile.first_name + ' ' + requested.profile.last_name 7 | @requested_email = requested.email 8 | mail(from: @requester_email, to: @requested_email, subject: 'Great News! Someone From Jr. Dev Mentoring Wants To Connect') 9 | end 10 | 11 | def connection_email_copy(requester, requested) 12 | @requester_name = requester.profile.first_name + ' ' + requester.profile.last_name 13 | @requester_email = requester.email 14 | @requested_name = requested.profile.first_name + ' ' + requested.profile.last_name 15 | @requested_email = requested.email 16 | mail(from: @requester_email, to: 'kmc3046@gmail.com', subject: 'Jr. Dev Mentoring Connect Form Message') 17 | end 18 | end -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to Jr Dev Mentoring 2 | 3 | With so much love, we say: "Thanks for taking the time to contribute" 4 | ##### Sharing is caring... 5 | The #1 contribution you could make is to blog, share, post, tweet, and/or tell people about this project. 6 | 7 | Next will be the [issues page](https://github.com/kmcrayton7/jr_dev_mentoring/issues) where you can find a list of issues workable on which can be any of bug fixing, enhancements or new features. 8 | 9 | We are also happy to accept contributions of any kind, including feedback and ideas... 10 | 11 | *Did you find a bug?* 12 | 13 | You can create a new issue for it on the [issues page](https://github.com/kmcrayton7/jr_dev_mentoring/issues) after checking to make sure that someone else has not reported the same issue. 14 | 15 | ##### *Kindly open all PRs to the `dev` branch of the project.* 16 | 17 | ## License 18 | 19 | This project is licensed under the [MIT open source license](https://opensource.org/licenses/MIT) 20 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Please review the problems below:" 13 | # Examples 14 | # labels: 15 | # defaults: 16 | # password: 'Password' 17 | # user: 18 | # new: 19 | # email: 'E-mail to sign in.' 20 | # edit: 21 | # email: 'E-mail.' 22 | # hints: 23 | # defaults: 24 | # username: 'User name to sign in.' 25 | # password: 'No special characters, please.' 26 | # include_blanks: 27 | # defaults: 28 | # age: 'Rather not say' 29 | # prompts: 30 | # defaults: 31 | # age: 'Select your age' 32 | -------------------------------------------------------------------------------- /app/controllers/connections_controller.rb: -------------------------------------------------------------------------------- 1 | class ConnectionsController < AuthenticationController 2 | before_action :ensure_profile_availability 3 | 4 | def new 5 | requester = current_user 6 | requested = Profile.find(params[:profile_id]).user 7 | @connection = Connection.new(requester: requester, requested: requested) 8 | 9 | if @connection.save 10 | flash[:success] = "Congratulations! Your request to connect has been sent. The person your request has been sent to now has your email address and will contact you if they agree to this connection." 11 | else 12 | flash[:danger] = "Error occurred, message has not been sent. Please try again." 13 | end 14 | redirect_to :back 15 | end 16 | 17 | private 18 | def ensure_profile_availability 19 | if current_user.profile.nil? 20 | redirect_to :back, flash: { 21 | danger: "Please create a profile in order to connect with someone in the community." 22 | } 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/controllers/pages_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe PagesController do 4 | 5 | before :each do 6 | @user = create(:user) 7 | end 8 | 9 | describe 'not signed in' do 10 | it 'should be a success' do 11 | [:home, :about].each do |action| 12 | get action 13 | expect(response.status).to eq 200 14 | end 15 | end 16 | end 17 | describe 'signed in' do 18 | it 'should be a success' do 19 | sign_in @user 20 | [:home, :about].each do |action| 21 | get action 22 | expect(response.status).to eq 200 23 | end 24 | end 25 | end 26 | 27 | describe 'GET#dashboard' do 28 | it 'should redirect back when not authenticated' do 29 | get :dashboard 30 | expect(response.status).to eq 302 31 | end 32 | 33 | it 'should be successfull for an authenticated user' do 34 | sign_in @user 35 | get :dashboard 36 | expect(response.status).to eq 200 37 | end 38 | end 39 | end -------------------------------------------------------------------------------- /spec/models/contact_model_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe Contact do 4 | it "should have a valid factory" do 5 | contact = FactoryGirl.build(:contact) 6 | expect(contact).to be_valid 7 | end 8 | 9 | describe "Validation" do 10 | it "should test to see if name is present" do 11 | contact = FactoryGirl.build(:contact, name: nil) 12 | expect{ contact.save }.not_to change(Contact, :count) 13 | expect(contact.errors[:name]).to be_present 14 | end 15 | 16 | it "should test to see if email is present" do 17 | contact = FactoryGirl.build(:contact, email: nil) 18 | expect{ contact.save }.not_to change(Contact, :count) 19 | expect(contact.errors[:email]).to be_present 20 | end 21 | 22 | it "should test to see if comment is present" do 23 | contact = FactoryGirl.build(:contact, comments: nil) 24 | expect{ contact.save }.not_to change(Contact, :count) 25 | expect(contact.errors[:comments]).to be_present 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: fa78acdab336fec1f0b58d81b2d74824b3a31bc9c813db7924233c0c43746a3a4deeb1fe9e8e84ea6268515b30d56070fa97a591abeccbc6ad94420c9362e92f 15 | 16 | test: 17 | secret_key_base: 298feaa37894f9b85b365229c9f74730f80cc9d64900a75d92efc309314a649ce4fb0f5a030d20aed483fd7342f20367141705711bf6e301ef5e1e122e5fed7d 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /app/admin/dashboard.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register_page "Dashboard" do 2 | 3 | menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") } 4 | 5 | content title: proc{ I18n.t("active_admin.dashboard") } do 6 | div class: "blank_slate_container", id: "dashboard_default_message" do 7 | span class: "blank_slate" do 8 | span I18n.t("active_admin.dashboard_welcome.welcome") 9 | small I18n.t("active_admin.dashboard_welcome.call_to_action") 10 | end 11 | end 12 | 13 | # Here is an example of a simple dashboard with columns and panels. 14 | # 15 | # columns do 16 | # column do 17 | # panel "Recent Posts" do 18 | # ul do 19 | # Post.recent(5).map do |post| 20 | # li link_to(post.title, admin_post_path(post)) 21 | # end 22 | # end 23 | # end 24 | # end 25 | 26 | # column do 27 | # panel "Info" do 28 | # para "Welcome to ActiveAdmin." 29 | # end 30 | # end 31 | # end 32 | end # content 33 | end 34 | -------------------------------------------------------------------------------- /app/views/internships/_my_internships.html.erb: -------------------------------------------------------------------------------- 1 | <% if internships.empty? %> 2 |
No internships available in this category
3 | <% else %> 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | <% internships.each do |internship| %> 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | <% end %> 26 | 27 |
TitleDescriptionDeadlineActions
<%= internship.title %><%= internship.description %><%= internship.deadline %><%= link_to 'Edit', edit_internship_path(internship) %><%= link_to 'Destroy', internship, method: :delete, data: { confirm: 'Are you sure?' } %>
28 |
29 | <% end %> 30 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Log in

5 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, class: 'form-control' %> 9 |
10 |
11 | <%= f.label :password %>
12 | <%= f.password_field :password, autocomplete: "off", class: 'form-control' %> 13 |
14 | <% if devise_mapping.rememberable? -%> 15 |
16 | <%= f.check_box :remember_me %> 17 | <%= f.label :remember_me %> 18 |
19 | <% end -%> 20 |
21 | <%= f.submit "Log in", class: 'btn btn-primary' %> 22 |
23 | <% end %> 24 | <%= render "devise/shared/links" %> 25 |
26 |
27 |
-------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :database_authenticatable, :registerable, 5 | :recoverable, :rememberable, :trackable, :validatable 6 | 7 | has_one :profile 8 | 9 | has_many :connections, foreign_key: :requester_id 10 | has_many :connection_requests, class_name: 'Connection', foreign_key: :requested_id 11 | 12 | has_many :internships, dependent: :destroy 13 | 14 | scope :mentors, -> {joins(:profile).where("profiles.not_available=? and 'mentor'=ANY(profiles.plan_types)", false)} 15 | scope :mentees, -> {joins(:profile).where("profiles.not_available=? and 'mentee'=ANY(profiles.plan_types)", false)} 16 | 17 | 18 | def mentor? 19 | plan_types.include? 'mentor' 20 | end 21 | 22 | def mentee? 23 | plan_types.include? 'mentee' 24 | end 25 | 26 | Profile::PLAN_TYPES.each do |type| 27 | define_method("#{type}?") do 28 | profile.plan_types.include? type if profile 29 | end 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /app/views/devise/registrations/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {id: 'mentee_form'}) do |f| %> 2 | <%= devise_error_messages! %> 3 | 4 | <%= hidden_field_tag 'plan', params[:plan] %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, class: 'form-control' %> 9 |
10 | 11 |
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 |
20 | <%= f.label :password_confirmation %>
21 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %> 22 |
23 | 24 |
25 | <%= f.submit "Sign up", class: 'btn btn-success' %> 26 |
27 | <% end %> -------------------------------------------------------------------------------- /spec/factories/factories.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :user do 3 | email { Faker::Internet.email } 4 | password { Faker::Internet.password } 5 | end 6 | 7 | factory :profile do 8 | first_name { Faker::Name.first_name } 9 | last_name { Faker::Name.last_name } 10 | contact_email { Faker::Internet.email } 11 | coding_languages { Faker::Lorem.sentence } 12 | bio { Faker::Lorem.paragraph } 13 | mentoring_needs { Faker::Lorem.sentence } 14 | plan_types [] 15 | 16 | association :user 17 | 18 | trait :mentor do 19 | after(:build) do |instance| 20 | instance.plan_types << 'mentor' 21 | end 22 | end 23 | 24 | trait :mentee do 25 | after(:build) do |instance| 26 | instance.plan_types << 'mentee' 27 | end 28 | end 29 | end 30 | 31 | factory :contact do 32 | name { Faker::Name.name } 33 | email { Faker::Internet.email } 34 | comments { Faker::Lorem.paragraph } 35 | end 36 | 37 | factory :connection do 38 | requester { create(:profile).user } 39 | requested { create(:profile).user } 40 | 41 | end 42 | end -------------------------------------------------------------------------------- /spec/controllers/contacts_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe ContactsController do 4 | 5 | describe 'unauthenticated user' do 6 | it "should give a success response for the new action" do 7 | get :new 8 | expect(response.status).to eq 200 9 | end 10 | it 'should give a success response for the create action' do 11 | contact = FactoryGirl.attributes_for(:contact) 12 | expect{post :create, contact: contact}.to change{ ActionMailer::Base.deliveries.count }.by(1) 13 | expect(response.status).to eq 302 14 | end 15 | end 16 | 17 | describe 'authenticated user' do 18 | before :each do 19 | @user = FactoryGirl.create(:user) 20 | sign_in @user 21 | end 22 | it "should give a success response for the new action" do 23 | get :new 24 | expect(response.status).to eq 200 25 | end 26 | it 'should give a success response for the create action' do 27 | contact = FactoryGirl.attributes_for(:contact) 28 | expect{post :create, contact: contact}.to change{ ActionMailer::Base.deliveries.count }.by(1) 29 | expect(response.status).to eq 302 30 | end 31 | end 32 | end -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Workspace 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 17 | # config.time_zone = 'Central Time (US & Canada)' 18 | 19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 21 | # config.i18n.default_locale = :de 22 | 23 | # Do not swallow errors in after_commit/after_rollback callbacks. 24 | config.active_record.raise_in_transactional_callbacks = true 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | <%= image_tag @user.profile.avatar.url, class: 'user-show-avatar' %> 5 |
6 |
7 |

<%= @user.profile.first_name %>

8 |

<%= @user.profile.city %>, <%= @user.profile.state %>, <%= @user.profile.country %>

9 |
10 |

Bio

11 |

<%= @user.profile.bio %>

12 |

Coding Languages

13 |

<%= @user.profile.coding_languages %>

14 |

Mentoring Needs

15 |

<%= @user.profile.mentoring_needs %>

16 |
17 | <% unless current_user == @user || @connection %> 18 | <%= button_to('Click to Connect', new_connections_path(@user.profile.id), method: :get, class: 'btn btn-primary btn-lg btn-block' ) %> 19 | <% end %> 20 | <% if @connection %> 21 |

You already sent a request to this user.

22 | <% end %> 23 |
24 | 25 |
26 |
27 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%> 25 | <% end -%> 26 | -------------------------------------------------------------------------------- /app/views/internships/index.html.erb: -------------------------------------------------------------------------------- 1 |

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 |
4 | 5 | 12 | 13 | 14 |
15 |
<%= render 'internships', internships: @active_internships %>
16 |
<%= render 'internships', internships: @expired_internships %>
17 | <% unless @my_internships.empty? %> 18 |
<%= render 'my_internships', internships: @my_internships %>
19 | <% end %> 20 |
21 |
22 | -------------------------------------------------------------------------------- /app/models/profile.rb: -------------------------------------------------------------------------------- 1 | class Profile < ActiveRecord::Base 2 | include PgSearch 3 | belongs_to :user 4 | 5 | PLAN_TYPES = %w{mentor mentee} 6 | 7 | validates :first_name, presence: true 8 | validates :last_name, presence: true 9 | validates :contact_email, presence: true 10 | validates :bio, presence: true 11 | validates :mentoring_needs, presence: true, if: :mentee? 12 | validates_length_of :coding_languages, minimum: 1, maximum: 500 13 | validates_length_of :bio, minimum: 1, maximum: 1000 14 | validates_length_of :mentoring_needs, minimum: 1, maximum: 500, if: :mentee? 15 | validate :valid_plan_types 16 | 17 | has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>", :square => '200x200#' }, :default_url => "/images/:style/missing.png" 18 | validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/ 19 | 20 | pg_search_scope :search_for, against: %i(coding_languages) 21 | 22 | scope :mentors, -> {where("not_available=? and 'mentor'=ANY(plan_types)", false)} 23 | scope :mentees, -> {where("not_available=? and 'mentee'=ANY(plan_types)", false)} 24 | 25 | def valid_plan_types 26 | plan_types.each do |type| 27 | errors.add(:plan_types, 'invalid plan entered') unless PLAN_TYPES.include? type 28 | end 29 | end 30 | 31 | PLAN_TYPES.each do |type| 32 | define_method("#{type}?") do 33 | plan_types.include? type 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /spec/controllers/connections_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe ConnectionsController do 4 | 5 | let(:profile) { create(:profile) } 6 | let(:connection_request) { get :new, profile_id: profile.id } 7 | 8 | before do 9 | @request.env['HTTP_REFERER'] = 'http://test.com/sessions/new' 10 | end 11 | 12 | describe 'unauthenticated' do 13 | it 'should not be able to send a connection request if not signed in' do 14 | expect{ connection_request }.not_to change{ ActionMailer::Base.deliveries.count } 15 | end 16 | end 17 | 18 | describe 'authenticated' do 19 | it 'should not be able to send a connection request if user has no profile' do 20 | user = create(:user) 21 | sign_in user 22 | expect{ connection_request }.not_to change{ ActionMailer::Base.deliveries.count } 23 | expect(response).to redirect_to 'http://test.com/sessions/new' 24 | end 25 | 26 | context 'with completed params' do 27 | before do 28 | @user = create(:profile).user 29 | sign_in @user 30 | end 31 | 32 | it 'should be able to send a connection request if user has a profile' do 33 | profile = @user.profile 34 | expect{ connection_request }.to change{ ActionMailer::Base.deliveries.count }.by 2 35 | end 36 | 37 | it 'should create a new connection' do 38 | profile = @user.profile 39 | expect{ connection_request }.to change{ Connection.count }.by 1 40 | end 41 | end 42 | 43 | end 44 | 45 | end 46 | -------------------------------------------------------------------------------- /db/migrate/20151211020810_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration 2 | def change 3 | create_table(:users) do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.string :current_sign_in_ip 20 | t.string :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | 34 | t.timestamps 35 | end 36 | 37 | add_index :users, :email, unique: true 38 | add_index :users, :reset_password_token, unique: true 39 | # add_index :users, :confirmation_token, unique: true 40 | # add_index :users, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /app/controllers/profiles_controller.rb: -------------------------------------------------------------------------------- 1 | class ProfilesController < AuthenticationController 2 | before_action :authenticate_user! 3 | before_action :set_user 4 | before_action :only_current_user 5 | 6 | def new 7 | @profile = Profile.new 8 | end 9 | 10 | def create 11 | @profile = @user.build_profile(profile_params) 12 | if @profile.save 13 | flash[:success] = "Profile Updated!" 14 | redirect_to user_path( @user ) 15 | else 16 | flash[:danger] = "An error occurred and your profile has not been updated. You must complete all form fields." 17 | render action: :new 18 | end 19 | end 20 | 21 | def edit 22 | @profile = @user.profile 23 | end 24 | 25 | def update 26 | @profile = @user.profile 27 | if @profile.update_attributes(profile_params) 28 | flash[:success] = "Profile Updated!" 29 | redirect_to user_path( params[:user_id] ) 30 | else 31 | render action: :edit 32 | end 33 | end 34 | 35 | private 36 | def profile_params 37 | # Remove the extra blank introduced by rails collection_check_boxes 38 | params[:profile][:plan_types].reject!{|f| f.blank?} 39 | 40 | params.require(:profile) 41 | .permit(:not_available, :first_name, :last_name, :avatar, :contact_email, :city, :state, 42 | :country, :coding_languages, :bio, :mentoring_needs, plan_types: []) 43 | end 44 | 45 | def only_current_user 46 | redirect_to(root_url) unless @user == current_user 47 | end 48 | 49 | def set_user 50 | @user = User.find( params[:user_id] ) 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /db/migrate/20160218152619_devise_create_admin_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateAdminUsers < ActiveRecord::Migration 2 | def change 3 | create_table(:admin_users) do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.inet :current_sign_in_ip 20 | t.inet :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | 34 | t.timestamps 35 | end 36 | 37 | add_index :admin_users, :email, unique: true 38 | add_index :admin_users, :reset_password_token, unique: true 39 | # add_index :admin_users, :confirmation_token, unique: true 40 | # add_index :admin_users, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Junior Developer Mentoring [![CircleCI](https://circleci.com/gh/JrDevMentoring/jr_dev_mentoring.svg?style=svg&circle-token=5626595a0b63b1dedbee04a8e40883709b91a3cf)](https://circleci.com/gh/JrDevMentoring/jr_dev_mentoring) 2 | 3 | Harnessing the power of mentorship to build a community of work ready Jr. Devs. 4 | 5 | __Note: Usage of all/any Jr Dev Mentoring space signifies agreement to conform to the [code of conduct](http://bit.ly/2mMILU1)__ 6 | 7 | ### Getting Started 8 | 9 | ###### Dependencies: 10 | 11 | 1. Ruby 2.3 12 | 2. Rails 4 13 | 3. Postgres DB 14 | 15 | ###### Installations steps: 16 | 17 | 1. Clone the app 18 | 2. Install bundles 19 | 3. Get a valid `application.yml` file for env vars. 20 | 4. Create and Migrate database 21 | 5. Start up the local server 22 | 6. Create a default admin user => `$ rake db:seed` 23 | Visit the homepage at: `http://localhost:3000`, or Admin homepage at `http://localhost:3000/admin` 24 | 25 | ### Running the tests 26 | 27 | The Continous Integration testing has CI-status has shown above. However, to run these test on the development environment we are using Rspec => from inside the root folder of the project, run `$ rspec` 28 | 29 | ### Contributing 30 | 31 | Please read the [Contribution Guide](https://github.com/JrDevMentoring/jr_dev_mentoring/blob/master/CONTRIBUTING.md) for details on the process for submitting pull requests to us. 32 | 33 | ### License 34 | 35 | This project is licensed under the [MIT open source license](https://opensource.org/licenses/MIT) 36 | 37 | ### On the media 38 | 39 | Twitter: [@JrDevMentoring](https://twitter.com/JrDevMentoring) 40 | -------------------------------------------------------------------------------- /app/views/pages/dashboard.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Welcome to Jr. Dev Mentoring

3 |

Mentee

4 |
5 |
6 | <% if current_user.profile %> 7 | <% if current_user.mentee? && current_user.mentor? %> 8 |
9 | <%= render partial: 'mentor_partial' %> 10 |
11 |
12 | <%= render partial: 'mentee_partial' %> 13 |
14 |
15 | <%= render partial: 'profiles_partial' %> 16 |
17 | <% elsif current_user.mentee? || current_user.mentor? %> 18 |
19 | <% if current_user.mentee? %> 20 | <%= render partial: 'mentee_partial' %> 21 | <% else %> 22 | <%= render partial: 'mentor_partial' %> 23 | <% end %> 24 |
25 |
26 | <%= render partial: 'profiles_partial' %> 27 |
28 | <% else %> 29 |
30 | <%= render partial: 'profiles_partial' %> 31 |
32 | <% end %> 33 | <% else %> 34 |
35 |
36 |
37 |
38 |

Create your profile so that you can be matched with someone in the Jr. Dev Mentoring community.

39 | <%= link_to 'Create your profile', new_user_profile_path(current_user), class: 'btn btn-default btn-lg btn-block'%> 40 |
41 |
42 |
43 |
44 | <% end %> 45 | 46 |
47 | -------------------------------------------------------------------------------- /app/views/profiles/_community_profile.erb: -------------------------------------------------------------------------------- 1 |

Jr. Dev Mentoring's Community of <%= community_type %>

2 |

How does this work?

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 |
7 |
8 | 9 | <% if profiles.empty? %> 10 |
No available <%= community_type.downcase %> at the moment. Kindly check back later
11 | <% end %> 12 | 13 | 33 |
34 |
-------------------------------------------------------------------------------- /app/views/layouts/_header.html.erb: -------------------------------------------------------------------------------- 1 | 35 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

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

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

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

63 |
64 |

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

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | config.action_mailer.delivery_method = :letter_opener 19 | 20 | # Print deprecation notices to the Rails logger. 21 | config.active_support.deprecation = :log 22 | 23 | # Raise an error on page load if there are pending migrations. 24 | config.active_record.migration_error = :page_load 25 | 26 | # Debug mode disables concatenation and preprocessing of assets. 27 | # This option may cause significant delays in view rendering with a large 28 | # number of complex assets. 29 | config.assets.debug = true 30 | 31 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 32 | # yet still be able to expire them through the digest params. 33 | config.assets.digest = true 34 | 35 | # Adds additional error checking when serving assets at runtime. 36 | # Checks for improperly declared sprockets dependencies. 37 | # Raises helpful error messages. 38 | config.assets.raise_runtime_errors = true 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

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

63 |
64 |

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

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

Edit <%= resource_name.to_s.humanize %>

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

Cancel my account

38 | 39 |

Sorry to see you go. Keep coding! <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger' %>

40 | 41 | <%= link_to "Back", :back %> 42 |
43 |
44 | -------------------------------------------------------------------------------- /.generators: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Randomize the order test cases are executed. 35 | config.active_support.test_order = :random 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /app/views/communities/index.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | 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 |
3 | <%= f.label :not_available do %> 4 | <%= f.check_box :not_available %> 5 | I am NOT available 6 | <% end %> 7 |

Leave my profile intact, but indicate to mentors/mentees that I am currently unavailable.

8 |

9 | 10 |
11 |

Are you looking to find a mentor? Be a mentor? Check boxes that apply.

12 | <%= f.label :plan_types do %> 13 | <%= f.collection_check_boxes :plan_types, Profile::PLAN_TYPES.map{|p| OpenStruct.new(name: p)}, :name, :name do |b| %> 14 |
15 | <%= b.check_box %> 16 | <%= b.label %> 17 |
18 | <% end %> 19 | <% end %> 20 |
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 |
60 |

This is required for a "MENTEE" plan

61 | <%= f.label :mentoring_needs, ' What are your mentoring needs? (Mentees ONLY - 1000 character limit)' %> 62 | <%= f.text_area :mentoring_needs, class: 'form-control' %> 63 |
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 | --------------------------------------------------------------------------------