36 lines
743 B
Ruby
36 lines
743 B
Ruby
|
class FaqsController < ApplicationController
|
||
|
def index
|
||
|
faqs = Qa.filter_by_categories.collect do |qa|
|
||
|
{
|
||
|
"link_to_show" => OrbitHelper.url_to_show(qa.to_param),
|
||
|
"question" => qa.title
|
||
|
}
|
||
|
end
|
||
|
{
|
||
|
"data" => faqs,
|
||
|
"extras" => {"widget-title"=>"Faqs"}
|
||
|
}
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
params = OrbitHelper.params
|
||
|
faq = Qa.find_by_param(params[:uid])
|
||
|
faqs_files = faq.qa_files.collect do |f|
|
||
|
{
|
||
|
"file_url" => f.file.url,
|
||
|
"file_title" => f.title
|
||
|
}
|
||
|
end
|
||
|
faqs_links = faq.qa_links.collect do |f|
|
||
|
{
|
||
|
"link_url" => f.url,
|
||
|
"link_title" => f.title
|
||
|
}
|
||
|
end
|
||
|
{
|
||
|
"extras" => {"question" => faq.title,"answer" => faq.answer},
|
||
|
"faqs_links" => faqs_links,
|
||
|
"faqs_files" => faqs_files
|
||
|
}
|
||
|
end
|
||
|
end
|