浏览代码

Ensure elections and districts are sorted correctly

tags/last-sinatra-version
Adrian Short 13 年前
父节点
当前提交
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
@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 查看文件

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

正在加载...
取消
保存