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

View File

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

View File

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