Skip to content

Commit

Permalink
scaffold'd
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachBeta committed Aug 9, 2011
1 parent 97534f6 commit fbf302a
Show file tree
Hide file tree
Showing 42 changed files with 793 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -30,6 +30,7 @@ GEM
activesupport (3.0.7)
annotate (2.4.0)
arel (2.0.10)
bcrypt-ruby (2.1.4)
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
Expand All @@ -40,6 +41,7 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mocha (0.9.12)
nifty-generators (0.4.6)
polyglot (0.3.2)
rack (1.2.3)
Expand Down Expand Up @@ -73,6 +75,8 @@ PLATFORMS

DEPENDENCIES
annotate
bcrypt-ruby
mocha
nifty-generators
rails (= 3.0.7)
sqlite3
83 changes: 83 additions & 0 deletions app/controllers/clock_ins_controller.rb
@@ -0,0 +1,83 @@
class ClockInsController < ApplicationController
# GET /clock_ins
# GET /clock_ins.xml
def index
@clock_ins = ClockIn.all

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clock_ins }
end
end

# GET /clock_ins/1
# GET /clock_ins/1.xml
def show
@clock_in = ClockIn.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @clock_in }
end
end

# GET /clock_ins/new
# GET /clock_ins/new.xml
def new
@clock_in = ClockIn.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @clock_in }
end
end

# GET /clock_ins/1/edit
def edit
@clock_in = ClockIn.find(params[:id])
end

# POST /clock_ins
# POST /clock_ins.xml
def create
@clock_in = ClockIn.new(params[:clock_in])

respond_to do |format|
if @clock_in.save
format.html { redirect_to(@clock_in, :notice => 'Clock in was successfully created.') }
format.xml { render :xml => @clock_in, :status => :created, :location => @clock_in }
else
format.html { render :action => "new" }
format.xml { render :xml => @clock_in.errors, :status => :unprocessable_entity }
end
end
end

# PUT /clock_ins/1
# PUT /clock_ins/1.xml
def update
@clock_in = ClockIn.find(params[:id])

respond_to do |format|
if @clock_in.update_attributes(params[:clock_in])
format.html { redirect_to(@clock_in, :notice => 'Clock in was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @clock_in.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /clock_ins/1
# DELETE /clock_ins/1.xml
def destroy
@clock_in = ClockIn.find(params[:id])
@clock_in.destroy

respond_to do |format|
format.html { redirect_to(clock_ins_url) }
format.xml { head :ok }
end
end
end
83 changes: 83 additions & 0 deletions app/controllers/clock_outs_controller.rb
@@ -0,0 +1,83 @@
class ClockOutsController < ApplicationController
# GET /clock_outs
# GET /clock_outs.xml
def index
@clock_outs = ClockOut.all

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clock_outs }
end
end

# GET /clock_outs/1
# GET /clock_outs/1.xml
def show
@clock_out = ClockOut.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @clock_out }
end
end

# GET /clock_outs/new
# GET /clock_outs/new.xml
def new
@clock_out = ClockOut.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @clock_out }
end
end

# GET /clock_outs/1/edit
def edit
@clock_out = ClockOut.find(params[:id])
end

# POST /clock_outs
# POST /clock_outs.xml
def create
@clock_out = ClockOut.new(params[:clock_out])

respond_to do |format|
if @clock_out.save
format.html { redirect_to(@clock_out, :notice => 'Clock out was successfully created.') }
format.xml { render :xml => @clock_out, :status => :created, :location => @clock_out }
else
format.html { render :action => "new" }
format.xml { render :xml => @clock_out.errors, :status => :unprocessable_entity }
end
end
end

# PUT /clock_outs/1
# PUT /clock_outs/1.xml
def update
@clock_out = ClockOut.find(params[:id])

respond_to do |format|
if @clock_out.update_attributes(params[:clock_out])
format.html { redirect_to(@clock_out, :notice => 'Clock out was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @clock_out.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /clock_outs/1
# DELETE /clock_outs/1.xml
def destroy
@clock_out = ClockOut.find(params[:id])
@clock_out.destroy

respond_to do |format|
format.html { redirect_to(clock_outs_url) }
format.xml { head :ok }
end
end
end
83 changes: 83 additions & 0 deletions app/controllers/tasks_controller.rb
@@ -0,0 +1,83 @@
class TasksController < ApplicationController
# GET /tasks
# GET /tasks.xml
def index
@tasks = Task.all

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @tasks }
end
end

# GET /tasks/1
# GET /tasks/1.xml
def show
@task = Task.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @task }
end
end

