64 lines
1.5 KiB
Ruby
64 lines
1.5 KiB
Ruby
module DelayedJobsHelper
|
|
def print_name(job)
|
|
case job.name
|
|
when "Class#expire_cache"
|
|
"<strong>expire post count cache</strong>"
|
|
|
|
when "Upload#process!"
|
|
"<strong>upload post</strong>"
|
|
|
|
when "Tag#update_related"
|
|
"<strong>update related tags</strong>"
|
|
|
|
when "TagAlias#process!"
|
|
"<strong>alias</strong>"
|
|
|
|
when "TagImplication#process!"
|
|
"<strong>implication</strong>"
|
|
|
|
when "Class#clear_cache_for"
|
|
"<strong>expire tag alias cache</strong>"
|
|
|
|
when "Tag#update_category_cache"
|
|
"<strong>update tag category cache</strong>"
|
|
|
|
when "Tag#update_category_post_counts"
|
|
"<strong>update category post counts</strong>"
|
|
|
|
else
|
|
h(job.name)
|
|
end
|
|
end
|
|
|
|
def print_handler(job)
|
|
case job.name
|
|
when "Class#expire_cache"
|
|
h(job.payload_object.args.flatten.join(" "))
|
|
|
|
when "Upload#process!"
|
|
%{<a href="/uploads/#{job.payload_object.object.id}">record</a>}
|
|
|
|
when "Tag#update_related"
|
|
h(job.payload_object.name)
|
|
|
|
when "TagAlias#process!"
|
|
h(job.payload_object.antecedent_name) + " -> " + h(job.payload_object.consequent_name)
|
|
|
|
when "TagImplication#process!"
|
|
h(job.payload_object.antecedent_name) + " -> " + h(job.payload_object.consequent_name)
|
|
|
|
when "Class#clear_cache_for"
|
|
h(job.payload_object.args.flatten.join(" "))
|
|
|
|
when "Tag#update_category_cache"
|
|
h(job.payload_object.name)
|
|
|
|
when "Tag#update_category_post_counts"
|
|
h(job.payload_object.name)
|
|
|
|
else
|
|
h(job.handler)
|
|
end
|
|
end
|
|
end
|