Renamed Task#task_type to Task#type; use time_entries instead of entries.
This commit is contained in:
parent
ee58b00d2c
commit
6ffe7b23b0
23
stoptime.rb
23
stoptime.rb
|
@ -67,7 +67,7 @@ module StopTime::Models
|
||||||
not self.fixed_cost.blank?
|
not self.fixed_cost.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def task_type
|
def type
|
||||||
fixed_cost? ? "fixed_cost" : "hourly_rate"
|
fixed_cost? ? "fixed_cost" : "hourly_rate"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ module StopTime::Controllers
|
||||||
@task = Task.create(
|
@task = Task.create(
|
||||||
:customer_id => customer_id,
|
:customer_id => customer_id,
|
||||||
:name => @input.name)
|
:name => @input.name)
|
||||||
case @input.task_type
|
case @input.type
|
||||||
when "fixed_cost"
|
when "fixed_cost"
|
||||||
@task.fixed_cost = @input.fixed_cost
|
@task.fixed_cost = @input.fixed_cost
|
||||||
@task.hourly_rate = nil
|
@task.hourly_rate = nil
|
||||||
|
@ -376,7 +376,7 @@ module StopTime::Controllers
|
||||||
@target = [CustomersNTasks, customer_id]
|
@target = [CustomersNTasks, customer_id]
|
||||||
@method = "create"
|
@method = "create"
|
||||||
@input = @task.attributes
|
@input = @task.attributes
|
||||||
@input["task_type"] = @task.task_type # FIXME: find nicer way!
|
@input["type"] = @task.type # FIXME: find nicer way!
|
||||||
render :task_form
|
render :task_form
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -388,7 +388,7 @@ module StopTime::Controllers
|
||||||
@target = [CustomersNTasksN, customer_id, task_id]
|
@target = [CustomersNTasksN, customer_id, task_id]
|
||||||
@method = "update"
|
@method = "update"
|
||||||
@input = @task.attributes
|
@input = @task.attributes
|
||||||
@input["task_type"] = @task.task_type
|
@input["type"] = @task.type
|
||||||
# FIXME: Check that task is of that customer.
|
# FIXME: Check that task is of that customer.
|
||||||
render :task_form
|
render :task_form
|
||||||
end
|
end
|
||||||
|
@ -400,7 +400,7 @@ module StopTime::Controllers
|
||||||
if @input.has_key? "update"
|
if @input.has_key? "update"
|
||||||
# FIXME: task should be cloned/dupped as to prevent rewriting history!
|
# FIXME: task should be cloned/dupped as to prevent rewriting history!
|
||||||
@task["name"] = @input["name"] unless @input["name"].blank?
|
@task["name"] = @input["name"] unless @input["name"].blank?
|
||||||
case @input.task_type
|
case @input.type
|
||||||
when "fixed_cost"
|
when "fixed_cost"
|
||||||
@task.fixed_cost = @input.fixed_cost
|
@task.fixed_cost = @input.fixed_cost
|
||||||
@task.hourly_rate = nil
|
@task.hourly_rate = nil
|
||||||
|
@ -414,7 +414,7 @@ module StopTime::Controllers
|
||||||
@target = [CustomersNTasksN, customer_id, task_id]
|
@target = [CustomersNTasksN, customer_id, task_id]
|
||||||
@method = "update"
|
@method = "update"
|
||||||
@input = @task.attributes
|
@input = @task.attributes
|
||||||
@input["task_type"] = @input.task_type
|
@input["type"] = @input.type
|
||||||
return render :task_form
|
return render :task_form
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -531,7 +531,7 @@ module StopTime::Controllers
|
||||||
|
|
||||||
class Timeline
|
class Timeline
|
||||||
def get
|
def get
|
||||||
@entries = TimeEntry.all(:order => "start DESC")
|
@time_entries = TimeEntry.all(:order => "start DESC")
|
||||||
@customer_list = Customer.all.map { |c| [c.id, c.short_name] }
|
@customer_list = Customer.all.map { |c| [c.id, c.short_name] }
|
||||||
@task_list = Task.all.map { |t| [t.id, t.name] }
|
@task_list = Task.all.map { |t| [t.id, t.name] }
|
||||||
@input["bill"] = true # Bill by default.
|
@input["bill"] = true # Bill by default.
|
||||||
|
@ -553,9 +553,10 @@ module StopTime::Controllers
|
||||||
elsif @input.has_key? "delete"
|
elsif @input.has_key? "delete"
|
||||||
end
|
end
|
||||||
|
|
||||||
@entries = TimeEntry.all(:order => "start DESC")
|
@time_entries = TimeEntry.all(:order => "start DESC")
|
||||||
@customer_list = Customer.all.map { |c| [c.id, c.short_name] }
|
@customer_list = Customer.all.map { |c| [c.id, c.short_name] }
|
||||||
@task_list = Task.all.map { |t| [t.id, t.name] }
|
@task_list = Task.all.map { |t| [t.id, t.name] }
|
||||||
|
@input["bill"] = true # Bill by default.
|
||||||
render :time_entries
|
render :time_entries
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -698,7 +699,7 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@entries.each do |entry|
|
@time_entries.each do |entry|
|
||||||
tr do
|
tr do
|
||||||
td { a entry.customer.short_name,
|
td { a entry.customer.short_name,
|
||||||
:href => R(CustomersN, entry.customer.id) }
|
:href => R(CustomersN, entry.customer.id) }
|
||||||
|
@ -825,11 +826,11 @@ module StopTime::Views
|
||||||
li do
|
li do
|
||||||
ol.radio do
|
ol.radio do
|
||||||
li do
|
li do
|
||||||
_form_input_radio("task_type", "hourly_rate", default=true)
|
_form_input_radio("type", "hourly_rate", default=true)
|
||||||
_form_input_with_label("Hourly rate", "hourly_rate", :text)
|
_form_input_with_label("Hourly rate", "hourly_rate", :text)
|
||||||
end
|
end
|
||||||
li do
|
li do
|
||||||
_form_input_radio("task_type", "fixed_cost")
|
_form_input_radio("type", "fixed_cost")
|
||||||
_form_input_with_label("Fixed cost", "fixed_cost", :text)
|
_form_input_with_label("Fixed cost", "fixed_cost", :text)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue