fix widget tags problem
This commit is contained in:
parent
12c5cdbfe4
commit
dbed445f68
|
@ -28,27 +28,15 @@ class ArchivesController < ApplicationController
|
|||
"file-url" => "/xhr/archive/download?file=#{file.id}"
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
{
|
||||
"archive-title" => archive.title || "",
|
||||
"statuses" => statuses,
|
||||
"files" => files
|
||||
}
|
||||
end
|
||||
|
||||
tag_name = ""
|
||||
|
||||
if(!t.nil?)
|
||||
t.each do |item|
|
||||
tag_name += item.name + " + "
|
||||
end
|
||||
end
|
||||
tag_name = (tag_name[0...-2] rescue "")
|
||||
|
||||
{
|
||||
"tag-name" => tag_name,
|
||||
"tag-name" => (t[0].name rescue ""),
|
||||
"archives" => archives
|
||||
|
||||
}
|
||||
|
@ -57,7 +45,7 @@ class ArchivesController < ApplicationController
|
|||
{
|
||||
"category-title" => "",
|
||||
"tags" => ts,
|
||||
"link_to_edit" => url_to_edit
|
||||
"url_to_edit" => url_to_edit
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -87,13 +75,15 @@ class ArchivesController < ApplicationController
|
|||
end
|
||||
|
||||
def widget
|
||||
if OrbitHelper.widget_tags.first == "all"
|
||||
files_by_cateogry = ArchiveFile.filter_by_widget_categories.with_tags(OrbitHelper.widget_module_app.tags.collect{|tag| tag.id.to_s}).group_by(&:category)
|
||||
else
|
||||
files_by_cateogry = ArchiveFile.filter_by_widget_categories.with_tags(OrbitHelper.widget_tags).group_by(&:category)
|
||||
end
|
||||
|
||||
cats = files_by_cateogry.keys.collect do |cat|
|
||||
files_by_category_tag = files_by_cateogry[cat].group_by(&:tags)
|
||||
|
||||
|
||||
|
||||
ts = files_by_category_tag.keys.collect do |t|
|
||||
archives = files_by_category_tag[t].collect do |archive|
|
||||
{
|
||||
|
@ -101,17 +91,8 @@ class ArchivesController < ApplicationController
|
|||
"archive_url" => OrbitHelper.widget_more_url
|
||||
}
|
||||
end
|
||||
tag_name = ""
|
||||
|
||||
if(!t.nil?)
|
||||
t.each do |item|
|
||||
tag_name += item.name + " + "
|
||||
end
|
||||
end
|
||||
tag_name = (tag_name[0...-2] rescue "")
|
||||
|
||||
{
|
||||
"tag-name" => tag_name,
|
||||
"tag-name" => (t[0].name rescue ""),
|
||||
"archives" => archives
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue