├── log └── .keep ├── tmp └── .keep ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── public ├── favicon.ico ├── apple-touch-icon.png ├── apple-touch-icon-precomposed.png ├── system │ └── posts │ │ └── images │ │ └── 000 │ │ └── 000 │ │ ├── 003 │ │ ├── thumb │ │ │ └── Rails.png │ │ ├── medium │ │ │ └── Rails.png │ │ └── original │ │ │ └── Rails.png │ │ ├── 001 │ │ ├── thumb │ │ │ └── Javascript.png │ │ ├── medium │ │ │ └── Javascript.png │ │ └── original │ │ │ └── Javascript.png │ │ └── 002 │ │ ├── medium │ │ └── Wordpress.png │ │ ├── thumb │ │ └── Wordpress.png │ │ └── original │ │ └── Wordpress.png ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── test ├── helpers │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── post_test.rb │ ├── user_test.rb │ └── admin_user_test.rb ├── controllers │ ├── .keep │ └── posts_controller_test.rb ├── fixtures │ ├── .keep │ ├── files │ │ └── .keep │ ├── posts.yml │ ├── users.yml │ └── admin_users.yml ├── integration │ └── .keep └── test_helper.rb ├── app ├── assets │ ├── images │ │ ├── .keep │ │ ├── cake.png │ │ ├── game.png │ │ ├── safe.png │ │ ├── cabin.png │ │ ├── circus.png │ │ ├── profile.png │ │ └── submarine.png │ ├── javascripts │ │ ├── channels │ │ │ └── .keep │ │ ├── active_admin.js.coffee │ │ ├── posts.coffee │ │ ├── cable.js │ │ ├── application.js │ │ ├── freelancer.js │ │ └── jqBootstrapValidation.js │ ├── .DS_Store │ ├── config │ │ └── manifest.js │ └── stylesheets │ │ ├── active_admin.scss │ │ ├── posts.scss │ │ ├── portfolio-item.css │ │ ├── application.css │ │ └── freelancer.css ├── models │ ├── concerns │ │ └── .keep │ ├── application_record.rb │ ├── admin_user.rb │ ├── user.rb │ └── post.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── application_controller.rb │ └── posts_controller.rb ├── admin │ ├── user.rb │ ├── admin_user.rb │ ├── post.rb │ └── dashboard.rb ├── views │ ├── layouts │ │ ├── mailer.text.erb │ │ ├── mailer.html.erb │ │ └── application.html.erb │ ├── shared │ │ ├── _alerts.html.erb │ │ ├── _header.html.erb │ │ └── _footer.html.erb │ └── posts │ │ ├── show.html.erb │ │ └── index.html.erb ├── helpers │ ├── posts_helper.rb │ └── application_helper.rb ├── jobs │ └── application_job.rb ├── .DS_Store ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb └── mailers │ └── application_mailer.rb ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── .DS_Store ├── bin ├── bundle ├── rake ├── rails ├── spring ├── update └── setup ├── config ├── spring.rb ├── boot.rb ├── environment.rb ├── cable.yml ├── initializers │ ├── session_store.rb │ ├── mime_types.rb │ ├── application_controller_renderer.rb │ ├── filter_parameter_logging.rb │ ├── cookies_serializer.rb │ ├── backtrace_silencers.rb │ ├── assets.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ ├── new_framework_defaults.rb │ ├── active_admin.rb │ └── devise.rb ├── routes.rb ├── application.rb ├── database.yml ├── locales │ ├── en.yml │ └── devise.en.yml ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb └── puma.rb ├── config.ru ├── Rakefile ├── db ├── migrate │ ├── 20160730205930_create_posts.rb │ ├── 20160730211331_add_attachment_image_to_posts.rb │ ├── 20160730210501_create_active_admin_comments.rb │ ├── 20160730210308_devise_create_users.rb │ └── 20160730210452_devise_create_admin_users.rb ├── seeds.rb └── schema.rb ├── .gitignore ├── Gemfile └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/admin/user.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register User do 2 | end -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | module PostsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/active_admin.js.coffee: -------------------------------------------------------------------------------- 1 | #= require active_admin/base 2 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/.DS_Store -------------------------------------------------------------------------------- /app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/.DS_Store -------------------------------------------------------------------------------- /app/views/shared/_alerts.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 |

<%= alert %>

-------------------------------------------------------------------------------- /app/assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/.DS_Store -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/assets/images/cake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/images/cake.png -------------------------------------------------------------------------------- /app/assets/images/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/images/game.png -------------------------------------------------------------------------------- /app/assets/images/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/images/safe.png -------------------------------------------------------------------------------- /app/assets/images/cabin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/images/cabin.png -------------------------------------------------------------------------------- /app/assets/images/circus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/images/circus.png -------------------------------------------------------------------------------- /app/assets/images/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/images/profile.png -------------------------------------------------------------------------------- /app/assets/images/submarine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/app/assets/images/submarine.png -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | end 4 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/active_admin.scss: -------------------------------------------------------------------------------- 1 | @import "active_admin/mixins"; 2 | @import "active_admin/base"; 3 | 4 | $skinLogo: none; 5 | 6 | @import "active_skin"; -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /test/models/post_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: redis://localhost:6379/1 10 | -------------------------------------------------------------------------------- /public/system/posts/images/000/000/003/thumb/Rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/003/thumb/Rails.png -------------------------------------------------------------------------------- /test/models/admin_user_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AdminUserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /public/system/posts/images/000/000/003/medium/Rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/003/medium/Rails.png -------------------------------------------------------------------------------- /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: '_portfolio_session' 4 | -------------------------------------------------------------------------------- /public/system/posts/images/000/000/001/thumb/Javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/001/thumb/Javascript.png -------------------------------------------------------------------------------- /public/system/posts/images/000/000/002/medium/Wordpress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/002/medium/Wordpress.png -------------------------------------------------------------------------------- /public/system/posts/images/000/000/002/thumb/Wordpress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/002/thumb/Wordpress.png -------------------------------------------------------------------------------- /public/system/posts/images/000/000/003/original/Rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/003/original/Rails.png -------------------------------------------------------------------------------- /public/system/posts/images/000/000/001/medium/Javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/001/medium/Javascript.png -------------------------------------------------------------------------------- /public/system/posts/images/000/000/002/original/Wordpress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/002/original/Wordpress.png -------------------------------------------------------------------------------- /public/system/posts/images/000/000/001/original/Javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanblakely/Rails-5-Blog-Express-Course/HEAD/public/system/posts/images/000/000/001/original/Javascript.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/controllers/posts_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostsControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /app/assets/stylesheets/posts.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the posts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | devise_for :admin_users, ActiveAdmin::Devise.config 3 | ActiveAdmin.routes(self) 4 | devise_for :users 5 | resources :posts 6 | 7 | root 'posts#index' 8 | end 9 | -------------------------------------------------------------------------------- /test/fixtures/posts.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | title: MyString 5 | body: MyText 6 | 7 | two: 8 | title: MyString 9 | body: MyText 10 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /app/assets/javascripts/posts.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /db/migrate/20160730205930_create_posts.rb: -------------------------------------------------------------------------------- 1 | class CreatePosts < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :posts do |t| 4 | t.string :title 5 | t.text :body 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/models/admin_user.rb: -------------------------------------------------------------------------------- 1 | class AdminUser < ApplicationRecord 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 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :database_authenticatable, :registerable, 5 | :recoverable, :rememberable, :trackable, :validatable 6 | end 7 | -------------------------------------------------------------------------------- /app/models/post.rb: -------------------------------------------------------------------------------- 1 | class Post < ApplicationRecord 2 | validates :title, presence: true, length: { minimum: 5 } 3 | validates :body, presence: true 4 | 5 | has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" } 6 | validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/ 7 | end 8 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /db/migrate/20160730211331_add_attachment_image_to_posts.rb: -------------------------------------------------------------------------------- 1 | class AddAttachmentImageToPosts < ActiveRecord::Migration 2 | def self.up 3 | change_table :posts do |t| 4 | t.attachment :image 5 | end 6 | end 7 | 8 | def self.down 9 | remove_attachment :posts, :image 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/posts_controller.rb: -------------------------------------------------------------------------------- 1 | class PostsController < ApplicationController 2 | def index 3 | @posts = Post.all.order('created_at DESC') 4 | end 5 | 6 | def show 7 | @post = Post.find(params[:id]) 8 | @posts = Post.order("created_at desc").limit(4).offset(1) 9 | end 10 | 11 | private 12 | def post_params 13 | params.require(:post).permit(:title, :body) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /test/fixtures/admin_users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the rails generate channel command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') -------------------------------------------------------------------------------- /app/assets/stylesheets/portfolio-item.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - Portfolio Item (http://startbootstrap.com/) 3 | * Copyright 2013-2016 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) 5 | */ 6 | 7 | body { 8 | padding-top: 70px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */ 9 | } 10 | 11 | .portfolio-item { 12 | margin-bottom: 25px; 13 | } 14 | 15 | footer { 16 | margin: 50px 0; 17 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.join(Gem.path_separator) } 12 | gem 'spring', match[1] 13 | require 'spring/binstub' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 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 Portfolio 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 | end 15 | end 16 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /.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 | /tmp/* 17 | !/log/.keep 18 | !/tmp/.keep 19 | 20 | # Ignore Byebug command history file. 21 | .byebug_history 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/admin/post.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register Post do 2 | permit_params :title, :body, :image 3 | 4 | show do |t| 5 | attributes_table do 6 | row :title 7 | row :body 8 | row :image do 9 | post.image? ? image_tag(post.image.url, height: '100') : content_tag(:span, "No photo yet") 10 | end 11 | end 12 | end 13 | 14 | form :html => { :enctype => "multipart/form-data" } do |f| 15 | f.inputs do 16 | f.input :title 17 | f.input :body 18 | f.input :image, hint: f.post.image? ? image_tag(post.image.url, height: '100') : content_tag(:span, "Upload JPG/PNG/GIF image") 19 | end 20 | f.actions 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /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: sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /db/migrate/20160730210501_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/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/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 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 other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /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. JavaScript code in this file should be added after the last require_* statement. 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 turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rails', '~> 5.0.0' 4 | gem 'sqlite3' 5 | gem 'puma', '~> 3.0' 6 | gem 'sass-rails', '~> 5.0' 7 | gem 'uglifier', '>= 1.3.0' 8 | gem 'coffee-rails', '~> 4.2' 9 | 10 | gem 'jquery-rails' 11 | gem 'turbolinks', '~> 5' 12 | gem 'jbuilder', '~> 2.5' 13 | gem 'devise', '~> 4.2' 14 | gem 'activeadmin', github: 'activeadmin' 15 | gem 'inherited_resources', github: 'activeadmin/inherited_resources' 16 | gem 'active_skin' 17 | gem 'paperclip', '~> 4.3', '>= 4.3.6' 18 | 19 | group :development, :test do 20 | gem 'byebug', platform: :mri 21 | end 22 | 23 | group :development do 24 | gem 'web-console' 25 | gem 'listen', '~> 3.0.5' 26 | gem 'spring' 27 | gem 'spring-watcher-listen', '~> 2.0.0' 28 | end 29 | 30 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 31 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 32 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Portfolio 5 | <%= csrf_meta_tags %> 6 | 7 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 8 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | <%= render 'shared/header' %> 19 | <%= render 'shared/alerts' %> 20 | <%= yield %> 21 | <%= render 'shared/footer' %> 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # puts "\n== Copying sample files ==" 22 | # unless File.exist?('config/database.yml') 23 | # cp 'config/database.yml.sample', 'config/database.yml' 24 | # end 25 | 26 | puts "\n== Preparing database ==" 27 | system! 'bin/rails db:setup' 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! 'bin/rails log:clear tmp:clear' 31 | 32 | puts "\n== Restarting application server ==" 33 | system! 'bin/rails restart' 34 | end 35 | -------------------------------------------------------------------------------- /config/initializers/new_framework_defaults.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains migration options to ease your Rails 5.0 upgrade. 4 | # 5 | # Read the Rails 5.0 release notes for more info on each option. 6 | 7 | # Enable per-form CSRF tokens. Previous versions had false. 8 | Rails.application.config.action_controller.per_form_csrf_tokens = true 9 | 10 | # Enable origin-checking CSRF mitigation. Previous versions had false. 11 | Rails.application.config.action_controller.forgery_protection_origin_check = true 12 | 13 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. 14 | # Previous versions had false. 15 | ActiveSupport.to_time_preserves_timezone = true 16 | 17 | # Require `belongs_to` associations by default. Previous versions had false. 18 | Rails.application.config.active_record.belongs_to_required_by_default = true 19 | 20 | # Do not halt callback chains when a callback returns false. Previous versions had true. 21 | ActiveSupport.halt_callback_chains_on_return_false = false 22 | 23 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false. 24 | Rails.application.config.ssl_options = { hsts: { subdomains: true } } 25 | -------------------------------------------------------------------------------- /app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 |
6 |
7 |

