Style the no customer/invoices/projects alerts the same way

This commit is contained in:
Paul van Tilburg 2014-10-18 21:28:18 +02:00
parent 70588df53f
commit e5e879df03
1 changed files with 67 additions and 63 deletions

View File

@ -1526,13 +1526,13 @@ module StopTime::Views
small "#{@tasks.count} customers, #{@task_count} active projects/tasks" small "#{@tasks.count} customers, #{@task_count} active projects/tasks"
end end
end end
div.row do if @tasks.empty?
if @tasks.empty? div.alert.alert_info do
div.alert.alert_info do text! "No customers, projects or tasks found! Set them up " +
text! "No customers, projects or tasks found! Set them up " + "#{a "here", :href => R(CustomersNew)}."
"#{a "here", :href => R(CustomersNew)}." end
end else
else div.row do
div.span6 do div.span6 do
@tasks.keys.sort_by { |c| c.name }.each do |customer| @tasks.keys.sort_by { |c| c.name }.each do |customer|
inv_klass = "text_info" inv_klass = "text_info"
@ -1750,7 +1750,7 @@ module StopTime::Views
end end
end end
if @customers.empty? if @customers.empty?
p do div.alert.alert_info do
text! "None found! You can create one " + text! "None found! You can create one " +
"#{a "here", :href => R(CustomersNew)}." "#{a "here", :href => R(CustomersNew)}."
end end
@ -1861,56 +1861,60 @@ module StopTime::Views
:href => R(CustomersNTasksNew, @customer.id) :href => R(CustomersNTasksNew, @customer.id)
end end
end end
div.accordion.task_list! do if @billed_tasks.empty?
@billed_tasks.keys.sort_by { |task| task.name }.each do |task| p "None found!"
div.accordion_group do else
div.accordion_heading do div.accordion.task_list! do
span.accordion_toggle do @billed_tasks.keys.sort_by { |task| task.name }.each do |task|
a task.name, "data-toggle" => "collapse", div.accordion_group do
"data-parent" => "#task_list", div.accordion_heading do
:href => "#collapse#{task.id}" span.accordion_toggle do
# FXIME: the following is not very RESTful! a task.name, "data-toggle" => "collapse",
form.form_inline.pull_right :action => R(CustomersNTasks, @customer.id), "data-parent" => "#task_list",
:method => :post do :href => "#collapse#{task.id}"
a.btn.btn_mini "Edit", :href => R(CustomersNTasksN, @customer.id, task.id) # FXIME: the following is not very RESTful!
input :type => :hidden, :name => "task_id", :value => task.id form.form_inline.pull_right :action => R(CustomersNTasks, @customer.id),
button.btn.btn_danger.btn_mini "Delete", :type => :submit, :method => :post do
:name => "delete", :value => "Delete" a.btn.btn_mini "Edit", :href => R(CustomersNTasksN, @customer.id, task.id)
input :type => :hidden, :name => "task_id", :value => task.id
button.btn.btn_danger.btn_mini "Delete", :type => :submit,
:name => "delete", :value => "Delete"
end
end end
end end
end div.accordion_body.collapse :id => "collapse#{task.id}" do
div.accordion_body.collapse :id => "collapse#{task.id}" do div.accordion_inner do
div.accordion_inner do if @billed_tasks[task].empty?
if @billed_tasks[task].empty? i { "No billed projects/tasks found" }
i { "No billed projects/tasks found" } else
else table.table.table_condensed do
table.table.table_condensed do col.task_list
col.task_list @billed_tasks[task].sort_by { |t| t.invoice.number }.each do |billed_task|
@billed_tasks[task].sort_by { |t| t.invoice.number }.each do |billed_task| tr do
tr do td do
td do a billed_task.comment_or_name,
a billed_task.comment_or_name, :href => R(CustomersNTasksN, @customer.id, billed_task.id)
:href => R(CustomersNTasksN, @customer.id, billed_task.id) small do
small do text! "(billed in invoice "
text! "(billed in invoice " a billed_task.invoice.number,
a billed_task.invoice.number, :title => billed_task.invoice.number,
:title => billed_task.invoice.number, :href => R(CustomersNInvoicesX, @customer.id,
:href => R(CustomersNInvoicesX, @customer.id, billed_task.invoice.number)
billed_task.invoice.number) text! ")"
text! ")" end
end end
end td do
td do # FXIME: the following is not very RESTful!
# FXIME: the following is not very RESTful! form.form_inline.pull_right :action => R(CustomersNTasks, @customer.id),
form.form_inline.pull_right :action => R(CustomersNTasks, @customer.id), :method => :post do
:method => :post do a.btn.btn_mini "Edit",
a.btn.btn_mini "Edit", :href => R(CustomersNTasksN, @customer.id,
:href => R(CustomersNTasksN, @customer.id, billed_task.id)
billed_task.id) input :type => :hidden, :name => "task_id",
input :type => :hidden, :name => "task_id", :value => billed_task.id
:value => billed_task.id button.btn.btn_danger.btn_mini "Delete", :type => :submit,
button.btn.btn_danger.btn_mini "Delete", :type => :submit, :name => "delete", :value => "Delete"
:name => "delete", :value => "Delete" end
end end
end end
end end
@ -2004,14 +2008,14 @@ module StopTime::Views
small "#{@invoices.count} customers, #{@invoice_count} invoices" small "#{@invoices.count} customers, #{@invoice_count} invoices"
end end
end end
div.row do if @invoices.values.flatten.empty?
div.span7 do div.alert.alert_info do
if @invoices.values.flatten.empty? text! "Found none! You can create one by " +
p do "#{a "selecting a customer", :href => R(Customers)}."
text! "Found none! You can create one by " end
"#{a "selecting a customer", :href => R(Customers)}." else
end div.row do
else div.span7 do
@invoices.keys.sort.each do |key| @invoices.keys.sort.each do |key|
next if @invoices[key].empty? next if @invoices[key].empty?
h3 { key } h3 { key }