diff --git a/Gemfile b/Gemfile index 2075440..fd019b9 100644 --- a/Gemfile +++ b/Gemfile @@ -16,35 +16,17 @@ gem 'bourbon' gem 'jquery-rails' -# Use unicorn as the web server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -# gem 'ruby-debug' - -# Bundle the extra gems: -# gem 'bj' -# gem 'nokogiri' -# gem 'sqlite3-ruby', :require => 'sqlite3' gem 'aws-sdk' # Bundle gems for the local environment. Make sure to # put test-only gems in this group so their generators # and rake tasks are available in development mode: group :development do - gem 'sqlite3' gem 'ruby_parser' - gem 'hpricot' gem 'powder' gem 'better_errors' gem 'binding_of_caller' gem 'letter_opener' - gem 'tunnel' - gem 'rbtrace', git: 'https://github.com/tmm1/rbtrace', branch: 'master' - gem 'foreman' end group :test, :development do @@ -72,10 +54,8 @@ end gem 'exception_notification', :git => 'git://github.com/rails/exception_notification', :require => 'exception_notifier' gem 'pg' -gem 'devise' gem 'simple_form' gem 'squeel' -# gem 'mini_exiftool' gem 'will_paginate' gem 'redcarpet' gem 'dragonfly' diff --git a/Gemfile.lock b/Gemfile.lock index 7815f3e..6e196a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,16 +4,6 @@ GIT specs: exception_notification (1.0.0) -GIT - remote: https://github.com/tmm1/rbtrace - revision: 5830d1fd91f1338250316ff867ce1aadb73ac52d - branch: master - specs: - rbtrace (0.4.7) - ffi (>= 1.0.6) - msgpack (>= 0.4.3) - trollop (>= 1.16.2) - GEM remote: http://rubygems.org/ specs: @@ -54,7 +44,6 @@ GEM jmespath (~> 1.0) aws-sdk-resources (2.1.29) aws-sdk-core (= 2.1.29) - bcrypt (3.1.10) better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) @@ -85,13 +74,6 @@ GEM coffee-script-source (1.9.1.1) database_cleaner (1.5.0) debug_inspector (0.0.2) - devise (3.5.2) - bcrypt (~> 3.0) - orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) - responders - thread_safe (~> 0.1) - warden (~> 1.2.3) diff-lcs (1.2.5) docile (1.1.5) dotenv (2.0.2) @@ -113,7 +95,6 @@ GEM factory_girl_rails (4.5.0) factory_girl (~> 4.5.0) railties (>= 3.0.0) - ffi (1.9.10) fivemat (1.3.1) fog-aws (0.7.6) fog-core (~> 1.27) @@ -133,13 +114,9 @@ GEM fog-xml (0.1.2) fog-core nokogiri (~> 1.5, >= 1.5.11) - foreman (0.78.0) - thor (~> 0.19.1) formatador (0.2.5) haml (4.0.7) tilt - highline (1.7.8) - hpricot (0.8.6) i18n (0.7.0) ipaddress (0.8.0) jmespath (1.1.3) @@ -157,14 +134,12 @@ GEM mime-types (2.6.2) mini_portile (0.6.2) minitest (5.8.1) - msgpack (0.6.2) multi_json (1.11.2) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (3.0.1) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) - orm_adapter (0.5.0) parser (2.2.3.0) ast (>= 1.1, < 3.0) pg (0.18.3) @@ -209,8 +184,6 @@ GEM rainbow (2.0.0) rake (10.4.2) redcarpet (3.3.3) - responders (1.1.2) - railties (>= 3.2, < 4.2) rspec-core (3.3.2) rspec-support (~> 3.3.0) rspec-expectations (3.3.1) @@ -269,7 +242,6 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.11) squeel (1.2.3) activerecord (>= 3.0) activesupport (>= 3.0) @@ -277,10 +249,6 @@ GEM thor (0.19.1) thread_safe (0.3.5) tilt (2.0.1) - trollop (2.1.2) - tunnel (0.0.3) - highline (~> 1.6) - thor tzinfo (1.2.2) thread_safe (~> 0.1) uglifier (2.7.2) @@ -289,8 +257,6 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.1) - warden (1.2.3) - rack (>= 1.0) websocket-driver (0.6.2) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) @@ -309,16 +275,13 @@ DEPENDENCIES capybara-screenshot coffee-rails (~> 4.1.0) database_cleaner - devise dotenv-rails dragonfly dragonfly-s3_data_store exception_notification! factory_girl_rails fivemat - foreman haml - hpricot jquery-rails letter_opener pg @@ -328,7 +291,6 @@ DEPENDENCIES puma rails (~> 4.1.0) rails_12factor - rbtrace! redcarpet rspec-rails rubocop @@ -341,9 +303,7 @@ DEPENDENCIES simplecov skylight slugtastic - sqlite3 squeel - tunnel uglifier unf will_paginate diff --git a/app/assets/images/admin/logo.png b/app/assets/images/admin/logo.png deleted file mode 100644 index ce9b20c..0000000 Binary files a/app/assets/images/admin/logo.png and /dev/null differ diff --git a/app/assets/images/admin/logo.svg b/app/assets/images/admin/logo.svg deleted file mode 100644 index 333d40c..0000000 --- a/app/assets/images/admin/logo.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - logo - Created with Sketch (http://www.bohemiancoding.com/sketch) - - - - - - diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js deleted file mode 100644 index 46f4388..0000000 --- a/app/assets/javascripts/admin.js +++ /dev/null @@ -1,11 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require jquery.transit -//= require fancybox -//= require_directory ./admin diff --git a/app/assets/javascripts/admin/admin.js.coffee b/app/assets/javascripts/admin/admin.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/app/assets/javascripts/admin/admin.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/admin/dashboard.js.coffee b/app/assets/javascripts/admin/dashboard.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/app/assets/javascripts/admin/dashboard.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/admin/downloads.js.coffee b/app/assets/javascripts/admin/downloads.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/app/assets/javascripts/admin/downloads.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/admin/flash.js.coffee b/app/assets/javascripts/admin/flash.js.coffee deleted file mode 100644 index ebaf709..0000000 --- a/app/assets/javascripts/admin/flash.js.coffee +++ /dev/null @@ -1,4 +0,0 @@ -$ -> - $(".flash a.close").click -> - $(this).parent().transition({ "height": 0, "padding-top": 0, "padding-bottom": 0, "opacity": 0 }, 250, 'in-out', -> $(this).hide()) - false diff --git a/app/assets/javascripts/admin/photos.js.coffee b/app/assets/javascripts/admin/photos.js.coffee deleted file mode 100644 index bbd3026..0000000 --- a/app/assets/javascripts/admin/photos.js.coffee +++ /dev/null @@ -1,2 +0,0 @@ -$ -> - $(".photos .photo a").not(".actions a").fancybox() \ No newline at end of file diff --git a/app/assets/javascripts/admin/unlocks.js.coffee b/app/assets/javascripts/admin/unlocks.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/app/assets/javascripts/admin/unlocks.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/admin.sass b/app/assets/stylesheets/admin.sass deleted file mode 100644 index 1e98f3e..0000000 --- a/app/assets/stylesheets/admin.sass +++ /dev/null @@ -1,11 +0,0 @@ -@import 'bourbon' - -@import 'fancybox' -@import 'admin/admin' -@import 'admin/dashboard' -@import 'admin/flash' -@import 'admin/menu' -@import 'admin/photos' -@import 'admin/pages' -@import 'admin/simple_form' -@import 'admin/unlocks' diff --git a/app/assets/stylesheets/admin/admin.sass b/app/assets/stylesheets/admin/admin.sass deleted file mode 100644 index a937456..0000000 --- a/app/assets/stylesheets/admin/admin.sass +++ /dev/null @@ -1,134 +0,0 @@ -// Place all the styles related to the admin/admin controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ - -//= depend_on_asset "admin/logo.svg" - -body - background-color: #999 - color: #333 - font-family: "Helvetica Neue", "Arial", sans-serif - font-size: 14px - line-height: 1.3 - margin: 0 - padding: 0 - -#page, #login - background: #fafafa - padding: 1em 2em 3em - border-bottom: 1px solid #666 - box-shadow: 0 1px 12px rgba(0, 0, 0, 0.1) - -#login - width: 40em - margin: 5em auto 0 - -header - background: #333 - margin: -2.5em -2em 0 - #user - position: absolute - top: 1em - right: 2em - color: #ccc - a - color: #999 - h1 - background: #333 - font-size: 2em - margin-bottom: 0em - a - display: inline-block - padding: 1em 1em - line-height: 0 - img - height: 3rem - &:hover - background-color: inherit - -#login - h1 - margin-bottom: 0.5em - position: relative - z-index: 1 - -h2 - margin-top: 1.2em - -p, ol, ul, td - font-family: "Helvetica Neue", "Arial", sans-serif - font-size: 1em - line-height: 1.5em - -pre - background-color: #eee - padding: 0.5em - font-size: 0.9em - -a - color: #000 - &:hover - color: #fff - background-color: #000 - -div - &.field, &.actions - margin-bottom: 0.5em - -#notice - color: green - -table - border: 1px solid #bbb - border-spacing: 0 - box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) - border-radius: 0.25rem - td, th - border-bottom: 1px solid #bbb - tr:nth-child(even) td - background: #f0f0f0 - tr:nth-child(odd) td - background: #fff - thead - background: #ddd - color: #333 - td, th - text-align: left - padding: 0.5em 0.7em - tfoot td - background: #ddd !important - border-bottom: 0 - -.pagination - margin: 0.5em 0 - -#error_explanation - width: 32rem - border: 2px solid red - padding: 0.5rem - padding-bottom: 0 - margin-bottom: 1.5rem - background-color: #f0f0f0 - h2 - text-align: left - font-weight: bold - padding: 0.5rem 0.5rem 0.5rem 1rem - font-size: 0.85rem - margin: -0.5rem - margin-bottom: 0 - background-color: #c00 - color: #fff - ul li - font-size: 0.85rem - list-style: square - -form ul.taxonomies - border: 1px solid #ccc - border-radius: 0.35rem - box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.1) - margin-top: 1em - padding: 1em - width: 25% - float: right - > li - font-weight: bold diff --git a/app/assets/stylesheets/admin/dashboard.sass b/app/assets/stylesheets/admin/dashboard.sass deleted file mode 100644 index e84d552..0000000 --- a/app/assets/stylesheets/admin/dashboard.sass +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the admin/dashboard controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/admin/downloads.sass b/app/assets/stylesheets/admin/downloads.sass deleted file mode 100644 index 5b0ab4e..0000000 --- a/app/assets/stylesheets/admin/downloads.sass +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the admin/downloads controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/admin/flash.sass b/app/assets/stylesheets/admin/flash.sass deleted file mode 100644 index 1defa18..0000000 --- a/app/assets/stylesheets/admin/flash.sass +++ /dev/null @@ -1,38 +0,0 @@ -.alert, .notice - position: relative - font-size: 1em - border-style: solid - border-width: 0 0 1px - padding: 0.7em 2em - margin: -1em -2em 0 - height: 1.5em - overflow: hidden - a.close - font-size: 1em - position: absolute - font-weight: bold - right: 0em - top: 0em - text-decoration: none - padding: 0.7em 1em - color: #666 - -.alert - border-color: #cc6633 - background: #ffddcc - color: #662200 - a.close - color: #662200 - &:hover, &:focus - background-color: #cc6633 - color: #ffddcc - -.notice - border-color: #449911 - background: #ddffcc - color: #226600 - a.close - color: #226600 - &:hover, &:focus - background-color: #449911 - color: #ddffcc diff --git a/app/assets/stylesheets/admin/menu.sass b/app/assets/stylesheets/admin/menu.sass deleted file mode 100644 index 665ac1d..0000000 --- a/app/assets/stylesheets/admin/menu.sass +++ /dev/null @@ -1,45 +0,0 @@ -header - nav - ul - font-size: 1em - @include linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.2)) - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.5) - background-color: #DDD - border-style: solid - border-width: 0 0 1px 0 - border-color: #999 - color: white - margin: 0 0 1em - padding: 0 1em - list-style: none - height: 2.5em - position: relative - z-index: 100 - li a - @include linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.2)) - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 -1px 0 rgba(255, 255, 255, 0.5) - background-color: #DDD - color: #444 - text-decoration: none - display: block - height: 1.5em - float: left - padding: 0.5em 1em - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) - @include transition(background 0.15s 0s ease) - &:hover, &:focus - @include linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.2)) - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 -1px 0 rgba(255, 255, 255, 0.5) - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) - color: #444 - background-color: white - &:active - background-color: #ccc - &.selected - @include linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0)) - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 -1px 0 rgba(255, 255, 255, 0.2), inset 0 0 6px rgba(0, 0, 0, 0.4) - text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5) - background-color: #999 - color: white - &:hover - background-color: #aaa diff --git a/app/assets/stylesheets/admin/pages.sass b/app/assets/stylesheets/admin/pages.sass deleted file mode 100644 index be0990b..0000000 --- a/app/assets/stylesheets/admin/pages.sass +++ /dev/null @@ -1,2 +0,0 @@ -.page - max-width: 30em diff --git a/app/assets/stylesheets/admin/photos.sass b/app/assets/stylesheets/admin/photos.sass deleted file mode 100644 index 03f3a8f..0000000 --- a/app/assets/stylesheets/admin/photos.sass +++ /dev/null @@ -1,19 +0,0 @@ -.photos - .photo - float: left - margin-right: 1em - margin-top: 1em - &:after - content: "" - display: block - clear: both - -ul.categories - list-style: none - border: 1px solid #ccc - border-radius: 0.25rem - box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.1) - margin-top: 1em - padding: 1em - width: 25% - float: right diff --git a/app/assets/stylesheets/admin/simple_form.sass b/app/assets/stylesheets/admin/simple_form.sass deleted file mode 100644 index 12a566e..0000000 --- a/app/assets/stylesheets/admin/simple_form.sass +++ /dev/null @@ -1,108 +0,0 @@ -@import "../includes/button" - -form.simple_form - background: white - border: 1px solid #ccc - margin: 0 0 1em - padding: 0 1em - label - text-align: right - margin-right: 1em - .required - label - font-weight: bold - border-radius: 5px - .input - margin-bottom: 0em - margin-top: 0em - overflow: hidden - padding: 0.5em 0 - label - display: block - float: left - padding: 0.5em 0 - font-weight: bold - width: 13em - input - @include placeholder - color: rgba(0, 0, 0, 0.4) - textarea - height: 10em - input, textarea - font-family: "Helvetica Neue", "Arial", sans-serif - font-size: 1em - margin: 0 0.5rem 0 0 - border-width: 1px - border-style: solid - border-color: #ccc - padding: 0.5em - border-radius: 2px - &:focus - border-color: #67A #9AF #9AF #67A - box-shadow: 0 0 4px rgba(0, 128, 255, 0.5), inset 1px 1px 4px rgba(0, 0, 0, 0.1) - &[type=text], &[type=email], &[type=url] - width: 15em - &[type=number] - width: 3.5em - text-align: right - &:-webkit-inner-spin-button, &:-webkit-outer-spin-button - -webkit-appearance: none - margin: 0 - - .fragments - .label label - width: 13em - - .fragments-group - padding-left: 14em - - input[type=submit], a.button - @include button(#9C7) - - .input.boolean - padding-left: 14em - label - text-align: left - input - float: left - margin-top: 0.4em - margin-right: 0.6em - - .field_with_errors input - border-width: 1px - border-style: solid - border-color: #933 #FBB #FBB #933 - background: #FFEFEF - padding: 0.3em - box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.1) - - span.error - display: inline - margin-left: 1em - color: #933 - - fieldset - border: 0 - margin-bottom: 0.5em - - fieldset.inputs - padding: 1em 0 - border-bottom: 1px solid #ccc - fieldset.actions - padding: 1.5em 0 1em 14em - .string, .email, .password, .text - input, textarea - width: 40% - - .help - margin-left: 14em - margin-top: -0.5em - p - font-size: 0.8em - color: #999 - -a.button - @include button(#999) - -a.button.new - @include button(#359ADD) diff --git a/app/assets/stylesheets/admin/unlocks.scss b/app/assets/stylesheets/admin/unlocks.scss deleted file mode 100644 index a13ad4c..0000000 --- a/app/assets/stylesheets/admin/unlocks.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the admin/unlocks controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb deleted file mode 100644 index 47f884e..0000000 --- a/app/controllers/admin/admin_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Admin - class AdminController < ApplicationController - layout 'admin/layouts/admin' - before_filter :authenticate_admin_user! - before_filter :admin_menu - - force_ssl host: APP_CONFIG[:ssl_hostname] - - def admin_menu - @admin_menu = { dashboard: '', - admin_users: '', - categories: '', - photos: '', - pages: '' } - end - end -end diff --git a/app/controllers/admin/admin_users_controller.rb b/app/controllers/admin/admin_users_controller.rb deleted file mode 100644 index e07bef0..0000000 --- a/app/controllers/admin/admin_users_controller.rb +++ /dev/null @@ -1,64 +0,0 @@ -module Admin - class AdminUsersController < Admin::AdminController - def index - @admin_users = AdminUser.all - end - - def new - @admin_user = AdminUser.new - end - - def edit - @admin_user = AdminUser.find(params[:id]) - end - - def update - @admin_user = AdminUser.find(params[:id]) - - if @admin_user.update_attributes(permitted_params) - redirect_to admin_admin_users_path, notice: 'Admin User was successfully updated.' - else - render :edit - end - end - - def create - @admin_user = AdminUser.new(permitted_params) - - if @admin_user.save - redirect_to admin_admin_users_path, notice: 'Admin User was successfully added.' - else - render :edit - end - end - - def destroy - @admin_user = AdminUser.find(params[:id]) - @admin_user.destroy - - redirect_to admin_admin_users_path, notice: 'Admin User was deleted.' - end - - # Allow the current logged in user to change their password - def edit_password - @admin_user = current_admin_user - end - - def update_password - @admin_user = current_admin_user - - if @admin_user.update_with_password(permitted_params) - sign_in @admin_user, bypass: true - redirect_to admin_dashboard_path, notice: 'Password updated!' - else - render :edit_password - end - end - - private - - def permitted_params - params.require(:admin_user).permit(:email, :password, :password_confirmable, :remember_me) - end - end -end diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb deleted file mode 100644 index 16ce1b9..0000000 --- a/app/controllers/admin/categories_controller.rb +++ /dev/null @@ -1,48 +0,0 @@ -module Admin - class CategoriesController < Admin::AdminController - def index - @categories = Category.all - end - - def new - @category = Category.new - end - - def edit - @category = Category.find(params[:id]) - end - - def update - @category = Category.find(params[:id]) - - if @category.update_attributes(permitted_params) - redirect_to admin_categories_path, notice: 'Category was successfully updated.' - else - render :edit - end - end - - def create - @category = Category.new(permitted_params) - - if @category.save - redirect_to admin_categories_path, notice: 'Category was successfully added.' - else - render :edit - end - end - - def destroy - @category = Category.find(params[:id]) - @category.destroy - - redirect_to admin_categories_path, notice: 'Category was deleted.' - end - - private - - def permitted_params - params.require(:category).permit(:name, :slug, :description, :base_colour, :sort) - end - end -end diff --git a/app/controllers/admin/confirmations_controller.rb b/app/controllers/admin/confirmations_controller.rb deleted file mode 100644 index 3b3e5c4..0000000 --- a/app/controllers/admin/confirmations_controller.rb +++ /dev/null @@ -1,64 +0,0 @@ -module Admin - class ConfirmationsController < ::Devise::PasswordsController - layout 'admin/layouts/login' - - skip_before_filter(:authenticate_user!) - - def update - with_unconfirmed_confirmable do - if @confirmable.has_no_password? - update_password - else - self.class.add_error_on(self, :email, :password_already_set) - end - end - - render_with_scope :new unless confirmable.errors.empty? - end - - def show - with_unconfirmed_confirmable do - if @confirmable.has_no_password? - do_show - else - do_confirm - end - end - - render_with_scope :new unless @confirmable.errors.empty? - end - - private - - def update_password - @confirmable.attempt_set_password(params[:admin_user]) - if @confirmable.valid? - do_confirm - else - do_show - @confirmable.errors.clear # so that we won't render :new - end - end - - protected - - def with_unconfirmed_confirmable - @confirmable = AdminUser.find_or_initialize_with_error_by(:confirmation_token, params[:confirmation_token]) - - @confirmable.only_if_unconfirmed { yield } unless @confirmable.new_record? - end - - def do_show - @confirmation_token = params[:confirmation_token] - @requires_password = true - self.resource = @confirmable - render_with_scope :show - end - - def do_confirm - @confirmable.confirm! - set_flash_message :notice, :confirmed - sign_in_and_redirect(resource_name, @confirmable) - end - end -end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb deleted file mode 100644 index 3057bd3..0000000 --- a/app/controllers/admin/dashboard_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Admin - class DashboardController < Admin::AdminController - end -end diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb deleted file mode 100644 index 79ab815..0000000 --- a/app/controllers/admin/pages_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -module Admin - class PagesController < Admin::AdminController - def index - @pages = Page.all - end - - def new - @page = Page.new - end - - def edit - @page = Page.find(params[:id]) - end - - def show - page = Page.find(params[:id]) - @page = PagePresenter.new(page) - end - - def update - @page = Page.find(params[:id]) - - if @page.update_attributes(permitted_params) - redirect_to admin_pages_path, notice: 'Page was successfully updated.' - else - render :edit - end - end - - def create - @page = Page.new(permitted_params) - - if @page.save - redirect_to admin_pages_path, notice: 'Page was successfully added.' - else - render :edit - end - end - - def destroy - @page = Page.find(params[:id]) - @page.destroy - - redirect_to admin_pages_path, notice: 'Page was deleted.' - end - - private - - def permitted_params - params.require(:page).permit(:name, :title, :content) - end - end -end diff --git a/app/controllers/admin/passwords_controller.rb b/app/controllers/admin/passwords_controller.rb deleted file mode 100644 index 6b0b2d9..0000000 --- a/app/controllers/admin/passwords_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Admin - class PasswordsController < ::Devise::PasswordsController - layout 'admin/layouts/login' - end -end diff --git a/app/controllers/admin/photos_controller.rb b/app/controllers/admin/photos_controller.rb deleted file mode 100644 index f2d5fe9..0000000 --- a/app/controllers/admin/photos_controller.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Admin - class PhotosController < Admin::AdminController - before_filter :categories - - def index - @photos = Photo.paginate(page: params[:page], per_page: 16) - end - - def new - @photo = Photo.new - end - - def edit - @photo = Photo.find(params[:id]) - end - - def update - @photo = Photo.find(params[:id]) - - if @photo.update_attributes(permitted_params) - redirect_to admin_photos_path, notice: 'Photo was successfully updated.' - else - render :edit - end - end - - def create - @photo = Photo.new(permitted_params) - - if @photo.save - redirect_to admin_photos_path, notice: 'Photo was successfully added.' - else - render :edit - end - end - - def destroy - @photo = Photo.find(params[:id]) - @photo.destroy - - redirect_to :back, notice: 'Photo was deleted.' - end - - private - - def categories - @categories = Category.all - end - - def permitted_params - params.require(:photo).permit(:image, :title, :description, :flickr_url, :featured, - :enabled, :taken_at, category_ids: []) - end - end -end diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb deleted file mode 100644 index 059b7a5..0000000 --- a/app/controllers/admin/registrations_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Admin - class RegistrationsController < ::Devise::RegistrationsController - layout 'admin/layouts/login' - end -end diff --git a/app/controllers/admin/sessions_controller.rb b/app/controllers/admin/sessions_controller.rb deleted file mode 100644 index 81cc512..0000000 --- a/app/controllers/admin/sessions_controller.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Admin - class SessionsController < ::Devise::SessionsController - layout 'admin/layouts/login' - - before_filter :check_https - - private - - def check_https - secure_link = url_for(protocol: 'https') - flash[:alert] = I18n.t('insecure_alert', secure_link: secure_link).html_safe unless request.scheme == 'https' - end - end -end diff --git a/app/controllers/admin/unlocks_controller.rb b/app/controllers/admin/unlocks_controller.rb deleted file mode 100644 index 1753ffd..0000000 --- a/app/controllers/admin/unlocks_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Admin - class UnlocksController < ::Devise::UnlocksController - layout 'admin/layouts/login' - end -end diff --git a/app/helpers/admin/admin_helper.rb b/app/helpers/admin/admin_helper.rb deleted file mode 100644 index c2d80e8..0000000 --- a/app/helpers/admin/admin_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Admin - module AdminHelper - def inputs_field_set(&block) - field_set_tag nil, class: :inputs, &block - end - - def actions_field_set(&block) - field_set_tag nil, class: :actions, &block - end - end -end diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb deleted file mode 100644 index f9b66f2..0000000 --- a/app/models/admin_user.rb +++ /dev/null @@ -1,30 +0,0 @@ -class AdminUser < ActiveRecord::Base - # Include default devise modules. Others available are: - # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable - devise :database_authenticatable, :confirmable, - :recoverable, :rememberable, :trackable, :validatable, :lockable - - # new function to set the password without knowing the current password used in our confirmation controller. - def attempt_set_password(params) - update_attributes(params.slice(:password, :password_confirmation)) - end - - # new function to return whether a password has been set - def no_password? - encrypted_password.blank? - end - - # new function to provide access to protected method unless_confirmed - def only_if_unconfirmed - unless_confirmed { yield } - end - - def password_required? - # Password is required if it is being set, but not for new records - if !persisted? - false - else - !password.nil? || !password_confirmation.nil? - end - end -end diff --git a/app/views/admin/admin_users/_admin_user.html.haml b/app/views/admin/admin_users/_admin_user.html.haml deleted file mode 100644 index 07e264f..0000000 --- a/app/views/admin/admin_users/_admin_user.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%tr - %td= admin_user.email - %td= admin_user.last_sign_in_at - %td= admin_user.last_sign_in_ip - %td{ class: :actions } - - unless admin_user == current_admin_user - = link_to 'Delete', admin_admin_user_path(admin_user), method: :delete, data: { confirm: 'Are you sure you wish to delete this Admin User?' } diff --git a/app/views/admin/admin_users/_form.html.haml b/app/views/admin/admin_users/_form.html.haml deleted file mode 100644 index c615980..0000000 --- a/app/views/admin/admin_users/_form.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -= simple_form_for [:admin, admin_user] do |f| - = inputs_field_set do - = f.input :email, required: true - = actions_field_set do - = f.submit diff --git a/app/views/admin/admin_users/edit.html.haml b/app/views/admin/admin_users/edit.html.haml deleted file mode 100644 index 2bd8e0b..0000000 --- a/app/views/admin/admin_users/edit.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 Edit Admin User -= render 'form', admin_user: @admin_user diff --git a/app/views/admin/admin_users/edit_password.html.haml b/app/views/admin/admin_users/edit_password.html.haml deleted file mode 100644 index fde4917..0000000 --- a/app/views/admin/admin_users/edit_password.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%h3 Change your password - -= simple_form_for(@admin_user, url: update_password_admin_admin_user_path, html: { method: :put }) do |f| - = inputs_field_set do - = f.input :current_password - = inputs_field_set do - = f.input :password, label: 'New Password' - = f.input :password_confirmation, label: 'Confirm Password' - - = actions_field_set do - = f.submit 'Change my password' diff --git a/app/views/admin/admin_users/index.html.haml b/app/views/admin/admin_users/index.html.haml deleted file mode 100644 index bb19300..0000000 --- a/app/views/admin/admin_users/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h2 Admin Users - -%table - %thead - %tr - %th Email - %th Last Signed In? - %th IP Address - %th - %tbody - = render partial: 'admin_user', collection: @admin_users - %tfoot - %tr - %td{ colspan: 4 } -%br/ -= link_to 'New Admin User', new_admin_admin_user_path, class: [:button, :new] diff --git a/app/views/admin/admin_users/new.html.haml b/app/views/admin/admin_users/new.html.haml deleted file mode 100644 index 4dbf62f..0000000 --- a/app/views/admin/admin_users/new.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 New Admin User -= render 'form', admin_user: @admin_user diff --git a/app/views/admin/categories/_category.html.haml b/app/views/admin/categories/_category.html.haml deleted file mode 100644 index 8ab6237..0000000 --- a/app/views/admin/categories/_category.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%tr - %td= category.name - %td= category.slug - %td= category.base_colour - %td{ class: :actions } - = link_to 'Edit', edit_admin_category_path(category) - = link_to 'Destroy', [:admin, category], data: { confirm: 'Are you sure?' }, method: :delete diff --git a/app/views/admin/categories/_form.html.haml b/app/views/admin/categories/_form.html.haml deleted file mode 100644 index 003e141..0000000 --- a/app/views/admin/categories/_form.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -= simple_form_for [:admin, category] do |f| - = inputs_field_set do - = f.input :name - = f.input :slug, placeholder: 'derived from name if blank' - = f.input :description - = f.input :base_colour - = f.input :sort - = actions_field_set do - = f.submit diff --git a/app/views/admin/categories/edit.html.haml b/app/views/admin/categories/edit.html.haml deleted file mode 100644 index f60e1d3..0000000 --- a/app/views/admin/categories/edit.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 Edit Category -= render 'form', category: @category diff --git a/app/views/admin/categories/index.html.haml b/app/views/admin/categories/index.html.haml deleted file mode 100644 index b6121a1..0000000 --- a/app/views/admin/categories/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h2 Categories - -%table - %thead - %tr - %th Name - %th Slug - %th Base Colour - %th - %tbody - = render @categories - %tfoot - %tr - %td{ colspan: 5 } -%br/ -= link_to 'New Category', new_admin_category_path, class: [:button, :new] diff --git a/app/views/admin/categories/new.html.haml b/app/views/admin/categories/new.html.haml deleted file mode 100644 index 08bd551..0000000 --- a/app/views/admin/categories/new.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 New Category -= render 'form', category: @category diff --git a/app/views/admin/confirmations/new.html.haml b/app/views/admin/confirmations/new.html.haml deleted file mode 100644 index 778026a..0000000 --- a/app/views/admin/confirmations/new.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%h3 Resend confirmation instructions - -= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| - - = inputs_field_set do - = f.input :email - - = actions_field_set do - = f.submit 'Resend confirmation instructions' - -= render 'devise/shared/links' diff --git a/app/views/admin/confirmations/show.html.haml b/app/views/admin/confirmations/show.html.haml deleted file mode 100644 index 5708eb9..0000000 --- a/app/views/admin/confirmations/show.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -%h3= "Account Activation for #{resource.email}" - -= simple_form_for resource, as: resource_name, url: update_user_confirmation_path, html: {method: 'put'}, id: 'activation-form' do |f| - = devise_error_messages! - = inputs_field_set do - %ol - - if @requires_password - = f.input :password, :label 'Choose a Password' - = f.input :password_confirmation, :label 'Confirm Password' - = hidden_field_tag :confirmation_token, @confirmation_token - = f.actions do - = f.submit 'Activate' diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml deleted file mode 100644 index 22f9e2d..0000000 --- a/app/views/admin/dashboard/index.html.haml +++ /dev/null @@ -1 +0,0 @@ -%p This is the admin dashboard. \ No newline at end of file diff --git a/app/views/admin/layouts/admin.html.haml b/app/views/admin/layouts/admin.html.haml deleted file mode 100644 index a62931c..0000000 --- a/app/views/admin/layouts/admin.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -!!! -%html - %head - %title= "#{APP_CONFIG['name']} Admin" - = stylesheet_link_tag 'admin' - = javascript_include_tag 'admin' - = csrf_meta_tag - - %body - #page - %header{ role: 'banner' }= render 'admin/shared/header' - = render 'shared/flash_messages' - = yield - %footer{ role: 'footer' }= render 'admin/shared/footer' diff --git a/app/views/admin/layouts/login.html.haml b/app/views/admin/layouts/login.html.haml deleted file mode 100644 index 409a66f..0000000 --- a/app/views/admin/layouts/login.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -!!! -%html - %head - %title= "#{APP_CONFIG['name']} Admin" - = stylesheet_link_tag 'admin' - = javascript_include_tag 'admin' - = csrf_meta_tag - - %body - #login - %header{ role: 'banner' }= render 'admin/shared/login_header' - = render 'shared/flash_messages' - = yield diff --git a/app/views/admin/pages/_form.html.haml b/app/views/admin/pages/_form.html.haml deleted file mode 100644 index 7b941fc..0000000 --- a/app/views/admin/pages/_form.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -= simple_form_for [:admin, page] do |f| - = inputs_field_set do - = f.input :name - = f.input :title - = f.input :content - = actions_field_set do - = f.submit diff --git a/app/views/admin/pages/_page.html.haml b/app/views/admin/pages/_page.html.haml deleted file mode 100644 index 458f405..0000000 --- a/app/views/admin/pages/_page.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%tr - %td= page.name - %td= page.title - %td{ class: :actions } - = link_to 'Show', [:admin, page] - = link_to 'Edit', edit_admin_page_path(page) - = link_to 'Destroy', [:admin, page], data: { confirm: 'Are you sure?' }, method: :delete diff --git a/app/views/admin/pages/edit.html.haml b/app/views/admin/pages/edit.html.haml deleted file mode 100644 index f602114..0000000 --- a/app/views/admin/pages/edit.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 Edit Page -= render 'form', page: @page diff --git a/app/views/admin/pages/index.html.haml b/app/views/admin/pages/index.html.haml deleted file mode 100644 index 8f6e696..0000000 --- a/app/views/admin/pages/index.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%h2 Pages - -%table - %thead - %tr - %th Name - %th Title - %th - %tbody - = render partial: 'page', collection: @pages - %tfoot - %tr - %td{ colspan: 4 } -%br/ -= link_to 'New Page', new_admin_page_path, class: [:button, :new] diff --git a/app/views/admin/pages/new.html.haml b/app/views/admin/pages/new.html.haml deleted file mode 100644 index a258f91..0000000 --- a/app/views/admin/pages/new.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 New Page -= render partial: "form", locals: { page: @page } diff --git a/app/views/admin/pages/show.html.haml b/app/views/admin/pages/show.html.haml deleted file mode 100644 index 0999900..0000000 --- a/app/views/admin/pages/show.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.page - %h2= @page.title - - .content= @page.content_as_html diff --git a/app/views/admin/passwords/edit.html.haml b/app/views/admin/passwords/edit.html.haml deleted file mode 100644 index ef04556..0000000 --- a/app/views/admin/passwords/edit.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h3 Change your password - -= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| - = devise_error_messages! - = f.hidden_field :reset_password_token - - = inputs_field_set do - = f.input :password, label: "New Password", required: true - = f.input :password_confirmation, label: "Confirm Password", required: true - - = actions_field_set do - = f.submit "Change my password" - -= render partial: "devise/shared/links" diff --git a/app/views/admin/passwords/new.html.haml b/app/views/admin/passwords/new.html.haml deleted file mode 100644 index 6c53383..0000000 --- a/app/views/admin/passwords/new.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%h3 Forgot your password? - -= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| - - = inputs_field_set do - = f.input :email, required: true - - = actions_field_set do - = f.submit "Reset Password" - -= render partial: "devise/shared/links" diff --git a/app/views/admin/photos/_form.html.haml b/app/views/admin/photos/_form.html.haml deleted file mode 100644 index 5b472bf..0000000 --- a/app/views/admin/photos/_form.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -= simple_form_for [:admin, photo] do |f| - %ul.categories - - @categories.each do |photo_category| - %li - = check_box_tag 'photo[category_ids][]', photo_category.id, @photo.categories.include?(photo_category), id: "photo_category_ids_#{photo_category.id}" - = label_tag "photo_category_ids_#{photo_category.id}", photo_category.name - - = inputs_field_set do - = f.input :image, as: :file - = f.input :title - = f.input :description - = f.input :flickr_url - = f.input :featured - = f.input :enabled - = f.input :taken_at - = actions_field_set do - = f.submit diff --git a/app/views/admin/photos/_photo.html.haml b/app/views/admin/photos/_photo.html.haml deleted file mode 100644 index 5d6d7d8..0000000 --- a/app/views/admin/photos/_photo.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.photo - = link_to image_tag(photo.image.admin.url, title: photo.title), photo.image.url - .actions - = link_to 'Edit', edit_admin_photo_path(photo) - = link_to 'Destroy', [:admin, photo], data: { confirm: 'Are you sure?' }, method: :delete diff --git a/app/views/admin/photos/edit.html.haml b/app/views/admin/photos/edit.html.haml deleted file mode 100644 index 89a482a..0000000 --- a/app/views/admin/photos/edit.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 Edit Photo -= render partial: "form", locals: { photo: @photo } diff --git a/app/views/admin/photos/index.html.haml b/app/views/admin/photos/index.html.haml deleted file mode 100644 index 6047404..0000000 --- a/app/views/admin/photos/index.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%h2 Photos - -= will_paginate @photos, remote: true - -.photos - = render partial: "photo", collection: @photos - -= will_paginate @products, remote: true - -%br/ -= link_to 'New Photo', new_admin_photo_path, class: [:button, :new] diff --git a/app/views/admin/photos/new.html.haml b/app/views/admin/photos/new.html.haml deleted file mode 100644 index bb8fc1e..0000000 --- a/app/views/admin/photos/new.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%h2 New Photo -= render partial: "form", locals: { photo: @photo } diff --git a/app/views/admin/sessions/new.html.haml b/app/views/admin/sessions/new.html.haml deleted file mode 100644 index 3f1e2c3..0000000 --- a/app/views/admin/sessions/new.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h3 Sign in - -= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| - = inputs_field_set do - = f.input :email, required: true - = f.input :password, required: true - - - if devise_mapping.rememberable? - = f.input :remember_me, as: :boolean - - = actions_field_set do - = f.submit 'Sign In' - -= render 'devise/shared/links' diff --git a/app/views/admin/shared/_footer.html.haml b/app/views/admin/shared/_footer.html.haml deleted file mode 100644 index e69de29..0000000 diff --git a/app/views/admin/shared/_header.html.haml b/app/views/admin/shared/_header.html.haml deleted file mode 100644 index 0067c73..0000000 --- a/app/views/admin/shared/_header.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h1= link_to image_tag(asset_url('admin/logo.svg'), alt: APP_CONFIG['name']), admin_dashboard_path -= render 'admin/shared/user' -= render 'admin/shared/menu' diff --git a/app/views/admin/shared/_login_header.html.haml b/app/views/admin/shared/_login_header.html.haml deleted file mode 100644 index 6aee1ab..0000000 --- a/app/views/admin/shared/_login_header.html.haml +++ /dev/null @@ -1 +0,0 @@ -%h1= link_to image_tag(asset_url('admin/logo.svg'), alt: APP_CONFIG['name']), admin_dashboard_path diff --git a/app/views/admin/shared/_menu.html.haml b/app/views/admin/shared/_menu.html.haml deleted file mode 100644 index 4496dfc..0000000 --- a/app/views/admin/shared/_menu.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%nav - %ul - - @admin_menu.each do |key, value| - = render 'admin/shared/menu_item', menu_item: key diff --git a/app/views/admin/shared/_menu_item.html.haml b/app/views/admin/shared/_menu_item.html.haml deleted file mode 100644 index 43c87f0..0000000 --- a/app/views/admin/shared/_menu_item.html.haml +++ /dev/null @@ -1 +0,0 @@ -%li= link_to menu_item.to_s.gsub(/_/, ' ').titleize, { controller: menu_item }, class: (params[:controller] == "admin/#{menu_item}" ? 'selected' : nil) diff --git a/app/views/admin/shared/_user.html.haml b/app/views/admin/shared/_user.html.haml deleted file mode 100644 index 77ad56d..0000000 --- a/app/views/admin/shared/_user.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -#user - %strong= current_admin_user.email - | - = link_to 'Change Password', edit_password_admin_admin_user_path - | - = link_to 'Logout', destroy_admin_user_session_path, method: :delete diff --git a/app/views/admin/unlocks/new.html.haml b/app/views/admin/unlocks/new.html.haml deleted file mode 100644 index ea55081..0000000 --- a/app/views/admin/unlocks/new.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%h3 Resend unlock instructions - -= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| - - = inputs_field_set do - = f.input :email - - = actions_field_set do - = f.submit 'Resend unlock instructions' - -= render partial: 'devise/shared/links' diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb deleted file mode 100644 index 3758724..0000000 --- a/config/initializers/devise.rb +++ /dev/null @@ -1,254 +0,0 @@ -# Use this hook to configure devise mailer, warden hooks and so forth. -# Many of these configuration options can be set straight in your model. -Devise.setup do |config| - # The secret key used by Devise. Devise uses this key to generate - # random tokens. Changing this key will render invalid all existing - # confirmation, reset password and unlock tokens in the database. - config.secret_key = '61c6eff811df1ecd36c7fc2365c73f535546bf47ef542cce436cbb43cb6e7fbcd9d89f07d01cd65413b3ba16b850934c8f7e56d85f8aece02444b2487389efb8' - - # ==> Mailer Configuration - # Configure the e-mail address which will be shown in Devise::Mailer, - # note that it will be overwritten if you use your own mailer class - # with default "from" parameter. - config.mailer_sender = 'site@danbarberphoto.com' - - # Configure the class responsible to send e-mails. - # config.mailer = 'Devise::Mailer' - - # ==> ORM configuration - # Load and configure the ORM. Supports :active_record (default) and - # :mongoid (bson_ext recommended) by default. Other ORMs may be - # available as additional gems. - require 'devise/orm/active_record' - - # ==> Configuration for any authentication mechanism - # Configure which keys are used when authenticating a user. The default is - # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating a user, both parameters are required. Remember that those - # parameters are used only when authenticating and not when retrieving from - # session. If you need permissions, you should implement that in a before filter. - # You can also supply a hash where the value is a boolean determining whether - # or not authentication should be aborted when the value is not present. - # config.authentication_keys = [ :email ] - - # Configure parameters from the request object used for authentication. Each entry - # given should be a request method and it will automatically be passed to the - # find_for_authentication method and considered in your model lookup. For instance, - # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. - # The same considerations mentioned for authentication_keys also apply to request_keys. - # config.request_keys = [] - - # Configure which authentication keys should be case-insensitive. - # These keys will be downcased upon creating or modifying a user and when used - # to authenticate or find a user. Default is :email. - config.case_insensitive_keys = [ :email ] - - # Configure which authentication keys should have whitespace stripped. - # These keys will have whitespace before and after removed upon creating or - # modifying a user and when used to authenticate or find a user. Default is :email. - config.strip_whitespace_keys = [ :email ] - - # Tell if authentication through request.params is enabled. True by default. - # It can be set to an array that will enable params authentication only for the - # given strategies, for example, `config.params_authenticatable = [:database]` will - # enable it only for database (email + password) authentication. - # config.params_authenticatable = true - - # Tell if authentication through HTTP Auth is enabled. False by default. - # It can be set to an array that will enable http authentication only for the - # given strategies, for example, `config.http_authenticatable = [:database]` will - # enable it only for database authentication. The supported strategies are: - # :database = Support basic authentication with authentication key + password - # config.http_authenticatable = false - - # If http headers should be returned for AJAX requests. True by default. - # config.http_authenticatable_on_xhr = true - - # The realm used in Http Basic Authentication. 'Application' by default. - # config.http_authentication_realm = 'Application' - - # It will change confirmation, password recovery and other workflows - # to behave the same regardless if the e-mail provided was right or wrong. - # Does not affect registerable. - # config.paranoid = true - - # By default Devise will store the user in session. You can skip storage for - # particular strategies by setting this option. - # Notice that if you are skipping storage for all authentication paths, you - # may want to disable generating routes to Devise's sessions controller by - # passing :skip => :sessions to `devise_for` in your config/routes.rb - config.skip_session_storage = [:http_auth] - - # By default, Devise cleans up the CSRF token on authentication to - # avoid CSRF token fixation attacks. This means that, when using AJAX - # requests for sign in and sign up, you need to get a new CSRF token - # from the server. You can disable this option at your own risk. - # config.clean_up_csrf_token_on_authentication = true - - # ==> Configuration for :database_authenticatable - # For bcrypt, this is the cost for hashing the password and defaults to 10. If - # using other encryptors, it sets how many times you want the password re-encrypted. - # - # Limiting the stretches to just one in testing will increase the performance of - # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use - # a value less than 10 in other environments. - config.stretches = Rails.env.test? ? 1 : 10 - - # Setup a pepper to generate the encrypted password. - # config.pepper = 'ba9cae796e2b75bc34af798332ac62a9dd8887c51367cb6cbe8415bec851543e981167db889d2672c1bbcb9b58101b2ac258f9c8d310f5697078089a8b8e47b9' - - # ==> Configuration for :confirmable - # A period that the user is allowed to access the website even without - # confirming his account. For instance, if set to 2.days, the user will be - # able to access the website for two days without confirming his account, - # access will be blocked just in the third day. Default is 0.days, meaning - # the user cannot access the website without confirming his account. - # config.allow_unconfirmed_access_for = 2.days - - # A period that the user is allowed to confirm their account before their - # token becomes invalid. For example, if set to 3.days, the user can confirm - # their account within 3 days after the mail was sent, but on the fourth day - # their account can't be confirmed with the token any more. - # Default is nil, meaning there is no restriction on how long a user can take - # before confirming their account. - # config.confirm_within = 3.days - - # If true, requires any email changes to be confirmed (exactly the same way as - # initial account confirmation) to be applied. Requires additional unconfirmed_email - # db field (see migrations). Until confirmed new email is stored in - # unconfirmed email column, and copied to email column on successful confirmation. - config.reconfirmable = false - - # Defines which key will be used when confirming an account - # config.confirmation_keys = [ :email ] - - # ==> Configuration for :rememberable - # The time the user will be remembered without asking for credentials again. - # config.remember_for = 2.weeks - - # If true, extends the user's remember period when remembered via cookie. - # config.extend_remember_period = false - - # Options to be passed to the created cookie. For instance, you can set - # :secure => true in order to force SSL only cookies. - # config.rememberable_options = {} - - # ==> Configuration for :validatable - # Range for password length. Default is 8..128. - config.password_length = 8..128 - - # Email regex used to validate email formats. It simply asserts that - # one (and only one) @ exists in the given string. This is mainly - # to give user feedback and not to assert the e-mail validity. - # config.email_regexp = /\A[^@]+@[^@]+\z/ - - # ==> Configuration for :timeoutable - # The time you want to timeout the user session without activity. After this - # time the user will be asked for credentials again. Default is 30 minutes. - # config.timeout_in = 30.minutes - - # If true, expires auth token on session timeout. - # config.expire_auth_token_on_timeout = false - - # ==> Configuration for :lockable - # Defines which strategy will be used to lock an account. - # :failed_attempts = Locks an account after a number of failed attempts to sign in. - # :none = No lock strategy. You should handle locking by yourself. - # config.lock_strategy = :failed_attempts - - # Defines which key will be used when locking and unlocking an account - # config.unlock_keys = [ :email ] - - # Defines which strategy will be used to unlock an account. - # :email = Sends an unlock link to the user email - # :time = Re-enables login after a certain amount of time (see :unlock_in below) - # :both = Enables both strategies - # :none = No unlock strategy. You should handle unlocking by yourself. - # config.unlock_strategy = :both - - # Number of authentication tries before locking an account if lock_strategy - # is failed attempts. - # config.maximum_attempts = 20 - - # Time interval to unlock the account if :time is enabled as unlock_strategy. - # config.unlock_in = 1.hour - - # Warn on the last attempt before the account is locked. - # config.last_attempt_warning = false - - # ==> Configuration for :recoverable - # - # Defines which key will be used when recovering the password for an account - # config.reset_password_keys = [ :email ] - - # Time interval you can reset your password with a reset password key. - # Don't put a too small interval or your users won't have the time to - # change their passwords. - config.reset_password_within = 6.hours - - # ==> Configuration for :encryptable - # Allow you to use another encryption algorithm besides bcrypt (default). You can use - # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, - # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) - # and :restful_authentication_sha1 (then you should set stretches to 10, and copy - # REST_AUTH_SITE_KEY to pepper). - # - # Require the `devise-encryptable` gem when using anything other than bcrypt - # config.encryptor = :sha512 - - # ==> Scopes configuration - # Turn scoped views on. Before rendering "sessions/new", it will first check for - # "users/sessions/new". It's turned off by default because it's slower if you - # are using only default views. - # config.scoped_views = false - - # Configure the default scope given to Warden. By default it's the first - # devise role declared in your routes (usually :user). - # config.default_scope = :user - - # Set this configuration to false if you want /users/sign_out to sign out - # only the current scope. By default, Devise signs out all scopes. - # config.sign_out_all_scopes = true - - # ==> Navigation configuration - # Lists the formats that should be treated as navigational. Formats like - # :html, should redirect to the sign in page when the user does not have - # access, but formats like :xml or :json, should return 401. - # - # If you have any extra navigational formats, like :iphone or :mobile, you - # should add them to the navigational formats lists. - # - # The "*/*" below is required to match Internet Explorer requests. - # config.navigational_formats = ['*/*', :html] - - # The default HTTP method used to sign out a resource. Default is :delete. - config.sign_out_via = :delete - - # ==> OmniAuth - # Add a new OmniAuth provider. Check the wiki for more information on setting - # up on your models and hooks. - # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' - - # ==> Warden configuration - # If you want to use other strategies, that are not supported by Devise, or - # change the failure app, you can configure them inside the config.warden block. - # - # config.warden do |manager| - # manager.intercept_401 = false - # manager.default_strategies(:scope => :user).unshift :some_external_strategy - # end - - # ==> Mountable engine configurations - # When using Devise inside an engine, let's call it `MyEngine`, and this engine - # is mountable, there are some extra configurations to be taken into account. - # The following options are available, assuming the engine is mounted as: - # - # mount MyEngine, at: '/my_engine' - # - # The router that invoked `devise_for`, in the example above, would be: - # config.router_name = :my_engine - # - # When using omniauth, Devise cannot automatically set Omniauth path, - # so you need to do it manually. For the users scope, it would be: - # config.omniauth_path_prefix = '/my_engine/users/auth' -end diff --git a/config/routes.rb b/config/routes.rb index 5a1779f..9f73ec9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,85 +1,6 @@ DanBarberPhoto::Application.routes.draw do resources :contacts - as :admin_user do - match '/admin_users/confirmation' => 'admin/confirmations#update', via: :put, as: :update_user_confirmation - end - - devise_for :admin_users, controllers: { - sessions: "admin/sessions", - passwords: "admin/passwords", - #registrations: "admin/registrations", - confirmations: "admin/confirmations", - unlocks: "admin/unlocks" - } - - namespace :admin do - root to: "dashboard#index", as: :dashboard - resources :admin_users - resource :admin_user do - member do - get :edit_password - put :update_password - end - end - resources :categories - resources :photos - resources :pages - end - - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => "welcome#index" - - # See how all your routes lay out with "rake routes" - resources :categories do resources :photos do member do @@ -94,21 +15,8 @@ DanBarberPhoto::Application.routes.draw do end end - #match 'contact' => 'pages#contact', :as => :contact resources :contacts, only: [:new, :create] - match '/:name' => 'pages#show', as: :page, via: :get - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id(.:format)))' - - # root :to => 'welcome#index' + get '/:name' => 'pages#show', as: :page root to: 'home#index' - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id(.:format)))' end diff --git a/db/migrate/20151022110802_remove_devise_admin_users.rb b/db/migrate/20151022110802_remove_devise_admin_users.rb new file mode 100644 index 0000000..5da29d5 --- /dev/null +++ b/db/migrate/20151022110802_remove_devise_admin_users.rb @@ -0,0 +1,45 @@ +class RemoveDeviseAdminUsers < ActiveRecord::Migration + def up + drop_table :admin_users + end + + def down + create_table(:admin_users) do |t| + # Database authenticatable + t.string :email, :null => false, :default => "" + t.string :encrypted_password, :null => false, :default => "" + + # Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + # Rememberable + t.datetime :remember_created_at + + # Trackable + t.integer :sign_in_count, :default => 0 + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + # Confirmable + t.string :confirmation_token + t.datetime :confirmed_at + t.datetime :confirmation_sent_at + t.string :unconfirmed_email # Only if using reconfirmable + + # Lockable + t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts + t.string :unlock_token # Only if unlock strategy is :email or :both + t.datetime :locked_at + + t.timestamps + end + + add_index :admin_users, :email, :unique => true + add_index :admin_users, :reset_password_token, :unique => true + add_index :admin_users, :confirmation_token, :unique => true + add_index :admin_users, :unlock_token, :unique => true + end +end diff --git a/db/schema.rb b/db/schema.rb index 333c11a..05e53c1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,37 +11,11 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150827205816) do +ActiveRecord::Schema.define(version: 20151022110802) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" - create_table "admin_users", force: true do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", limit: 128, default: "", null: false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" - t.integer "failed_attempts", default: 0 - t.string "unlock_token" - t.datetime "locked_at" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "admin_users", ["confirmation_token"], name: "index_admin_users_on_confirmation_token", unique: true, using: :btree - add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree - add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree - add_index "admin_users", ["unlock_token"], name: "index_admin_users_on_unlock_token", unique: true, using: :btree - create_table "categories", force: true do |t| t.string "name" t.text "description"