diff --git a/app/controllers/faqs_controller.rb b/app/controllers/faqs_controller.rb index 5acb529..9e52db1 100644 --- a/app/controllers/faqs_controller.rb +++ b/app/controllers/faqs_controller.rb @@ -33,4 +33,18 @@ class FaqsController < ApplicationController "faqs_files" => faqs_files } end + + def widget + faqs = Qa.filter_by_widget_categories.collect do |qa| + { + "link_to_show" => OrbitHelper.url_to_show(qa.to_param), + "title" => qa.title, + "postdate" => qa.created_at.strftime('%Y-%m-%d %H:%M') + } + end + { + "faqs" => faqs, + "extras" => {"widget-title"=>"Faqs"} + } + end end \ No newline at end of file diff --git a/lib/faq/engine.rb b/lib/faq/engine.rb index 4fb1197..c917628 100644 --- a/lib/faq/engine.rb +++ b/lib/faq/engine.rb @@ -4,7 +4,8 @@ module Faq OrbitApp.registration "Faq", :type => "ModuleApp" do module_label "faq.faq" base_url File.expand_path File.dirname(__FILE__) - + widget_methods ['widget'] + widget_settings [{"data_count"=>10}] taggable "Qa" categorizable authorizable