Louis | reverts fa110, which was branched instead

This commit is contained in:
Loos
2014-09-16 20:23:43 -04:00
parent fa110546c8
commit 3c8962fa49
228 changed files with 27 additions and 4656 deletions
@@ -0,0 +1,5 @@
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
end
+61
View File
@@ -0,0 +1,61 @@
class BikesController < ApplicationController
before_action :set_bike, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
def index
@bikes = Bike.all
end
def show
end
def new
@bike = Bike.new
end
def edit
end
def create
@bike = Bike.new(bike_params)
respond_to do |format|
if @bike.save
format.html { redirect_to @bike, notice: 'Bike was successfully created.' }
else
format.html { render action: 'new' }
end
end
end
def update
respond_to do |format|
if @bike.update(bike_params)
format.html { redirect_to @bike, notice: 'Bike was successfully updated.' }
else
format.html { render action: 'edit' }
end
end
end
def destroy
@bike.destroy
respond_to do |format|
format.html { redirect_to bikes_url }
end
end
private
def set_bike
@bike = Bike.find(params[:id])
end
def bike_params
params.require(:bike).permit(:entry_date, :brand, :model,
:type, :color, :frame_size,
:log_number, :purpose, :serial_number,
:notes, :tag_info, :mechanic,
:completion_date, :price,
:top_tube_size, :seat_tube_size,
:created_at, :updated_at)
end
end
View File
@@ -0,0 +1,3 @@
class StaticPagesController < ApplicationController
def home; end
end
+49
View File
@@ -0,0 +1,49 @@
class VolunteersController < ApplicationController
before_action :set_volunteer, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
def index
@volunteers = Volunteer.all
end
def show; end
def new
@volunteer = Volunteer.new
end
def edit; end
def create
@volunteer = Volunteer.new(volunteer_params)
if @volunteer.save
redirect_to @volunteer, notice: 'Volunteer was successfully created.'
else
render action: 'new'
end
end
def update
if @volunteer.update(volunteer_params)
redirect_to @volunteer, notice: 'Volunteer was successfully updated.'
else
render action: 'edit'
end
end
def destroy
@volunteer.destroy
redirect_to volunteers_url
end
private
def set_volunteer
@volunteer = Volunteer.find(params[:id])
end
def volunteer_params
params.require(:volunteer).permit(:name, :email, :phone)
end
end