try to fix the orbit 4.5 bug
This commit is contained in:
parent
ef5cd170a1
commit
20f6dc8687
|
@ -6,46 +6,45 @@ class ArchivesController < ApplicationController
|
||||||
module_app = OrbitHelper.this_module_app
|
module_app = OrbitHelper.this_module_app
|
||||||
@categories = module_app.categories.collect do |cat|
|
@categories = module_app.categories.collect do |cat|
|
||||||
{
|
{
|
||||||
"title" => cat.title,
|
"title" => cat.title || "",
|
||||||
"id" => cat.id.to_s
|
"id" => cat.id.to_s
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
categories.each do |cat|
|
categories.each do |cat|
|
||||||
c = Category.find(cat)
|
c = Category.find(cat)
|
||||||
@categories << {"title" => c.title, "id" => c.id.to_s}
|
@categories << {"title" => c.title || "", "id" => c.id.to_s}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cats = @categories.collect do |cat|
|
cats = @categories.collect do |cat|
|
||||||
archives = ArchiveFile.where(:category_id => cat["id"]).order_by(:sort_number=>'asc').collect do |archive|
|
archives = ArchiveFile.where(:category_id => cat["id"]).order_by(:sort_number=>'asc').collect do |archive|
|
||||||
statuses = archive.statuses_with_classname.collect do |status|
|
statuses = archive.statuses_with_classname.collect do |status|
|
||||||
{
|
{
|
||||||
"status" => status["name"],
|
"status" => status["name"] || "",
|
||||||
"status-class" => "status-#{status['classname']}"
|
"status-class" => "status-#{status['classname']}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
files = archive.archive_file_multiples.order_by(:sort_number=>'asc').collect do |file|
|
files = archive.archive_file_multiples.order_by(:sort_number=>'asc').collect do |file|
|
||||||
title = (file.file_title.blank? ? File.basename(file.file.path) : file.file_title)
|
title = (file.file_title.blank? ? File.basename(file.file.path) : file.file_title)
|
||||||
{
|
{
|
||||||
"file-name" => title ,
|
"file-name" => title || "",
|
||||||
"file-type" => file.file.file.extension.downcase,
|
"file-type" => file.file.file.extension.downcase || "",
|
||||||
"file-url" => file.file.url
|
"file-url" => file.file.url || ""
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
"archive-title" => archive.title,
|
"archive-title" => archive.title || "",
|
||||||
"statuses" => statuses,
|
"statuses" => statuses || [],
|
||||||
"files" => files
|
"files" => files
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
"category-title" => cat["title"],
|
"category-title" => cat["title"] || "",
|
||||||
"archives" => archives
|
"archives" => archives
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
"categories" => cats,
|
"categories" => cats
|
||||||
"extras" => {"widget-title" => "Archives"}
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue