Просмотр исходного кода

Output results in DokuWiki wikitext format

tags/last-sinatra-version
Adrian Short 9 лет назад
Родитель
Сommit
e44b2a613a
2 измененных файлов: 23 добавлений и 1 удалений
  1. +19
    -1
      app.rb
  2. +4
    -0
      views/resultsdistrict.haml

+ 19
- 1
app.rb Просмотреть файл

@@ -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 Просмотреть файл

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

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

%h2 Votes by party

%table


Загрузка…
Отмена
Сохранить