From 7d84062ebe272855c0e6ebbfd991ab277fdc079f Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 15:59:50 -0500 Subject: currently adding Session controller and view --- Gemfile.lock | 8 ---- app/controllers/application_controller.rb | 4 ++ app/views/layouts/application.html.erb | 29 ------------- config/routes.rb | 72 +++++++++++++++++-------------- generate.sh | 1 + 5 files changed, 45 insertions(+), 69 deletions(-) delete mode 100644 app/views/layouts/application.html.erb diff --git a/Gemfile.lock b/Gemfile.lock index 9de990e..9dd0199 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,11 +26,7 @@ GEM thread_safe (~> 0.1) tzinfo (~> 0.3.37) arel (4.0.2) -<<<<<<< HEAD atomic (1.1.15) -======= - atomic (1.1.14) ->>>>>>> 699bd065c06689a159c11ac3aacef6b34001617c bcrypt-ruby (3.1.2) bootstrap-sass (3.1.1.0) sass (~> 3.2) @@ -119,11 +115,7 @@ GEM multi_json (~> 1.0) rubyzip (< 1.0.0) websocket (~> 1.0.4) -<<<<<<< HEAD sprockets (2.11.0) -======= - sprockets (2.10.1) ->>>>>>> 699bd065c06689a159c11ac3aacef6b34001617c hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e..03ef797 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,8 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + #include sessionhelper for the session controller and view + include SessionHelper + end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 0deede3..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,29 +0,0 @@ - - - - Leaguer - <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> - <%= javascript_include_tag "application", "data-turbolinks-track" => true %> - <%= csrf_meta_tags %> - - - -<%= yield %> - -
- - - - diff --git a/config/routes.rb b/config/routes.rb index 7d898b8..a4f1f66 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,12 @@ Leaguer::Application.routes.draw do + + #creates sessions as a resource but limits it to these actions + resources :sessions, only: [:new, :create, :destroy] + + match 'signup', to: 'users#new', via: 'get' + match 'signin', to: 'sessions#new', via: 'get' + match 'signout', to: 'sessions#destroy', via: 'delete' + resources :pms resources :alerts @@ -24,51 +32,51 @@ Leaguer::Application.routes.draw do # root 'welcome#index' # Example of regular route: - # get 'products/:id' => 'catalog#view' + # get 'products/:id' => 'catalog#view' # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase + # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products + # resources :products # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end # - # collection do - # get 'sold' - # end - # end + # collection do + # get 'sold' + # end + # end # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end + # resources :products do + # resources :comments, :sales + # resource :seller + # end # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', on: :collection + # end + # end # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable + # concern :toggleable do + # post 'toggle' + # end + # resources :posts, concerns: :toggleable + # resources :photos, concerns: :toggleable # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end end diff --git a/generate.sh b/generate.sh index 807b9ef..7f70d56 100755 --- a/generate.sh +++ b/generate.sh @@ -18,6 +18,7 @@ bundle exec rails generate scaffold tournament game:references $NOTEST bundle exec rails generate scaffold match tournament:references $NOTEST bundle exec rails generate scaffold team $NOTEST bundle exec rails generate controller users $NOTEST +bundle exec rails generate controller Sessions bundle exec rails generate model user name:string email:string user_name:string $NOTEST bundle exec rails generate model user_team_pair user:references team:references $NOTEST bundle exec rails generate model team_match_pair team:references match:references $NOTEST -- cgit v1.2.3-2-g168b