Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
717 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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://jashkenas.github.com/coffee-script/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class PeopleController < ApplicationController | ||
# GET /people | ||
# GET /people.json | ||
def index | ||
@people = Person.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @people } | ||
end | ||
end | ||
|
||
# GET /people/1 | ||
# GET /people/1.json | ||
def show | ||
@person = Person.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @person } | ||
end | ||
end | ||
|
||
# GET /people/new | ||
# GET /people/new.json | ||
def new | ||
@person = Person.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @person } | ||
end | ||
end | ||
|
||
# GET /people/1/edit | ||
def edit | ||
@person = Person.find(params[:id]) | ||
end | ||
|
||
# POST /people | ||
# POST /people.json | ||
def create | ||
@person = Person.new(params[:person]) | ||
|
||
respond_to do |format| | ||
if @person.save | ||
format.html { redirect_to @person, notice: 'Person was successfully created.' } | ||
format.json { render json: @person, status: :created, location: @person } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @person.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /people/1 | ||
# PUT /people/1.json | ||
def update | ||
@person = Person.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @person.update_attributes(params[:person]) | ||
format.html { redirect_to @person, notice: 'Person was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @person.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /people/1 | ||
# DELETE /people/1.json | ||
def destroy | ||
@person = Person.find(params[:id]) | ||
@person.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to people_url } | ||
format.json { head :no_content } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module PeopleHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Person < ActiveRecord::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
= simple_form_for(@person) do |f| | ||
= f.error_notification | ||
|
||
.form-inputs | ||
= f.input :last_name | ||
= f.input :first_name | ||
= f.input :middle_name | ||
= f.input :maden | ||
= f.input :prefix | ||
= f.input :suffix | ||
= f.input :gender | ||
= f.input :birth_date | ||
= f.input :death_date | ||
= f.input :death_hebrew_date_day | ||
= f.input :death_hebrew_date_month | ||
= f.input :death_hebrew_date_year | ||
= f.input :death_after_sunset | ||
|
||
.form-actions | ||
= f.button :wrapped, :cancel => people_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%h1 Editing person | ||
|
||
= render 'form' | ||
|
||
= link_to 'Show', @person | ||
\| | ||
= link_to 'Back', people_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
%h1 Listing people | ||
|
||
%table | ||
%tr | ||
%th Last name | ||
%th First name | ||
%th Middle name | ||
%th Maden | ||
%th Prefix | ||
%th Suffix | ||
%th Gender | ||
%th Birth date | ||
%th Death date | ||
%th Death hebrew date day | ||
%th Death hebrew date month | ||
%th Death hebrew date year | ||
%th Death after sunset | ||
%th | ||
%th | ||
%th | ||
|
||
- @people.each do |person| | ||
%tr | ||
%td= person.last_name | ||
%td= person.first_name | ||
%td= person.middle_name | ||
%td= person.maden | ||
%td= person.prefix | ||
%td= person.suffix | ||
%td= person.gender | ||
%td= person.birth_date | ||
%td= person.death_date | ||
%td= person.death_hebrew_date_day | ||
%td= person.death_hebrew_date_month | ||
%td= person.death_hebrew_date_year | ||
%td= person.death_after_sunset | ||
%td= link_to 'Show', person | ||
%td= link_to 'Edit', edit_person_path(person) | ||
%td= link_to 'Destroy', person, :confirm => 'Are you sure?', :method => :delete | ||
|
||
%br | ||
|
||
= link_to 'New Person', new_person_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
%h1 New person | ||
|
||
= render 'form' | ||
|
||
= link_to 'Back', people_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
%p#notice= notice | ||
|
||
%p | ||
%b Last name: | ||
= @person.last_name | ||
%p | ||
%b First name: | ||
= @person.first_name | ||
%p | ||
%b Middle name: | ||
= @person.middle_name | ||
%p | ||
%b Maden: | ||
= @person.maden | ||
%p | ||
%b Prefix: | ||
= @person.prefix | ||
%p | ||
%b Suffix: | ||
= @person.suffix | ||
%p | ||
%b Gender: | ||
= @person.gender | ||
%p | ||
%b Birth date: | ||
= @person.birth_date | ||
%p | ||
%b Death date: | ||
= @person.death_date | ||
%p | ||
%b Death hebrew date day: | ||
= @person.death_hebrew_date_day | ||
%p | ||
%b Death hebrew date month: | ||
= @person.death_hebrew_date_month | ||
%p | ||
%b Death hebrew date year: | ||
= @person.death_hebrew_date_year | ||
%p | ||
%b Death after sunset: | ||
= @person.death_after_sunset | ||
|
||
= link_to 'Edit', edit_person_path(@person) | ||
\| | ||
= link_to 'Back', people_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
Ym32::Application.routes.draw do | ||
|
||
resources :people | ||
|
||
match 'about' => 'pages#about' | ||
root :to => 'pages#home' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class CreatePeople < ActiveRecord::Migration | ||
def change | ||
create_table :people do |t| | ||
t.string :last_name | ||
t.string :first_name | ||
t.string :middle_name | ||
t.string :maden | ||
t.string :prefix | ||
t.string :suffix | ||
t.string :gender | ||
t.date :birth_date | ||
t.date :death_date | ||
t.integer :death_hebrew_date_day | ||
t.integer :death_hebrew_date_month | ||
t.integer :death_hebrew_date_year | ||
t.boolean :death_after_sunset | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.