Pārlūkot izejas kodu

Added payment view

pull/3/head
Adrian Short pirms 14 gadiem
vecāks
revīzija
b85e974663
7 mainītis faili ar 68 papildinājumiem un 2 dzēšanām
  1. +5
    -0
      app.rb
  2. +1
    -1
      public/style.css
  3. +16
    -0
      slugify.rb
  4. +5
    -1
      views/directorate.haml
  5. +33
    -0
      views/payment.haml
  6. +4
    -0
      views/service.haml
  7. +4
    -0
      views/supplier.haml

+ 5
- 0
app.rb Parādīt failu

@@ -70,6 +70,11 @@ get '/services/?' do
haml :services
end

get '/payments/:id' do
@payment = Payment.get(params[:id])
haml :payment
end

get '/error' do
haml :error
end


+ 1
- 1
public/style.css Parādīt failu

@@ -131,6 +131,6 @@ tr

.download a:hover
{
background-color: #ccc;
background-color: #eee;
color: red;
}

+ 16
- 0
slugify.rb Parādīt failu

@@ -0,0 +1,16 @@
require 'lib/models'

for supplier in Supplier.all
supplier.slug = Supplier.slugify(supplier.name)
supplier.save!
end

for service in Service.all
service.slug = Service.slugify(service.name)
service.save!
end

for directorate in Directorate.all
directorate.slug = Directorate.slugify(directorate.name)
directorate.save!
end

+ 5
- 1
views/directorate.haml Parādīt failu

@@ -12,6 +12,7 @@
%table
%tr
%th Date
%th Ref.
%th Service
%th Supplier
%th.right £
@@ -19,6 +20,9 @@
- for payment in @directorate.payments
%tr
%td= payment.d.strftime("%d %b %Y")
%td
%a{ :href => "/payments/#{payment.id}" }
= payment.id
%td
%a{ :href => '/services/' + payment.service.slug }
= payment.service.name
@@ -33,5 +37,5 @@
%td
%strong TOTAL
%td.right= sprintf("%0d", @total)
%td

+ 33
- 0
views/payment.haml Parādīt failu

@@ -0,0 +1,33 @@
.grid_12
%h2= @page_title = "Payment " + @payment.id.to_s
%table
%tr
%td Date
%td= @payment.d.strftime("%d %b %Y")
%tr
%td Directorate
%td
%a{ :href => "/directorates/#{@payment.directorate.slug}" }
= @payment.directorate.name
%tr
%td Service
%td
%a{ :href => "/services/#{@payment.service.slug}" }
= @payment.service.name
%tr
%td Supplier
%td
%a{ :href => "/suppliers/#{@payment.supplier.slug}" }
= @payment.supplier.name
%tr
%td Amount £
%td= sprintf("%0.2f", @payment.amount)
%tr
%td Transaction Number
%td= @payment.trans_no > 0 ? @payment.trans_no : "unknown"
%tr
%td Type
%td= @payment.tyype


+ 4
- 0
views/service.haml Parādīt failu

@@ -16,6 +16,7 @@
%table
%tr
%th Date
%th Ref.
%th Directorate
%th Supplier
%th.right £
@@ -23,6 +24,9 @@
- for payment in @service.payments
%tr
%td= payment.d.strftime("%d %b %Y")
%td
%a{ :href => "/payments/#{payment.id}" }
= payment.id
%td
%a{ :href => '/directorates/' + payment.directorate.slug }
= payment.directorate.name


+ 4
- 0
views/supplier.haml Parādīt failu

@@ -16,6 +16,7 @@
%table
%tr
%th Date
%th Ref.
%th Directorate
%th Service
%th.right £
@@ -23,6 +24,9 @@
- for payment in @supplier.payments
%tr
%td= payment.d.strftime("%d %b %Y")
%td
%a{ :href => "/payments/#{payment.id}" }
= payment.id
%td
%a{ :href => '/directorates/' + payment.directorate.slug }
= payment.directorate.name


Notiek ielāde…
Atcelt
Saglabāt