Initial commit
This commit is contained in:
10
app/controllers/application_controller.rb
Normal file
10
app/controllers/application_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# Filters added to this controller apply to all controllers in the application.
|
||||
# Likewise, all the methods added will be available for all controllers.
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
helper :all # include all helpers, all the time
|
||||
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
||||
|
||||
# Scrub sensitive parameters from your log
|
||||
# filter_parameter_logging :password
|
||||
end
|
||||
86
app/controllers/contract_templates_controller.rb
Normal file
86
app/controllers/contract_templates_controller.rb
Normal file
@@ -0,0 +1,86 @@
|
||||
class ContractTemplatesController < ApplicationController
|
||||
# GET /contract_templates
|
||||
# GET /contract_templates.xml
|
||||
def index
|
||||
@contract_templates = ContractTemplate.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @contract_templates }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contract_templates/1
|
||||
# GET /contract_templates/1.xml
|
||||
def show
|
||||
@contract_template = ContractTemplate.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @contract_template }
|
||||
format.text do
|
||||
render :text => @contract_template.boilerplate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contract_templates/new
|
||||
# GET /contract_templates/new.xml
|
||||
def new
|
||||
@contract_template = ContractTemplate.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @contract_template }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contract_templates/1/edit
|
||||
def edit
|
||||
@contract_template = ContractTemplate.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /contract_templates
|
||||
# POST /contract_templates.xml
|
||||
def create
|
||||
@contract_template = ContractTemplate.new(params[:contract_template])
|
||||
|
||||
respond_to do |format|
|
||||
if @contract_template.save
|
||||
format.html { redirect_to(@contract_template, :notice => 'ContractTemplate was successfully created.') }
|
||||
format.xml { render :xml => @contract_template, :status => :created, :location => @contract_template }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @contract_template.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /contract_templates/1
|
||||
# PUT /contract_templates/1.xml
|
||||
def update
|
||||
@contract_template = ContractTemplate.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @contract_template.update_attributes(params[:contract_template])
|
||||
format.html { redirect_to(@contract_template, :notice => 'ContractTemplate was successfully updated.') }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @contract_template.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /contract_templates/1
|
||||
# DELETE /contract_templates/1.xml
|
||||
def destroy
|
||||
@contract_template = ContractTemplate.find(params[:id])
|
||||
@contract_template.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(contract_templates_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
90
app/controllers/contracts_controller.rb
Normal file
90
app/controllers/contracts_controller.rb
Normal file
@@ -0,0 +1,90 @@
|
||||
class ContractsController < ApplicationController
|
||||
# GET /contracts
|
||||
# GET /contracts.xml
|
||||
def index
|
||||
@contracts = Contract.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @contracts }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contracts/1
|
||||
# GET /contracts/1.xml
|
||||
def show
|
||||
@contract = Contract.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @contract }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contracts/new
|
||||
# GET /contracts/new.xml
|
||||
def new
|
||||
@contract = Contract.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @contract }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contracts/1/edit
|
||||
def edit
|
||||
@contract = Contract.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /contracts
|
||||
# POST /contracts.xml
|
||||
def create
|
||||
@contract = Contract.new(params[:contract])
|
||||
@contract_template = ContractTemplate.find(params[:boilerplateid])
|
||||
|
||||
@contract.name = @contract_template.name
|
||||
@contract.boilerplate = @contract_template.boilerplate
|
||||
@contract.datesigned = Time.current
|
||||
@contract.signinghash = Digest::SHA1.hexdigest @contract.boilerplate+@contract.signature+@contract.datesigned.to_s
|
||||
|
||||
respond_to do |format|
|
||||
if @contract.save
|
||||
format.html { redirect_to(@contract, :notice => 'Contract was successfully created.') }
|
||||
format.xml { render :xml => @contract, :status => :created, :location => @contract }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /contracts/1
|
||||
# PUT /contracts/1.xml
|
||||
def update
|
||||
@contract = Contract.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
# if @contract.update_attributes(params[:contract])
|
||||
|
||||
# format.html { redirect_to(@contract, :notice => 'Contract was successfully updated.') }
|
||||
# format.xml { head :ok }
|
||||
# else
|
||||
format.html { redirect_to(@contract, :notice => 'Contracts cannot be edited.') }
|
||||
format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /contracts/1
|
||||
# DELETE /contracts/1.xml
|
||||
def destroy
|
||||
@contract = Contract.find(params[:id])
|
||||
@contract.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(contracts_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
26
app/controllers/quicksign_controller.rb
Normal file
26
app/controllers/quicksign_controller.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
class QuicksignController < ApplicationController
|
||||
|
||||
def new
|
||||
@contract = Contract.new
|
||||
@contract.signer = Signer.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@contract = Contract.new(params[:contract])
|
||||
|
||||
@contract.datesigned = Time.current
|
||||
@contract.signinghash = Digest::SHA1.hexdigest @contract.boilerplate+@contract.signature+@contract.datesigned.to_s
|
||||
|
||||
@contract.save
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(@contract, :notice => 'Contract was successfully created.') }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
83
app/controllers/signers_controller.rb
Normal file
83
app/controllers/signers_controller.rb
Normal file
@@ -0,0 +1,83 @@
|
||||
class SignersController < ApplicationController
|
||||
# GET /signers
|
||||
# GET /signers.xml
|
||||
def index
|
||||
@signers = Signer.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @signers }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /signers/1
|
||||
# GET /signers/1.xml
|
||||
def show
|
||||
@signer = Signer.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @signer }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /signers/new
|
||||
# GET /signers/new.xml
|
||||
def new
|
||||
@signer = Signer.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @signer }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /signers/1/edit
|
||||
def edit
|
||||
@signer = Signer.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /signers
|
||||
# POST /signers.xml
|
||||
def create
|
||||
@signer = Signer.new(params[:signer])
|
||||
|
||||
respond_to do |format|
|
||||
if @signer.save
|
||||
format.html { redirect_to(@signer, :notice => 'Signer was successfully created.') }
|
||||
format.xml { render :xml => @signer, :status => :created, :location => @signer }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @signer.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /signers/1
|
||||
# PUT /signers/1.xml
|
||||
def update
|
||||
@signer = Signer.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @signer.update_attributes(params[:signer])
|
||||
format.html { redirect_to(@signer, :notice => 'Signer was successfully updated.') }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @signer.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /signers/1
|
||||
# DELETE /signers/1.xml
|
||||
def destroy
|
||||
@signer = Signer.find(params[:id])
|
||||
@signer.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(signers_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user