<%= @post.title %> 8 | Item Subheading 9 |

10 |
11 |
12 | 13 | 14 | 15 |
16 | 17 |
18 | <%= image_tag @post.image, class: 'img-responsive' %> 19 |
20 | 21 |
22 |

Project Description

23 |

<%= @post.body %>

24 |
25 | 26 |
27 | 28 | 29 | 30 |
31 | 32 |
33 | 34 |
35 | 36 | <% @posts.each do |post| %> 37 |
38 | <%= link_to post_path(post) do %> 39 | <%= image_tag post.image, class: 'img-responsive portfolio-item' %> 40 | <% end %> 41 |
42 | <% end %> 43 | 44 |
45 | 46 |
-------------------------------------------------------------------------------- /app/views/shared/_header.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /db/migrate/20160730210308_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :users do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.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 null: false 35 | end 36 | 37 | add_index :users, :email, unique: true 38 | add_index :users, :reset_password_token, unique: true 39 | # add_index :users, :confirmation_token, unique: true 40 | # add_index :users, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /db/migrate/20160730210452_devise_create_admin_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateAdminUsers < ActiveRecord::Migration[5.0] 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.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 null: false 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 | -------------------------------------------------------------------------------- /app/assets/javascripts/freelancer.js: -------------------------------------------------------------------------------- 1 | // Freelancer Theme JavaScript 2 | 3 | (function($) { 4 | "use strict"; // Start of use strict 5 | 6 | // jQuery for page scrolling feature - requires jQuery Easing plugin 7 | $('.page-scroll a').bind('click', function(event) { 8 | var $anchor = $(this); 9 | $('html, body').stop().animate({ 10 | scrollTop: ($($anchor.attr('href')).offset().top - 50) 11 | }, 1250, 'easeInOutExpo'); 12 | event.preventDefault(); 13 | }); 14 | 15 | // Highlight the top nav as scrolling occurs 16 | $('body').scrollspy({ 17 | target: '.navbar-fixed-top', 18 | offset: 51 19 | }); 20 | 21 | // Closes the Responsive Menu on Menu Item Click 22 | $('.navbar-collapse ul li a:not(.dropdown-toggle)').click(function() { 23 | $('.navbar-toggle:visible').click(); 24 | }); 25 | 26 | // Offset for Main Navigation 27 | $('#mainNav').affix({ 28 | offset: { 29 | top: 100 30 | } 31 | }) 32 | 33 | // Floating label headings for the contact form 34 | $(function() { 35 | $("body").on("input propertychange", ".floating-label-form-group", function(e) { 36 | $(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val()); 37 | }).on("focus", ".floating-label-form-group", function() { 38 | $(this).addClass("floating-label-form-group-with-focus"); 39 | }).on("blur", ".floating-label-form-group", function() { 40 | $(this).removeClass("floating-label-form-group-with-focus"); 41 | }); 42 | }); 43 | 44 | })(jQuery); // End of use strict 45 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

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

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

The change you wanted was rejected.

62 |

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

63 |
64 |

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

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

The page you were looking for doesn't exist.

62 |

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

63 |
64 |

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

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => 'public, max-age=3600' 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | 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/shared/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum, this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. If you use this option 30 | # you need to make sure to reconnect any threads in the `on_worker_boot` 31 | # block. 32 | # 33 | # preload_app! 34 | 35 | # The code in the `on_worker_boot` will be called if you are using 36 | # clustered mode by specifying a number of `workers`. After each worker 37 | # process is booted this block will be run, if you are using `preload_app!` 38 | # option you will want to use this block to reconnect to any threads 39 | # or connections that may have been created at application boot, Ruby 40 | # cannot share connections between processes. 41 | # 42 | # on_worker_boot do 43 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 44 | # end 45 | 46 | # Allow puma to be restarted by `rails restart` command. 47 | plugin :tmp_restart 48 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | if Rails.root.join('tmp/caching-dev.txt').exist? 17 | config.action_controller.perform_caching = true 18 | 19 | config.cache_store = :memory_store 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => 'public, max-age=172800' 22 | } 23 | else 24 | config.action_controller.perform_caching = false 25 | 26 | config.cache_store = :null_store 27 | end 28 | 29 | # Don't care if the mailer can't send. 30 | config.action_mailer.raise_delivery_errors = false 31 | 32 | config.action_mailer.perform_caching = false 33 | 34 | # Print deprecation notices to the Rails logger. 35 | config.active_support.deprecation = :log 36 | 37 | # Raise an error on page load if there are pending migrations. 38 | config.active_record.migration_error = :page_load 39 | 40 | # Debug mode disables concatenation and preprocessing of assets. 41 | # This option may cause significant delays in view rendering with a large 42 | # number of complex assets. 43 | config.assets.debug = true 44 | 45 | # Suppress logger output for asset requests. 46 | config.assets.quiet = true 47 | 48 | # Raises error for missing translations 49 | # config.action_view.raise_on_missing_translations = true 50 | 51 | # Use an evented file watcher to asynchronously detect changes in source code, 52 | # routes, locales, etc. This feature depends on the listen gem. 53 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 54 | 55 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 56 | end 57 | -------------------------------------------------------------------------------- /app/views/posts/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | <%= image_tag "profile.png", class: "img-responsive" %> 7 |
8 | Start Bootstrap 9 |
10 | Web Developer - Graphic Artist - User Experience Designer 11 |
12 |
13 |
14 |
15 |
16 | 17 | 18 |
19 |
20 |
21 |
22 |

Portfolio

23 |
24 |
25 |
26 |
27 | <% @posts.each do |post| %> 28 |
29 | <%= link_to post_path(post) do %> 30 | <%= image_tag post.image, class: 'img-responsive' %> 31 | <% end %> 32 |
33 | <% end %> 34 |
35 |
36 |
37 | 38 | 39 |
40 |
41 |
42 |
43 |

About

44 |
45 |
46 |
47 |
48 |
49 |

Freelancer is a free bootstrap theme created by Start Bootstrap. The download includes the complete source files including HTML, CSS, and JavaScript as well as optional LESS stylesheets for easy customization.

50 |
51 |
52 |

Whether you're a student looking to showcase your work, a professional looking to attract clients, or a graphic artist looking to share your projects, this template is the perfect starting point!

53 |
54 | 59 |
60 |
61 |
62 | 63 | 64 |
65 |
66 |
67 |
68 |

<%= mail_to "hello@open-labs.io", "Contact Me", subject: "Hi! Please include your name and email address" %>