# GET /tasks/new
# GET /tasks/new.xml
def new
@task = Task.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @task }
end
end

# GET /tasks/1/edit
def edit
@task = Task.find(params[:id])
end

# POST /tasks
# POST /tasks.xml
def create
@task = Task.new(params[:task])

respond_to do |format|
if @task.save
format.html { redirect_to(@task, :notice => 'Task was successfully created.') }
format.xml { render :xml => @task, :status => :created, :location => @task }
else
format.html { render :action => "new" }
format.xml { render :xml => @task.errors, :status => :unprocessable_entity }
end
end
end

# PUT /tasks/1
# PUT /tasks/1.xml
def update
@task = Task.find(params[:id])

respond_to do |format|
if @task.update_attributes(params[:task])
format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @task.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /tasks/1
# DELETE /tasks/1.xml
def destroy
@task = Task.find(params[:id])
@task.destroy

respond_to do |format|
format.html { redirect_to(tasks_url) }
format.xml { head :ok }
end
end
end
2 changes: 2 additions & 0 deletions app/helpers/clock_ins_helper.rb
@@ -0,0 +1,2 @@
module ClockInsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/clock_outs_helper.rb
@@ -0,0 +1,2 @@
module ClockOutsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/tasks_helper.rb
@@ -0,0 +1,2 @@
module TasksHelper
end
2 changes: 2 additions & 0 deletions app/models/clock_in.rb
@@ -0,0 +1,2 @@
class ClockIn < ActiveRecord::Base
end
2 changes: 2 additions & 0 deletions app/models/clock_out.rb
@@ -0,0 +1,2 @@
class ClockOut < ActiveRecord::Base
end
2 changes: 2 additions & 0 deletions app/models/task.rb
@@ -0,0 +1,2 @@
class Task < ActiveRecord::Base
end
25 changes: 25 additions & 0 deletions app/views/clock_ins/_form.html.erb
@@ -0,0 +1,25 @@
<%= form_for(@clock_in) do |f| %>
<% if @clock_in.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@clock_in.errors.count, "error") %> prohibited this clock_in from being saved:</h2>

<ul>
<% @clock_in.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= f.label :in_time %><br />
<%= f.datetime_select :in_time %>
</div>
<div class="field">
<%= f.label :task_id %><br />
<%= f.text_field :task_id %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
6 changes: 6 additions & 0 deletions app/views/clock_ins/edit.html.erb
@@ -0,0 +1,6 @@
<h1>Editing clock_in</h1>

<%= render 'form' %>
<%= link_to 'Show', @clock_in %> |
<%= link_to 'Back', clock_ins_path %>
25 changes: 25 additions & 0 deletions app/views/clock_ins/index.html.erb
@@ -0,0 +1,25 @@
<h1>Listing clock_ins</h1>

<table>
<tr>
<th>In time</th>
<th>Task</th>
<th></th>
<th></th>
<th></th>
</tr>

<% @clock_ins.each do |clock_in| %>
<tr>
<td><%= clock_in.in_time %></td>
<td><%= clock_in.task_id %></td>
<td><%= link_to 'Show', clock_in %></td>
<td><%= link_to 'Edit', edit_clock_in_path(clock_in) %></td>
<td><%= link_to 'Destroy', clock_in, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>

<br />

<%= link_to 'New Clock in', new_clock_in_path %>
5 changes: 5 additions & 0 deletions app/views/clock_ins/new.html.erb
@@ -0,0 +1,5 @@
<h1>New clock_in</h1>

<%= render 'form' %>
<%= link_to 'Back', clock_ins_path %>
15 changes: 15 additions & 0 deletions app/views/clock_ins/show.html.erb
@@ -0,0 +1,15 @@
<p id="notice"><%= notice %></p>

<p>
<b>In time:</b>
<%= @clock_in.in_time %>
</p>

<p>
<b>Task:</b>
<%= @clock_in.task_id %>
</p>


<%= link_to 'Edit', edit_clock_in_path(@clock_in) %> |
<%= link_to 'Back', clock_ins_path %>

0 comments on commit fbf302a

Please sign in to comment.