{{answer}}
+ +{{question}}
+{{answer}}
+diff --git a/app/controllers/faqs_controller.rb b/app/controllers/faqs_controller.rb index 895e39d..2b48ae2 100644 --- a/app/controllers/faqs_controller.rb +++ b/app/controllers/faqs_controller.rb @@ -1,18 +1,25 @@ class FaqsController < ApplicationController def index faqs = Qa.can_display.order_by(:order_position => "asc").filter_by_categories - f = faqs.collect do |qa| + f = faqs.collect do |qa| statuses = qa.statuses_with_classname.collect do |status| { "status" => status["name"], "status-class" => "status-#{status['classname']}" } end + qa_files = qa.qa_files.map do |qa_file| + { + "file_url" => qa_file.file.url, + "file_title" => qa_file.title.blank? ? File.basename(qa_file["file"]) + } + end { "link_to_show" => OrbitHelper.url_to_show(qa.to_param), "question" => qa.title, "answer" => qa.answer, - "statuses" => statuses + "statuses" => statuses, + "qa_files" => qa_files } end { diff --git a/faq.gemspec b/faq.gemspec index 4162312..795c845 100644 --- a/faq.gemspec +++ b/faq.gemspec @@ -2,7 +2,18 @@ $:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "faq/version" - +app_path = File.expand_path(__dir__) +all_template = Dir.glob(template_path+'/*/') +all_template.each do |folder| + if !folder.include?('mobile') + begin + puts "updating faq index page" + Bundler.with_clean_env{%x[cp -f #{app_path}/modules/faq/faq_index2.html.erb #{folder}modules/faq/faq_index2.html.erb]} + rescue + puts "There has some error when updating faq index page." + end + end +end # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "faq" diff --git a/modules/faq/_faq_widget1.html.erb b/modules/faq/_faq_widget1.html.erb new file mode 100644 index 0000000..357ac03 --- /dev/null +++ b/modules/faq/_faq_widget1.html.erb @@ -0,0 +1,15 @@ +
\ No newline at end of file diff --git a/modules/faq/faq_index1.html.erb b/modules/faq/faq_index1.html.erb new file mode 100644 index 0000000..63b7fad --- /dev/null +++ b/modules/faq/faq_index1.html.erb @@ -0,0 +1,16 @@ +{{answer}}
+ +{{answer}}
+