Created namespace 'finance' and moved invoices into it.
This commit is contained in:
parent
30f3d199d3
commit
1d85b880f2
17 changed files with 163 additions and 133 deletions
79
app/controllers/finance/invoices_controller.rb
Normal file
79
app/controllers/finance/invoices_controller.rb
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
class Finance::InvoicesController < ApplicationController
|
||||
|
||||
def index
|
||||
@invoices = Invoice.find(:all, :order => "date DESC")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @invoices }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@invoice = Invoice.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @invoice }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@invoice = Invoice.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @invoice }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@invoice = Invoice.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /invoices
|
||||
# POST /invoices.xml
|
||||
def create
|
||||
@invoice = Invoice.new(params[:invoice])
|
||||
|
||||
respond_to do |format|
|
||||
if @invoice.save
|
||||
flash[:notice] = 'Invoice was successfully created.'
|
||||
format.html { redirect_to([:finance, @invoice]) }
|
||||
format.xml { render :xml => @invoice, :status => :created, :location => @invoice }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /invoices/1
|
||||
# PUT /invoices/1.xml
|
||||
def update
|
||||
@invoice = Invoice.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @invoice.update_attributes(params[:invoice])
|
||||
flash[:notice] = 'Invoice was successfully updated.'
|
||||
format.html { redirect_to([:finance, @invoice]) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /invoices/1
|
||||
# DELETE /invoices/1.xml
|
||||
def destroy
|
||||
@invoice = Invoice.find(params[:id])
|
||||
@invoice.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(finance_invoices_path) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue