Update category and tag

This commit is contained in:
manson 2014-05-13 15:30:44 +08:00
parent 352fdfa76c
commit 05713bdb2c
3 changed files with 21 additions and 14 deletions

View File

@ -3,7 +3,7 @@ class Admin::FaqsController < OrbitAdminController
before_filter :setup_vars before_filter :setup_vars
def index def index
@table_fields = ["Status","Category","Title","Tags"] @table_fields = ["status","category","title","tags"]
@categories = @module_app.categories @categories = @module_app.categories
@tags = @module_app.tags @tags = @module_app.tags
@filter_fields = { @filter_fields = {

View File

@ -39,7 +39,7 @@
<div class="control-group"> <div class="control-group">
<%= f.label :category ,t(:category), :class=>"control-label muted" %> <%= f.label :category ,t(:category), :class=>"control-label muted" %>
<div class="controls"> <div class="controls">
<%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %> <%= select_category(f, @module_app) %>
</div> </div>
</div> </div>
@ -72,14 +72,7 @@
<!-- Tag --> <!-- Tag -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted">Tag</label> <label class="control-label muted">Tag</label>
<div class="controls" data-toggle="buttons-checkbox"> <%= select_tag(f, @module_app) %>
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @qa.tags.include?(tag) %>">
<%= check_box_tag 'qa[tags][]', tag.id, @qa.tags.include?(tag)%>
<%= tag.name %>
</label>
<% end %>
</div>
</div> </div>
</div> </div>
@ -120,7 +113,7 @@
<% end %> <% end %>
<!-- Link --> <!-- Link -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted">Link</label> <label class="control-label muted"><%= t(:link) %></label>
<div class="controls add-input"> <div class="controls add-input">
<!-- Exist --> <!-- Exist -->
@ -147,7 +140,7 @@
<!-- File --> <!-- File -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted">File</label> <label class="control-label muted"><%= t(:file_) %></label>
<div class="controls"> <div class="controls">
<!-- Exist --> <!-- Exist -->

View File

@ -15,15 +15,29 @@ module Faq
active_for_controllers (['admin/faqs']) active_for_controllers (['admin/faqs'])
head_link_path "admin_faqs_path" head_link_path "admin_faqs_path"
context_link 'faq.all', context_link 'all',
:link_path=>"admin_faqs_path" , :link_path=>"admin_faqs_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/faqs'=>"index"} :active_for_action=>{'admin/faqs'=>"index"}
context_link 'faq.new', context_link 'new_',
:link_path=>"new_admin_faq_path" , :link_path=>"new_admin_faq_path" ,
:priority=>2, :priority=>2,
:active_for_action=>{'admin/faqs'=>"new"} :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 end
end end