69 |
70 |
71 |
72 |
73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 20160730211331) do 14 | 15 | create_table "active_admin_comments", force: :cascade do |t| 16 | t.string "namespace" 17 | t.text "body" 18 | t.string "resource_id", null: false 19 | t.string "resource_type", null: false 20 | t.string "author_type" 21 | t.integer "author_id" 22 | t.datetime "created_at" 23 | t.datetime "updated_at" 24 | t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id" 25 | t.index ["namespace"], name: "index_active_admin_comments_on_namespace" 26 | t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id" 27 | end 28 | 29 | create_table "admin_users", force: :cascade do |t| 30 | t.string "email", default: "", null: false 31 | t.string "encrypted_password", default: "", null: false 32 | t.string "reset_password_token" 33 | t.datetime "reset_password_sent_at" 34 | t.datetime "remember_created_at" 35 | t.integer "sign_in_count", default: 0, null: false 36 | t.datetime "current_sign_in_at" 37 | t.datetime "last_sign_in_at" 38 | t.string "current_sign_in_ip" 39 | t.string "last_sign_in_ip" 40 | t.datetime "created_at", null: false 41 | t.datetime "updated_at", null: false 42 | t.index ["email"], name: "index_admin_users_on_email", unique: true 43 | t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true 44 | end 45 | 46 | create_table "posts", force: :cascade do |t| 47 | t.string "title" 48 | t.text "body" 49 | t.datetime "created_at", null: false 50 | t.datetime "updated_at", null: false 51 | t.string "image_file_name" 52 | t.string "image_content_type" 53 | t.integer "image_file_size" 54 | t.datetime "image_updated_at" 55 | end 56 | 57 | create_table "users", force: :cascade do |t| 58 | t.string "email", default: "", null: false 59 | t.string "encrypted_password", default: "", null: false 60 | t.string "reset_password_token" 61 | t.datetime "reset_password_sent_at" 62 | t.datetime "remember_created_at" 63 | t.integer "sign_in_count", default: 0, null: false 64 | t.datetime "current_sign_in_at" 65 | t.datetime "last_sign_in_at" 66 | t.string "current_sign_in_ip" 67 | t.string "last_sign_in_ip" 68 | t.datetime "created_at", null: false 69 | t.datetime "updated_at", null: false 70 | t.index ["email"], name: "index_users_on_email", unique: true 71 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 72 | end 73 | 74 | end 75 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Disable serving static files from the `/public` folder by default since 18 | # Apache or NGINX already handles this. 19 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 20 | 21 | # Compress JavaScripts and CSS. 22 | config.assets.js_compressor = :uglifier 23 | # config.assets.css_compressor = :sass 24 | 25 | # Do not fallback to assets pipeline if a precompiled asset is missed. 26 | config.assets.compile = false 27 | 28 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 29 | 30 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 31 | # config.action_controller.asset_host = 'http://assets.example.com' 32 | 33 | # Specifies the header that your server uses for sending files. 34 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 35 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 36 | 37 | # Mount Action Cable outside main process or domain 38 | # config.action_cable.mount_path = nil 39 | # config.action_cable.url = 'wss://example.com/cable' 40 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 41 | 42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 43 | # config.force_ssl = true 44 | 45 | # Use the lowest log level to ensure availability of diagnostic information 46 | # when problems arise. 47 | config.log_level = :debug 48 | 49 | # Prepend all log lines with the following tags. 50 | config.log_tags = [ :request_id ] 51 | 52 | # Use a different cache store in production. 53 | # config.cache_store = :mem_cache_store 54 | 55 | # Use a real queuing backend for Active Job (and separate queues per environment) 56 | # config.active_job.queue_adapter = :resque 57 | # config.active_job.queue_name_prefix = "portfolio_#{Rails.env}" 58 | config.action_mailer.perform_caching = false 59 | 60 | # Ignore bad email addresses and do not raise email delivery errors. 61 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 62 | # config.action_mailer.raise_delivery_errors = false 63 | 64 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 65 | # the I18n.default_locale when a translation cannot be found). 66 | config.i18n.fallbacks = true 67 | 68 | # Send deprecation notices to registered listeners. 69 | config.active_support.deprecation = :notify 70 | 71 | # Use default logging formatter so that PID and timestamp are not suppressed. 72 | config.log_formatter = ::Logger::Formatter.new 73 | 74 | # Use a different logger for distributed setups. 75 | # require 'syslog/logger' 76 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 77 | 78 | if ENV["RAILS_LOG_TO_STDOUT"].present? 79 | logger = ActiveSupport::Logger.new(STDOUT) 80 | logger.formatter = config.log_formatter 81 | config.logger = ActiveSupport::TaggedLogging.new(logger) 82 | end 83 | 84 | # Do not dump schema after migrations. 85 | config.active_record.dump_schema_after_migration = false 86 | end 87 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | password_change: 27 | subject: "Password Changed" 28 | omniauth_callbacks: 29 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 30 | success: "Successfully authenticated from %{kind} account." 31 | passwords: 32 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 33 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 34 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 35 | updated: "Your password has been changed successfully. You are now signed in." 36 | updated_not_active: "Your password has been changed successfully." 37 | registrations: 38 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 39 | signed_up: "Welcome! You have signed up successfully." 40 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 41 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 42 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." 43 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." 44 | updated: "Your account has been updated successfully." 45 | sessions: 46 | signed_in: "Signed in successfully." 47 | signed_out: "Signed out successfully." 48 | already_signed_out: "Signed out successfully." 49 | unlocks: 50 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 51 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 52 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 53 | errors: 54 | messages: 55 | already_confirmed: "was already confirmed, please try signing in" 56 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 57 | expired: "has expired, please request a new one" 58 | not_found: "not found" 59 | not_locked: "was not locked" 60 | not_saved: 61 | one: "1 error prohibited this %{resource} from being saved:" 62 | other: "%{count} errors prohibited this %{resource} from being saved:" 63 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: git://github.com/activeadmin/activeadmin.git 3 | revision: 85ab3f5961e1fab5d5c864ba9170b5e0fd1f6548 4 | specs: 5 | activeadmin (1.0.0.pre4) 6 | arbre (~> 1.0, >= 1.0.2) 7 | bourbon 8 | coffee-rails 9 | formtastic (~> 3.1) 10 | formtastic_i18n 11 | inherited_resources (~> 1.6) 12 | jquery-rails 13 | jquery-ui-rails 14 | kaminari (~> 0.15) 15 | rails (>= 3.2, < 5.1) 16 | ransack (~> 1.3) 17 | sass-rails 18 | sprockets (< 4.1) 19 | 20 | GIT 21 | remote: git://github.com/activeadmin/inherited_resources.git 22 | revision: ba9467db4817944591df35dfe340f4c05a948033 23 | specs: 24 | inherited_resources (1.6.0) 25 | actionpack (>= 3.2, < 5.1) 26 | has_scope (~> 0.6) 27 | railties (>= 3.2, < 5.1) 28 | responders 29 | 30 | GEM 31 | remote: https://rubygems.org/ 32 | specs: 33 | actioncable (5.0.0) 34 | actionpack (= 5.0.0) 35 | nio4r (~> 1.2) 36 | websocket-driver (~> 0.6.1) 37 | actionmailer (5.0.0) 38 | actionpack (= 5.0.0) 39 | actionview (= 5.0.0) 40 | activejob (= 5.0.0) 41 | mail (~> 2.5, >= 2.5.4) 42 | rails-dom-testing (~> 2.0) 43 | actionpack (5.0.0) 44 | actionview (= 5.0.0) 45 | activesupport (= 5.0.0) 46 | rack (~> 2.0) 47 | rack-test (~> 0.6.3) 48 | rails-dom-testing (~> 2.0) 49 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 50 | actionview (5.0.0) 51 | activesupport (= 5.0.0) 52 | builder (~> 3.1) 53 | erubis (~> 2.7.0) 54 | rails-dom-testing (~> 2.0) 55 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 56 | active_skin (0.0.12) 57 | activejob (5.0.0) 58 | activesupport (= 5.0.0) 59 | globalid (>= 0.3.6) 60 | activemodel (5.0.0) 61 | activesupport (= 5.0.0) 62 | activerecord (5.0.0) 63 | activemodel (= 5.0.0) 64 | activesupport (= 5.0.0) 65 | arel (~> 7.0) 66 | activesupport (5.0.0) 67 | concurrent-ruby (~> 1.0, >= 1.0.2) 68 | i18n (~> 0.7) 69 | minitest (~> 5.1) 70 | tzinfo (~> 1.1) 71 | arbre (1.1.1) 72 | activesupport (>= 3.0.0) 73 | arel (7.1.1) 74 | bcrypt (3.1.11) 75 | bourbon (4.2.7) 76 | sass (~> 3.4) 77 | thor (~> 0.19) 78 | builder (3.2.2) 79 | byebug (9.0.5) 80 | climate_control (0.0.3) 81 | activesupport (>= 3.0) 82 | cocaine (0.5.8) 83 | climate_control (>= 0.0.3, < 1.0) 84 | coffee-rails (4.2.1) 85 | coffee-script (>= 2.2.0) 86 | railties (>= 4.0.0, < 5.2.x) 87 | coffee-script (2.4.1) 88 | coffee-script-source 89 | execjs 90 | coffee-script-source (1.10.0) 91 | concurrent-ruby (1.0.2) 92 | debug_inspector (0.0.2) 93 | devise (4.2.0) 94 | bcrypt (~> 3.0) 95 | orm_adapter (~> 0.1) 96 | railties (>= 4.1.0, < 5.1) 97 | responders 98 | warden (~> 1.2.3) 99 | erubis (2.7.0) 100 | execjs (2.7.0) 101 | ffi (1.9.14) 102 | formtastic (3.1.4) 103 | actionpack (>= 3.2.13) 104 | formtastic_i18n (0.6.0) 105 | globalid (0.3.7) 106 | activesupport (>= 4.1.0) 107 | has_scope (0.7.0) 108 | actionpack (>= 4.1, < 5.1) 109 | activesupport (>= 4.1, < 5.1) 110 | i18n (0.7.0) 111 | jbuilder (2.6.0) 112 | activesupport (>= 3.0.0, < 5.1) 113 | multi_json (~> 1.2) 114 | jquery-rails (4.1.1) 115 | rails-dom-testing (>= 1, < 3) 116 | railties (>= 4.2.0) 117 | thor (>= 0.14, < 2.0) 118 | jquery-ui-rails (5.0.5) 119 | railties (>= 3.2.16) 120 | kaminari (0.17.0) 121 | actionpack (>= 3.0.0) 122 | activesupport (>= 3.0.0) 123 | listen (3.0.8) 124 | rb-fsevent (~> 0.9, >= 0.9.4) 125 | rb-inotify (~> 0.9, >= 0.9.7) 126 | loofah (2.0.3) 127 | nokogiri (>= 1.5.9) 128 | mail (2.6.4) 129 | mime-types (>= 1.16, < 4) 130 | method_source (0.8.2) 131 | mime-types (3.1) 132 | mime-types-data (~> 3.2015) 133 | mime-types-data (3.2016.0521) 134 | mimemagic (0.3.0) 135 | mini_portile2 (2.1.0) 136 | minitest (5.9.0) 137 | multi_json (1.12.1) 138 | nio4r (1.2.1) 139 | nokogiri (1.6.8) 140 | mini_portile2 (~> 2.1.0) 141 | pkg-config (~> 1.1.7) 142 | orm_adapter (0.5.0) 143 | paperclip (4.3.7) 144 | activemodel (>= 3.2.0) 145 | activesupport (>= 3.2.0) 146 | cocaine (~> 0.5.5) 147 | mime-types 148 | mimemagic (= 0.3.0) 149 | pkg-config (1.1.7) 150 | polyamorous (1.3.1) 151 | activerecord (>= 3.0) 152 | puma (3.6.0) 153 | rack (2.0.1) 154 | rack-test (0.6.3) 155 | rack (>= 1.0) 156 | rails (5.0.0) 157 | actioncable (= 5.0.0) 158 | actionmailer (= 5.0.0) 159 | actionpack (= 5.0.0) 160 | actionview (= 5.0.0) 161 | activejob (= 5.0.0) 162 | activemodel (= 5.0.0) 163 | activerecord (= 5.0.0) 164 | activesupport (= 5.0.0) 165 | bundler (>= 1.3.0, < 2.0) 166 | railties (= 5.0.0) 167 | sprockets-rails (>= 2.0.0) 168 | rails-dom-testing (2.0.1) 169 | activesupport (>= 4.2.0, < 6.0) 170 | nokogiri (~> 1.6.0) 171 | rails-html-sanitizer (1.0.3) 172 | loofah (~> 2.0) 173 | railties (5.0.0) 174 | actionpack (= 5.0.0) 175 | activesupport (= 5.0.0) 176 | method_source 177 | rake (>= 0.8.7) 178 | thor (>= 0.18.1, < 2.0) 179 | rake (11.2.2) 180 | ransack (1.8.1) 181 | actionpack (>= 3.0) 182 | activerecord (>= 3.0) 183 | activesupport (>= 3.0) 184 | i18n 185 | polyamorous (~> 1.3) 186 | rb-fsevent (0.9.7) 187 | rb-inotify (0.9.7) 188 | ffi (>= 0.5.0) 189 | responders (2.2.0) 190 | railties (>= 4.2.0, < 5.1) 191 | sass (3.4.22) 192 | sass-rails (5.0.6) 193 | railties (>= 4.0.0, < 6) 194 | sass (~> 3.1) 195 | sprockets (>= 2.8, < 4.0) 196 | sprockets-rails (>= 2.0, < 4.0) 197 | tilt (>= 1.1, < 3) 198 | spring (1.7.2) 199 | spring-watcher-listen (2.0.0) 200 | listen (>= 2.7, < 4.0) 201 | spring (~> 1.2) 202 | sprockets (3.7.0) 203 | concurrent-ruby (~> 1.0) 204 | rack (> 1, < 3) 205 | sprockets-rails (3.1.1) 206 | actionpack (>= 4.0) 207 | activesupport (>= 4.0) 208 | sprockets (>= 3.0.0) 209 | sqlite3 (1.3.11) 210 | thor (0.19.1) 211 | thread_safe (0.3.5) 212 | tilt (2.0.5) 213 | turbolinks (5.0.0) 214 | turbolinks-source (~> 5) 215 | turbolinks-source (5.0.0) 216 | tzinfo (1.2.2) 217 | thread_safe (~> 0.1) 218 | uglifier (3.0.1) 219 | execjs (>= 0.3.0, < 3) 220 | warden (1.2.6) 221 | rack (>= 1.0) 222 | web-console (3.3.1) 223 | actionview (>= 5.0) 224 | activemodel (>= 5.0) 225 | debug_inspector 226 | railties (>= 5.0) 227 | websocket-driver (0.6.4) 228 | websocket-extensions (>= 0.1.0) 229 | websocket-extensions (0.1.2) 230 | 231 | PLATFORMS 232 | ruby 233 | 234 | DEPENDENCIES 235 | active_skin 236 | activeadmin! 237 | byebug 238 | coffee-rails (~> 4.2) 239 | devise (~> 4.2) 240 | inherited_resources! 241 | jbuilder (~> 2.5) 242 | jquery-rails 243 | listen (~> 3.0.5) 244 | paperclip (~> 4.3, >= 4.3.6) 245 | puma (~> 3.0) 246 | rails (~> 5.0.0) 247 | sass-rails (~> 5.0) 248 | spring 249 | spring-watcher-listen (~> 2.0.0) 250 | sqlite3 251 | turbolinks (~> 5) 252 | tzinfo-data 253 | uglifier (>= 1.3.0) 254 | web-console 255 | 256 | BUNDLED WITH 257 | 1.12.5 258 | -------------------------------------------------------------------------------- /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 = "Portfolio" 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 change the name under which comments are registered: 125 | # config.comments_registration_name = 'AdminComment' 126 | # 127 | # You can change the order for the comments and you can change the column 128 | # to be used for ordering: 129 | # config.comments_order = 'created_at ASC' 130 | # 131 | # You can disable the menu item for the comments index page: 132 | # config.comments_menu = false 133 | # 134 | # You can customize the comment menu: 135 | # config.comments_menu = { parent: 'Admin', priority: 1 } 136 | 137 | # == Batch Actions 138 | # 139 | # Enable and disable Batch Actions 140 | # 141 | config.batch_actions = true 142 | 143 | # == Controller Filters 144 | # 145 | # You can add before, after and around filters to all of your 146 | # Active Admin resources and pages from here. 147 | # 148 | # config.before_filter :do_something_awesome 149 | 150 | # == Localize Date/Time Format 151 | # 152 | # Set the localize format to display dates and times. 153 | # To understand how to localize your app with I18n, read more at 154 | # https://github.com/svenfuchs/i18n/blob/master/lib%2Fi18n%2Fbackend%2Fbase.rb#L52 155 | # 156 | config.localize_format = :long 157 | 158 | # == Setting a Favicon 159 | # 160 | # config.favicon = 'favicon.ico' 161 | 162 | # == Meta Tags 163 | # 164 | # Add additional meta tags to the head element of active admin pages. 165 | # 166 | # Add tags to all pages logged in users see: 167 | # config.meta_tags = { author: 'My Company' } 168 | 169 | # By default, sign up/sign in/recover password pages are excluded 170 | # from showing up in search engine results by adding a robots meta 171 | # tag. You can reset the hash of meta tags included in logged out 172 | # pages: 173 | # config.meta_tags_for_logged_out_pages = {} 174 | 175 | # == Removing Breadcrumbs 176 | # 177 | # Breadcrumbs are enabled by default. You can customize them for individual 178 | # resources or you can disable them globally from here. 179 | # 180 | # config.breadcrumb = false 181 | 182 | # == Register Stylesheets & Javascripts 183 | # 184 | # We recommend using the built in Active Admin layout and loading 185 | # up your own stylesheets / javascripts to customize the look 186 | # and feel. 187 | # 188 | # To load a stylesheet: 189 | # config.register_stylesheet 'my_stylesheet.css' 190 | # 191 | # You can provide an options hash for more control, which is passed along to stylesheet_link_tag(): 192 | # config.register_stylesheet 'my_print_stylesheet.css', media: :print 193 | # 194 | # To load a javascript file: 195 | # config.register_javascript 'my_javascript.js' 196 | 197 | # == CSV options 198 | # 199 | # Set the CSV builder separator 200 | # config.csv_options = { col_sep: ';' } 201 | # 202 | # Force the use of quotes 203 | # config.csv_options = { force_quotes: true } 204 | 205 | # == Menu System 206 | # 207 | # You can add a navigation menu to be used in your application, or configure a provided menu 208 | # 209 | # To change the default utility navigation to show a link to your website & a logout btn 210 | # 211 | # config.namespace :admin do |admin| 212 | # admin.build_menu :utility_navigation do |menu| 213 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } 214 | # admin.add_logout_button_to_menu menu 215 | # end 216 | # end 217 | # 218 | # If you wanted to add a static menu item to the default menu provided: 219 | # 220 | # config.namespace :admin do |admin| 221 | # admin.build_menu :default do |menu| 222 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } 223 | # end 224 | # end 225 | 226 | # == Download Links 227 | # 228 | # You can disable download links on resource listing pages, 229 | # or customize the formats shown per namespace/globally 230 | # 231 | # To disable/customize for the :admin namespace: 232 | # 233 | # config.namespace :admin do |admin| 234 | # 235 | # # Disable the links entirely 236 | # admin.download_links = false 237 | # 238 | # # Only show XML & PDF options 239 | # admin.download_links = [:xml, :pdf] 240 | # 241 | # # Enable/disable the links based on block 242 | # # (for example, with cancan) 243 | # admin.download_links = proc { can?(:view_download_links) } 244 | # 245 | # end 246 | 247 | # == Pagination 248 | # 249 | # Pagination is enabled by default for all resources. 250 | # You can control the default per page count for all resources here. 251 | # 252 | # config.default_per_page = 30 253 | # 254 | # You can control the max per page count too. 255 | # 256 | # config.max_per_page = 10_000 257 | 258 | # == Filters 259 | # 260 | # By default the index screen includes a "Filters" sidebar on the right 261 | # hand side with a filter for each attribute of the registered model. 262 | # You can enable or disable them for all resources here. 263 | # 264 | # config.filters = true 265 | # 266 | # By default the filters include associations in a select, which means 267 | # that every record will be loaded for each association. 268 | # You can enabled or disable the inclusion 269 | # of those filters by default here. 270 | # 271 | # config.include_default_association_filters = true 272 | end 273 | -------------------------------------------------------------------------------- /app/assets/stylesheets/freelancer.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - Freelancer v1.1.1 (http://startbootstrap.com/template-overviews/freelancer) 3 | * Copyright 2013-2016 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) 5 | */ 6 | body { 7 | font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif; 8 | overflow-x: hidden; 9 | } 10 | p { 11 | font-size: 20px; 12 | } 13 | p.small { 14 | font-size: 16px; 15 | } 16 | a, 17 | a:hover, 18 | a:focus, 19 | a:active, 20 | a.active { 21 | color: #18BC9C; 22 | outline: none; 23 | } 24 | h1, 25 | h2, 26 | h3, 27 | h4, 28 | h5, 29 | h6 { 30 | font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif; 31 | text-transform: uppercase; 32 | font-weight: 700; 33 | } 34 | hr.star-light, 35 | hr.star-primary { 36 | padding: 0; 37 | border: none; 38 | border-top: solid 5px; 39 | text-align: center; 40 | max-width: 250px; 41 | margin: 25px auto 30px; 42 | } 43 | hr.star-light:after, 44 | hr.star-primary:after { 45 | content: "\f005"; 46 | font-family: FontAwesome; 47 | display: inline-block; 48 | position: relative; 49 | top: -0.8em; 50 | font-size: 2em; 51 | padding: 0 0.25em; 52 | } 53 | hr.star-light { 54 | border-color: white; 55 | } 56 | hr.star-light:after { 57 | background-color: #18BC9C; 58 | color: white; 59 | } 60 | hr.star-primary { 61 | border-color: #2C3E50; 62 | } 63 | hr.star-primary:after { 64 | background-color: white; 65 | color: #2C3E50; 66 | } 67 | .img-centered { 68 | margin: 0 auto; 69 | } 70 | header { 71 | text-align: center; 72 | background: #18BC9C; 73 | color: white; 74 | } 75 | header .container { 76 | padding-top: 100px; 77 | padding-bottom: 50px; 78 | } 79 | header img { 80 | display: block; 81 | margin: 0 auto 20px; 82 | } 83 | header .intro-text .name { 84 | display: block; 85 | font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif; 86 | text-transform: uppercase; 87 | font-weight: 700; 88 | font-size: 2em; 89 | } 90 | header .intro-text .skills { 91 | font-size: 1.25em; 92 | font-weight: 300; 93 | } 94 | @media (min-width: 768px) { 95 | header .container { 96 | padding-top: 200px; 97 | padding-bottom: 100px; 98 | } 99 | header .intro-text .name { 100 | font-size: 4.75em; 101 | } 102 | header .intro-text .skills { 103 | font-size: 1.75em; 104 | } 105 | } 106 | .navbar-custom { 107 | background: #2C3E50; 108 | font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif; 109 | text-transform: uppercase; 110 | font-weight: 700; 111 | border: none; 112 | } 113 | .navbar-custom a:focus { 114 | outline: none; 115 | } 116 | .navbar-custom .navbar-brand { 117 | color: white; 118 | } 119 | .navbar-custom .navbar-brand:hover, 120 | .navbar-custom .navbar-brand:focus, 121 | .navbar-custom .navbar-brand:active, 122 | .navbar-custom .navbar-brand.active { 123 | color: white; 124 | } 125 | .navbar-custom .navbar-nav { 126 | letter-spacing: 1px; 127 | } 128 | .navbar-custom .navbar-nav li a { 129 | color: white; 130 | } 131 | .navbar-custom .navbar-nav li a:hover { 132 | color: #18BC9C; 133 | outline: none; 134 | } 135 | .navbar-custom .navbar-nav li a:focus, 136 | .navbar-custom .navbar-nav li a:active { 137 | color: white; 138 | } 139 | .navbar-custom .navbar-nav li.active a { 140 | color: white; 141 | background: #18BC9C; 142 | } 143 | .navbar-custom .navbar-nav li.active a:hover, 144 | .navbar-custom .navbar-nav li.active a:focus, 145 | .navbar-custom .navbar-nav li.active a:active { 146 | color: white; 147 | background: #18BC9C; 148 | } 149 | .navbar-custom .navbar-toggle { 150 | color: white; 151 | text-transform: uppercase; 152 | font-size: 10px; 153 | border-color: white; 154 | } 155 | .navbar-custom .navbar-toggle:hover, 156 | .navbar-custom .navbar-toggle:focus { 157 | background-color: #18BC9C; 158 | color: white; 159 | border-color: #18BC9C; 160 | } 161 | @media (min-width: 768px) { 162 | .navbar-custom { 163 | padding: 25px 0; 164 | -webkit-transition: padding 0.3s; 165 | -moz-transition: padding 0.3s; 166 | transition: padding 0.3s; 167 | } 168 | .navbar-custom .navbar-brand { 169 | font-size: 2em; 170 | -webkit-transition: all 0.3s; 171 | -moz-transition: all 0.3s; 172 | transition: all 0.3s; 173 | } 174 | .navbar-custom.affix { 175 | padding: 10px 0; 176 | } 177 | .navbar-custom.affix .navbar-brand { 178 | font-size: 1.5em; 179 | } 180 | } 181 | section { 182 | padding: 100px 0; 183 | } 184 | section h2 { 185 | margin: 0; 186 | font-size: 3em; 187 | } 188 | section.success { 189 | background: #18BC9C; 190 | color: white; 191 | } 192 | @media (max-width: 767px) { 193 | section { 194 | padding: 75px 0; 195 | } 196 | section.first { 197 | padding-top: 75px; 198 | } 199 | } 200 | #portfolio .portfolio-item { 201 | margin: 0 0 15px; 202 | right: 0; 203 | } 204 | #portfolio .portfolio-item .portfolio-link { 205 | display: block; 206 | position: relative; 207 | max-width: 400px; 208 | margin: 0 auto; 209 | } 210 | #portfolio .portfolio-item .portfolio-link .caption { 211 | background: rgba(24, 188, 156, 0.9); 212 | position: absolute; 213 | width: 100%; 214 | height: 100%; 215 | opacity: 0; 216 | transition: all ease 0.5s; 217 | -webkit-transition: all ease 0.5s; 218 | -moz-transition: all ease 0.5s; 219 | } 220 | #portfolio .portfolio-item .portfolio-link .caption:hover { 221 | opacity: 1; 222 | } 223 | #portfolio .portfolio-item .portfolio-link .caption .caption-content { 224 | position: absolute; 225 | width: 100%; 226 | height: 20px; 227 | font-size: 20px; 228 | text-align: center; 229 | top: 50%; 230 | margin-top: -12px; 231 | color: white; 232 | } 233 | #portfolio .portfolio-item .portfolio-link .caption .caption-content i { 234 | margin-top: -12px; 235 | } 236 | #portfolio .portfolio-item .portfolio-link .caption .caption-content h3, 237 | #portfolio .portfolio-item .portfolio-link .caption .caption-content h4 { 238 | margin: 0; 239 | } 240 | #portfolio * { 241 | z-index: 2; 242 | } 243 | @media (min-width: 767px) { 244 | #portfolio .portfolio-item { 245 | margin: 0 0 30px; 246 | } 247 | } 248 | .floating-label-form-group { 249 | position: relative; 250 | margin-bottom: 0; 251 | padding-bottom: 0.5em; 252 | border-bottom: 1px solid #eeeeee; 253 | } 254 | .floating-label-form-group input, 255 | .floating-label-form-group textarea { 256 | z-index: 1; 257 | position: relative; 258 | padding-right: 0; 259 | padding-left: 0; 260 | border: none; 261 | border-radius: 0; 262 | font-size: 1.5em; 263 | background: none; 264 | box-shadow: none !important; 265 | resize: none; 266 | } 267 | .floating-label-form-group label { 268 | display: block; 269 | z-index: 0; 270 | position: relative; 271 | top: 2em; 272 | margin: 0; 273 | font-size: 0.85em; 274 | line-height: 1.764705882em; 275 | vertical-align: middle; 276 | vertical-align: baseline; 277 | opacity: 0; 278 | -webkit-transition: top 0.3s ease,opacity 0.3s ease; 279 | -moz-transition: top 0.3s ease,opacity 0.3s ease; 280 | -ms-transition: top 0.3s ease,opacity 0.3s ease; 281 | transition: top 0.3s ease,opacity 0.3s ease; 282 | } 283 | .floating-label-form-group:not(:first-child) { 284 | padding-left: 14px; 285 | border-left: 1px solid #eeeeee; 286 | } 287 | .floating-label-form-group-with-value label { 288 | top: 0; 289 | opacity: 1; 290 | } 291 | .floating-label-form-group-with-focus label { 292 | color: #18BC9C; 293 | } 294 | form .row:first-child .floating-label-form-group { 295 | border-top: 1px solid #eeeeee; 296 | } 297 | footer { 298 | color: white; 299 | } 300 | footer h3 { 301 | margin-bottom: 30px; 302 | } 303 | footer .footer-above { 304 | padding-top: 50px; 305 | background-color: #2C3E50; 306 | } 307 | footer .footer-col { 308 | margin-bottom: 50px; 309 | } 310 | footer .footer-below { 311 | padding: 25px 0; 312 | background-color: #233140; 313 | } 314 | .btn-outline { 315 | color: white; 316 | font-size: 20px; 317 | border: solid 2px white; 318 | background: transparent; 319 | transition: all 0.3s ease-in-out; 320 | margin-top: 15px; 321 | } 322 | .btn-outline:hover, 323 | .btn-outline:focus, 324 | .btn-outline:active, 325 | .btn-outline.active { 326 | color: #18BC9C; 327 | background: white; 328 | border: solid 2px white; 329 | } 330 | .btn-primary { 331 | color: white; 332 | background-color: #2C3E50; 333 | border-color: #2C3E50; 334 | font-weight: 700; 335 | } 336 | .btn-primary:hover, 337 | .btn-primary:focus, 338 | .btn-primary:active, 339 | .btn-primary.active, 340 | .open .dropdown-toggle.btn-primary { 341 | color: white; 342 | background-color: #1a242f; 343 | border-color: #161f29; 344 | } 345 | .btn-primary:active, 346 | .btn-primary.active, 347 | .open .dropdown-toggle.btn-primary { 348 | background-image: none; 349 | } 350 | .btn-primary.disabled, 351 | .btn-primary[disabled], 352 | fieldset[disabled] .btn-primary, 353 | .btn-primary.disabled:hover, 354 | .btn-primary[disabled]:hover, 355 | fieldset[disabled] .btn-primary:hover, 356 | .btn-primary.disabled:focus, 357 | .btn-primary[disabled]:focus, 358 | fieldset[disabled] .btn-primary:focus, 359 | .btn-primary.disabled:active, 360 | .btn-primary[disabled]:active, 361 | fieldset[disabled] .btn-primary:active, 362 | .btn-primary.disabled.active, 363 | .btn-primary[disabled].active, 364 | fieldset[disabled] .btn-primary.active { 365 | background-color: #2C3E50; 366 | border-color: #2C3E50; 367 | } 368 | .btn-primary .badge { 369 | color: #2C3E50; 370 | background-color: white; 371 | } 372 | .btn-success { 373 | color: white; 374 | background-color: #18BC9C; 375 | border-color: #18BC9C; 376 | font-weight: 700; 377 | } 378 | .btn-success:hover, 379 | .btn-success:focus, 380 | .btn-success:active, 381 | .btn-success.active, 382 | .open .dropdown-toggle.btn-success { 383 | color: white; 384 | background-color: #128f76; 385 | border-color: #11866f; 386 | } 387 | .btn-success:active, 388 | .btn-success.active, 389 | .open .dropdown-toggle.btn-success { 390 | background-image: none; 391 | } 392 | .btn-success.disabled, 393 | .btn-success[disabled], 394 | fieldset[disabled] .btn-success, 395 | .btn-success.disabled:hover, 396 | .btn-success[disabled]:hover, 397 | fieldset[disabled] .btn-success:hover, 398 | .btn-success.disabled:focus, 399 | .btn-success[disabled]:focus, 400 | fieldset[disabled] .btn-success:focus, 401 | .btn-success.disabled:active, 402 | .btn-success[disabled]:active, 403 | fieldset[disabled] .btn-success:active, 404 | .btn-success.disabled.active, 405 | .btn-success[disabled].active, 406 | fieldset[disabled] .btn-success.active { 407 | background-color: #18BC9C; 408 | border-color: #18BC9C; 409 | } 410 | .btn-success .badge { 411 | color: #18BC9C; 412 | background-color: white; 413 | } 414 | .btn-social { 415 | display: inline-block; 416 | height: 50px; 417 | width: 50px; 418 | border: 2px solid white; 419 | border-radius: 100%; 420 | text-align: center; 421 | font-size: 20px; 422 | line-height: 45px; 423 | } 424 | .btn:focus, 425 | .btn:active, 426 | .btn.active { 427 | outline: none; 428 | } 429 | .scroll-top { 430 | position: fixed; 431 | right: 2%; 432 | bottom: 2%; 433 | width: 50px; 434 | height: 50px; 435 | z-index: 1049; 436 | } 437 | .scroll-top .btn { 438 | font-size: 20px; 439 | width: 50px; 440 | height: 50px; 441 | border-radius: 100%; 442 | line-height: 28px; 443 | } 444 | .scroll-top .btn:focus { 445 | outline: none; 446 | } 447 | .portfolio-modal .modal-content { 448 | border-radius: 0; 449 | background-clip: border-box; 450 | -webkit-box-shadow: none; 451 | box-shadow: none; 452 | border: none; 453 | min-height: 100%; 454 | padding: 100px 0; 455 | text-align: center; 456 | } 457 | .portfolio-modal .modal-content h2 { 458 | margin: 0; 459 | font-size: 3em; 460 | } 461 | .portfolio-modal .modal-content img { 462 | margin-bottom: 30px; 463 | } 464 | .portfolio-modal .modal-content .item-details { 465 | margin: 30px 0; 466 | } 467 | .portfolio-modal .close-modal { 468 | position: absolute; 469 | width: 75px; 470 | height: 75px; 471 | background-color: transparent; 472 | top: 25px; 473 | right: 25px; 474 | cursor: pointer; 475 | } 476 | .portfolio-modal .close-modal:hover { 477 | opacity: 0.3; 478 | } 479 | .portfolio-modal .close-modal .lr { 480 | height: 75px; 481 | width: 1px; 482 | margin-left: 35px; 483 | background-color: #2C3E50; 484 | transform: rotate(45deg); 485 | -ms-transform: rotate(45deg); 486 | /* IE 9 */ 487 | -webkit-transform: rotate(45deg); 488 | /* Safari and Chrome */ 489 | z-index: 1051; 490 | } 491 | .portfolio-modal .close-modal .lr .rl { 492 | height: 75px; 493 | width: 1px; 494 | background-color: #2C3E50; 495 | transform: rotate(90deg); 496 | -ms-transform: rotate(90deg); 497 | /* IE 9 */ 498 | -webkit-transform: rotate(90deg); 499 | /* Safari and Chrome */ 500 | z-index: 1052; 501 | } 502 | .portfolio-modal .modal-backdrop { 503 | opacity: 0; 504 | display: none; 505 | } 506 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # Use this hook to configure devise mailer, warden hooks and so forth. 2 | # Many of these configuration options can be set straight in your model. 3 | Devise.setup do |config| 4 | # The secret key used by Devise. Devise uses this key to generate 5 | # random tokens. Changing this key will render invalid all existing 6 | # confirmation, reset password and unlock tokens in the database. 7 | # Devise will use the `secret_key_base` as its `secret_key` 8 | # by default. You can change it below and use your own secret key. 9 | # config.secret_key = '869b9af1c8d6a2138b0868a16b58c7c0dd44b8d8ef2f84c99aa02475233d6551e31dae391ddc8fea687b4801a81f3fecd4e4643bf211b3c7fbb91132da24ddc7' 10 | 11 | # ==> Mailer Configuration 12 | # Configure the e-mail address which will be shown in Devise::Mailer, 13 | # note that it will be overwritten if you use your own mailer class 14 | # with default "from" parameter. 15 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 16 | 17 | # Configure the class responsible to send e-mails. 18 | # config.mailer = 'Devise::Mailer' 19 | 20 | # Configure the parent class responsible to send e-mails. 21 | # config.parent_mailer = 'ActionMailer::Base' 22 | 23 | # ==> ORM configuration 24 | # Load and configure the ORM. Supports :active_record (default) and 25 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 26 | # available as additional gems. 27 | require 'devise/orm/active_record' 28 | 29 | # ==> Configuration for any authentication mechanism 30 | # Configure which keys are used when authenticating a user. The default is 31 | # just :email. You can configure it to use [:username, :subdomain], so for 32 | # authenticating a user, both parameters are required. Remember that those 33 | # parameters are used only when authenticating and not when retrieving from 34 | # session. If you need permissions, you should implement that in a before filter. 35 | # You can also supply a hash where the value is a boolean determining whether 36 | # or not authentication should be aborted when the value is not present. 37 | # config.authentication_keys = [:email] 38 | 39 | # Configure parameters from the request object used for authentication. Each entry 40 | # given should be a request method and it will automatically be passed to the 41 | # find_for_authentication method and considered in your model lookup. For instance, 42 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 43 | # The same considerations mentioned for authentication_keys also apply to request_keys. 44 | # config.request_keys = [] 45 | 46 | # Configure which authentication keys should be case-insensitive. 47 | # These keys will be downcased upon creating or modifying a user and when used 48 | # to authenticate or find a user. Default is :email. 49 | config.case_insensitive_keys = [:email] 50 | 51 | # Configure which authentication keys should have whitespace stripped. 52 | # These keys will have whitespace before and after removed upon creating or 53 | # modifying a user and when used to authenticate or find a user. Default is :email. 54 | config.strip_whitespace_keys = [:email] 55 | 56 | # Tell if authentication through request.params is enabled. True by default. 57 | # It can be set to an array that will enable params authentication only for the 58 | # given strategies, for example, `config.params_authenticatable = [:database]` will 59 | # enable it only for database (email + password) authentication. 60 | # config.params_authenticatable = true 61 | 62 | # Tell if authentication through HTTP Auth is enabled. False by default. 63 | # It can be set to an array that will enable http authentication only for the 64 | # given strategies, for example, `config.http_authenticatable = [:database]` will 65 | # enable it only for database authentication. The supported strategies are: 66 | # :database = Support basic authentication with authentication key + password 67 | # config.http_authenticatable = false 68 | 69 | # If 401 status code should be returned for AJAX requests. True by default. 70 | # config.http_authenticatable_on_xhr = true 71 | 72 | # The realm used in Http Basic Authentication. 'Application' by default. 73 | # config.http_authentication_realm = 'Application' 74 | 75 | # It will change confirmation, password recovery and other workflows 76 | # to behave the same regardless if the e-mail provided was right or wrong. 77 | # Does not affect registerable. 78 | # config.paranoid = true 79 | 80 | # By default Devise will store the user in session. You can skip storage for 81 | # particular strategies by setting this option. 82 | # Notice that if you are skipping storage for all authentication paths, you 83 | # may want to disable generating routes to Devise's sessions controller by 84 | # passing skip: :sessions to `devise_for` in your config/routes.rb 85 | config.skip_session_storage = [:http_auth] 86 | 87 | # By default, Devise cleans up the CSRF token on authentication to 88 | # avoid CSRF token fixation attacks. This means that, when using AJAX 89 | # requests for sign in and sign up, you need to get a new CSRF token 90 | # from the server. You can disable this option at your own risk. 91 | # config.clean_up_csrf_token_on_authentication = true 92 | 93 | # When false, Devise will not attempt to reload routes on eager load. 94 | # This can reduce the time taken to boot the app but if your application 95 | # requires the Devise mappings to be loaded during boot time the application 96 | # won't boot properly. 97 | # config.reload_routes = true 98 | 99 | # ==> Configuration for :database_authenticatable 100 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If 101 | # using other algorithms, it sets how many times you want the password to be hashed. 102 | # 103 | # Limiting the stretches to just one in testing will increase the performance of 104 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 105 | # a value less than 10 in other environments. Note that, for bcrypt (the default 106 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 107 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 108 | config.stretches = Rails.env.test? ? 1 : 11 109 | 110 | # Set up a pepper to generate the hashed password. 111 | # config.pepper = '2dfd02595947bc72743fc51c866da105fc1ae1622d3bae8308c392369a9b87228607eb52316da3771742627f10025b5af043b247e3097910ab53ddaecd7ccd7a' 112 | 113 | # Send a notification email when the user's password is changed 114 | # config.send_password_change_notification = false 115 | 116 | # ==> Configuration for :confirmable 117 | # A period that the user is allowed to access the website even without 118 | # confirming their account. For instance, if set to 2.days, the user will be 119 | # able to access the website for two days without confirming their account, 120 | # access will be blocked just in the third day. Default is 0.days, meaning 121 | # the user cannot access the website without confirming their account. 122 | # config.allow_unconfirmed_access_for = 2.days 123 | 124 | # A period that the user is allowed to confirm their account before their 125 | # token becomes invalid. For example, if set to 3.days, the user can confirm 126 | # their account within 3 days after the mail was sent, but on the fourth day 127 | # their account can't be confirmed with the token any more. 128 | # Default is nil, meaning there is no restriction on how long a user can take 129 | # before confirming their account. 130 | # config.confirm_within = 3.days 131 | 132 | # If true, requires any email changes to be confirmed (exactly the same way as 133 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 134 | # db field (see migrations). Until confirmed, new email is stored in 135 | # unconfirmed_email column, and copied to email column on successful confirmation. 136 | config.reconfirmable = true 137 | 138 | # Defines which key will be used when confirming an account 139 | # config.confirmation_keys = [:email] 140 | 141 | # ==> Configuration for :rememberable 142 | # The time the user will be remembered without asking for credentials again. 143 | # config.remember_for = 2.weeks 144 | 145 | # Invalidates all the remember me tokens when the user signs out. 146 | config.expire_all_remember_me_on_sign_out = true 147 | 148 | # If true, extends the user's remember period when remembered via cookie. 149 | # config.extend_remember_period = false 150 | 151 | # Options to be passed to the created cookie. For instance, you can set 152 | # secure: true in order to force SSL only cookies. 153 | # config.rememberable_options = {} 154 | 155 | # ==> Configuration for :validatable 156 | # Range for password length. 157 | config.password_length = 6..128 158 | 159 | # Email regex used to validate email formats. It simply asserts that 160 | # one (and only one) @ exists in the given string. This is mainly 161 | # to give user feedback and not to assert the e-mail validity. 162 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 163 | 164 | # ==> Configuration for :timeoutable 165 | # The time you want to timeout the user session without activity. After this 166 | # time the user will be asked for credentials again. Default is 30 minutes. 167 | # config.timeout_in = 30.minutes 168 | 169 | # ==> Configuration for :lockable 170 | # Defines which strategy will be used to lock an account. 171 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 172 | # :none = No lock strategy. You should handle locking by yourself. 173 | # config.lock_strategy = :failed_attempts 174 | 175 | # Defines which key will be used when locking and unlocking an account 176 | # config.unlock_keys = [:email] 177 | 178 | # Defines which strategy will be used to unlock an account. 179 | # :email = Sends an unlock link to the user email 180 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 181 | # :both = Enables both strategies 182 | # :none = No unlock strategy. You should handle unlocking by yourself. 183 | # config.unlock_strategy = :both 184 | 185 | # Number of authentication tries before locking an account if lock_strategy 186 | # is failed attempts. 187 | # config.maximum_attempts = 20 188 | 189 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 190 | # config.unlock_in = 1.hour 191 | 192 | # Warn on the last attempt before the account is locked. 193 | # config.last_attempt_warning = true 194 | 195 | # ==> Configuration for :recoverable 196 | # 197 | # Defines which key will be used when recovering the password for an account 198 | # config.reset_password_keys = [:email] 199 | 200 | # Time interval you can reset your password with a reset password key. 201 | # Don't put a too small interval or your users won't have the time to 202 | # change their passwords. 203 | config.reset_password_within = 6.hours 204 | 205 | # When set to false, does not sign a user in automatically after their password is 206 | # reset. Defaults to true, so a user is signed in automatically after a reset. 207 | # config.sign_in_after_reset_password = true 208 | 209 | # ==> Configuration for :encryptable 210 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 211 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 212 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 213 | # for default behavior) and :restful_authentication_sha1 (then you should set 214 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 215 | # 216 | # Require the `devise-encryptable` gem when using anything other than bcrypt 217 | # config.encryptor = :sha512 218 | 219 | # ==> Scopes configuration 220 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 221 | # "users/sessions/new". It's turned off by default because it's slower if you 222 | # are using only default views. 223 | # config.scoped_views = false 224 | 225 | # Configure the default scope given to Warden. By default it's the first 226 | # devise role declared in your routes (usually :user). 227 | # config.default_scope = :user 228 | 229 | # Set this configuration to false if you want /users/sign_out to sign out 230 | # only the current scope. By default, Devise signs out all scopes. 231 | # config.sign_out_all_scopes = true 232 | 233 | # ==> Navigation configuration 234 | # Lists the formats that should be treated as navigational. Formats like 235 | # :html, should redirect to the sign in page when the user does not have 236 | # access, but formats like :xml or :json, should return 401. 237 | # 238 | # If you have any extra navigational formats, like :iphone or :mobile, you 239 | # should add them to the navigational formats lists. 240 | # 241 | # The "*/*" below is required to match Internet Explorer requests. 242 | # config.navigational_formats = ['*/*', :html] 243 | 244 | # The default HTTP method used to sign out a resource. Default is :delete. 245 | config.sign_out_via = :delete 246 | 247 | # ==> OmniAuth 248 | # Add a new OmniAuth provider. Check the wiki for more information on setting 249 | # up on your models and hooks. 250 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 251 | 252 | # ==> Warden configuration 253 | # If you want to use other strategies, that are not supported by Devise, or 254 | # change the failure app, you can configure them inside the config.warden block. 255 | # 256 | # config.warden do |manager| 257 | # manager.intercept_401 = false 258 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 259 | # end 260 | 261 | # ==> Mountable engine configurations 262 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 263 | # is mountable, there are some extra configurations to be taken into account. 264 | # The following options are available, assuming the engine is mounted as: 265 | # 266 | # mount MyEngine, at: '/my_engine' 267 | # 268 | # The router that invoked `devise_for`, in the example above, would be: 269 | # config.router_name = :my_engine 270 | # 271 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 272 | # so you need to do it manually. For the users scope, it would be: 273 | # config.omniauth_path_prefix = '/my_engine/users/auth' 274 | end 275 | -------------------------------------------------------------------------------- /app/assets/javascripts/jqBootstrapValidation.js: -------------------------------------------------------------------------------- 1 | /* jqBootstrapValidation 2 | * A plugin for automating validation on Twitter Bootstrap formatted forms. 3 | * 4 | * v1.3.6 5 | * 6 | * License: MIT - see LICENSE file 7 | * 8 | * http://ReactiveRaven.github.com/jqBootstrapValidation/ 9 | */ 10 | 11 | (function( $ ){ 12 | 13 | var createdElements = []; 14 | 15 | var defaults = { 16 | options: { 17 | prependExistingHelpBlock: false, 18 | sniffHtml: true, // sniff for 'required', 'maxlength', etc 19 | preventSubmit: true, // stop the form submit event from firing if validation fails 20 | submitError: false, // function called if there is an error when trying to submit 21 | submitSuccess: false, // function called just before a successful submit event is sent to the server 22 | semanticallyStrict: false, // set to true to tidy up generated HTML output 23 | autoAdd: { 24 | helpBlocks: true 25 | }, 26 | filter: function () { 27 | // return $(this).is(":visible"); // only validate elements you can see 28 | return true; // validate everything 29 | } 30 | }, 31 | methods: { 32 | init : function( options ) { 33 | 34 | var settings = $.extend(true, {}, defaults); 35 | 36 | settings.options = $.extend(true, settings.options, options); 37 | 38 | var $siblingElements = this; 39 | 40 | var uniqueForms = $.unique( 41 | $siblingElements.map( function () { 42 | return $(this).parents("form")[0]; 43 | }).toArray() 44 | ); 45 | 46 | $(uniqueForms).bind("submit", function (e) { 47 | var $form = $(this); 48 | var warningsFound = 0; 49 | var $inputs = $form.find("input,textarea,select").not("[type=submit],[type=image]").filter(settings.options.filter); 50 | $inputs.trigger("submit.validation").trigger("validationLostFocus.validation"); 51 | 52 | $inputs.each(function (i, el) { 53 | var $this = $(el), 54 | $controlGroup = $this.parents(".control-group").first(); 55 | if ( 56 | $controlGroup.hasClass("warning") 57 | ) { 58 | $controlGroup.removeClass("warning").addClass("error"); 59 | warningsFound++; 60 | } 61 | }); 62 | 63 | $inputs.trigger("validationLostFocus.validation"); 64 | 65 | if (warningsFound) { 66 | if (settings.options.preventSubmit) { 67 | e.preventDefault(); 68 | } 69 | $form.addClass("error"); 70 | if ($.isFunction(settings.options.submitError)) { 71 | settings.options.submitError($form, e, $inputs.jqBootstrapValidation("collectErrors", true)); 72 | } 73 | } else { 74 | $form.removeClass("error"); 75 | if ($.isFunction(settings.options.submitSuccess)) { 76 | settings.options.submitSuccess($form, e); 77 | } 78 | } 79 | }); 80 | 81 | return this.each(function(){ 82 | 83 | // Get references to everything we're interested in 84 | var $this = $(this), 85 | $controlGroup = $this.parents(".control-group").first(), 86 | $helpBlock = $controlGroup.find(".help-block").first(), 87 | $form = $this.parents("form").first(), 88 | validatorNames = []; 89 | 90 | // create message container if not exists 91 | if (!$helpBlock.length && settings.options.autoAdd && settings.options.autoAdd.helpBlocks) { 92 | $helpBlock = $('
'); 93 | $controlGroup.find('.controls').append($helpBlock); 94 | createdElements.push($helpBlock[0]); 95 | } 96 | 97 | // ============================================================= 98 | // SNIFF HTML FOR VALIDATORS 99 | // ============================================================= 100 | 101 | // *snort sniff snuffle* 102 | 103 | if (settings.options.sniffHtml) { 104 | var message = ""; 105 | // --------------------------------------------------------- 106 | // PATTERN 107 | // --------------------------------------------------------- 108 | if ($this.attr("pattern") !== undefined) { 109 | message = "Not in the expected format"; 110 | if ($this.data("validationPatternMessage")) { 111 | message = $this.data("validationPatternMessage"); 112 | } 113 | $this.data("validationPatternMessage", message); 114 | $this.data("validationPatternRegex", $this.attr("pattern")); 115 | } 116 | // --------------------------------------------------------- 117 | // MAX 118 | // --------------------------------------------------------- 119 | if ($this.attr("max") !== undefined || $this.attr("aria-valuemax") !== undefined) { 120 | var max = ($this.attr("max") !== undefined ? $this.attr("max") : $this.attr("aria-valuemax")); 121 | message = "Too high: Maximum of '" + max + "'"; 122 | if ($this.data("validationMaxMessage")) { 123 | message = $this.data("validationMaxMessage"); 124 | } 125 | $this.data("validationMaxMessage", message); 126 | $this.data("validationMaxMax", max); 127 | } 128 | // --------------------------------------------------------- 129 | // MIN 130 | // --------------------------------------------------------- 131 | if ($this.attr("min") !== undefined || $this.attr("aria-valuemin") !== undefined) { 132 | var min = ($this.attr("min") !== undefined ? $this.attr("min") : $this.attr("aria-valuemin")); 133 | message = "Too low: Minimum of '" + min + "'"; 134 | if ($this.data("validationMinMessage")) { 135 | message = $this.data("validationMinMessage"); 136 | } 137 | $this.data("validationMinMessage", message); 138 | $this.data("validationMinMin", min); 139 | } 140 | // --------------------------------------------------------- 141 | // MAXLENGTH 142 | // --------------------------------------------------------- 143 | if ($this.attr("maxlength") !== undefined) { 144 | message = "Too long: Maximum of '" + $this.attr("maxlength") + "' characters"; 145 | if ($this.data("validationMaxlengthMessage")) { 146 | message = $this.data("validationMaxlengthMessage"); 147 | } 148 | $this.data("validationMaxlengthMessage", message); 149 | $this.data("validationMaxlengthMaxlength", $this.attr("maxlength")); 150 | } 151 | // --------------------------------------------------------- 152 | // MINLENGTH 153 | // --------------------------------------------------------- 154 | if ($this.attr("minlength") !== undefined) { 155 | message = "Too short: Minimum of '" + $this.attr("minlength") + "' characters"; 156 | if ($this.data("validationMinlengthMessage")) { 157 | message = $this.data("validationMinlengthMessage"); 158 | } 159 | $this.data("validationMinlengthMessage", message); 160 | $this.data("validationMinlengthMinlength", $this.attr("minlength")); 161 | } 162 | // --------------------------------------------------------- 163 | // REQUIRED 164 | // --------------------------------------------------------- 165 | if ($this.attr("required") !== undefined || $this.attr("aria-required") !== undefined) { 166 | message = settings.builtInValidators.required.message; 167 | if ($this.data("validationRequiredMessage")) { 168 | message = $this.data("validationRequiredMessage"); 169 | } 170 | $this.data("validationRequiredMessage", message); 171 | } 172 | // --------------------------------------------------------- 173 | // NUMBER 174 | // --------------------------------------------------------- 175 | if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "number") { 176 | message = settings.builtInValidators.number.message; 177 | if ($this.data("validationNumberMessage")) { 178 | message = $this.data("validationNumberMessage"); 179 | } 180 | $this.data("validationNumberMessage", message); 181 | } 182 | // --------------------------------------------------------- 183 | // EMAIL 184 | // --------------------------------------------------------- 185 | if ($this.attr("type") !== undefined && $this.attr("type").toLowerCase() === "email") { 186 | message = "Not a valid email address"; 187 | if ($this.data("validationValidemailMessage")) { 188 | message = $this.data("validationValidemailMessage"); 189 | } else if ($this.data("validationEmailMessage")) { 190 | message = $this.data("validationEmailMessage"); 191 | } 192 | $this.data("validationValidemailMessage", message); 193 | } 194 | // --------------------------------------------------------- 195 | // MINCHECKED 196 | // --------------------------------------------------------- 197 | if ($this.attr("minchecked") !== undefined) { 198 | message = "Not enough options checked; Minimum of '" + $this.attr("minchecked") + "' required"; 199 | if ($this.data("validationMincheckedMessage")) { 200 | message = $this.data("validationMincheckedMessage"); 201 | } 202 | $this.data("validationMincheckedMessage", message); 203 | $this.data("validationMincheckedMinchecked", $this.attr("minchecked")); 204 | } 205 | // --------------------------------------------------------- 206 | // MAXCHECKED 207 | // --------------------------------------------------------- 208 | if ($this.attr("maxchecked") !== undefined) { 209 | message = "Too many options checked; Maximum of '" + $this.attr("maxchecked") + "' required"; 210 | if ($this.data("validationMaxcheckedMessage")) { 211 | message = $this.data("validationMaxcheckedMessage"); 212 | } 213 | $this.data("validationMaxcheckedMessage", message); 214 | $this.data("validationMaxcheckedMaxchecked", $this.attr("maxchecked")); 215 | } 216 | } 217 | 218 | // ============================================================= 219 | // COLLECT VALIDATOR NAMES 220 | // ============================================================= 221 | 222 | // Get named validators 223 | if ($this.data("validation") !== undefined) { 224 | validatorNames = $this.data("validation").split(","); 225 | } 226 | 227 | // Get extra ones defined on the element's data attributes 228 | $.each($this.data(), function (i, el) { 229 | var parts = i.replace(/([A-Z])/g, ",$1").split(","); 230 | if (parts[0] === "validation" && parts[1]) { 231 | validatorNames.push(parts[1]); 232 | } 233 | }); 234 | 235 | // ============================================================= 236 | // NORMALISE VALIDATOR NAMES 237 | // ============================================================= 238 | 239 | var validatorNamesToInspect = validatorNames; 240 | var newValidatorNamesToInspect = []; 241 | 242 | do // repeatedly expand 'shortcut' validators into their real validators 243 | { 244 | // Uppercase only the first letter of each name 245 | $.each(validatorNames, function (i, el) { 246 | validatorNames[i] = formatValidatorName(el); 247 | }); 248 | 249 | // Remove duplicate validator names 250 | validatorNames = $.unique(validatorNames); 251 | 252 | // Pull out the new validator names from each shortcut 253 | newValidatorNamesToInspect = []; 254 | $.each(validatorNamesToInspect, function(i, el) { 255 | if ($this.data("validation" + el + "Shortcut") !== undefined) { 256 | // Are these custom validators? 257 | // Pull them out! 258 | $.each($this.data("validation" + el + "Shortcut").split(","), function(i2, el2) { 259 | newValidatorNamesToInspect.push(el2); 260 | }); 261 | } else if (settings.builtInValidators[el.toLowerCase()]) { 262 | // Is this a recognised built-in? 263 | // Pull it out! 264 | var validator = settings.builtInValidators[el.toLowerCase()]; 265 | if (validator.type.toLowerCase() === "shortcut") { 266 | $.each(validator.shortcut.split(","), function (i, el) { 267 | el = formatValidatorName(el); 268 | newValidatorNamesToInspect.push(el); 269 | validatorNames.push(el); 270 | }); 271 | } 272 | } 273 | }); 274 | 275 | validatorNamesToInspect = newValidatorNamesToInspect; 276 | 277 | } while (validatorNamesToInspect.length > 0) 278 | 279 | // ============================================================= 280 | // SET UP VALIDATOR ARRAYS 281 | // ============================================================= 282 | 283 | var validators = {}; 284 | 285 | $.each(validatorNames, function (i, el) { 286 | // Set up the 'override' message 287 | var message = $this.data("validation" + el + "Message"); 288 | var hasOverrideMessage = (message !== undefined); 289 | var foundValidator = false; 290 | message = 291 | ( 292 | message 293 | ? message 294 | : "'" + el + "' validation failed " 295 | ) 296 | ; 297 | 298 | $.each( 299 | settings.validatorTypes, 300 | function (validatorType, validatorTemplate) { 301 | if (validators[validatorType] === undefined) { 302 | validators[validatorType] = []; 303 | } 304 | if (!foundValidator && $this.data("validation" + el + formatValidatorName(validatorTemplate.name)) !== undefined) { 305 | validators[validatorType].push( 306 | $.extend( 307 | true, 308 | { 309 | name: formatValidatorName(validatorTemplate.name), 310 | message: message 311 | }, 312 | validatorTemplate.init($this, el) 313 | ) 314 | ); 315 | foundValidator = true; 316 | } 317 | } 318 | ); 319 | 320 | if (!foundValidator && settings.builtInValidators[el.toLowerCase()]) { 321 | 322 | var validator = $.extend(true, {}, settings.builtInValidators[el.toLowerCase()]); 323 | if (hasOverrideMessage) { 324 | validator.message = message; 325 | } 326 | var validatorType = validator.type.toLowerCase(); 327 | 328 | if (validatorType === "shortcut") { 329 | foundValidator = true; 330 | } else { 331 | $.each( 332 | settings.validatorTypes, 333 | function (validatorTemplateType, validatorTemplate) { 334 | if (validators[validatorTemplateType] === undefined) { 335 | validators[validatorTemplateType] = []; 336 | } 337 | if (!foundValidator && validatorType === validatorTemplateType.toLowerCase()) { 338 | $this.data("validation" + el + formatValidatorName(validatorTemplate.name), validator[validatorTemplate.name.toLowerCase()]); 339 | validators[validatorType].push( 340 | $.extend( 341 | validator, 342 | validatorTemplate.init($this, el) 343 | ) 344 | ); 345 | foundValidator = true; 346 | } 347 | } 348 | ); 349 | } 350 | } 351 | 352 | if (! foundValidator) { 353 | $.error("Cannot find validation info for '" + el + "'"); 354 | } 355 | }); 356 | 357 | // ============================================================= 358 | // STORE FALLBACK VALUES 359 | // ============================================================= 360 | 361 | $helpBlock.data( 362 | "original-contents", 363 | ( 364 | $helpBlock.data("original-contents") 365 | ? $helpBlock.data("original-contents") 366 | : $helpBlock.html() 367 | ) 368 | ); 369 | 370 | $helpBlock.data( 371 | "original-role", 372 | ( 373 | $helpBlock.data("original-role") 374 | ? $helpBlock.data("original-role") 375 | : $helpBlock.attr("role") 376 | ) 377 | ); 378 | 379 | $controlGroup.data( 380 | "original-classes", 381 | ( 382 | $controlGroup.data("original-clases") 383 | ? $controlGroup.data("original-classes") 384 | : $controlGroup.attr("class") 385 | ) 386 | ); 387 | 388 | $this.data( 389 | "original-aria-invalid", 390 | ( 391 | $this.data("original-aria-invalid") 392 | ? $this.data("original-aria-invalid") 393 | : $this.attr("aria-invalid") 394 | ) 395 | ); 396 | 397 | // ============================================================= 398 | // VALIDATION 399 | // ============================================================= 400 | 401 | $this.bind( 402 | "validation.validation", 403 | function (event, params) { 404 | 405 | var value = getValue($this); 406 | 407 | // Get a list of the errors to apply 408 | var errorsFound = []; 409 | 410 | $.each(validators, function (validatorType, validatorTypeArray) { 411 | if (value || value.length || (params && params.includeEmpty) || (!!settings.validatorTypes[validatorType].blockSubmit && params && !!params.submitting)) { 412 | $.each(validatorTypeArray, function (i, validator) { 413 | if (settings.validatorTypes[validatorType].validate($this, value, validator)) { 414 | errorsFound.push(validator.message); 415 | } 416 | }); 417 | } 418 | }); 419 | 420 | return errorsFound; 421 | } 422 | ); 423 | 424 | $this.bind( 425 | "getValidators.validation", 426 | function () { 427 | return validators; 428 | } 429 | ); 430 | 431 | // ============================================================= 432 | // WATCH FOR CHANGES 433 | // ============================================================= 434 | $this.bind( 435 | "submit.validation", 436 | function () { 437 | return $this.triggerHandler("change.validation", {submitting: true}); 438 | } 439 | ); 440 | $this.bind( 441 | [ 442 | "keyup", 443 | "focus", 444 | "blur", 445 | "click", 446 | "keydown", 447 | "keypress", 448 | "change" 449 | ].join(".validation ") + ".validation", 450 | function (e, params) { 451 | 452 | var value = getValue($this); 453 | 454 | var errorsFound = []; 455 | 456 | $controlGroup.find("input,textarea,select").each(function (i, el) { 457 | var oldCount = errorsFound.length; 458 | $.each($(el).triggerHandler("validation.validation", params), function (j, message) { 459 | errorsFound.push(message); 460 | }); 461 | if (errorsFound.length > oldCount) { 462 | $(el).attr("aria-invalid", "true"); 463 | } else { 464 | var original = $this.data("original-aria-invalid"); 465 | $(el).attr("aria-invalid", (original !== undefined ? original : false)); 466 | } 467 | }); 468 | 469 | $form.find("input,select,textarea").not($this).not("[name=\"" + $this.attr("name") + "\"]").trigger("validationLostFocus.validation"); 470 | 471 | errorsFound = $.unique(errorsFound.sort()); 472 | 473 | // Were there any errors? 474 | if (errorsFound.length) { 475 | // Better flag it up as a warning. 476 | $controlGroup.removeClass("success error").addClass("warning"); 477 | 478 | // How many errors did we find? 479 | if (settings.options.semanticallyStrict && errorsFound.length === 1) { 480 | // Only one? Being strict? Just output it. 481 | $helpBlock.html(errorsFound[0] + 482 | ( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" )); 483 | } else { 484 | // Multiple? Being sloppy? Glue them together into an UL. 485 | $helpBlock.html("" + 486 | ( settings.options.prependExistingHelpBlock ? $helpBlock.data("original-contents") : "" )); 487 | } 488 | } else { 489 | $controlGroup.removeClass("warning error success"); 490 | if (value.length > 0) { 491 | $controlGroup.addClass("success"); 492 | } 493 | $helpBlock.html($helpBlock.data("original-contents")); 494 | } 495 | 496 | if (e.type === "blur") { 497 | $controlGroup.removeClass("success"); 498 | } 499 | } 500 | ); 501 | $this.bind("validationLostFocus.validation", function () { 502 | $controlGroup.removeClass("success"); 503 | }); 504 | }); 505 | }, 506 | destroy : function( ) { 507 | 508 | return this.each( 509 | function() { 510 | 511 | var 512 | $this = $(this), 513 | $controlGroup = $this.parents(".control-group").first(), 514 | $helpBlock = $controlGroup.find(".help-block").first(); 515 | 516 | // remove our events 517 | $this.unbind('.validation'); // events are namespaced. 518 | // reset help text 519 | $helpBlock.html($helpBlock.data("original-contents")); 520 | // reset classes 521 | $controlGroup.attr("class", $controlGroup.data("original-classes")); 522 | // reset aria 523 | $this.attr("aria-invalid", $this.data("original-aria-invalid")); 524 | // reset role 525 | $helpBlock.attr("role", $this.data("original-role")); 526 | // remove all elements we created 527 | if (createdElements.indexOf($helpBlock[0]) > -1) { 528 | $helpBlock.remove(); 529 | } 530 | 531 | } 532 | ); 533 | 534 | }, 535 | collectErrors : function(includeEmpty) { 536 | 537 | var errorMessages = {}; 538 | this.each(function (i, el) { 539 | var $el = $(el); 540 | var name = $el.attr("name"); 541 | var errors = $el.triggerHandler("validation.validation", {includeEmpty: true}); 542 | errorMessages[name] = $.extend(true, errors, errorMessages[name]); 543 | }); 544 | 545 | $.each(errorMessages, function (i, el) { 546 | if (el.length === 0) { 547 | delete errorMessages[i]; 548 | } 549 | }); 550 | 551 | return errorMessages; 552 | 553 | }, 554 | hasErrors: function() { 555 | 556 | var errorMessages = []; 557 | 558 | this.each(function (i, el) { 559 | errorMessages = errorMessages.concat( 560 | $(el).triggerHandler("getValidators.validation") ? $(el).triggerHandler("validation.validation", {submitting: true}) : [] 561 | ); 562 | }); 563 | 564 | return (errorMessages.length > 0); 565 | }, 566 | override : function (newDefaults) { 567 | defaults = $.extend(true, defaults, newDefaults); 568 | } 569 | }, 570 | validatorTypes: { 571 | callback: { 572 | name: "callback", 573 | init: function ($this, name) { 574 | return { 575 | validatorName: name, 576 | callback: $this.data("validation" + name + "Callback"), 577 | lastValue: $this.val(), 578 | lastValid: true, 579 | lastFinished: true 580 | }; 581 | }, 582 | validate: function ($this, value, validator) { 583 | if (validator.lastValue === value && validator.lastFinished) { 584 | return !validator.lastValid; 585 | } 586 | 587 | if (validator.lastFinished === true) 588 | { 589 | validator.lastValue = value; 590 | validator.lastValid = true; 591 | validator.lastFinished = false; 592 | 593 | var rrjqbvValidator = validator; 594 | var rrjqbvThis = $this; 595 | executeFunctionByName( 596 | validator.callback, 597 | window, 598 | $this, 599 | value, 600 | function (data) { 601 | if (rrjqbvValidator.lastValue === data.value) { 602 | rrjqbvValidator.lastValid = data.valid; 603 | if (data.message) { 604 | rrjqbvValidator.message = data.message; 605 | } 606 | rrjqbvValidator.lastFinished = true; 607 | rrjqbvThis.data("validation" + rrjqbvValidator.validatorName + "Message", rrjqbvValidator.message); 608 | // Timeout is set to avoid problems with the events being considered 'already fired' 609 | setTimeout(function () { 610 | rrjqbvThis.trigger("change.validation"); 611 | }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst 612 | } 613 | } 614 | ); 615 | } 616 | 617 | return false; 618 | 619 | } 620 | }, 621 | ajax: { 622 | name: "ajax", 623 | init: function ($this, name) { 624 | return { 625 | validatorName: name, 626 | url: $this.data("validation" + name + "Ajax"), 627 | lastValue: $this.val(), 628 | lastValid: true, 629 | lastFinished: true 630 | }; 631 | }, 632 | validate: function ($this, value, validator) { 633 | if (""+validator.lastValue === ""+value && validator.lastFinished === true) { 634 | return validator.lastValid === false; 635 | } 636 | 637 | if (validator.lastFinished === true) 638 | { 639 | validator.lastValue = value; 640 | validator.lastValid = true; 641 | validator.lastFinished = false; 642 | $.ajax({ 643 | url: validator.url, 644 | data: "value=" + value + "&field=" + $this.attr("name"), 645 | dataType: "json", 646 | success: function (data) { 647 | if (""+validator.lastValue === ""+data.value) { 648 | validator.lastValid = !!(data.valid); 649 | if (data.message) { 650 | validator.message = data.message; 651 | } 652 | validator.lastFinished = true; 653 | $this.data("validation" + validator.validatorName + "Message", validator.message); 654 | // Timeout is set to avoid problems with the events being considered 'already fired' 655 | setTimeout(function () { 656 | $this.trigger("change.validation"); 657 | }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst 658 | } 659 | }, 660 | failure: function () { 661 | validator.lastValid = true; 662 | validator.message = "ajax call failed"; 663 | validator.lastFinished = true; 664 | $this.data("validation" + validator.validatorName + "Message", validator.message); 665 | // Timeout is set to avoid problems with the events being considered 'already fired' 666 | setTimeout(function () { 667 | $this.trigger("change.validation"); 668 | }, 1); // doesn't need a long timeout, just long enough for the event bubble to burst 669 | } 670 | }); 671 | } 672 | 673 | return false; 674 | 675 | } 676 | }, 677 | regex: { 678 | name: "regex", 679 | init: function ($this, name) { 680 | return {regex: regexFromString($this.data("validation" + name + "Regex"))}; 681 | }, 682 | validate: function ($this, value, validator) { 683 | return (!validator.regex.test(value) && ! validator.negative) 684 | || (validator.regex.test(value) && validator.negative); 685 | } 686 | }, 687 | required: { 688 | name: "required", 689 | init: function ($this, name) { 690 | return {}; 691 | }, 692 | validate: function ($this, value, validator) { 693 | return !!(value.length === 0 && ! validator.negative) 694 | || !!(value.length > 0 && validator.negative); 695 | }, 696 | blockSubmit: true 697 | }, 698 | match: { 699 | name: "match", 700 | init: function ($this, name) { 701 | var element = $this.parents("form").first().find("[name=\"" + $this.data("validation" + name + "Match") + "\"]").first(); 702 | element.bind("validation.validation", function () { 703 | $this.trigger("change.validation", {submitting: true}); 704 | }); 705 | return {"element": element}; 706 | }, 707 | validate: function ($this, value, validator) { 708 | return (value !== validator.element.val() && ! validator.negative) 709 | || (value === validator.element.val() && validator.negative); 710 | }, 711 | blockSubmit: true 712 | }, 713 | max: { 714 | name: "max", 715 | init: function ($this, name) { 716 | return {max: $this.data("validation" + name + "Max")}; 717 | }, 718 | validate: function ($this, value, validator) { 719 | return (parseFloat(value, 10) > parseFloat(validator.max, 10) && ! validator.negative) 720 | || (parseFloat(value, 10) <= parseFloat(validator.max, 10) && validator.negative); 721 | } 722 | }, 723 | min: { 724 | name: "min", 725 | init: function ($this, name) { 726 | return {min: $this.data("validation" + name + "Min")}; 727 | }, 728 | validate: function ($this, value, validator) { 729 | return (parseFloat(value) < parseFloat(validator.min) && ! validator.negative) 730 | || (parseFloat(value) >= parseFloat(validator.min) && validator.negative); 731 | } 732 | }, 733 | maxlength: { 734 | name: "maxlength", 735 | init: function ($this, name) { 736 | return {maxlength: $this.data("validation" + name + "Maxlength")}; 737 | }, 738 | validate: function ($this, value, validator) { 739 | return ((value.length > validator.maxlength) && ! validator.negative) 740 | || ((value.length <= validator.maxlength) && validator.negative); 741 | } 742 | }, 743 | minlength: { 744 | name: "minlength", 745 | init: function ($this, name) { 746 | return {minlength: $this.data("validation" + name + "Minlength")}; 747 | }, 748 | validate: function ($this, value, validator) { 749 | return ((value.length < validator.minlength) && ! validator.negative) 750 | || ((value.length >= validator.minlength) && validator.negative); 751 | } 752 | }, 753 | maxchecked: { 754 | name: "maxchecked", 755 | init: function ($this, name) { 756 | var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]"); 757 | elements.bind("click.validation", function () { 758 | $this.trigger("change.validation", {includeEmpty: true}); 759 | }); 760 | return {maxchecked: $this.data("validation" + name + "Maxchecked"), elements: elements}; 761 | }, 762 | validate: function ($this, value, validator) { 763 | return (validator.elements.filter(":checked").length > validator.maxchecked && ! validator.negative) 764 | || (validator.elements.filter(":checked").length <= validator.maxchecked && validator.negative); 765 | }, 766 | blockSubmit: true 767 | }, 768 | minchecked: { 769 | name: "minchecked", 770 | init: function ($this, name) { 771 | var elements = $this.parents("form").first().find("[name=\"" + $this.attr("name") + "\"]"); 772 | elements.bind("click.validation", function () { 773 | $this.trigger("change.validation", {includeEmpty: true}); 774 | }); 775 | return {minchecked: $this.data("validation" + name + "Minchecked"), elements: elements}; 776 | }, 777 | validate: function ($this, value, validator) { 778 | return (validator.elements.filter(":checked").length < validator.minchecked && ! validator.negative) 779 | || (validator.elements.filter(":checked").length >= validator.minchecked && validator.negative); 780 | }, 781 | blockSubmit: true 782 | } 783 | }, 784 | builtInValidators: { 785 | email: { 786 | name: "Email", 787 | type: "shortcut", 788 | shortcut: "validemail" 789 | }, 790 | validemail: { 791 | name: "Validemail", 792 | type: "regex", 793 | regex: "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\.[A-Za-z]{2,4}", 794 | message: "Not a valid email address" 795 | }, 796 | passwordagain: { 797 | name: "Passwordagain", 798 | type: "match", 799 | match: "password", 800 | message: "Does not match the given password" 801 | }, 802 | positive: { 803 | name: "Positive", 804 | type: "shortcut", 805 | shortcut: "number,positivenumber" 806 | }, 807 | negative: { 808 | name: "Negative", 809 | type: "shortcut", 810 | shortcut: "number,negativenumber" 811 | }, 812 | number: { 813 | name: "Number", 814 | type: "regex", 815 | regex: "([+-]?\\\d+(\\\.\\\d*)?([eE][+-]?[0-9]+)?)?", 816 | message: "Must be a number" 817 | }, 818 | integer: { 819 | name: "Integer", 820 | type: "regex", 821 | regex: "[+-]?\\\d+", 822 | message: "No decimal places allowed" 823 | }, 824 | positivenumber: { 825 | name: "Positivenumber", 826 | type: "min", 827 | min: 0, 828 | message: "Must be a positive number" 829 | }, 830 | negativenumber: { 831 | name: "Negativenumber", 832 | type: "max", 833 | max: 0, 834 | message: "Must be a negative number" 835 | }, 836 | required: { 837 | name: "Required", 838 | type: "required", 839 | message: "This is required" 840 | }, 841 | checkone: { 842 | name: "Checkone", 843 | type: "minchecked", 844 | minchecked: 1, 845 | message: "Check at least one option" 846 | } 847 | } 848 | }; 849 | 850 | var formatValidatorName = function (name) { 851 | return name 852 | .toLowerCase() 853 | .replace( 854 | /(^|\s)([a-z])/g , 855 | function(m,p1,p2) { 856 | return p1+p2.toUpperCase(); 857 | } 858 | ) 859 | ; 860 | }; 861 | 862 | var getValue = function ($this) { 863 | // Extract the value we're talking about 864 | var value = $this.val(); 865 | var type = $this.attr("type"); 866 | if (type === "checkbox") { 867 | value = ($this.is(":checked") ? value : ""); 868 | } 869 | if (type === "radio") { 870 | value = ($('input[name="' + $this.attr("name") + '"]:checked').length > 0 ? value : ""); 871 | } 872 | return value; 873 | }; 874 | 875 | function regexFromString(inputstring) { 876 | return new RegExp("^" + inputstring + "$"); 877 | } 878 | 879 | /** 880 | * Thanks to Jason Bunting via StackOverflow.com 881 | * 882 | * http://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string#answer-359910 883 | * Short link: http://tinyurl.com/executeFunctionByName 884 | **/ 885 | function executeFunctionByName(functionName, context /*, args*/) { 886 | var args = Array.prototype.slice.call(arguments).splice(2); 887 | var namespaces = functionName.split("."); 888 | var func = namespaces.pop(); 889 | for(var i = 0; i < namespaces.length; i++) { 890 | context = context[namespaces[i]]; 891 | } 892 | return context[func].apply(this, args); 893 | } 894 | 895 | $.fn.jqBootstrapValidation = function( method ) { 896 | 897 | if ( defaults.methods[method] ) { 898 | return defaults.methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); 899 | } else if ( typeof method === 'object' || ! method ) { 900 | return defaults.methods.init.apply( this, arguments ); 901 | } else { 902 | $.error( 'Method ' + method + ' does not exist on jQuery.jqBootstrapValidation' ); 903 | return null; 904 | } 905 | 906 | }; 907 | 908 | $.jqBootstrapValidation = function (options) { 909 | $(":input").not("[type=image],[type=submit]").jqBootstrapValidation.apply(this,arguments); 910 | }; 911 | 912 | })( jQuery ); 913 | --------------------------------------------------------------------------------