Beautified the pages a bit.
* Mention when a list is empty. * Add a link to where to create new items when the list is emtpy. * Add form reset buttons. * Synced and added the page headers.
This commit is contained in:
parent
5f64874252
commit
a628b83129
107
stoptime.rb
107
stoptime.rb
|
@ -770,8 +770,9 @@ module StopTime::Views
|
||||||
|
|
||||||
if @tasks.empty?
|
if @tasks.empty?
|
||||||
p do
|
p do
|
||||||
text "No customers found! Create one "
|
text "No customers, projects or tasks found! Set them up "
|
||||||
a "here", :href => R(CustomersNew)
|
a "here", :href => R(CustomersNew)
|
||||||
|
text "."
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@tasks.keys.sort_by { |c| c.name }.each do |customer|
|
@tasks.keys.sort_by { |c| c.name }.each do |customer|
|
||||||
|
@ -897,38 +898,46 @@ module StopTime::Views
|
||||||
|
|
||||||
def customers
|
def customers
|
||||||
h2 "Customers"
|
h2 "Customers"
|
||||||
table.customers do
|
if @customers.empty?
|
||||||
col.name {}
|
p do
|
||||||
col.short_name {}
|
text "None found! You can create one "
|
||||||
col.address {}
|
a "here", :href => R(CustomersNew)
|
||||||
col.email {}
|
text "."
|
||||||
col.phone {}
|
end
|
||||||
tr do
|
else
|
||||||
th "Name"
|
table.customers do
|
||||||
th "Short name"
|
col.name {}
|
||||||
th "Address"
|
col.short_name {}
|
||||||
th "Email"
|
col.address {}
|
||||||
th "Phone"
|
col.email {}
|
||||||
end
|
col.phone {}
|
||||||
@customers.each do |customer|
|
tr do
|
||||||
tr do
|
th "Name"
|
||||||
td { a customer.name, :href => R(CustomersN, customer.id) }
|
th "Short name"
|
||||||
td { customer.short_name }
|
th "Address"
|
||||||
td { [customer.address_street,
|
th "Email"
|
||||||
customer.address_postal_code,
|
th "Phone"
|
||||||
customer.address_city].join(", ") unless customer.address_street.blank? }
|
end
|
||||||
td { a customer.email, :href => "mailto:#{customer.email}" }
|
@customers.each do |customer|
|
||||||
td { customer.phone }
|
tr do
|
||||||
td do
|
td { a customer.name, :href => R(CustomersN, customer.id) }
|
||||||
form :action => R(CustomersN, customer.id), :method => :post do
|
td { customer.short_name }
|
||||||
input :type => :submit, :name => "delete", :value => "Delete"
|
td { [customer.address_street,
|
||||||
|
customer.address_postal_code,
|
||||||
|
customer.address_city].join(", ") unless customer.address_street.blank? }
|
||||||
|
td { a customer.email, :href => "mailto:#{customer.email}" }
|
||||||
|
td { customer.phone }
|
||||||
|
td do
|
||||||
|
form :action => R(CustomersN, customer.id), :method => :post do
|
||||||
|
input :type => :submit, :name => "delete", :value => "Delete"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
a "Add a new customer", :href=> R(CustomersNew)
|
a "Add a new customer", :href=> R(CustomersNew)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def customer_form
|
def customer_form
|
||||||
|
@ -974,11 +983,12 @@ module StopTime::Views
|
||||||
a "Create a new invoice", :href => R(CustomersNInvoicesNew, @customer.id)
|
a "Create a new invoice", :href => R(CustomersNInvoicesNew, @customer.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
div.clear {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def _invoice_list(invoices)
|
def _invoice_list(invoices)
|
||||||
if invoices.empty?
|
if invoices.empty?
|
||||||
p "None!"
|
p "None found!"
|
||||||
else
|
else
|
||||||
table.invoices do
|
table.invoices do
|
||||||
col.number {}
|
col.number {}
|
||||||
|
@ -1016,6 +1026,7 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
|
|
||||||
def task_form
|
def task_form
|
||||||
|
h2 "Task information"
|
||||||
form :action => R(*@target), :method => :post do
|
form :action => R(*@target), :method => :post do
|
||||||
ol do
|
ol do
|
||||||
li { _form_input_with_label("Name", "name", :text) }
|
li { _form_input_with_label("Name", "name", :text) }
|
||||||
|
@ -1040,12 +1051,20 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
|
|
||||||
def invoices
|
def invoices
|
||||||
h2 "List of invoices"
|
h2 "Invoices"
|
||||||
|
|
||||||
@invoices.keys.sort.each do |key|
|
if @invoices.empty?
|
||||||
next if @invoices[key].empty?
|
p do
|
||||||
h3 { key }
|
text "Found none! You can create one by "
|
||||||
_invoice_list(@invoices[key])
|
a "selecting a customer", :href => R(Customers)
|
||||||
|
text "."
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@invoices.keys.sort.each do |key|
|
||||||
|
next if @invoices[key].empty?
|
||||||
|
h3 { key }
|
||||||
|
_invoice_list(@invoices[key])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1075,6 +1094,7 @@ module StopTime::Views
|
||||||
td.val do
|
td.val do
|
||||||
_form_input_checkbox("payed")
|
_form_input_checkbox("payed")
|
||||||
input :type => :submit, :name => "update", :value => "Update"
|
input :type => :submit, :name => "update", :value => "Update"
|
||||||
|
input :type => :reset, :name => "reset", :value => "Reset"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1234,6 +1254,7 @@ module StopTime::Views
|
||||||
li { _form_input_with_label("Account number", "accountno", :text) }
|
li { _form_input_with_label("Account number", "accountno", :text) }
|
||||||
end
|
end
|
||||||
input :type => "submit", :name => "update", :value => "Update"
|
input :type => "submit", :name => "update", :value => "Update"
|
||||||
|
input :type => :reset, :name => "reset", :value => "Reset"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1265,12 +1286,18 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
|
|
||||||
def _form_select(name, opts_list)
|
def _form_select(name, opts_list)
|
||||||
select :name => name, :id => name do
|
if opts_list.empty?
|
||||||
opts_list.each do |opt_val, opt_str|
|
select :name => name, :id => name, :disabled => true do
|
||||||
if @input[name] == opt_val
|
option "None found", :value => "none", :selected => true
|
||||||
option opt_str, :value => opt_val, :selected => true
|
end
|
||||||
else
|
else
|
||||||
option opt_str, :value => opt_val
|
select :name => name, :id => name do
|
||||||
|
opts_list.sort_by { |o| o.last }.each do |opt_val, opt_str|
|
||||||
|
if @input[name] == opt_val
|
||||||
|
option opt_str, :value => opt_val, :selected => true
|
||||||
|
else
|
||||||
|
option opt_str, :value => opt_val
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue