fixed tags problem

This commit is contained in:
Harry Bomrah 2015-09-08 17:45:38 +08:00
parent a595d1611b
commit 1526e3eccc
1 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,6 @@ class ArchivesController < ApplicationController
cats = files_by_cateogry.keys.collect do |cat|
files_by_category_tag = files_by_cateogry[cat].group_by(&:tags)
url_to_edit = OrbitHelper.user_has_cateogry?(cat) ? "/admin/archive_files?filters[category][]=#{cat.id.to_s}" : ""
ts = []
files_by_category_tag.keys.each do |t|
@ -39,10 +38,13 @@ class ArchivesController < ApplicationController
if t.count > 1
t.each do |inner_tag|
index = ts.index{|tot| tot["tag-name"] == inner_tag.name}
if !index.nil?
ts[index]["archives"] << a
if index.nil?
ts << {
"tag-name" => (inner_tag.name rescue ""),
"archives" => [a]
}
else
archives << a
ts[index]["archives"] << a
end
end
else