This commit is contained in:
Matthew K. Fu JuYuan 2012-08-13 18:35:47 +08:00
parent 080974b563
commit 6cc470ede9
19 changed files with 72 additions and 14 deletions

View File

@ -22,5 +22,7 @@ $(document).on('click', '.quick_edit_cancel', function(){
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
}); });
$('.reject_info').tooltip({
placement : 'bottom'
});
}); });

View File

@ -23,4 +23,7 @@ $(document).on('click', '.quick_edit_cancel', function(){
$("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide();
$("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide(); $("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide();
}); });
$('.reject_info').tooltip({
placement : 'bottom'
});
}); });

View File

@ -226,4 +226,9 @@ module ApplicationHelper
end end
end end
def wrap_string_with(str,options={})
line_width = options[:line_width] || 12
wrap_mark = options[:wrap_mark] || "<br />"
str.scan((/.{0,#{line_width}}/)).join(wrap_mark)
end
end end

View File

@ -298,6 +298,7 @@ en:
sys: sys:
not_previewable: "Preview not support" not_previewable: "Preview not support"
limit_of_upload_file_size: "Upload file must be less than: %{best_size}" limit_of_upload_file_size: "Upload file must be less than: %{best_size}"
preview_only_for_img: "Preview only supprt with file type:jpg,png,gif,bmp"
can_not_display_due_to_no_context: "Can not display due to no context for English" can_not_display_due_to_no_context: "Can not display due to no context for English"
module_page_lang_not_support: "We are sorry, this page is not available for English" module_page_lang_not_support: "We are sorry, this page is not available for English"
search: search:

View File

@ -528,6 +528,7 @@ zh_tw:
sys: sys:
not_previewable: "不支援預覽" not_previewable: "不支援預覽"
limit_of_upload_file_size: "上傳檔案大小限制: %{best_size}" limit_of_upload_file_size: "上傳檔案大小限制: %{best_size}"
preview_only_for_img: "預覽僅支援jpg,png,gif,bmp...等圖片格式"
can_not_display_due_to_no_context: "因為沒有中文版本,所以無法顯示" can_not_display_due_to_no_context: "因為沒有中文版本,所以無法顯示"
module_page_lang_not_support: "很抱歉,本頁沒有開放中文版本" module_page_lang_not_support: "很抱歉,本頁沒有開放中文版本"
object_disable: object_disable:

View File

@ -183,7 +183,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# PUT /bulletins/1.xml # PUT /bulletins/1.xml
def update def update
if params[:bulletin_link] if params[:bulletin_link]
@bulletin_link = BulletinLink.find(params[:id]) @bulletin_link = BulletinLink.find(params[:id])

View File

@ -54,7 +54,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
preview_content preview_content
else else
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first @bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
if !@bulletin.disable? if !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s) if @bulletin.enabled_for_lang(I18n.locale.to_s)
impressionist(@bulletin) impressionist(@bulletin)
get_categorys get_categorys

View File

@ -1,4 +1,10 @@
module Panel::Announcement::BackEnd::BulletinsHelper module Panel::Announcement::BackEnd::BulletinsHelper
def show_reject_reason(bulletin)
by_bulletin = bulletin.is_rejected
by_user = (((bulletin.create_user_id == current_user.id) rescue nil) or is_manager? or is_admin?)
by_bulletin && by_user
end
def show_form_status_field(bulletin) def show_form_status_field(bulletin)
#by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?) #by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?)
by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?) by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)

View File

@ -56,6 +56,9 @@
<% if show_approval_link(bulletin) %> <% if show_approval_link(bulletin) %>
<li><%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %> <li><%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
<% end %> <% end %>
<% if show_reject_reason(bulletin)%>
<li><%= link_to t('rejected_reason')+truncate(bulletin.not_checked_reason, :length => 10),'#',:rel=>"tooltip" ,'data-original-title'=> (wrap_string_with(bulletin.not_checked_reason, :line_width => 24)),:class=>'reject_info' %></li>
<% end %>
</ul> </ul>
</div> </div>
</td> </td>

View File

@ -49,6 +49,17 @@
</div> </div>
</div> </div>
</div> </div>
<% end %>
<% if @bulletin.is_rejected %>
<div id="widget-rejected" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Rejected Report" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Approval Status</h3>
<div class="widget-content clear form-horizontal">
<%= @bulletin.not_checked_reason rescue t("rejected_reason_empty") %>
</div>
</div>
<% end %> <% end %>
<div id="widget-tags" class="widget-box widget-size-300"> <div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear"> <div class="widget-action clear">
@ -198,6 +209,7 @@
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %> <%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a> <a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p> <p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
<p><%= t("sys.preview_only_for_img") %></p>
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -35,6 +35,9 @@ en:
passed: Passed passed: Passed
pending: Pending pending: Pending
rejected: Rejected rejected: Rejected
rejected_reason: 'Reason:'
rejected_reason_empty: "Approval rejected,no referencable information"
clear: Clear clear: Clear
hot: Hot hot: Hot

View File

@ -30,6 +30,8 @@ zh_tw:
passed: 審核通過 passed: 審核通過
pending: 待審查 pending: 待審查
rejected: 不通過 rejected: 不通過
rejected_reason_empty: 審核沒有通過,沒有相關訊息
rejected_reason: '原因:'
clear: 清除 clear: 清除
quick_edit: 快速編輯 quick_edit: 快速編輯

View File

@ -226,7 +226,6 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
# PUT /news_bulletins/1 # PUT /news_bulletins/1
# PUT /news_bulletins/1.xml # PUT /news_bulletins/1.xml
def update def update
if params[:news_bulletin_link] if params[:news_bulletin_link]
@news_bulletin_link = NewsBulletinLink.find(params[:id]) @news_bulletin_link = NewsBulletinLink.find(params[:id])
@ -278,7 +277,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
end end
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner') expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) } # format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) }
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.update_success')) } format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news.news_bulletin.update_success')) }
format.js { render 'toggle_enable' } format.js { render 'toggle_enable' }
format.xml { head :ok } format.xml { head :ok }
else else

View File

@ -54,7 +54,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
else else
'' ''
@news_bulletin = NewsBulletin.all.can_display.where(_id: params[:id]).first @news_bulletin = NewsBulletin.all.can_display.where(_id: params[:id]).first
if !@news_bulletin.disable? if !@news_bulletin.disable? and !@news_bulletin.is_rejected
if @news_bulletin.enabled_for_lang(I18n.locale.to_s) if @news_bulletin.enabled_for_lang(I18n.locale.to_s)
impressionist(@news_bulletin) impressionist(@news_bulletin)
get_categorys get_categorys

View File

@ -1,4 +1,9 @@
module Panel::News::BackEnd::NewsBulletinsHelper module Panel::News::BackEnd::NewsBulletinsHelper
def news_show_reject_reason(news_bulletin)
by_news_bulletin = news_bulletin.is_rejected
by_user = (((news_bulletin.create_user_id == current_user.id) rescue nil) or is_manager? or is_admin?)
by_news_bulletin && by_user
end
def news_show_form_status_field(news_bulletin) def news_show_form_status_field(news_bulletin)
#by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?) #by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?)
by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?) by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)

View File

@ -100,6 +100,17 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<% if @news_bulletin.is_rejected %>
<div id="widget-rejected" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Rejected Report" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Approval Status</h3>
<div class="widget-content clear form-horizontal">
<%= @news_bulletin.not_checked_reason rescue t("rejected_reason_empty") %>
</div>
</div>
<% end %>
<% if params[:action] != 'new' %> <% if params[:action] != 'new' %>
<div id="widget-audit" class="widget-box"> <div id="widget-audit" class="widget-box">
<div class="widget-action clear"> <div class="widget-action clear">
@ -239,6 +250,7 @@
<%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %> <%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a> <a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p> <p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
<p><%= t("sys.preview_only_for_img") %></p>
</div> </div>
</td> </td>

View File

@ -46,9 +46,6 @@
<li><%#= link_to t(:file), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %></li> <li><%#= link_to t(:file), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %></li>
</ul> </ul>
</li> </li>
<%#= debugger %>
<%#= a=1 %>
<% end %> <% end %>
<% end %> <% end %>
<% if news_show_delete_link(news_bulletin) %> <% if news_show_delete_link(news_bulletin) %>
@ -57,7 +54,9 @@
<% if news_show_approval_link(news_bulletin) %> <% if news_show_approval_link(news_bulletin) %>
<li><%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %> <li><%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
<% end %> <% end %>
<% if news_show_reject_reason(news_bulletin)%>
<li><%= link_to t('rejected_reason')+truncate(news_bulletin.not_checked_reason, :length => 10),'#',:rel=>"tooltip" ,'data-original-title'=> (wrap_string_with(news_bulletin.not_checked_reason, :line_width => 24)),:class=>'reject_info' %></li>
<% end %>
</ul> </ul>
</div> </div>
</td> </td>

View File

@ -35,6 +35,9 @@ en:
passed: Passed passed: Passed
pending: Pending pending: Pending
rejected: Rejected rejected: Rejected
rejected_reason: 'Reason:'
rejected_reason_empty: "Approval rejected,no referencable information"
clear: Clear clear: Clear
hot: Hot hot: Hot
@ -79,7 +82,7 @@ en:
approval_pending: 'Pending' approval_pending: 'Pending'
approval_pass: 'Pass' approval_pass: 'Pass'
approval_setting_window_title: 'Unit' approval_setting_window_title: 'Unit'
update_success: Successfully Updated
# admin: # admin:
# action: Action # action: Action
# add_language: Add language # add_language: Add language

View File

@ -30,6 +30,8 @@ zh_tw:
passed: 審核通過 passed: 審核通過
pending: 待審查 pending: 待審查
rejected: 不通過 rejected: 不通過
rejected_reason: '原因:'
rejected_reason_empty: 審核沒有通過,沒有相關訊息
clear: 清除 clear: 清除
quick_edit: 快速編輯 quick_edit: 快速編輯
@ -64,7 +66,7 @@ zh_tw:
approval_pass: '通過' approval_pass: '通過'
approval_not_pass_reason: '不通過原因' approval_not_pass_reason: '不通過原因'
approval_setting_window_title: '單位' approval_setting_window_title: '單位'
update_success: 新聞已成功更新
news_bulletin: news_bulletin:
last_modified: 最後修改於 last_modified: 最後修改於
tags: 標籤 tags: 標籤
@ -82,6 +84,7 @@ zh_tw:
update_success: 更新新聞成功 update_success: 更新新聞成功
approve_bulletin_success: 成功審核新聞 approve_bulletin_success: 成功審核新聞
approve_bulletin_fail: 審核新聞失敗 approve_bulletin_fail: 審核新聞失敗
# action: 行動 # action: 行動
# add_language: 新增語言 # add_language: 新增語言
# admin: 管理 # admin: 管理