Re-namespacing a bit to clear out some fairly old stuff from the top level
This commit is contained in:
BIN
oldstuff/RubyFun/rails/gerbil/app/assets/images/rails.png
Normal file
BIN
oldstuff/RubyFun/rails/gerbil/app/assets/images/rails.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
@@ -0,0 +1,9 @@
|
||||
// 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_tree .
|
@@ -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/
|
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require_self
|
||||
*= require_tree .
|
||||
*/
|
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the People controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@@ -0,0 +1,56 @@
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px; }
|
||||
|
||||
p, ol, ul, td {
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px; }
|
||||
|
||||
pre {
|
||||
background-color: #eee;
|
||||
padding: 10px;
|
||||
font-size: 11px; }
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
&:visited {
|
||||
color: #666; }
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background-color: #000; } }
|
||||
|
||||
div {
|
||||
&.field, &.actions {
|
||||
margin-bottom: 10px; } }
|
||||
|
||||
#notice {
|
||||
color: green; }
|
||||
|
||||
.field_with_errors {
|
||||
padding: 2px;
|
||||
background-color: red;
|
||||
display: table; }
|
||||
|
||||
#error_explanation {
|
||||
width: 450px;
|
||||
border: 2px solid red;
|
||||
padding: 7px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f0f0f0;
|
||||
h2 {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 5px 5px 5px 15px;
|
||||
font-size: 12px;
|
||||
margin: -7px;
|
||||
margin-bottom: 0px;
|
||||
background-color: #c00;
|
||||
color: #fff; }
|
||||
ul li {
|
||||
font-size: 12px;
|
||||
list-style: square; } }
|
@@ -0,0 +1,3 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
end
|
@@ -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 :ok }
|
||||
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 :ok }
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,2 @@
|
||||
module ApplicationHelper
|
||||
end
|
@@ -0,0 +1,2 @@
|
||||
module PeopleHelper
|
||||
end
|
0
oldstuff/RubyFun/rails/gerbil/app/mailers/.gitkeep
Normal file
0
oldstuff/RubyFun/rails/gerbil/app/mailers/.gitkeep
Normal file
0
oldstuff/RubyFun/rails/gerbil/app/models/.gitkeep
Normal file
0
oldstuff/RubyFun/rails/gerbil/app/models/.gitkeep
Normal file
2
oldstuff/RubyFun/rails/gerbil/app/models/person.rb
Normal file
2
oldstuff/RubyFun/rails/gerbil/app/models/person.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Person < ActiveRecord::Base
|
||||
end
|
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Gerbil</title>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -0,0 +1,29 @@
|
||||
<%= form_for(@person) do |f| %>
|
||||
<% if @person.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @person.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :age %><br />
|
||||
<%= f.number_field :age %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :zipcode %><br />
|
||||
<%= f.text_field :zipcode %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
@@ -0,0 +1,6 @@
|
||||
<h1>Editing person</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @person %> |
|
||||
<%= link_to 'Back', people_path %>
|
@@ -0,0 +1,27 @@
|
||||
<h1>Listing people</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Age</th>
|
||||
<th>Zipcode</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @people.each do |person| %>
|
||||
<tr>
|
||||
<td><%= person.name %></td>
|
||||
<td><%= person.age %></td>
|
||||
<td><%= person.zipcode %></td>
|
||||
<td><%= link_to 'Show', person %></td>
|
||||
<td><%= link_to 'Edit', edit_person_path(person) %></td>
|
||||
<td><%= link_to 'Destroy', person, :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New Person', new_person_path %>
|
@@ -0,0 +1,5 @@
|
||||
<h1>New person</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', people_path %>
|
20
oldstuff/RubyFun/rails/gerbil/app/views/people/show.html.erb
Normal file
20
oldstuff/RubyFun/rails/gerbil/app/views/people/show.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<b>Name:</b>
|
||||
<%= @person.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Age:</b>
|
||||
<%= @person.age %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Zipcode:</b>
|
||||
<%= @person.zipcode %>
|
||||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_person_path(@person) %> |
|
||||
<%= link_to 'Back', people_path %>
|
Reference in New Issue
Block a user