ソースを参照

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

tags/last-sinatra-version
Adrian Short 10年前
コミット
6f970e581b
4個のファイルの変更9行の追加3行の削除
  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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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)


読み込み中…
キャンセル
保存