Initial commit
This commit is contained in:
29
app/views/contract_templates/edit.html.erb
Normal file
29
app/views/contract_templates/edit.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<!-- TinyMCE -->
|
||||
<script type="text/javascript" src="/javascripts/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
mode : "textareas",
|
||||
theme : "simple"
|
||||
});
|
||||
</script>
|
||||
<!-- /TinyMCE -->
|
||||
|
||||
<h1>Editing contract_template</h1>
|
||||
|
||||
<% form_for(@contract_template) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :boilerplate %><br />
|
||||
<%= f.text_area :boilerplate %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Edit' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', contract_templates_path %>
|
||||
22
app/views/contract_templates/index.html.erb
Normal file
22
app/views/contract_templates/index.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<h1>Listing contract_templates</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Boilerplate</th>
|
||||
</tr>
|
||||
|
||||
<% @contract_templates.each do |contract_template| %>
|
||||
<tr>
|
||||
<td><%=h contract_template.name %></td>
|
||||
<td><%= truncate(contract_template.boilerplate, :length => 1000) %></td>
|
||||
<td><%= link_to 'Show', contract_template %></td>
|
||||
<td><%= link_to 'Edit', edit_contract_template_path(contract_template) %></td>
|
||||
<td><%= link_to 'Destroy', contract_template, :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New contract_template', new_contract_template_path %>
|
||||
29
app/views/contract_templates/new.html.erb
Normal file
29
app/views/contract_templates/new.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<!-- TinyMCE -->
|
||||
<script type="text/javascript" src="/javascripts/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
mode : "textareas",
|
||||
theme : "simple"
|
||||
});
|
||||
</script>
|
||||
<!-- /TinyMCE -->
|
||||
|
||||
<h1>New contract_template</h1>
|
||||
|
||||
<% form_for(@contract_template) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :boilerplate %><br />
|
||||
<%= f.text_area :boilerplate %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Create' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', contract_templates_path %>
|
||||
1
app/views/contract_templates/show.html.erb
Normal file
1
app/views/contract_templates/show.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%=@contract_template.boilerplate %>
|
||||
24
app/views/contracts/edit.html.erb
Normal file
24
app/views/contracts/edit.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Editing contract</h1>
|
||||
|
||||
<% form_for(@contract) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :boilerplate %><br />
|
||||
<%= f.text_field :boilerplate %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :signature %><br />
|
||||
<%= f.text_field :signature %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :signinghash %><br />
|
||||
<%= f.text_field :signinghash %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Update' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Show', @contract %> |
|
||||
<%= link_to 'Back', contracts_path %>
|
||||
24
app/views/contracts/index.html.erb
Normal file
24
app/views/contracts/index.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Listing contracts</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Name</th>
|
||||
<th>Signer</th>
|
||||
</tr>
|
||||
|
||||
<% @contracts.each do |contract| %>
|
||||
<tr>
|
||||
<td><%=h contract.datesigned %></td>
|
||||
<td><%=h contract.name %></td>
|
||||
<td><% if(!contract.signer.blank?) then %><%=h contract.signer.first_name %> <%=h contract.signer.last_name %><% end %></td>
|
||||
<td><%= link_to 'Show', contract %></td>
|
||||
<td><%= link_to 'Edit', edit_contract_path(contract) %></td>
|
||||
<td><%= link_to 'Destroy', contract, :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New contract', new_contract_path %>
|
||||
182
app/views/contracts/new.html.erb
Normal file
182
app/views/contracts/new.html.erb
Normal file
@@ -0,0 +1,182 @@
|
||||
<script language="javascript">
|
||||
function showboiler(id) {
|
||||
|
||||
if(id>0) {
|
||||
$.ajax({
|
||||
url: "/contract_templates/"+id+".txt",
|
||||
context: document.body,
|
||||
success: function(data){
|
||||
document.getElementById('boilerdisplay').innerHTML = data;
|
||||
document.getElementById('contract_boilerplate').value = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
document.getElementById('boilerdisplay').innerHTML = "";
|
||||
document.getElementById('contract_boilerplate').value = "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function clearme() {
|
||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
context.beginPath();
|
||||
}
|
||||
</script>
|
||||
|
||||
<% form_for(@contract) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :Template %>
|
||||
<%= select_tag("boilerplate_select", options_for_select(ContractTemplate.all.collect{ |c| [c.name, c.id] }.insert(0, '')), {:onchange => "showboiler(this.value)"}) %>
|
||||
<%= f.hidden_field :signature %>
|
||||
<%= f.hidden_field :boilerplate %>
|
||||
</p>
|
||||
<div id="boilerdisplay"></div>
|
||||
|
||||
<meta name = "viewport" content = "width = device-width">
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
#canvas {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<body id="body">
|
||||
|
||||
<input type="button" value="Clear" onclick="clearme()" />
|
||||
|
||||
<div id="container"> <!-- container. start -->
|
||||
<canvas width="800" height="200" id="canvas">
|
||||
</canvas>
|
||||
</div><!-- container. end -->
|
||||
<!-- <p id="debug"></p> -->
|
||||
<p>
|
||||
<%= f.submit 'Update' %>
|
||||
</p>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<%= link_to 'Back', contracts_path %>
|
||||
|
||||
|
||||
|
||||
<!-- JavaScript -->
|
||||
<script type="text/javascript" src="/javascripts/jquery-1.3.2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var oldX,oldY,sofX,sofY,down=false,drag=false;
|
||||
var q = new Array;
|
||||
var body = document.getElementById("body");
|
||||
var canvas = document.getElementById("canvas");
|
||||
var context = canvas.getContext('2d');
|
||||
body.addEventListener("touchmove", touch, false);
|
||||
canvas.addEventListener("touchstart", touchStart, false);
|
||||
canvas.addEventListener("touchmove", touchMove, false);
|
||||
canvas.addEventListener("touchend", drawEnd, false);
|
||||
canvas.addEventListener("touchcancel", drawEnd, false);
|
||||
|
||||
body.addEventListener('mouseup', drawEnd);
|
||||
canvas.addEventListener('mousedown', mouseDown);
|
||||
canvas.addEventListener('mousemove', mouseMove);
|
||||
canvas.addEventListener('mouseup', drawEnd);
|
||||
|
||||
function touch(event) {
|
||||
// console.log(event);
|
||||
event.preventDefault();
|
||||
element = document.getElementById("debug");
|
||||
element.innerHTML = event.touches.length+" touch ("+event.touches[0].pageX+","+event.touches[0].pageY+")("+$(canvas).offset().left+","+$(canvas).offset().top+") down:"+down+" drag:"+drag;
|
||||
}
|
||||
|
||||
function touchStart(event) {
|
||||
touch(event);
|
||||
drawStart([event.touches[0].pageX - $(canvas).offset().left,event.touches[0].pageY - $(canvas).offset().top]);
|
||||
}
|
||||
|
||||
function mouseDown(event) {
|
||||
drawStart([event.pageX - $(canvas).offset().left,event.pageY - $(canvas).offset().top]);
|
||||
element = document.getElementById("debug");
|
||||
element.innerHTML = q.length+" ("+event.pageX+","+event.pageY+")("+$(canvas).offset().left+","+$(canvas).offset().top+") down:"+down+" drag:"+drag;
|
||||
}
|
||||
|
||||
function drawStart(point) {
|
||||
var x=point[0], y=point[1];
|
||||
q = [point];
|
||||
down = true;
|
||||
context.lineWidth = 1;
|
||||
context.strokeStyle = '#000000';
|
||||
}
|
||||
|
||||
function touchMove(event) {
|
||||
touch(event);
|
||||
drawMove([event.touches[0].pageX - $(canvas).offset().left,event.touches[0].pageY - $(canvas).offset().top]);
|
||||
};
|
||||
|
||||
function mouseMove(event) {
|
||||
drawMove([event.pageX - $(canvas).offset().left,event.pageY - $(canvas).offset().top]);
|
||||
}
|
||||
|
||||
function drawMove(point) {
|
||||
var x=point[0], y=point[1];
|
||||
drag=true;
|
||||
if(down && drag && q.length>=4) {
|
||||
q.push(point);
|
||||
// context.fillRect(q[1][0], q[1][1], 1, 1);
|
||||
// context.fillRect(q[2][0], q[2][1], 1, 1);
|
||||
context.beginPath();
|
||||
context.moveTo(q[0][0], q[0][1]);
|
||||
context.bezierCurveTo(q[1][0], q[1][1], q[2][0], q[2][1], q[3][0], q[3][1]);
|
||||
q.shift();
|
||||
q.shift();
|
||||
q.shift();
|
||||
// context.closePath();
|
||||
context.stroke();
|
||||
} else if(down && drag) {
|
||||
q.push(point);
|
||||
}
|
||||
oldX = x;
|
||||
oldY = y;
|
||||
sofX = oldX;
|
||||
sofY = oldY;
|
||||
}
|
||||
|
||||
// Finished drawing (mouse up)
|
||||
function drawEnd(event) {
|
||||
// touch(event);
|
||||
if(q.length>=2) {
|
||||
if(q.length==4){
|
||||
context.bezierCurveTo(q[1][0], q[1][1], q[2][0], q[2][1], q[3][0], q[3][1]);
|
||||
}
|
||||
if(q.length==3){
|
||||
context.quadraticCurveTo(q[1][0], q[1][1],q[2][0], q[2][1]);
|
||||
}
|
||||
if(q.length==2){
|
||||
context.lineTo(q[1][0], q[1][1]);
|
||||
}
|
||||
context.stroke();
|
||||
q=[];
|
||||
}
|
||||
if(down && drag==false || q.length==1) {
|
||||
// context.fillRect(q[0][0],q[0][1], 2, 2);
|
||||
context.beginPath();
|
||||
context.arc(q[0][0],q[0][1],1,0,Math.PI*2,true);
|
||||
context.closePath();
|
||||
context.stroke();
|
||||
context.fill();
|
||||
}
|
||||
down = false;
|
||||
drag = false;
|
||||
|
||||
// Write the canvas to a data url
|
||||
$("#contract_signature")[0].value = canvas.toDataURL("image/png")
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
23
app/views/contracts/new.html.erb.deleteme
Normal file
23
app/views/contracts/new.html.erb.deleteme
Normal file
@@ -0,0 +1,23 @@
|
||||
<h1>New contract</h1>
|
||||
|
||||
<% form_for(@contract) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :boilerplate %><br />
|
||||
<%= f.text_field :boilerplate %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :signature %><br />
|
||||
<%= f.text_field :signature %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :signinghash %><br />
|
||||
<%= f.text_field :signinghash %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Create' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', contracts_path %>
|
||||
27
app/views/contracts/show.html.erb
Normal file
27
app/views/contracts/show.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>
|
||||
<b>Boilerplate:</b>
|
||||
<%=@contract.boilerplate %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Signature:</b>
|
||||
<img src="<%=@contract.signature %>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Date Signed:</b>
|
||||
<%=h @contract.datesigned %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Hash:</b>
|
||||
<%=h @contract.signinghash %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Verification:</b>
|
||||
<%=Digest::SHA1.hexdigest @contract.boilerplate+@contract.signature+@contract.datesigned.to_s%>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_contract_path(@contract) %> |
|
||||
<%= link_to 'Back', contracts_path %>
|
||||
23
app/views/layouts/contract_templates.html.erb
Normal file
23
app/views/layouts/contract_templates.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<!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' %>
|
||||
</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>
|
||||
23
app/views/layouts/contracts.html.erb
Normal file
23
app/views/layouts/contracts.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<!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' %>
|
||||
</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>
|
||||
23
app/views/layouts/signers.html.erb
Normal file
23
app/views/layouts/signers.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<!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' %>
|
||||
</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>
|
||||
215
app/views/quicksign/new.html.erb
Normal file
215
app/views/quicksign/new.html.erb
Normal file
@@ -0,0 +1,215 @@
|
||||
|
||||
|
||||
<script language="javascript">
|
||||
function showboiler(id) {
|
||||
|
||||
if(id>0) {
|
||||
$.ajax({
|
||||
url: "/contract_templates/"+id+".txt",
|
||||
context: document.body,
|
||||
success: function(data){
|
||||
document.getElementById('boilerdisplay').innerHTML = data;
|
||||
document.getElementById('boilerplateid').value = id;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
document.getElementById('boilerdisplay').innerHTML = "";
|
||||
document.getElementById('boilerplateid').value = "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function clearme() {
|
||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
context.beginPath();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
font-size: 1.2em;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
#canvas {
|
||||
border: 1px solid black;
|
||||
}
|
||||
#boilerdisplay {
|
||||
height: 45%;
|
||||
overflow: scroll;
|
||||
font-size: 20pt !important;
|
||||
}
|
||||
input,select { width: 40%; font-size: 1.2em; }
|
||||
p { margin: 0.2em 0; }
|
||||
</style>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="viewport" content="user-scalable=no, width=device-width" />
|
||||
<link rel="apple-touch-icon" href="./apple-touch-icon.png" />
|
||||
|
||||
<body id="body">
|
||||
|
||||
<% form_for(@contract) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<% f.fields_for :signer do |signer_fields| %>
|
||||
<p>
|
||||
First Name:
|
||||
<%= signer_fields.text_field :first_name %>
|
||||
</p>
|
||||
<p>
|
||||
Last Name:
|
||||
<%= signer_fields.text_field :last_name %>
|
||||
</p>
|
||||
<p>
|
||||
Minor:
|
||||
<%= signer_fields.text_field :cosigner %>
|
||||
(if applicable)
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
<p>
|
||||
<%= f.label :Contract %>
|
||||
<%= select_tag("boilerplate_select", options_for_select(ContractTemplate.all.collect{ |c| [c.name, c.id] }.insert(0, '')), {:onchange => "showboiler(this.value)"}) %>
|
||||
<%= f.hidden_field :signature %>
|
||||
<%= hidden_field_tag :boilerplateid %>
|
||||
</p>
|
||||
<div id="boilerdisplay"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="container"> <!-- container. start -->
|
||||
<canvas width="800" height="200" id="canvas">
|
||||
</canvas>
|
||||
</div><!-- container. end -->
|
||||
<!-- <p id="debug"></p> -->
|
||||
<p>
|
||||
<input type="button" value="Clear Signature" onclick="clearme()" /> <%= f.submit 'Submit' %>
|
||||
</p>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<%= link_to 'Back', contracts_path %>
|
||||
|
||||
|
||||
|
||||
<!-- JavaScript -->
|
||||
<script type="text/javascript" src="/javascripts/jquery-1.3.2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var oldX,oldY,sofX,sofY,down=false,drag=false;
|
||||
var q = new Array;
|
||||
var body = document.getElementById("body");
|
||||
var canvas = document.getElementById("canvas");
|
||||
var context = canvas.getContext('2d');
|
||||
// body.addEventListener("touchmove", touch, false);
|
||||
canvas.addEventListener("touchstart", touchStart, false);
|
||||
canvas.addEventListener("touchmove", touchMove, false);
|
||||
canvas.addEventListener("touchend", drawEnd, false);
|
||||
canvas.addEventListener("touchcancel", drawEnd, false);
|
||||
|
||||
body.addEventListener('mouseup', drawEnd);
|
||||
canvas.addEventListener('mousedown', mouseDown);
|
||||
canvas.addEventListener('mousemove', mouseMove);
|
||||
canvas.addEventListener('mouseup', drawEnd);
|
||||
|
||||
function touch(event) {
|
||||
// console.log(event);
|
||||
event.preventDefault();
|
||||
// element = document.getElementById("debug");
|
||||
// element.innerHTML = event.touches.length+" touch ("+event.touches[0].pageX+","+event.touches[0].pageY+")("+$(canvas).offset().left+","+$(canvas).offset().top+") down:"+down+" drag:"+drag;
|
||||
}
|
||||
|
||||
function touchStart(event) {
|
||||
touch(event);
|
||||
drawStart([event.touches[0].pageX - $(canvas).offset().left,event.touches[0].pageY - $(canvas).offset().top]);
|
||||
}
|
||||
|
||||
function mouseDown(event) {
|
||||
drawStart([event.pageX - $(canvas).offset().left,event.pageY - $(canvas).offset().top]);
|
||||
// element = document.getElementById("debug");
|
||||
// element.innerHTML = q.length+" ("+event.pageX+","+event.pageY+")("+$(canvas).offset().left+","+$(canvas).offset().top+") down:"+down+" drag:"+drag;
|
||||
}
|
||||
|
||||
function drawStart(point) {
|
||||
var x=point[0], y=point[1];
|
||||
q = [point];
|
||||
down = true;
|
||||
context.lineWidth = 1;
|
||||
context.strokeStyle = '#000000';
|
||||
}
|
||||
|
||||
function touchMove(event) {
|
||||
touch(event);
|
||||
drawMove([event.touches[0].pageX - $(canvas).offset().left,event.touches[0].pageY - $(canvas).offset().top]);
|
||||
};
|
||||
|
||||
function mouseMove(event) {
|
||||
drawMove([event.pageX - $(canvas).offset().left,event.pageY - $(canvas).offset().top]);
|
||||
}
|
||||
|
||||
function drawMove(point) {
|
||||
var x=point[0], y=point[1];
|
||||
drag=true;
|
||||
if(down && drag && q.length>=4) {
|
||||
q.push(point);
|
||||
// context.fillRect(q[1][0], q[1][1], 1, 1);
|
||||
// context.fillRect(q[2][0], q[2][1], 1, 1);
|
||||
context.beginPath();
|
||||
context.moveTo(q[0][0], q[0][1]);
|
||||
context.bezierCurveTo(q[1][0], q[1][1], q[2][0], q[2][1], q[3][0], q[3][1]);
|
||||
q.shift();
|
||||
q.shift();
|
||||
q.shift();
|
||||
// context.closePath();
|
||||
context.stroke();
|
||||
} else if(down && drag) {
|
||||
q.push(point);
|
||||
}
|
||||
oldX = x;
|
||||
oldY = y;
|
||||
sofX = oldX;
|
||||
sofY = oldY;
|
||||
}
|
||||
|
||||
// Finished drawing (mouse up)
|
||||
function drawEnd(event) {
|
||||
// touch(event);
|
||||
if(q.length>=2) {
|
||||
if(q.length==4){
|
||||
context.bezierCurveTo(q[1][0], q[1][1], q[2][0], q[2][1], q[3][0], q[3][1]);
|
||||
}
|
||||
if(q.length==3){
|
||||
context.quadraticCurveTo(q[1][0], q[1][1],q[2][0], q[2][1]);
|
||||
}
|
||||
if(q.length==2){
|
||||
context.lineTo(q[1][0], q[1][1]);
|
||||
}
|
||||
context.stroke();
|
||||
q=[];
|
||||
}
|
||||
if(down && drag==false || q.length==1) {
|
||||
// context.fillRect(q[0][0],q[0][1], 2, 2);
|
||||
context.beginPath();
|
||||
context.arc(q[0][0],q[0][1],1,0,Math.PI*2,true);
|
||||
context.closePath();
|
||||
context.stroke();
|
||||
context.fill();
|
||||
}
|
||||
down = false;
|
||||
drag = false;
|
||||
|
||||
// Write the canvas to a data url
|
||||
$("#contract_signature")[0].value = canvas.toDataURL("image/png")
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
24
app/views/signers/edit.html.erb
Normal file
24
app/views/signers/edit.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Editing signer</h1>
|
||||
|
||||
<% form_for(@signer) 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 :cosigner %><br />
|
||||
<%= f.text_field :cosigner %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Update' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Show', @signer %> |
|
||||
<%= link_to 'Back', signers_path %>
|
||||
24
app/views/signers/index.html.erb
Normal file
24
app/views/signers/index.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Listing signers</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>First name</th>
|
||||
<th>Last name</th>
|
||||
<th>Cosigner</th>
|
||||
</tr>
|
||||
|
||||
<% @signers.each do |signer| %>
|
||||
<tr>
|
||||
<td><%=h signer.first_name %></td>
|
||||
<td><%=h signer.last_name %></td>
|
||||
<td><%=h signer.cosigner %></td>
|
||||
<td><%= link_to 'Show', signer %></td>
|
||||
<td><%= link_to 'Edit', edit_signer_path(signer) %></td>
|
||||
<td><%= link_to 'Destroy', signer, :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New signer', new_signer_path %>
|
||||
23
app/views/signers/new.html.erb
Normal file
23
app/views/signers/new.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<h1>New signer</h1>
|
||||
|
||||
<% form_for(@signer) 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 :cosigner %><br />
|
||||
<%= f.text_field :cosigner %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit 'Create' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', signers_path %>
|
||||
25
app/views/signers/show.html.erb
Normal file
25
app/views/signers/show.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<p>
|
||||
<b>First name:</b>
|
||||
<%=h @signer.first_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Last name:</b>
|
||||
<%=h @signer.last_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Cosigner:</b>
|
||||
<%=h @signer.cosigner %>
|
||||
</p>
|
||||
|
||||
<b>Contracts:</b>
|
||||
<ul>
|
||||
<% @signer.contracts.each do |c| %>
|
||||
<li><%= link_to c.name, contract_path(c) %> (<%= c.datesigned %>)</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_signer_path(@signer) %> |
|
||||
<%= link_to 'Back', signers_path %>
|
||||
Reference in New Issue
Block a user