-
Notifications
You must be signed in to change notification settings - Fork 0
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
Jordan Byron
committed
Nov 28, 2009
1 parent
9856c49
commit 8610d7a
Showing
22 changed files
with
449 additions
and
292 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
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,68 @@ | ||
class WorkOrdersController < ApplicationController | ||
# GET /work_orders | ||
# GET /work_orders.xml | ||
def index | ||
@work_orders = WorkOrder.all | ||
end | ||
|
||
# GET /work_orders/1 | ||
# GET /work_orders/1.xml | ||
def show | ||
@work_order = WorkOrder.find(params[:id]) | ||
end | ||
|
||
# GET /work_orders/new | ||
# GET /work_orders/new.xml | ||
def new | ||
@work_order = WorkOrder.new | ||
end | ||
|
||
# GET /work_orders/1/edit | ||
def edit | ||
@work_order = WorkOrder.find(params[:id]) | ||
end | ||
|
||
# POST /work_orders | ||
# POST /work_orders.xml | ||
def create | ||
@work_order = WorkOrder.new(params[:work_order]) | ||
|
||
# @work_order.status = | ||
|
||
respond_to do |format| | ||
if @work_order.save | ||
format.html { redirect_to thank_you_path } | ||
else | ||
format.html { render :action => "new" } | ||
end | ||
end | ||
end | ||
|
||
# PUT /work_orders/1 | ||
# PUT /work_orders/1.xml | ||
def update | ||
@work_order = WorkOrder.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @work_order.update_attributes(params[:work_order]) | ||
flash[:notice] = 'WorkOrder was successfully updated.' | ||
format.html { redirect_to(@work_order) } | ||
else | ||
format.html { render :action => "edit" } | ||
end | ||
end | ||
end | ||
|
||
def thank_you | ||
render :layout => 'entry' | ||
end | ||
|
||
# DELETE /work_orders/1 | ||
# DELETE /work_orders/1.xml | ||
def destroy | ||
@work_order = WorkOrder.find(params[:id]) | ||
@work_order.destroy | ||
|
||
redirect_to work_orders_url | ||
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 WorkOrdersHelper | ||
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,3 @@ | ||
class Note < ActiveRecord::Base | ||
belongs_to :work_order | ||
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,3 @@ | ||
class Status < ActiveRecord::Base | ||
has_many :work_orders | ||
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,4 @@ | ||
class WorkOrder < ActiveRecord::Base | ||
has_many :notes | ||
belongs_to :status | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | ||
<title><%= yield(:title) %></title> | ||
|
||
<!-- Defaults --> | ||
<%= javascript_include_tag :defaults %> | ||
<%= stylesheet_link_tag 'default' %> | ||
</head> | ||
<body> | ||
<div id='outer_container'> | ||
<div id='container'> | ||
<div id='header'> | ||
<%= image_tag 'prabums_icon.png' %><h1>prabums</h1> | ||
</div> | ||
<div id='contents'> | ||
<%= yield %> | ||
<div id="footer"> | ||
<%= version %><%= link_to image_tag('DSS.png'), "http://www.ducksoupsoftware.com", :popup => true %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
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 @@ | ||
<% title 'Users' %> | ||
<% header do %> | ||
<h1>Users</h1> | ||
<% 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,48 @@ | ||
<h1>Editing work_order</h1> | ||
|
||
<% form_for(@work_order) do |f| %> | ||
<%= f.error_messages %> | ||
|
||
<p> | ||
<%= f.label :first_name %><br /> | ||
<%= f.text_field :first_name %> | ||
</p> | ||
<p> | ||
<%= f.label :last_name %><br /> | ||
<%= f.text_field :last_name %> | ||
</p> | ||
<p> | ||
<%= f.label :phone_number %><br /> | ||
<%= f.text_field :phone_number %> | ||
</p> | ||
<p> | ||
<%= f.label :building_id %><br /> | ||
<%= f.text_field :building_id %> | ||
</p> | ||
<p> | ||
<%= f.label :room_number %><br /> | ||
<%= f.text_field :room_number %> | ||
</p> | ||
<p> | ||
<%= f.label :email %><br /> | ||
<%= f.text_field :email %> | ||
</p> | ||
<p> | ||
<%= f.label :location_of_problem %><br /> | ||
<%= f.text_field :location_of_problem %> | ||
</p> | ||
<p> | ||
<%= f.label :problem %><br /> | ||
<%= f.text_area :problem %> | ||
</p> | ||
<p> | ||
<%= f.label :status_id %><br /> | ||
<%= f.text_field :status_id %> | ||
</p> | ||
<p> | ||
<%= f.submit 'Update' %> | ||
</p> | ||
<% end %> | ||
<%= link_to 'Show', @work_order %> | | ||
<%= link_to 'Back', work_orders_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,40 @@ | ||
<% title 'Work Orders' %> | ||
<% header do %> | ||
<h1>Work Orders</h1> | ||
<% end %> | ||
|
||
<table> | ||
<tr> | ||
<th>First name</th> | ||
<th>Last name</th> | ||
<th>Phone number</th> | ||
<th>Building</th> | ||
<th>Room number</th> | ||
<th>Email</th> | ||
<th>Location of problem</th> | ||
<th>Problem</th> | ||
<th>Status</th> | ||
</tr> | ||
|
||
<% @work_orders.each do |work_order| %> | ||
<tr> | ||
<td><%=h work_order.first_name %></td> | ||
<td><%=h work_order.last_name %></td> | ||
<td><%=h work_order.phone_number %></td> | ||
<td><%=h work_order.building_id %></td> | ||
<td><%=h work_order.room_number %></td> | ||
<td><%=h work_order.email %></td> | ||
<td><%=h work_order.location_of_problem %></td> | ||
<td><%=h work_order.problem %></td> | ||
<td><%=h work_order.status_id %></td> | ||
<td><%= link_to 'Show', work_order %></td> | ||
<td><%= link_to 'Edit', edit_work_order_path(work_order) %></td> | ||
<td><%= link_to 'Destroy', work_order, :confirm => 'Are you sure?', :method => :delete %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<br /> | ||
|
||
<%= link_to 'New work_order', new_work_order_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,52 @@ | ||
<% title 'New Work Order'%> | ||
<% header do %> | ||
<h1>New Work Order</h1> | ||
<% end %> | ||
<% form_for(@work_order) do |f| %> | ||
<%= f.error_messages %> | ||
<div class="column_1"> | ||
<p> | ||
<%= f.label :first_name %><br /> | ||
<%= f.text_field :first_name %> | ||
</p> | ||
<p> | ||
<%= f.label :building_id %><br /> | ||
<%= f.select :building_id, Building.all.collect {|b| [b.name, b.id] } %> | ||
</p> | ||
</div> | ||
<div class="column_2"> | ||
<p> | ||
<%= f.label :last_name %><br /> | ||
<%= f.text_field :last_name %> | ||
</p> | ||
<p> | ||
<%= f.label :room_number %><br /> | ||
<%= f.text_field :room_number %> | ||
</p> | ||
</div> | ||
<div class="column_3"> | ||
<p> | ||
<%= f.label :phone_number %><br /> | ||
<%= f.text_field :phone_number %> | ||
</p> | ||
<p> | ||
<%= f.label :email %><br /> | ||
<%= f.text_field :email %> | ||
</p> | ||
</div> | ||
<div style="clear:both;"> | ||
<p> | ||
<%= f.label :location_of_problem %><br /> | ||
<%= f.text_field :location_of_problem %> | ||
</p> | ||
<p> | ||
<%= f.label :problem %><br /> | ||
<%= f.text_area :problem %> | ||
</p> | ||
</div> | ||
<div class="footer"> | ||
<%= f.submit 'Submit Work Order' %> <%= link_to_function 'Reset', "$('new_work_order').reset();" %> | ||
</div> | ||
<% 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,48 @@ | ||
<p> | ||
<b>First name:</b> | ||
<%=h @work_order.first_name %> | ||
</p> | ||
|
||
<p> | ||
<b>Last name:</b> | ||
<%=h @work_order.last_name %> | ||
</p> | ||
|
||
<p> | ||
<b>Phone number:</b> | ||
<%=h @work_order.phone_number %> | ||
</p> | ||
|
||
<p> | ||
<b>Building:</b> | ||
<%=h @work_order.building_id %> | ||
</p> | ||
|
||
<p> | ||
<b>Room number:</b> | ||
<%=h @work_order.room_number %> | ||
</p> | ||
|
||
<p> | ||
<b>Email:</b> | ||
<%=h @work_order.email %> | ||
</p> | ||
|
||
<p> | ||
<b>Location of problem:</b> | ||
<%=h @work_order.location_of_problem %> | ||
</p> | ||
|
||
<p> | ||
<b>Problem:</b> | ||
<%=h @work_order.problem %> | ||
</p> | ||
|
||
<p> | ||
<b>Status:</b> | ||
<%=h @work_order.status_id %> | ||
</p> | ||
|
||
|
||
<%= link_to 'Edit', edit_work_order_path(@work_order) %> | | ||
<%= link_to 'Back', work_orders_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,11 @@ | ||
<% title 'Work Order Submitted' %> | ||
<% header do %> | ||
<h1>Work Order Submitted</h1> | ||
<% end %> | ||
|
||
<h1>Your work order request has been submitted.</h1> | ||
<h2>Someone will contact you shortly ...</h2> | ||
<p> | ||
<%= link_to "Submit another work order", home_path %> | ||
</p> |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class CreateWorkOrders < ActiveRecord::Migration | ||
def self.up | ||
create_table :work_orders do |t| | ||
t.string :first_name | ||
t.string :last_name | ||
t.string :phone_number | ||
t.integer :building_id | ||
t.string :room_number | ||
t.string :email | ||
t.string :location_of_problem | ||
t.text :problem | ||
t.integer :status_id | ||
|
||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :work_orders | ||
end | ||
end |
Oops, something went wrong.