From 0eb4bf5b37dfd66c6d1a0567c929f69b892fefac Mon Sep 17 00:00:00 2001 From: Bernie Chiu Date: Thu, 22 Aug 2013 16:34:18 +0800 Subject: [PATCH] Edit category --- .../dictionary_vocab_categorys/_form.html.erb | 2 +- .../dictionary_vocab_categorys/create.js.erb | 2 +- .../dictionary_vocab_categorys/edit.js.erb | 1 + .../dictionary_vocab_categorys/index.html.erb | 4 ++-- .../dictionary_vocab_categorys/update.js.erb | 4 ++++ vendor/built_in_modules/dictionary/init.rb | 22 +++++++++---------- 6 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/edit.js.erb create mode 100644 vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/update.js.erb diff --git a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/_form.html.erb b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/_form.html.erb index d4c079d43..68cf72597 100644 --- a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/_form.html.erb +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/_form.html.erb @@ -1,6 +1,6 @@ <% # encoding: utf-8 %> -<%= form_for(@dictionary_vocab_category, :url => @url) do |f| %> +<%= form_for(@dictionary_vocab_category, :remote => true, :url => @url) do |f| %>

<%= (@dictionary_vocab_category.new_record? ? 'Add' : 'Edit') %>

diff --git a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/create.js.erb b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/create.js.erb index 9a2a1a960..c69e72115 100644 --- a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/create.js.erb +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/create.js.erb @@ -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(); \ No newline at end of file diff --git a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/edit.js.erb b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/edit.js.erb new file mode 100644 index 000000000..eaff01fa3 --- /dev/null +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/edit.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); \ No newline at end of file diff --git a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/index.html.erb b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/index.html.erb index 019ee9d82..5077dca4f 100644 --- a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/index.html.erb +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/index.html.erb @@ -1,9 +1,9 @@ <%= flash_messages %> - +
- + <% @site_valid_locales.each do |locale| %> <% end %> diff --git a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/update.js.erb b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/update.js.erb new file mode 100644 index 000000000..05d2a6e8f --- /dev/null +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/back_end/dictionary_vocab_categorys/update.js.erb @@ -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(); \ No newline at end of file diff --git a/vendor/built_in_modules/dictionary/init.rb b/vendor/built_in_modules/dictionary/init.rb index 9584e039d..68dd78eff 100644 --- a/vendor/built_in_modules/dictionary/init.rb +++ b/vendor/built_in_modules/dictionary/init.rb @@ -1,6 +1,6 @@ module Dictionary OrbitApp.registration "Dictionary",:type=> 'ModuleApp' do - module_label 'archive.archive' + module_label 'dictionary.dictionary' base_url File.expand_path File.dirname(__FILE__) # personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive' @@ -17,7 +17,7 @@ module Dictionary end end - category ["ArchiveFileCategory"] + category ["DictionaryVocabCategory"] 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]}} # end - categories_query 'ArchiveFileCategory.all' - tags_query 'ArchiveTag.all' + # categories_query 'ArchiveFileCategory.all' + # tags_query 'ArchiveTag.all' - customize_widget "index" do - widget_i18n "archive.widget.index" - style ["1"] - end + # customize_widget "index" do + # widget_i18n "archive.widget.index" + # style ["1"] + # end - customize_widget "archive_search_block" do - widget_i18n "announcement.widget.search" - end + # customize_widget "archive_search_block" do + # widget_i18n "announcement.widget.search" + # end # item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"] # item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
<%= t('dictionary_file_category.key') %><%= t('dictionary_vocab_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>