From 05713bdb2cca8840a367cd3b7294a8371b08a410 Mon Sep 17 00:00:00 2001 From: manson Date: Tue, 13 May 2014 15:30:44 +0800 Subject: [PATCH] Update category and tag --- app/controllers/admin/faqs_controller.rb | 2 +- app/views/admin/faqs/_form.html.erb | 15 ++++----------- lib/faq/engine.rb | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/controllers/admin/faqs_controller.rb b/app/controllers/admin/faqs_controller.rb index bcf6744..6a0845d 100644 --- a/app/controllers/admin/faqs_controller.rb +++ b/app/controllers/admin/faqs_controller.rb @@ -3,7 +3,7 @@ class Admin::FaqsController < OrbitAdminController before_filter :setup_vars def index - @table_fields = ["Status","Category","Title","Tags"] + @table_fields = ["status","category","title","tags"] @categories = @module_app.categories @tags = @module_app.tags @filter_fields = { diff --git a/app/views/admin/faqs/_form.html.erb b/app/views/admin/faqs/_form.html.erb index e1d1ddb..5eb1936 100644 --- a/app/views/admin/faqs/_form.html.erb +++ b/app/views/admin/faqs/_form.html.erb @@ -39,7 +39,7 @@
<%= f.label :category ,t(:category), :class=>"control-label muted" %>
- <%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %> + <%= select_category(f, @module_app) %>
@@ -72,14 +72,7 @@
-
- <% @tags.each do |tag| %> - - <% end %> -
+ <%= select_tag(f, @module_app) %>
@@ -120,7 +113,7 @@ <% end %>
- +
@@ -147,7 +140,7 @@
- +
diff --git a/lib/faq/engine.rb b/lib/faq/engine.rb index 8becbc4..6992b99 100644 --- a/lib/faq/engine.rb +++ b/lib/faq/engine.rb @@ -15,15 +15,29 @@ module Faq active_for_controllers (['admin/faqs']) head_link_path "admin_faqs_path" - context_link 'faq.all', + context_link 'all', :link_path=>"admin_faqs_path" , :priority=>1, :active_for_action=>{'admin/faqs'=>"index"} - context_link 'faq.new', + context_link 'new_', :link_path=>"new_admin_faq_path" , :priority=>2, :active_for_action=>{'admin/faqs'=>"new"} + + context_link 'categories', + :link_path=>"admin_module_app_categories_path" , + :link_arg=>{:module_app_id=>get_module_app.id}, + :priority=>3, + :active_for_action=>{'admin/faqs'=>'categories'}, + :active_for_category => 'Faq' + + context_link 'tags', + :link_path=>"admin_module_app_tags_path" , + :link_arg=>{:module_app_id=>get_module_app.id}, + :priority=>4, + :active_for_action=>{'admin/faqs'=>'tags'}, + :active_for_tag => 'Faq' end end end