Update category and tag

This commit is contained in:
manson 2014-05-16 16:26:43 +08:00
parent 8e5f1af790
commit 325838cf59
2 changed files with 18 additions and 11 deletions

View File

@ -40,7 +40,7 @@
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t(:category) %></label> <label class="control-label muted"><%= t(:category) %></label>
<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>
@ -81,14 +81,7 @@
<!-- Tag --> <!-- Tag -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label> <label class="control-label muted"><%= t(:tags) %></label>
<div class="controls" data-toggle="buttons-checkbox"> <%= select_tag(f, @module_app) %>
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @archive_file.tags.include?(tag) %>">
<%= check_box_tag 'archive_file[tags][]', tag.id, @archive_file.tags.include?(tag) %> <%= tag.name %>
<%= hidden_field_tag 'archive_file[tags][]', '' %>
</label>
<% end %>
</div>
</div> </div>
</div> </div>

View File

@ -15,15 +15,29 @@ module Archive
active_for_controllers (['admin/archive_files']) active_for_controllers (['admin/archive_files'])
head_link_path "admin_archive_files_path" head_link_path "admin_archive_files_path"
context_link 'archive.all', context_link 'all',
:link_path=>"admin_archive_files_path" , :link_path=>"admin_archive_files_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/archive_files'=>"index"} :active_for_action=>{'admin/archive_files'=>"index"}
context_link 'archive.new', context_link 'new_',
:link_path=>"new_admin_archive_file_path" , :link_path=>"new_admin_archive_file_path" ,
:priority=>2, :priority=>2,
:active_for_action=>{'admin/archive_files'=>"new"} :active_for_action=>{'admin/archive_files'=>"new"}
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'archive').id}",
:priority=>3,
:active_for_action=>{'admin/archive_files'=>'categories'},
:active_for_category => 'Archive'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'archive').id}",
:priority=>4,
:active_for_action=>{'admin/archive_files'=>'tags'},
:active_for_tag => 'Archive'
end end
end end
end end