From 6cc470ede955bc765424cff73615f471fb36b196 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 13 Aug 2012 18:35:47 +0800 Subject: [PATCH] nccu fix --- app/assets/javascripts/bulletin_form.js.erb | 4 +++- app/assets/javascripts/news_bulletin_form.js.erb | 3 +++ app/helpers/application_helper.rb | 5 +++++ config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + .../announcement/back_end/bulletins_controller.rb | 3 +-- .../announcement/front_end/bulletins_controller.rb | 2 +- .../panel/announcement/back_end/bulletins_helper.rb | 6 ++++++ .../back_end/bulletins/_bulletin.html.erb | 3 +++ .../announcement/back_end/bulletins/_form.html.erb | 12 ++++++++++++ .../announcement/config/locales/en.yml | 3 +++ .../announcement/config/locales/zh_tw.yml | 2 ++ .../panel/news/back_end/news_bulletins_controller.rb | 5 ++--- .../news/front_end/news_bulletins_controller.rb | 2 +- .../panel/news/back_end/news_bulletins_helper.rb | 5 +++++ .../news/back_end/news_bulletins/_form.html.erb | 12 ++++++++++++ .../back_end/news_bulletins/_news_bulletin.html.erb | 7 +++---- vendor/built_in_modules/news/config/locales/en.yml | 5 ++++- .../built_in_modules/news/config/locales/zh_tw.yml | 5 ++++- 19 files changed, 72 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index 0240c613..18e8e375 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -22,5 +22,7 @@ $(document).on('click', '.quick_edit_cancel', function(){ $("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); }); - +$('.reject_info').tooltip({ + placement : 'bottom' +}); }); \ No newline at end of file diff --git a/app/assets/javascripts/news_bulletin_form.js.erb b/app/assets/javascripts/news_bulletin_form.js.erb index e75e8d4f..092bbfff 100644 --- a/app/assets/javascripts/news_bulletin_form.js.erb +++ b/app/assets/javascripts/news_bulletin_form.js.erb @@ -23,4 +23,7 @@ $(document).on('click', '.quick_edit_cancel', function(){ $("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide(); }); +$('.reject_info').tooltip({ + placement : 'bottom' +}); }); \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 63526229..a7ea211f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -226,4 +226,9 @@ module ApplicationHelper end end + def wrap_string_with(str,options={}) + line_width = options[:line_width] || 12 + wrap_mark = options[:wrap_mark] || "
" + str.scan((/.{0,#{line_width}}/)).join(wrap_mark) + end end diff --git a/config/locales/en.yml b/config/locales/en.yml index a3e295ff..68222292 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -298,6 +298,7 @@ en: sys: not_previewable: "Preview not support" 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" module_page_lang_not_support: "We are sorry, this page is not available for English" search: diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 101b456b..443eb35d 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -528,6 +528,7 @@ zh_tw: sys: not_previewable: "不支援預覽" limit_of_upload_file_size: "上傳檔案大小限制: %{best_size}" + preview_only_for_img: "預覽僅支援:jpg,png,gif,bmp...等圖片格式" can_not_display_due_to_no_context: "因為沒有中文版本,所以無法顯示" module_page_lang_not_support: "很抱歉,本頁沒有開放中文版本" object_disable: diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 60784f05..6c3e5385 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -183,8 +183,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # PUT /bulletins/1.xml def update - - if params[:bulletin_link] + if params[:bulletin_link] @bulletin_link = BulletinLink.find(params[:id]) 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 0adc848b..6c3aa066 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 @@ -54,7 +54,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController preview_content else @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) impressionist(@bulletin) get_categorys diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index 844ee4e4..7e36a22d 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -1,4 +1,10 @@ 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) #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?) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index b8886ad7..f6d9d240 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -56,6 +56,9 @@ <% if show_approval_link(bulletin) %>
  • <%= link_to t('announcement.bulletin.approval'), panel_announcement_back_end_bulletin_approval_preview_path(bulletin),:class => 'preview_trigger' %>
  • <%#= #TODO add ancher so user can quick access into that part %> <% end %> + <% if show_reject_reason(bulletin)%> +
  • <%= 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' %>
  • + <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 47f24fe8..aecf1b6d 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -49,6 +49,17 @@ + <% end %> + <% if @bulletin.is_rejected %> +
    +
    + +
    +

    Approval Status

    +
    + <%= @bulletin.not_checked_reason rescue t("rejected_reason_empty") %> +
    +
    <% end %>
    @@ -198,6 +209,7 @@ <%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %> <%= t(:add) %>

    <%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %>

    +

    <%= t("sys.preview_only_for_img") %>

    diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 36b4665a..9f82af1b 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -35,6 +35,9 @@ en: passed: Passed pending: Pending rejected: Rejected + rejected_reason: 'Reason:' + rejected_reason_empty: "Approval rejected,no referencable information" + clear: Clear hot: Hot 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 21f26ae9..c652b1b6 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -30,6 +30,8 @@ zh_tw: passed: 審核通過 pending: 待審查 rejected: 不通過 + rejected_reason_empty: 審核沒有通過,沒有相關訊息 + rejected_reason: '原因:' clear: 清除 quick_edit: 快速編輯 diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb index fa08cac1..f0800e4f 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb @@ -226,7 +226,6 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController # PUT /news_bulletins/1 # PUT /news_bulletins/1.xml def update - if params[:news_bulletin_link] @news_bulletin_link = NewsBulletinLink.find(params[:id]) @@ -258,7 +257,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController else @news_bulletin = NewsBulletin.find(params[:id]) - @news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil) + @news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil) @news_bulletin.update_user_id = current_user.id @@ -278,7 +277,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController end 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_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.xml { head :ok } else diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb index e2cdf289..8b665b24 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb @@ -54,7 +54,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController else '' @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) impressionist(@news_bulletin) get_categorys diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb index 24de272b..2ad6f7f9 100644 --- a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb +++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb @@ -1,4 +1,9 @@ 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) #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?) diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb index 4a5a4577..71de8413 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb @@ -100,6 +100,17 @@ <% end %>
    + <% if @news_bulletin.is_rejected %> +
    +
    + +
    +

    Approval Status

    +
    + <%= @news_bulletin.not_checked_reason rescue t("rejected_reason_empty") %> +
    +
    + <% end %> <% if params[:action] != 'new' %>
    @@ -239,6 +250,7 @@ <%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %> <%= t(:add) %>

    <%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %>

    +

    <%= t("sys.preview_only_for_img") %>

    diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb index 58d82d7e..20126c09 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb @@ -46,9 +46,6 @@
  • <%#= link_to t(:file), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %>
  • - <%#= debugger %> - <%#= a=1 %> - <% end %> <% end %> <% if news_show_delete_link(news_bulletin) %> @@ -57,7 +54,9 @@ <% if news_show_approval_link(news_bulletin) %>
  • <%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin),:class => 'preview_trigger' %>
  • <%#= #TODO add ancher so user can quick access into that part %> <% end %> - + <% if news_show_reject_reason(news_bulletin)%> +
  • <%= 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' %>
  • + <% end %>
    diff --git a/vendor/built_in_modules/news/config/locales/en.yml b/vendor/built_in_modules/news/config/locales/en.yml index 71888726..872bcddc 100644 --- a/vendor/built_in_modules/news/config/locales/en.yml +++ b/vendor/built_in_modules/news/config/locales/en.yml @@ -35,6 +35,9 @@ en: passed: Passed pending: Pending rejected: Rejected + rejected_reason: 'Reason:' + rejected_reason_empty: "Approval rejected,no referencable information" + clear: Clear hot: Hot @@ -79,7 +82,7 @@ en: approval_pending: 'Pending' approval_pass: 'Pass' approval_setting_window_title: 'Unit' - + update_success: Successfully Updated # admin: # action: Action # add_language: Add language diff --git a/vendor/built_in_modules/news/config/locales/zh_tw.yml b/vendor/built_in_modules/news/config/locales/zh_tw.yml index 0d65fbff..4ed7d00b 100644 --- a/vendor/built_in_modules/news/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/news/config/locales/zh_tw.yml @@ -30,6 +30,8 @@ zh_tw: passed: 審核通過 pending: 待審查 rejected: 不通過 + rejected_reason: '原因:' + rejected_reason_empty: 審核沒有通過,沒有相關訊息 clear: 清除 quick_edit: 快速編輯 @@ -64,7 +66,7 @@ zh_tw: approval_pass: '通過' approval_not_pass_reason: '不通過原因' approval_setting_window_title: '單位' - + update_success: 新聞已成功更新 news_bulletin: last_modified: 最後修改於 tags: 標籤 @@ -82,6 +84,7 @@ zh_tw: update_success: 更新新聞成功 approve_bulletin_success: 成功審核新聞 approve_bulletin_fail: 審核新聞失敗 + # action: 行動 # add_language: 新增語言 # admin: 管理