From 000fcdd48f918a858346233d74d0c86da9822cb3 Mon Sep 17 00:00:00 2001 From: Bernie Chiu Date: Sun, 25 Aug 2013 14:40:34 +0800 Subject: [PATCH] Add search block --- .../widget/dictionary_vocabs_controller.rb | 15 +++++++++++++++ .../dictionary_search_block.html.erb | 7 +++++++ .../built_in_modules/dictionary/config/routes.rb | 9 ++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/widget/dictionary_vocabs_controller.rb create mode 100644 vendor/built_in_modules/dictionary/app/views/panel/dictionary/widget/dictionary_vocabs/dictionary_search_block.html.erb diff --git a/vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/widget/dictionary_vocabs_controller.rb b/vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/widget/dictionary_vocabs_controller.rb new file mode 100644 index 000000000..3450df414 --- /dev/null +++ b/vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/widget/dictionary_vocabs_controller.rb @@ -0,0 +1,15 @@ +class Panel::Dictionary::Widget::DictionaryVocabsController < OrbitWidgetController + include AdminHelper + + def initialize + super + @app_title = 'dictionary_vocabs' + end + + def get_categorys + @dictionary_vocab_categorys = DictionaryVocabCategory.excludes('disable' => true) + end + + def dictionary_search_block + end +end \ No newline at end of file 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 new file mode 100644 index 000000000..8103fb7ed --- /dev/null +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/widget/dictionary_vocabs/dictionary_search_block.html.erb @@ -0,0 +1,7 @@ +<%= form_tag panel_dictionary_front_end_dictionary_vocabs_path, method: :get do %> + <%= 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 %> +

+<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/dictionary/config/routes.rb b/vendor/built_in_modules/dictionary/config/routes.rb index 972bdef50..e931206b2 100644 --- a/vendor/built_in_modules/dictionary/config/routes.rb +++ b/vendor/built_in_modules/dictionary/config/routes.rb @@ -12,7 +12,14 @@ Rails.application.routes.draw do end namespace :front_end do - match "dictionary_vocabs" => "dictionary_vocabs#index" + get "dictionary_vocabs" => "dictionary_vocabs#index" + # resources :archive_files + end + + namespace :widget do + # match "index" => "archive_files#index" + get "dictionary_search_block", to: "dictionary_vocabs#dictionary_search_block" + get "dictionary_vocabs", to: "dictionary_vocabs#index" resources :dictionary_vocabs end # namespace :widget do