From 20f6dc86876ea9111c648dcd9242b33b60933d0d Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 16 Jul 2014 17:11:29 +0800 Subject: [PATCH] try to fix the orbit 4.5 bug --- app/controllers/archives_controller.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 35ed727..d6d1226 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -6,46 +6,45 @@ class ArchivesController < ApplicationController module_app = OrbitHelper.this_module_app @categories = module_app.categories.collect do |cat| { - "title" => cat.title, + "title" => cat.title || "", "id" => cat.id.to_s } end else categories.each do |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 cats = @categories.collect do |cat| archives = ArchiveFile.where(:category_id => cat["id"]).order_by(:sort_number=>'asc').collect do |archive| statuses = archive.statuses_with_classname.collect do |status| { - "status" => status["name"], + "status" => status["name"] || "", "status-class" => "status-#{status['classname']}" } end 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) { - "file-name" => title , - "file-type" => file.file.file.extension.downcase, - "file-url" => file.file.url + "file-name" => title || "", + "file-type" => file.file.file.extension.downcase || "", + "file-url" => file.file.url || "" } end { - "archive-title" => archive.title, - "statuses" => statuses, + "archive-title" => archive.title || "", + "statuses" => statuses || [], "files" => files } end { - "category-title" => cat["title"], + "category-title" => cat["title"] || "", "archives" => archives } end { - "categories" => cats, - "extras" => {"widget-title" => "Archives"} + "categories" => cats } end