fix widget tags problem
This commit is contained in:
parent
12c5cdbfe4
commit
dbed445f68
|
@ -15,7 +15,7 @@ class ArchivesController < ApplicationController
|
||||||
"status" => status["name"] || "",
|
"status" => status["name"] || "",
|
||||||
"status-class" => "status-#{status['classname']}"
|
"status-class" => "status-#{status['classname']}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
files = []
|
files = []
|
||||||
archive.archive_file_multiples.order_by(:sort_number=>'asc').each do |file|
|
archive.archive_file_multiples.order_by(:sort_number=>'asc').each do |file|
|
||||||
if file.choose_lang.include?(I18n.locale.to_s)
|
if file.choose_lang.include?(I18n.locale.to_s)
|
||||||
|
@ -28,27 +28,15 @@ class ArchivesController < ApplicationController
|
||||||
"file-url" => "/xhr/archive/download?file=#{file.id}"
|
"file-url" => "/xhr/archive/download?file=#{file.id}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
"archive-title" => archive.title || "",
|
"archive-title" => archive.title || "",
|
||||||
"statuses" => statuses,
|
"statuses" => statuses,
|
||||||
"files" => files
|
"files" => files
|
||||||
}
|
}
|
||||||
end
|
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
|
"archives" => archives
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +45,7 @@ class ArchivesController < ApplicationController
|
||||||
{
|
{
|
||||||
"category-title" => "",
|
"category-title" => "",
|
||||||
"tags" => ts,
|
"tags" => ts,
|
||||||
"link_to_edit" => url_to_edit
|
"url_to_edit" => url_to_edit
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -87,13 +75,15 @@ class ArchivesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def widget
|
def widget
|
||||||
files_by_cateogry = ArchiveFile.filter_by_widget_categories.with_tags(OrbitHelper.widget_tags).group_by(&:category)
|
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|
|
cats = files_by_cateogry.keys.collect do |cat|
|
||||||
files_by_category_tag = files_by_cateogry[cat].group_by(&:tags)
|
files_by_category_tag = files_by_cateogry[cat].group_by(&:tags)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ts = files_by_category_tag.keys.collect do |t|
|
ts = files_by_category_tag.keys.collect do |t|
|
||||||
archives = files_by_category_tag[t].collect do |archive|
|
archives = files_by_category_tag[t].collect do |archive|
|
||||||
{
|
{
|
||||||
|
@ -101,17 +91,8 @@ class ArchivesController < ApplicationController
|
||||||
"archive_url" => OrbitHelper.widget_more_url
|
"archive_url" => OrbitHelper.widget_more_url
|
||||||
}
|
}
|
||||||
end
|
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
|
"archives" => archives
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue