From b5ba6c11c6377b07d168800874893adda8ce32f9 Mon Sep 17 00:00:00 2001 From: Anthony Edwards Jr Date: Sat, 13 Jun 2015 21:01:49 -0400 Subject: [PATCH] stuff i dont remember doing --- .DS_Store | Bin 0 -> 6148 bytes Gemfile | 1 + Gemfile.lock | 48 + app/.DS_Store | Bin 0 -> 6148 bytes app/admin/admin_user.rb | 28 + app/admin/dashboard.rb | 33 + app/admin/photo.rb | 18 + app/assets/.DS_Store | Bin 0 -> 6148 bytes app/assets/javascripts/.DS_Store | Bin 0 -> 12292 bytes app/assets/javascripts/active_admin.js.coffee | 1 + app/assets/javascripts/comment.js.coffee | 3 + app/assets/javascripts/isotope2.js | 14 +- app/assets/javascripts/photo_shoot.js.coffee | 3 + app/assets/javascripts/photos.js | 6 +- app/assets/javascripts/shoot.js.coffee | 3 + app/assets/stylesheets/active_admin.css.scss | 17 + app/assets/stylesheets/comment.css.scss | 3 + app/assets/stylesheets/photo_shoot.css.scss | 3 + app/assets/stylesheets/shoot.css.scss | 3 + app/controllers/comments_controller.rb | 2 + app/controllers/photos_controller.rb | 103 +- app/controllers/shoots_controller.rb | 82 + app/helpers/comment_helper.rb | 2 + app/helpers/photo_shoot_helper.rb | 2 + app/helpers/shoot_helper.rb | 2 + app/models/admin_user.rb | 6 + app/models/comment.rb | 3 + app/models/photo.rb | 7 +- app/models/photo_shoot.rb | 4 + app/models/shoot.rb | 7 + app/models/user.rb | 10 + app/views/.DS_Store | Bin 0 -> 6148 bytes app/views/devise/confirmations/new.html.erb | 16 + .../mailer/confirmation_instructions.html.erb | 5 + .../reset_password_instructions.html.erb | 8 + .../mailer/unlock_instructions.html.erb | 7 + app/views/devise/passwords/edit.html.erb | 19 + app/views/devise/passwords/new.html.erb | 15 + app/views/devise/registrations/edit.html.erb | 27 + app/views/devise/registrations/new.html.erb | 17 + app/views/devise/sessions/new.html.erb | 15 + app/views/devise/shared/_links.html.erb | 25 + app/views/devise/unlocks/new.html.erb | 16 + app/views/layouts/application.html.erb | 5 +- app/views/photos/index.html.erb | 6 +- app/views/photos/new.html.erb | 61 +- app/views/photos/weddings.html.erb | 5 +- app/views/shoots/show.html.erb | 1 + config/initializers/active_admin.rb | 233 + config/routes.rb | 16 + db/migrate/20140901013021_create_photos.rb | 2 +- ...0141129015000_devise_create_admin_users.rb | 48 + ...1129015019_create_active_admin_comments.rb | 19 + .../20141129020303_devise_create_users.rb | 43 + db/migrate/20141129031409_create_shoots.rb | 9 + db/migrate/20141129031515_create_comments.rb | 10 + ...034237_add_column_role_access_to_photos.rb | 8 + db/schema.rb | 74 +- log/development.log | 31294 ++++++++++++++++ rails | 0 test/controllers/comment_controller_test.rb | 7 + .../photo_shoot_controller_test.rb | 7 + test/controllers/shoot_controller_test.rb | 7 + test/helpers/comment_helper_test.rb | 4 + test/helpers/photo_shoot_helper_test.rb | 4 + test/helpers/shoot_helper_test.rb | 4 + test/models/admin_user_test.rb | 7 + test/models/comment_test.rb | 7 + test/models/photo_shoot_test.rb | 7 + test/models/shoot_test.rb | 7 + test/models/user_test.rb | 7 + 71 files changed, 32374 insertions(+), 112 deletions(-) create mode 100644 .DS_Store create mode 100644 app/.DS_Store create mode 100644 app/admin/admin_user.rb create mode 100644 app/admin/dashboard.rb create mode 100644 app/admin/photo.rb create mode 100644 app/assets/.DS_Store create mode 100644 app/assets/javascripts/.DS_Store create mode 100644 app/assets/javascripts/active_admin.js.coffee create mode 100644 app/assets/javascripts/comment.js.coffee create mode 100644 app/assets/javascripts/photo_shoot.js.coffee create mode 100644 app/assets/javascripts/shoot.js.coffee create mode 100644 app/assets/stylesheets/active_admin.css.scss create mode 100644 app/assets/stylesheets/comment.css.scss create mode 100644 app/assets/stylesheets/photo_shoot.css.scss create mode 100644 app/assets/stylesheets/shoot.css.scss create mode 100644 app/controllers/comments_controller.rb create mode 100644 app/controllers/shoots_controller.rb create mode 100644 app/helpers/comment_helper.rb create mode 100644 app/helpers/photo_shoot_helper.rb create mode 100644 app/helpers/shoot_helper.rb create mode 100644 app/models/admin_user.rb create mode 100644 app/models/comment.rb create mode 100644 app/models/photo_shoot.rb create mode 100644 app/models/shoot.rb create mode 100644 app/models/user.rb create mode 100644 app/views/.DS_Store create mode 100644 app/views/devise/confirmations/new.html.erb create mode 100644 app/views/devise/mailer/confirmation_instructions.html.erb create mode 100644 app/views/devise/mailer/reset_password_instructions.html.erb create mode 100644 app/views/devise/mailer/unlock_instructions.html.erb create mode 100644 app/views/devise/passwords/edit.html.erb create mode 100644 app/views/devise/passwords/new.html.erb create mode 100644 app/views/devise/registrations/edit.html.erb create mode 100644 app/views/devise/registrations/new.html.erb create mode 100644 app/views/devise/sessions/new.html.erb create mode 100644 app/views/devise/shared/_links.html.erb create mode 100644 app/views/devise/unlocks/new.html.erb create mode 100644 app/views/shoots/show.html.erb create mode 100644 config/initializers/active_admin.rb create mode 100644 db/migrate/20141129015000_devise_create_admin_users.rb create mode 100644 db/migrate/20141129015019_create_active_admin_comments.rb create mode 100644 db/migrate/20141129020303_devise_create_users.rb create mode 100644 db/migrate/20141129031409_create_shoots.rb create mode 100644 db/migrate/20141129031515_create_comments.rb create mode 100644 db/migrate/20141129034237_add_column_role_access_to_photos.rb create mode 100644 rails create mode 100644 test/controllers/comment_controller_test.rb create mode 100644 test/controllers/photo_shoot_controller_test.rb create mode 100644 test/controllers/shoot_controller_test.rb create mode 100644 test/helpers/comment_helper_test.rb create mode 100644 test/helpers/photo_shoot_helper_test.rb create mode 100644 test/helpers/shoot_helper_test.rb create mode 100644 test/models/admin_user_test.rb create mode 100644 test/models/comment_test.rb create mode 100644 test/models/photo_shoot_test.rb create mode 100644 test/models/shoot_test.rb create mode 100644 test/models/user_test.rb diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0= 4) railties (>= 4) +GIT + remote: git://github.com/activeadmin/activeadmin.git + revision: 952273a204def082e0891cc94f1f8c15216605d0 + specs: + activeadmin (1.0.0.pre) + arbre (~> 1.0, >= 1.0.2) + bourbon + coffee-rails + formtastic (~> 3.1) + formtastic_i18n + inherited_resources (~> 1.4, != 1.5.0) + jquery-rails + jquery-ui-rails (~> 5.0) + kaminari (~> 0.15) + rails (>= 3.2, < 4.2) + ransack (~> 1.3) + sass-rails + GEM remote: https://rubygems.org/ specs: @@ -36,10 +54,15 @@ GEM thread_safe (~> 0.1) tzinfo (~> 1.1) addressable (2.3.6) + arbre (1.0.2) + activesupport (>= 3.0.0) arel (5.0.1.20140414130214) bcrypt (3.1.7) bootstrap-sass (3.3.0.1) sass (~> 3.2) + bourbon (3.2.3) + sass (~> 3.2) + thor builder (3.2.2) coffee-rails (4.0.1) coffee-script (>= 2.2.0) @@ -103,14 +126,25 @@ GEM fog-core nokogiri (~> 1.5, >= 1.5.11) formatador (0.2.5) + formtastic (3.1.2) + actionpack (>= 3.2.13) + formtastic_i18n (0.1.1) foundation-rails (5.4.5.0) railties (>= 3.1.0) sass (>= 3.2.0) haml (4.0.5) tilt + has_scope (0.6.0.rc) + actionpack (>= 3.2, < 5) + activesupport (>= 3.2, < 5) hike (1.2.3) i18n (0.6.11) inflecto (0.0.2) + inherited_resources (1.5.1) + actionpack (>= 3.2, < 4.2) + has_scope (~> 0.6.0.rc) + railties (>= 3.2, < 4.2) + responders (~> 1.0) ipaddress (0.8.0) jbuilder (2.2.4) activesupport (>= 3.0.0, < 5) @@ -118,7 +152,12 @@ GEM jquery-rails (3.1.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + jquery-ui-rails (5.0.2) + railties (>= 3.2.16) json (1.8.1) + kaminari (0.16.1) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) @@ -135,6 +174,8 @@ GEM mini_portile (= 0.6.0) orm_adapter (0.5.0) pg (0.17.1) + polyamorous (1.1.0) + activerecord (>= 3.0) polyglot (0.3.5) rack (1.5.2) rack-cache (1.2) @@ -157,6 +198,12 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.3.2) + ransack (1.5.1) + actionpack (>= 3.0) + activerecord (>= 3.0) + activesupport (>= 3.0) + i18n + polyamorous (~> 1.1) rdoc (4.1.2) json (~> 1.4) remotipart (1.2.1) @@ -208,6 +255,7 @@ PLATFORMS ruby DEPENDENCIES + activeadmin! bootstrap-sass coffee-rails (~> 4.0.0) devise diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0S6ot=d7X>#$5xUG1DEb7kv^#MlZvAc0w)V%Qt>`L`?zuBlL1Up6kz&ul z%!!kGW-?!<2{!_8ty%XNXacCSn(pth`KH);tCg}7d+em6AIMPP31i%%TZvYO2#A0P zh=2%)z$OsjJKIWq$$LMXRVxA_u$2Vt`H--hrcukF{?Wn4rvTI%yM5s?^8oKjqNY*H zpx(+cL-ydJ)x{LU1v}3t7EVp0mO+CZF4*DX%r0gq&d*L?;=|$6plU@x1gZq=XVXLv zL+0!cpYr#NIs73e7_i@thKw3f`zR*UyR%s_&FQ_uC3F4^Iol(SF~Ss&`~on-D|@?m zVP8%y=*t<=_HzsvHRjmn$S~)~1*^Hm}>`*~dZ+T6&i;nzBj>(91;@aijGa9zYKmG4 literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/active_admin.js.coffee b/app/assets/javascripts/active_admin.js.coffee new file mode 100644 index 0000000..3752dce --- /dev/null +++ b/app/assets/javascripts/active_admin.js.coffee @@ -0,0 +1 @@ +#= require active_admin/base diff --git a/app/assets/javascripts/comment.js.coffee b/app/assets/javascripts/comment.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/comment.js.coffee @@ -0,0 +1,3 @@ +# 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://coffeescript.org/ diff --git a/app/assets/javascripts/isotope2.js b/app/assets/javascripts/isotope2.js index b2689e3..9b505ff 100644 --- a/app/assets/javascripts/isotope2.js +++ b/app/assets/javascripts/isotope2.js @@ -4,9 +4,9 @@ $(window).load(function(){ var $container = $('#masonry-container').isotope({ - + itemSelector: '.box', - + masonry: { columnWidth: 5, gutter: 5, @@ -17,22 +17,22 @@ $(window).load(function(){ $container.imagesLoaded(function(){ $container.isotope('layout'); - }) + }); // $container.imagesLoaded() - + // .done( function( instance ){ // $container.isotope({ // itemSelector: '.box', - + // masonry: { // columnWidth: 5, // isFitWidth: true // } - // }); + // }); // }); - + $('#nav > li > ul').on( 'click', 'li', function() { var filterValue = $(this).attr('data-filter'); console.log(filterValue) diff --git a/app/assets/javascripts/photo_shoot.js.coffee b/app/assets/javascripts/photo_shoot.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/photo_shoot.js.coffee @@ -0,0 +1,3 @@ +# 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://coffeescript.org/ diff --git a/app/assets/javascripts/photos.js b/app/assets/javascripts/photos.js index cd5d293..a476d6a 100644 --- a/app/assets/javascripts/photos.js +++ b/app/assets/javascripts/photos.js @@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', function(){ if (document.querySelector(".photos-list")){ var img = document.querySelector(".photos-list"); img.addEventListener('click', imageModal); - + window.addEventListener('scroll', function(e){ var distanceY = window.pageYOffset || document.documentElement.scrollTop @@ -24,10 +24,12 @@ document.addEventListener('DOMContentLoaded', function(){ } }); } - var multiple_photos_form = $('#new_photo'); + var multiple_photos_form = $('form'); + console.log(multiple_photos_form); multiple_photos_form.fileupload({dataType: 'script'}); multiple_photos_form.on('fileuploadsubmit', function (e, data) { + console.log(data.formData) data.formData = multiple_photos_form.serializeArray(); }); }); diff --git a/app/assets/javascripts/shoot.js.coffee b/app/assets/javascripts/shoot.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/shoot.js.coffee @@ -0,0 +1,3 @@ +# 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://coffeescript.org/ diff --git a/app/assets/stylesheets/active_admin.css.scss b/app/assets/stylesheets/active_admin.css.scss new file mode 100644 index 0000000..90ba1d4 --- /dev/null +++ b/app/assets/stylesheets/active_admin.css.scss @@ -0,0 +1,17 @@ +// SASS variable overrides must be declared before loading up Active Admin's styles. +// +// To view the variables that Active Admin provides, take a look at +// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the +// Active Admin source. +// +// For example, to change the sidebar width: +// $sidebar-width: 242px; + +// Active Admin's got SASS! +@import "active_admin/mixins"; +@import "active_admin/base"; + +// Overriding any non-variable SASS must be done after the fact. +// For example, to change the default status-tag color: +// +// .status_tag { background: #6090DB; } diff --git a/app/assets/stylesheets/comment.css.scss b/app/assets/stylesheets/comment.css.scss new file mode 100644 index 0000000..6a64715 --- /dev/null +++ b/app/assets/stylesheets/comment.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Comment 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/photo_shoot.css.scss b/app/assets/stylesheets/photo_shoot.css.scss new file mode 100644 index 0000000..0236ec9 --- /dev/null +++ b/app/assets/stylesheets/photo_shoot.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the PhotoShoot 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/shoot.css.scss b/app/assets/stylesheets/shoot.css.scss new file mode 100644 index 0000000..8706968 --- /dev/null +++ b/app/assets/stylesheets/shoot.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Shoot 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/comments_controller.rb b/app/controllers/comments_controller.rb new file mode 100644 index 0000000..1599b9b --- /dev/null +++ b/app/controllers/comments_controller.rb @@ -0,0 +1,2 @@ +class CommentController < ApplicationController +end diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 084495e..da3e2ae 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -1,61 +1,62 @@ class PhotosController < ApplicationController - def index - @photos = Photo.where.not(category: ["wedding", "event"]) - end - - def new - @photo = Photo.new - end - - def create - respond_to do |format| - @photo = Photo.new(photo_params) - if @photo.save - flash[:success] = "Photo saved" - format.html {redirect_to photos_path} - format.js - else - render 'new' - end - end - end - - def weddings - @photos = Photo.where(category: "wedding").shuffle.shuffle - render layout: "wedding_layout" - end - - def wedding - respond_to do |format| - @photos = Photo.where(title: params[:id]).shuffle - format.js - end - end - - def events - @photos = Photo.where(category: "events") - end - - def event - respond_to do |format| - @photos = Photo.where(title: params[:id]) - format.js - end - end + def index + @photos = Photo.where.not(category: ["wedding", "event"]) + end + + def new + @shoot = Shoot.new + @shoot.photos.build + @photo = Photo.new + end + + def create + respond_to do |format| + @photo = Photo.new(photo_params) + if @photo.save + flash[:success] = "Photo saved" + format.html {redirect_to photos_path} + format.js + else + render 'new' + end + end + end + + def weddings + @photos = Photo.where(category: "wedding").shuffle.shuffle + render layout: "wedding_layout" + end + + def wedding + respond_to do |format| + @photos = Photo.where(title: params[:id]).shuffle + format.js + end + end + + def events + @photos = Photo.where(category: "events") + end + + def event + respond_to do |format| + @photos = Photo.where(title: params[:id]) + format.js + end + end def new_multiple @photo = Photo.new end + private - private - - def photo_show - params.require(:photo).permit(:image_uid) - end + def photo_show + params.require(:photo).permit(:image_uid) + end - def photo_params - params.require(:photo).permit(:image, :title, :category, :model, :shootdate) - end + def photo_params + params.require(:photo).permit(:image, :title, :category, :model, :shootdate) + end end \ No newline at end of file diff --git a/app/controllers/shoots_controller.rb b/app/controllers/shoots_controller.rb new file mode 100644 index 0000000..6c3ad01 --- /dev/null +++ b/app/controllers/shoots_controller.rb @@ -0,0 +1,82 @@ +class ShootsController < ApplicationController + + def index + @shoots = load_shoots + end + + def show + load_shoot + end + + def new + shoot_build + @shoot.photos.build + end + + def create + + build_shoot + save_shoot or render 'new' + end + + def edit + load_shoot + build_shoot + end + + def update + load_shoot + build_shoot + + save_shoot or render 'edit' + respond_to do |format| + format.js { redirect_to @person } + end + end + + def destroy + load_shoot + @shoot.destroy + redirect_to shoots_path + end + + private + + def load_shoots + @shoots ||= shoot_scope + end + + def load_shoot + @shoot ||= shoot_scope.find(params[:id]) + end + + def build_shoot + @shoot ||= shoot_scope.build + p @shoot + @shoot.attributes = shoot_params + p "shoot_params" + p @shoot.attributes + end + + def save_shoot + if @shoot.save + # p '*'*100 + # p shoot = params[:shoot][:photos_attributes]["0"].merge(params[:photo]) + # Photo.create(shoot) + # @shoot.photos.create(shoot) + redirect_to @shoot + end + end + + def shoot_params + + shoot_params =params[:shoot] + + shoot_params ? shoot_params.permit(:user_id, :title, photos_attributes: [:title, :shoot_id, :category, :model, :shootdate, :admittance, photo: :image]) : {} + + end + + def shoot_scope + Shoot.all + end +end diff --git a/app/helpers/comment_helper.rb b/app/helpers/comment_helper.rb new file mode 100644 index 0000000..2466d7e --- /dev/null +++ b/app/helpers/comment_helper.rb @@ -0,0 +1,2 @@ +module CommentHelper +end diff --git a/app/helpers/photo_shoot_helper.rb b/app/helpers/photo_shoot_helper.rb new file mode 100644 index 0000000..2240029 --- /dev/null +++ b/app/helpers/photo_shoot_helper.rb @@ -0,0 +1,2 @@ +module PhotoShootHelper +end diff --git a/app/helpers/shoot_helper.rb b/app/helpers/shoot_helper.rb new file mode 100644 index 0000000..aa45984 --- /dev/null +++ b/app/helpers/shoot_helper.rb @@ -0,0 +1,2 @@ +module ShootHelper +end diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb new file mode 100644 index 0000000..318ec39 --- /dev/null +++ b/app/models/admin_user.rb @@ -0,0 +1,6 @@ +class AdminUser < ActiveRecord::Base + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, + :recoverable, :rememberable, :trackable, :validatable +end diff --git a/app/models/comment.rb b/app/models/comment.rb new file mode 100644 index 0000000..249b471 --- /dev/null +++ b/app/models/comment.rb @@ -0,0 +1,3 @@ +class Comment < ActiveRecord::Base + belongs_to :commentable, polymorphic: true +end diff --git a/app/models/photo.rb b/app/models/photo.rb index d4197eb..076d2d9 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -1,4 +1,7 @@ class Photo < ActiveRecord::Base - dragonfly_accessor :image - + dragonfly_accessor :image + has_many :comments, as: :commentable + belongs_to :shoot + enum admittance: ["open", "closed" ] + enum rating: ['0', '1', '2', '3', '4', '5'] end diff --git a/app/models/photo_shoot.rb b/app/models/photo_shoot.rb new file mode 100644 index 0000000..1393096 --- /dev/null +++ b/app/models/photo_shoot.rb @@ -0,0 +1,4 @@ +class PhotoShoot < ActiveRecord::Base + belongs_to :photo + belongs_to :shoot +end diff --git a/app/models/shoot.rb b/app/models/shoot.rb new file mode 100644 index 0000000..8c3b16e --- /dev/null +++ b/app/models/shoot.rb @@ -0,0 +1,7 @@ +class Shoot < ActiveRecord::Base + has_many :comments, as: :commentable + has_many :photos + # has_many :photos, through: :photo_shoots, source: :shoot_id + accepts_nested_attributes_for :photos + belongs_to :user +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..0014b25 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,10 @@ +class User < ActiveRecord::Base + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + + enum status: [ :admin, :client, :photographer ] + has_many :shoots + has_many :photos, through: :shoots +end diff --git a/app/views/.DS_Store b/app/views/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..56c5324907b3907994e37d9e7d948771a9ae2d1d GIT binary patch literal 6148 zcmeHK%}N6?5Kd~XyA*T<5A~Ltmmca5R!=TfPhNx-dr+ynY_SVvQ@UGwsD(ZHd-fGX zU&w8%qRH_e8NhE>U>(+ClBJ+uzu!mDX-7#~sl4;tTz0B{oY$i`l>M6Q#bI*p zX=gnO)0UdlI4sMy?1obs3^uCOve?+&8J5MMTCJ4D)^=q$be?T%b!~I+D3CX|clQsE zPcN^UY!3gWl4XMjis%~5G^(Qm8oWN@cpec2YResend confirmation instructions + +<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> + <%= f.error_notification %> + <%= f.full_error :confirmation_token %> + +
+ <%= f.input :email, required: true, autofocus: true %> +
+ +
+ <%= f.button :submit, "Resend confirmation instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..dc55f64 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @email %>!

+ +

You can confirm your account email through the link below:

+ +

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

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

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

+ +

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

+ +

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

+

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

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

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

+ +

Click the link below to unlock your account:

+ +

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

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..8f995ed --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,19 @@ +

Change your password

+ +<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> + <%= f.error_notification %> + + <%= f.input :reset_password_token, as: :hidden %> + <%= f.full_error :reset_password_token %> + +
+ <%= f.input :password, label: "New password", required: true, autofocus: true %> + <%= f.input :password_confirmation, label: "Confirm your new password", required: true %> +
+ +
+ <%= f.button :submit, "Change my password" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..d1503e7 --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,15 @@ +

Forgot your password?

+ +<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, required: true, autofocus: true %> +
+ +
+ <%= f.button :submit, "Send me reset password instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..5db350b --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,27 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, required: true, autofocus: true %> + + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +

Currently waiting confirmation for: <%= resource.unconfirmed_email %>

+ <% end %> + + <%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %> + <%= f.input :password_confirmation, required: false %> + <%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %> +
+ +
+ <%= f.button :submit, "Update" %> +
+<% end %> + +

Cancel my account

+ +

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..4ea8fb9 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,17 @@ +

Sign up

+ +<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, required: true, autofocus: true %> + <%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @validatable) %> + <%= f.input :password_confirmation, required: true %> +
+ +
+ <%= f.button :submit, "Sign up" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..31f8a4d --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,15 @@ +

Log in

+ +<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> +
+ <%= f.input :email, required: false, autofocus: true %> + <%= f.input :password, required: false %> + <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %> +
+ +
+ <%= f.button :submit, "Log in" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb new file mode 100644 index 0000000..cd795ad --- /dev/null +++ b/app/views/devise/shared/_links.html.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Log in", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%> +<% end -%> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..788f62e --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,16 @@ +

Resend unlock instructions

+ +<%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> + <%= f.error_notification %> + <%= f.full_error :unlock_token %> + +
+ <%= f.input :email, required: true, autofocus: true %> +
+ +
+ <%= f.button :submit, "Resend unlock instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 093781b..42ad863 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,10 +13,7 @@ <%= yield %> -
- <%= render partial: "about_me" %> - × -
+ <%= javascript_include_tag 'application'%> diff --git a/app/views/photos/index.html.erb b/app/views/photos/index.html.erb index f7dd8cf..895f309 100644 --- a/app/views/photos/index.html.erb +++ b/app/views/photos/index.html.erb @@ -44,8 +44,10 @@
- - +
+ <%= render partial: "about_me" %> + × +