Merge branch 'master' into 'master'
fix order problem for gallery index See merge request !12
This commit is contained in:
commit
8c0c424f51
|
@ -35,7 +35,10 @@ class GalleriesController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
albums = Album.filter_by_categories.filter_by_tags.asc(:order)
|
||||
album_tp = Album.filter_by_categories.filter_by_tags
|
||||
albums_no_order = album_tp.desc(:created_at).select{|v| v.order == -1}
|
||||
albums_with_order = album_tp.asc(:order).select{|v| v.order != -1}
|
||||
albums = albums_no_order.concat(albums_with_order)
|
||||
galleries = albums.collect do |a|
|
||||
doc = Nokogiri::HTML(a.description.to_s)
|
||||
alt_text = doc.text.empty? ? 'gallery image' : doc.text
|
||||
|
@ -50,7 +53,7 @@ class GalleriesController < ApplicationController
|
|||
{
|
||||
"albums" => galleries,
|
||||
"extras" => {"widget-title"=>"Gallery"},
|
||||
"total_pages" => albums.total_pages
|
||||
"total_pages" => album_tp.total_pages
|
||||
}
|
||||
end
|
||||
def show
|
||||
|
|
Loading…
Reference in New Issue