ソースを参照

Ensure elections and districts are sorted correctly

tags/last-sinatra-version
Adrian Short 14年前
コミット
84e1975814
2個のファイルの変更4行の追加2行の削除
  1. +2
    -0
      app.rb
  2. +2
    -2
      views/body.haml

+ 2
- 0
app.rb ファイルの表示

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


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




+ 2
- 2
views/body.haml ファイルの表示

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


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

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