Sfoglia il codice sorgente

Merge Labour/Co-operative candidacies into Labour. Fixes #12

tags/last-sinatra-version
Adrian Short 10 anni fa
parent
commit
6f970e581b
4 ha cambiato i file con 9 aggiunte e 3 eliminazioni
  1. +5
    -0
      app.rb
  2. +1
    -0
      models.rb
  3. +1
    -1
      views/candidate.haml
  4. +2
    -2
      views/resultsdistrict.haml

+ 5
- 0
app.rb Vedi File

@@ -54,6 +54,11 @@ helpers do
d.strftime("%e %B %Y")
end

# Exception for Labour/Co-operative candidacies
def party_name(labcoop, party_name)
labcoop ? "Labour and Co-operative Party" : party_name
end

end

get '/' do


+ 1
- 0
models.rb Vedi File

@@ -88,6 +88,7 @@ class Candidacy
property :postcode, String
property :position, Integer # Position of this candidate in this district. (1..n)
property :seats, Integer # Number of seats won by this candidacy (0 or 1)
property :labcoop, Boolean # Candidacy is for joint Labour/Co-op party

belongs_to :election
belongs_to :candidate


+ 1
- 1
views/candidate.haml Vedi File

@@ -24,7 +24,7 @@
%a{ :href => "/bodies/#{ccy['body_slug']}/elections/#{ccy['d']}" }
-# Postgres returns ccy['d'] as a Date and sqlite returns it as a String
= long_date(ccy['d'].to_time)
%td= ccy['party_name']
%td= party_name(ccy['labcoop'], ccy['party_name'])
%td
%a{ :href => "/bodies/#{ccy['body_slug']}" }
= ccy['body_name']


+ 2
- 2
views/resultsdistrict.haml Vedi File

@@ -81,7 +81,7 @@
%th  

- count = 0
- for candidacy in @candidacies
- @candidacies.each do |candidacy|
- count += 1
%tr.vcard
%td= count
@@ -90,7 +90,7 @@
%a{ :href => "/candidates/#{candidacy.candidate.id}" }
= candidacy.candidate.short_name
%td.org
= candidacy.party.name
= party_name(candidacy.labcoop, candidacy.party.name)
%td.right= commify(candidacy.votes)


Caricamento…
Annulla
Salva