Compare commits

..
Author SHA1 Message Date
Matt K. Fu caf0426bd4 bulletin search 2013-05-01 12:16:28 +08:00
Matt K. Fu 7d077a92a5 system preference 2013-04-29 15:23:15 +08:00
11 changed files with 44 additions and 269 deletions

No files matched your search

@@ -9,7 +9,7 @@
<div class="tab-content">
<div class="tab-pane active in" id="summary">
<h2><%= I18n.t("site.system_preference_.summary.disk_space") %>:</h2>
<%= content_tag :p,@site.disk_space %>
<%= content_tag :p,@site.disk_space.gsub(/\n/,"<br />").html_safe if @site.disk_space %>
<h2><%= I18n.t("site.system_preference_.summary.code_update_at") %>: </h2>
<% @site.system_package_info.each do |index,value| %>
<h2><%= index.titleize %> <%= I18n.t("site.system_preference_.summary.version") %>:</h2>
@@ -20,7 +20,7 @@
<div class="tab-pane" id="commits">
<% if @git_commit_list_file %>
<% @git_commit_list_file.lines do |line|%>
<%= (line + "<br/>").html_safe %>
<%= line %><br/>
<% end%>
<% else %>
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
@@ -29,7 +29,7 @@
<div class="tab-pane" id="backups">
<%if @db_backup_list_file %>
<% @db_backup_list_file.lines do |line|%>
<%=(line + "<br/>").html_safe %>
<%=line %><br/>
<% end %>
<% else %>
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
@@ -38,7 +38,7 @@
<div class="tab-pane" id="resque_logs">
<%if @db_backup_list_file %>
<% @resque_logs_file.lines do |line|%>
<%=(line + "<br/>").html_safe %>
<%=line %><br/>
<% end if @resque_logs_file%>
<%else %>
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
@@ -7,7 +7,7 @@ module OrbitSystemPreference
DefaultDiskSpaceLimit = 3 #in GB
module SystemPackage
MongodbVersion = "mongod --version"
NginxVersion = "nginx -V"
NginxVersion = "nginx -V 2>&1"
SystemVersion = "uname -a"
end
end
+1 -1
View File
@@ -396,7 +396,7 @@ zh_tw:
tab_backups: 備份記錄
tab_commits: 程式版本
tab_summary: 總覽
tab_logs: 登錄檔
tab_logs: 排程工作日誌
summary:
code_update_at: 程式更新紀錄
disk_space: 硬碟空間
@@ -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
@@ -86,7 +86,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
end
def bulletins_search_block
@part = PagePart.find params[:part_id]
end
protected
@@ -4,269 +4,26 @@
<h1 class="h1"><%= @page.title rescue nil %></h1>
<% if !@item.frontend_field.blank? %>
<% if @frontend_style == '1' %>
<div class="news news1">
<table class="newstb" border="0" cellpadding="0" cellspacing="0" >
<thead>
<tr>
<% @item.frontend_field.each do |ff| %>
<th><span class="<%= ff[1] %>"><%= t("announcement.bulletin.#{ff[0]}") if !ff[0].blank? %></span></th>
<% end %>
</tr>
</thead>
<% @bulletins.each do |post| %>
<tr class="<%= cycle('odd', '')%>">
<% @item.frontend_field.each do |ff| %>
<td>
<span class="<%= ff[1] %>">
<% 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' %>
<div class="img app-pic"><%= image_tag(post.send(wf[0]).url) %></div>
<% 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? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% 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 %>
</span>
</td>
<% end %>
</tr>
<% end %>
</table>
</div>
<% elsif @frontend_style == '2' %>
<div class="news news2">
<ul class="newslist">
<% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
<% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>">
<% if ff[1] == 'title' %>
<%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<% elsif ff[1] == 'date' %>
<%= display_date(post.send(ff[0])) %>
<% elsif ff[1] == 'category' %>
<%= post.send("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% 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? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% 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 %>
</span>
<% end %>
</li>
<% end %>
</ul>
</div>
<% elsif @frontend_style == '3' %>
<div class="news news3">
<ul class="newslist">
<% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
<div class="wrap">
<% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>">
<% 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("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% 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? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% 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 %>
</span>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
<% elsif @frontend_style == '4' %>
<div class="news news4">
<ul class="newslist">
<% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<div class="img app-pic"><%= image_tag(post.image.url) %></div>
<div class="wrap">
<% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>">
<% 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("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% 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? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% 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 %>
</span>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
<% elsif @frontend_style == '5' %>
<div class="news news5">
<div class="img app-pic"><%= image_tag(@bulletins.first.image.url) %></div>
<ul class="newslist">
<% @bulletins.each do |post| %>
<li class="<%= cycle('odd', '')%>">
<% @item.frontend_field.each do |ff| %>
<span class="<%= ff[1] %>">
<% 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("#{post.class.to_s.underscore}_#{ff[0]}").title rescue nil %>
<% 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? %>
<span class="top"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<span class="hot"><%= t(:hot) %></span>
<% 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 %>
</span>
<% end %>
</li>
<% end %>
</ul>
</div>
<table class="table table-bordered">
<tr>
<%= content_tag (:th) do %>
<%= t(:category) %>
<% end if (!params[:search_query].blank? or params[:category_id].blank?)-%>
<th><%= t(:title) %></th>
<th><%= t(:postdate) %></th>
</tr>
<% if !params[:name].blank?%>
<%= t("search.unit_get",:unit_name => params[:name],:item_num=>@bulletins.count) %>
<% end %>
<% if @bulletins.blank? and !params[:search_query].blank? %>
<%=render :partial => 'shared/search_not_found' %>
<% elsif !params[:search_query].blank? %>
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>@bulletins.count) unless (@bulletins.count == 30) %>
<%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %>
<% end %>
<% @bulletins.each do |post| %>
<tr class=<%= cycle('odd', '') %>>
<%= content_tag(:th) do%>
<td><%= (post.bulletin_category.title rescue nil ) %></td>
<% end if(!params[:search_query].blank? or params[:category_id].blank?) %>
<td><%= 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) %>
</td>
<td class="date"><%= display_date_time(post.postdate) %></td>
</tr>
<% end %>
</table>
<% end %>
<% else %>
<table class="table table-bordered">
<tr>
<th><%= t('announcement.bulletin.category') %></th>
<%= t('announcement.bulletin.category') %>
<% end if (!params[:search_query].blank? or params[:category_id].blank?)-%>
<th><%= t('announcement.bulletin.title') %></th>
<th><%= t('announcement.bulletin.postdate') %></th>
</tr>
<% if !params[:name].blank?%>
<%= t("search.unit_get",:unit_name => params[:name],:item_num=>@bulletins.count) %>
<% end %>
<% if @bulletins.blank? and !params[:search_query].blank? %>
<%=render :partial => 'shared/search_not_found' %>
<% elsif !params[:search_query].blank? %>
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>@bulletins.count) unless (@bulletins.count == 30) %>
<%= t("search.too_many",:search_word => params[:search_query],:exceed_num=>@bulletins.count) if (@bulletins.count ==30) %>
<% end %>
<% @bulletins.each do |post| %>
<tr>
<td><%= post.bulletin_category.title rescue nil %></td>
@@ -280,7 +37,5 @@
</table>
<% end %>
<%= paginate @bulletins, :param_name => :page_main, :params => {:inner => 'false'} %>
@@ -1,8 +1,8 @@
<%= form_tag panel_announcement_front_end_bulletins_path, method: :get do %>
<%= form_tag panel_announcement_front_end_announcement_search_path, method: :get do %>
<%= hidden_field_tag :category_id, params[:category_id] %>
<%= hidden_field_tag :tag_id, params[:tag_id] %>
<p>
<%= 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 %>
</p>
<% end %>
+2 -1
View File
@@ -34,4 +34,5 @@ en:
url: URL
widget:
bulletins_and_web_links: Bulletins and Web Resources
index: Index
index: Index
search: Search
@@ -34,4 +34,5 @@ zh_tw:
url: 連結位置
widget:
bulletins_and_web_links: 索引
index: 索引
index: 索引
search: 搜尋
+1
View File
@@ -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
+5
View File
@@ -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