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:
Paul van Tilburg 2011-11-10 12:51:12 +01:00
parent 5f64874252
commit a628b83129
1 changed files with 67 additions and 40 deletions

View File

@ -770,8 +770,9 @@ module StopTime::Views
if @tasks.empty?
p do
text "No customers found! Create one "
text "No customers, projects or tasks found! Set them up "
a "here", :href => R(CustomersNew)
text "."
end
else
@tasks.keys.sort_by { |c| c.name }.each do |customer|
@ -897,6 +898,13 @@ module StopTime::Views
def customers
h2 "Customers"
if @customers.empty?
p do
text "None found! You can create one "
a "here", :href => R(CustomersNew)
text "."
end
else
table.customers do
col.name {}
col.short_name {}
@ -930,6 +938,7 @@ module StopTime::Views
a "Add a new customer", :href=> R(CustomersNew)
end
end
def customer_form
form.float_left :action => R(*@target), :method => :post do
@ -974,11 +983,12 @@ module StopTime::Views
a "Create a new invoice", :href => R(CustomersNInvoicesNew, @customer.id)
end
end
div.clear {}
end
def _invoice_list(invoices)
if invoices.empty?
p "None!"
p "None found!"
else
table.invoices do
col.number {}
@ -1016,6 +1026,7 @@ module StopTime::Views
end
def task_form
h2 "Task information"
form :action => R(*@target), :method => :post do
ol do
li { _form_input_with_label("Name", "name", :text) }
@ -1040,14 +1051,22 @@ module StopTime::Views
end
def invoices
h2 "List of invoices"
h2 "Invoices"
if @invoices.empty?
p do
text "Found none! You can create one by "
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
def invoice
h2 do
@ -1075,6 +1094,7 @@ module StopTime::Views
td.val do
_form_input_checkbox("payed")
input :type => :submit, :name => "update", :value => "Update"
input :type => :reset, :name => "reset", :value => "Reset"
end
end
end
@ -1234,6 +1254,7 @@ module StopTime::Views
li { _form_input_with_label("Account number", "accountno", :text) }
end
input :type => "submit", :name => "update", :value => "Update"
input :type => :reset, :name => "reset", :value => "Reset"
end
end
@ -1265,8 +1286,13 @@ module StopTime::Views
end
def _form_select(name, opts_list)
if opts_list.empty?
select :name => name, :id => name, :disabled => true do
option "None found", :value => "none", :selected => true
end
else
select :name => name, :id => name do
opts_list.each do |opt_val, opt_str|
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
@ -1275,5 +1301,6 @@ module StopTime::Views
end
end
end
end
end # module StopTime::Views