diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index e4bae5e5b..9866f67f4 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -13,6 +13,18 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController render :index end + def search_result + @search = Bulletin.solr_search do + fulltext params[:search_query] + with(:frontend_search,true) + with(:available_lang).any_of([I18n.locale.to_s]) + end + search_result = @search.results.collect{|result| result.id} + + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num) + render 'index' + end + def index @item = Page.find(params[:page_id]) rescue nil if @item diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index c8d328275..a8c016e87 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -86,7 +86,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController end def bulletins_search_block - + @part = PagePart.find params[:part_id] end protected diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb index fdf4e0974..9e2ade22b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb @@ -4,269 +4,26 @@
<%= t("announcement.bulletin.#{ff[0]}") if !ff[0].blank? %> | - <% end %> -
---|
-
- <% if ff[1] == 'title' %>
- <%= link_to post.send("#{ff[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
- <% elsif ff[1] == 'date' %>
- <%= display_date(post.send(ff[0])) %>
- <% elsif ff[1] == 'category' %>
- <%= post.send(ff[0]).title rescue nil %>
- <% elsif ff[1] == 'img' %>
- <%= image_tag(post.send(wf[0]).url) %>
- <% elsif ff[1] == 'text' %>
- <%#= post.send("#{ff[0]}[#{I18n.locale}]").html_safe %>
- <%= post.send("#{ff[0]}").html_safe %>
- <% elsif ff[1] == 'status' %>
- <% if post.is_top? %>
- <%= t(:top) %>
- <% end %>
- <% if post.is_hot? %>
- <%= t(:hot) %>
- <% end %>
- <% elsif ff[1] == 'link' %>
- <% elsif ff[1] == 'file' %>
- <% elsif ff[1] == 'tag' %>
- <% elsif ff[1] == 'viewcount' %>
- <%= dislpay_view_count(post) %>
- <% elsif ff[1] == 'poster' %>
- <%= User.from_id(post.update_user_id).name rescue ''%>
- <% end %>
-
- |
- <% end %>
-
<%= t(:title) %> | -<%= t(:postdate) %> | -|
---|---|---|
<%= (post.bulletin_category.title rescue nil ) %> | - <% end if(!params[:search_query].blank? or params[:category_id].blank?) %> -<%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> - <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %> - | -<%= display_date_time(post.postdate) %> | -
<%= t('announcement.bulletin.category') %> | + <%= t('announcement.bulletin.category') %> + <% end if (!params[:search_query].blank? or params[:category_id].blank?)-%><%= t('announcement.bulletin.title') %> | <%= t('announcement.bulletin.postdate') %> |
---|---|---|
<%= post.bulletin_category.title rescue nil %> | @@ -280,7 +37,5 @@
<%= text_field_tag :search_query, params[:search_query],{:value => (params[:search_query].blank?? '' : params[:search_query]),:placeholder => t("announcement.search") }%> - <%= submit_tag "Search", name: nil %> + <%= submit_tag t("search_"), name: nil %>
<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 93a1f1804..dd0a63299 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -34,4 +34,5 @@ en: url: URL widget: bulletins_and_web_links: Bulletins and Web Resources - index: Index \ No newline at end of file + index: Index + search: Search \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index a93822336..84635dbea 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -34,4 +34,5 @@ zh_tw: url: 連結位置 widget: bulletins_and_web_links: 索引 - index: 索引 \ No newline at end of file + index: 索引 + search: 搜尋 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 8c11ebd05..adb637038 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -46,6 +46,7 @@ Rails.application.routes.draw do end namespace :front_end do match "index_by_unit" => "bulletins#index_bulletins_by_unit",:as => :index_bulletins_by_unit + match "search_result" => "bulletins#search_result",:as=>:announcement_search resources :bulletins # do # match "preview" => "bulletins#preview_content",:as => :get_preview_content # end diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index 5aae60574..d17c34bb2 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -39,6 +39,11 @@ module Announcement widget_i18n "announcement.widget.index" style ["1","2"] end + + customize_widget "bulletins_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" end