Browse Source

Ensure elections and districts are sorted correctly

tags/last-sinatra-version
Adrian Short 13 years ago
parent
commit
84e1975814
2 changed files with 4 additions and 2 deletions
  1. +2
    -0
      app.rb
  2. +2
    -2
      views/body.haml

+ 2
- 0
app.rb View File

@@ -143,6 +143,8 @@ end

get '/bodies/:body/?' do
@body = Body.first(:slug => params[:body])
@elections = Election.all(:body => @body, :order => [:d.desc])
@districts = District.all(:body => @body, :order => [:name])
haml :body
end



+ 2
- 2
views/body.haml View File

@@ -7,7 +7,7 @@
%h2 Elections

%table
- @body.elections.each do |election|
- @elections.each do |election|
%tr
%td
%a{ :href => "/bodies/#{@body.slug}/elections/#{election.d}" }<
@@ -18,7 +18,7 @@
%h2
= @body.districts_name.capitalize
- @body.districts.each do |district|
- @districts.each do |district|
%p
%a{ :href => "/bodies/#{@body.slug}/#{@body.districts_name}/#{district.slug}" }
= district.name

Loading…
Cancel
Save