Ver a proveniência

Output results in DokuWiki wikitext format

tags/last-sinatra-version
Adrian Short há 9 anos
ascendente
cometimento
e44b2a613a
2 ficheiros alterados com 23 adições e 1 eliminações
  1. +19
    -1
      app.rb
  2. +4
    -0
      views/resultsdistrict.haml

+ 19
- 1
app.rb Ver ficheiro

@@ -281,7 +281,25 @@ get '/bodies/:body/elections/:date/:districts_name/:district' do
ORDER BY total_votes DESC
", @district.id, @election.id)
haml :resultsdistrict
if params[:wiki] == 'dokuwiki'
o = "^ #{@district.name} #{@district.body.district_name} results, #{@body.name} election #{short_date(@election.d)} ^^^^^^\n"
o += "^ Position ^ Candidate ^ Party ^ Votes ^ % Share ^ ^\n"
count = 0
@candidacies.each do |c|
count += 1
o += "| %2d | [[%-30s]] | [[%-40s]] | %6s | %3s | %-7s |\n" %
[ count,
c.candidate.short_name,
party_name(c.labcoop, c.party.name),
commify(c.votes),
format_percent(c.votes.to_f / @total_votes * 100),
c.seats == 1 ? 'Elected' : ''
]
end
o
else
haml :resultsdistrict
end
end

get '/bodies/:body/:districts_name/:district' do


+ 4
- 0
views/resultsdistrict.haml Ver ficheiro

@@ -84,6 +84,10 @@
%td  
%td  

%p
%a{ :href => "?wiki=dokuwiki" }
DokuWiki

%h2 Votes by party

%table


Carregando…
Cancelar
Guardar