DRYed layout, created print css, restricted deleting

This commit is contained in:
Will Bradley 2011-12-13 22:49:09 -07:00
parent 36caed19d4
commit f5b93fa757
6 changed files with 13 additions and 53 deletions

View File

@ -35,6 +35,7 @@ class ContractsController < ApplicationController
# GET /contracts/1/edit
def edit
@contract = Contract.find(params[:id])
redirect_to(@contract, :notice => 'Contracts cannot be edited.')
end
# POST /contracts
@ -80,11 +81,11 @@ class ContractsController < ApplicationController
# DELETE /contracts/1.xml
def destroy
@contract = Contract.find(params[:id])
@contract.destroy
#@contract.destroy
respond_to do |format|
format.html { redirect_to(contracts_url) }
format.xml { head :ok }
format.html { redirect_to(@contract, :notice => 'Contracts cannot be deleted.') }
format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }
end
end
end

View File

@ -1,11 +1,11 @@
<p>
<b>First Name:</b>
<b>Name:</b>
<%= @contract.signer.first_name %>
<%= @contract.signer.last_name %>
</p>
<p>
<b>Minor:</b>
<%= @contract.signer.cosigner %>
<%= if @contract.signer.cosigner.blank? then "n/a" else @contract.signer.cosigner end %>
</p>
<p>
@ -26,6 +26,7 @@
<b>Verification:</b>
<%=Digest::SHA1.hexdigest @contract.boilerplate+@contract.signature+@contract.datesigned.to_s%>
</p>
<div class="noprint">
<%= link_to 'Edit', edit_contract_path(@contract) %> |
<%= link_to 'Back', contracts_path %>
</div>

View File

@ -6,9 +6,10 @@
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title><%= controller.controller_name.capitalize %>: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold', :media => "all" %>
<%= stylesheet_link_tag 'print', :media => "print" %>
</head>
<body>
<div id="topnav">
<div id="topnav" class="noprint">
<b><a href="/quicksign/new">Quicksign</a></b>
<a href="/signers">Signers</a>
<a href="/contracts">Contracts</a>

View File

@ -1,23 +0,0 @@
<!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><%= controller.controller_name.capitalize %>: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold', :media => "all" %>
</head>
<body>
<div id="topnav">
<b><a href="/quicksign/new">Quicksign</a></b>
<a href="/signers">Signers</a>
<a href="/contracts">Contracts</a>
<a href="/contract_templates">Templates</a>
</div>
<p style="color: green"><%= notice %></p>
<%= yield %>
</body>
</html>

View File

@ -1,23 +0,0 @@
<!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>Signers: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold', :media => "all" %>
</head>
<body>
<div id="topnav">
<b><a href="/quicksign/new">Quicksign</a></b>
<a href="/signers">Signers</a>
<a href="/contracts">Contracts</a>
<a href="/contract_templates">Templates</a>
</div>
<p style="color: green"><%= notice %></p>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,3 @@
.noprint {
display: none;
}