Edit category

This commit is contained in:
Bernie Chiu 2013-08-22 16:34:18 +08:00 committed by chris
parent 6e2725d279
commit 0eb4bf5b37
6 changed files with 20 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= form_for(@dictionary_vocab_category, :url => @url) do |f| %> <%= form_for(@dictionary_vocab_category, :remote => true, :url => @url) do |f| %>
<h2><%= (@dictionary_vocab_category.new_record? ? 'Add' : 'Edit') %></h2> <h2><%= (@dictionary_vocab_category.new_record? ? 'Add' : 'Edit') %></h2>

View File

@ -1,2 +1,2 @@
$('<%= j render :partial => 'dictionary_file_category', :collection => [@dictionary_file_category] %>').appendTo('#dictionary_file_categorys').hide().fadeIn(); $('<%= j render :partial => 'dictionary_vocab_category', :collection => [@dictionary_vocab_category] %>').appendTo('#dictionary_vocab_categorys').hide().fadeIn();
$("#new_dictionary_file_category")[0].reset(); $("#new_dictionary_file_category")[0].reset();

View File

@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -1,9 +1,9 @@
<%= flash_messages %> <%= flash_messages %>
<table id="dictionary_file_categorys" class="table main-list"> <table id="dictionary_vocab_categorys" class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1-2"><%= t('dictionary_file_category.key') %></th> <th class="span1-2"><%= t('dictionary_vocab_category.key') %></th>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th> <th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %> <% end %>

View File

@ -0,0 +1,4 @@
$("#<%= dom_id @dictionary_vocab_category %>").replaceWith("<%= j render :partial => 'dictionary_vocab_category', :collection => [@dictionary_vocab_category] %>");
<% @dictionary_vocab_category = DictionaryVocabCategory.new(:display => 'List') # reset for new form %>
$(".edit_dictionary_vocab_category").replaceWith("<%= j render "form" %>")
$(".new_dictionary_vocab_category")[0].reset();

View File

@ -1,6 +1,6 @@
module Dictionary module Dictionary
OrbitApp.registration "Dictionary",:type=> 'ModuleApp' do OrbitApp.registration "Dictionary",:type=> 'ModuleApp' do
module_label 'archive.archive' module_label 'dictionary.dictionary'
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
# personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive' # personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive'
@ -17,7 +17,7 @@ module Dictionary
end end
end end
category ["ArchiveFileCategory"] category ["DictionaryVocabCategory"]
taggable taggable
@ -29,17 +29,17 @@ module Dictionary
# link_field :archive_file_category_with_title,{:method => 'panel_archive_front_end_archive_files_path',:args=>{:category_id => [:archive_file_category,:id]}} # link_field :archive_file_category_with_title,{:method => 'panel_archive_front_end_archive_files_path',:args=>{:category_id => [:archive_file_category,:id]}}
# end # end
categories_query 'ArchiveFileCategory.all' # categories_query 'ArchiveFileCategory.all'
tags_query 'ArchiveTag.all' # tags_query 'ArchiveTag.all'
customize_widget "index" do # customize_widget "index" do
widget_i18n "archive.widget.index" # widget_i18n "archive.widget.index"
style ["1"] # style ["1"]
end # end
customize_widget "archive_search_block" do # customize_widget "archive_search_block" do
widget_i18n "announcement.widget.search" # widget_i18n "announcement.widget.search"
end # end
# item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"] # item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links" # item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"