From 9625aa0f8b6be995dab9e62ecf8d082407cbe3f4 Mon Sep 17 00:00:00 2001 From: Bernie Chiu Date: Sun, 25 Aug 2013 14:49:02 +0800 Subject: [PATCH] Improve some models --- .../dictionary/app/models/archive_file.rb | 9 ++++----- .../dictionary/app/models/dictionary_vocab.rb | 4 ++-- .../dictionary_vocabs/dictionary_search_block.html.erb | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/vendor/built_in_modules/dictionary/app/models/archive_file.rb b/vendor/built_in_modules/dictionary/app/models/archive_file.rb index 780944d65..2edfc8118 100644 --- a/vendor/built_in_modules/dictionary/app/models/archive_file.rb +++ b/vendor/built_in_modules/dictionary/app/models/archive_file.rb @@ -78,11 +78,10 @@ class ArchiveFile end def save_archive_file_multiples - self.archive_file_multiples.each do |t| - if t.should_destroy - t.destroy - end + self.archive_file_multiples.each do |t| + if t.should_destroy + t.destroy + end end end - end diff --git a/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb b/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb index 909cf341f..d9f0daf90 100644 --- a/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb +++ b/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb @@ -23,9 +23,9 @@ class DictionaryVocab # field :is_hot, :type => Boolean, :default => false # field :is_hidden, :type => Boolean, :default => false - # scope :can_display,where(is_hidden: false) + scope :can_display, where(is_hidden: false) - # belongs_to :archive_file_category + belongs_to :dictionary_vocab_category # has_many :archive_file_multiples, :autosave => true, :dependent => :destroy diff --git a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/widget/dictionary_vocabs/dictionary_search_block.html.erb b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/widget/dictionary_vocabs/dictionary_search_block.html.erb index 8103fb7ed..02339a5b1 100644 --- a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/widget/dictionary_vocabs/dictionary_search_block.html.erb +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/widget/dictionary_vocabs/dictionary_search_block.html.erb @@ -2,6 +2,6 @@ <%= hidden_field_tag :category_id, params[:category_id] %>

<%= text_field_tag :search_query, params[:search_query],{ value: (params[:search_query].blank? ? '' : params[:search_query]), placeholder: t("dictionary.widget.search") }%> - <%= submit_tag "Search", name: nil %> + <%= submit_tag t("dictionary.widget.search"), name: nil %>

<% end %> \ No newline at end of file