Class: Eboshi::WorksController
Instance Method Summary
collapse
#assignment_path, #assignments_path, #convert_work_path, #edit_adjustment_path, #edit_invoice_path, #edit_work_path, #invoice_path, #invoices_path, #line_item_path, #merge_works_path, #new_adjustment_path, #new_assignment_path, #new_invoice_path, #new_payment_path, #payments_path, #work_path
Instance Method Details
#clock_in ⇒ Object
44
45
46
47
|
# File 'app/controllers/eboshi/works_controller.rb', line 44
def clock_in
@work = @client.clock_in current_user
redirect_to invoices_path(@client), status: :see_other
end
|
#clock_out ⇒ Object
49
50
51
52
53
|
# File 'app/controllers/eboshi/works_controller.rb', line 49
def clock_out
get_work
@work.clock_out
redirect_to invoices_path(@client), status: :see_other
end
|
#convert ⇒ Object
61
62
63
64
65
66
|
# File 'app/controllers/eboshi/works_controller.rb', line 61
def convert
get_work
@work.to_adjustment!
flash[:notice] = "Time item converted to adjustment"
redirect_to invoices_path(@client)
end
|
#create ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/eboshi/works_controller.rb', line 10
def create
@work = @client.works.build params[:work].merge(user: current_user)
if @work.save
flash[:notice] = "Successfully created Work."
redirect_to invoices_path(@client)
else
render :new
end
end
|
#destroy ⇒ Object
37
38
39
40
41
42
|
# File 'app/controllers/eboshi/works_controller.rb', line 37
def destroy
get_work
@work.destroy
invoice = @work.invoice || @client.build_invoice_from_unbilled
redirect_to invoices_path(@client), status: :see_other
end
|
#edit ⇒ Object
20
21
22
|
# File 'app/controllers/eboshi/works_controller.rb', line 20
def edit
get_work
end
|
#merge ⇒ Object
55
56
57
58
59
|
# File 'app/controllers/eboshi/works_controller.rb', line 55
def merge
@work = Work.merge_from_ids params[:line_item_ids]
@invoice = @work.invoice || @client.build_invoice_from_unbilled
render @work
end
|
#new ⇒ Object
6
7
8
|
# File 'app/controllers/eboshi/works_controller.rb', line 6
def new
@work = @client.works.build user: current_user
end
|
#update ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/eboshi/works_controller.rb', line 24
def update
get_work
if @work.update params[:work]
flash[:notice] = "Successfully updated Work."
respond_to do |wants|
wants.html { redirect_to invoices_path(@client) }
wants.js { head :ok }
end
else
render :edit
end
end
|