Check task and time entry checkboxes by default in #invoice_select_form (closes: #4fdf84)
This commit is contained in:
parent
05b2fff118
commit
10218e6fe5
19
stoptime.rb
19
stoptime.rb
|
@ -1789,7 +1789,7 @@ module StopTime::Views
|
||||||
label.control_label "Project/Task type"
|
label.control_label "Project/Task type"
|
||||||
div.controls do
|
div.controls do
|
||||||
label.radio do
|
label.radio do
|
||||||
_form_input_radio("type", "hourly_rate", default=true)
|
_form_input_radio("type", "hourly_rate", true)
|
||||||
text!("Hourly rate: ")
|
text!("Hourly rate: ")
|
||||||
_form_input("hourly_rate", :number, "Hourly rate", :class => "input-small")
|
_form_input("hourly_rate", :number, "Hourly rate", :class => "input-small")
|
||||||
end
|
end
|
||||||
|
@ -1889,7 +1889,7 @@ module StopTime::Views
|
||||||
div.control_group do
|
div.control_group do
|
||||||
label.control_label "Paid?"
|
label.control_label "Paid?"
|
||||||
div.controls do
|
div.controls do
|
||||||
_form_input_checkbox("paid")
|
_form_input_checkbox("paid")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
div.form_actions do
|
div.form_actions do
|
||||||
|
@ -2027,7 +2027,7 @@ module StopTime::Views
|
||||||
tbody do
|
tbody do
|
||||||
@hourly_rate_tasks.keys.each do |task|
|
@hourly_rate_tasks.keys.each do |task|
|
||||||
tr.task do
|
tr.task do
|
||||||
td { _form_input_checkbox("tasks[]", task.id) }
|
td { _form_input_checkbox("tasks[]", task.id, true) }
|
||||||
td task.name, :colspan => 3
|
td task.name, :colspan => 3
|
||||||
td do
|
td do
|
||||||
input :type => :text, :name => "task_#{task.id}_comment",
|
input :type => :text, :name => "task_#{task.id}_comment",
|
||||||
|
@ -2038,7 +2038,7 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
@hourly_rate_tasks[task].each do |entry|
|
@hourly_rate_tasks[task].each do |entry|
|
||||||
tr do
|
tr do
|
||||||
td.indent { _form_input_checkbox("time_entries[]", entry.id) }
|
td.indent { _form_input_checkbox("time_entries[]", entry.id, true) }
|
||||||
td { label entry.date.to_date,
|
td { label entry.date.to_date,
|
||||||
:for => "time_entries[]_#{entry.id}" }
|
:for => "time_entries[]_#{entry.id}" }
|
||||||
td { entry.start.to_formatted_s(:time_only) }
|
td { entry.start.to_formatted_s(:time_only) }
|
||||||
|
@ -2073,7 +2073,7 @@ module StopTime::Views
|
||||||
tbody do
|
tbody do
|
||||||
@fixed_cost_tasks.keys.each do |task|
|
@fixed_cost_tasks.keys.each do |task|
|
||||||
tr do
|
tr do
|
||||||
td { _form_input_checkbox("tasks[]", task.id) }
|
td { _form_input_checkbox("tasks[]", task.id, true) }
|
||||||
td { label task.name, :for => "tasks[]_#{task.id}" }
|
td { label task.name, :for => "tasks[]_#{task.id}" }
|
||||||
td do
|
td do
|
||||||
input :type => :text, :name => "task_#{task.id}_comment",
|
input :type => :text, :name => "task_#{task.id}_comment",
|
||||||
|
@ -2293,11 +2293,12 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Partial view that generates a form checkbox with the given _name_.
|
# Partial view that generates a form checkbox with the given _name_ and
|
||||||
# Whether it is initiall checked is determined by the _value_ flag.
|
# _value_.
|
||||||
|
# Whether it is initially checked is determined by the _default_ flag.
|
||||||
# Additional options can be passed via the collection _opts_.
|
# Additional options can be passed via the collection _opts_.
|
||||||
def _form_input_checkbox(name, value=true, *opts)
|
def _form_input_checkbox(name, value=true, default=false, *opts)
|
||||||
if @input[name] == value
|
if @input[name] == value or default
|
||||||
input({:type => "checkbox", :id => "#{name}_#{value}", :name => name,
|
input({:type => "checkbox", :id => "#{name}_#{value}", :name => name,
|
||||||
:value => value, :checked => true}, *opts)
|
:value => value, :checked => true}, *opts)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue