From 543ec3a420c397a12dabd5ad08a1fe9447fc7a6a Mon Sep 17 00:00:00 2001 From: spen Date: Fri, 2 May 2014 13:52:02 +0800 Subject: [PATCH] add backend form append note and fix show image --- .../announcement/back_end/bulletins_controller.rb | 4 +++- .../announcement/back_end/bulletins/_form.html.erb | 10 ++++++++-- .../announcement/front_end/bulletins/show.html.erb | 4 ---- config/locales/en.yml | 5 ++++- config/locales/zh_tw.yml | 5 ++++- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 76ac4d5..103a0df 100644 --- a/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -78,7 +78,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @tags = get_tags is_authorized_sub_manager = @bulletin.category.auth_sub_manager.authorized_user_ids rescue nil - if !(is_manager? || is_admin? || is_authorized_sub_manager.include?(current_user.id)) + if !(is_manager? || is_admin? || (is_authorized_sub_manager.include?(current_user.id) and @bulletin.create_user_id == current_user.id)) redirect_to :action => :index else # @summary_variable = @bulletin.summary_variable @@ -146,6 +146,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin = Bulletin.find(params[:id]) + params[:bulletin][:update_user_id] = current_user.id + delete_out_invalid_date_from_params respond_to do |format| if @bulletin.update_attributes(params[:bulletin]) diff --git a/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 7c5fcaa..703bfb8 100644 --- a/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -32,7 +32,7 @@ <%= t(:tags) %>
  • - <%= t(:image) %> + <%= t("announcement.image") %>
  • <%= t('announcement.email_reminder')%> @@ -116,7 +116,7 @@
    - +
    @@ -143,6 +143,8 @@ <%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px(w) x 230px(h)") %>
    <%= t("announcement.image_upload_size_note", :image_upload_size =>'900kb') %> +
    + <%= t("announcement.image_note")%>
    @@ -245,6 +247,10 @@ <% end %> +
    +
    <%= t('announcement.append_note')%>
    +
    +
    diff --git a/app/views/panel/announcement/front_end/bulletins/show.html.erb b/app/views/panel/announcement/front_end/bulletins/show.html.erb index 1550e71..55035b0 100644 --- a/app/views/panel/announcement/front_end/bulletins/show.html.erb +++ b/app/views/panel/announcement/front_end/bulletins/show.html.erb @@ -11,10 +11,6 @@ <%= t('announcement.default_widget.bulletin_create_dept') + ": " + unit unless unit.blank? %>
    -
    - <%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %> - <%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %> -
    <%= @bulletin.text.html_safe rescue '' %>
    diff --git a/config/locales/en.yml b/config/locales/en.yml index 350f09f..993e871 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4,6 +4,7 @@ en: add_new: Add New all_articles: All Articles announcement: Announcement + append_note: Suggest to input underside Link and File's annotation to show correct info in frontend approval_setting: Approval Setting approve_bulletin_fail: Approval Fail approve_bulletin_success: Approve Successfully @@ -26,6 +27,8 @@ en: frontend: bulletins: Announcement front-end search_result: Search result + image: Cover image + image_note: The image will not show in content link_name: Link Name new_bulletin_category: New Bulletin Category picture: Cover Picture @@ -54,4 +57,4 @@ en: mail_url_view: This email is the reminder of an announcement, please click the link for the details mail_source: Source mail_time: Time - image_upload_size_note: The following recommendations %{image_upload_size} upload size \ No newline at end of file + image_upload_size_note: The following recommendations %{image_upload_size} upload size diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 738a1da..36d696c 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -4,6 +4,7 @@ zh_tw: add_new: 新建 all_articles: 文章列表 announcement: 公告 + append_note: 以下之附加連結與檔案,為使前台顯示名稱,建議您輸入註解。 approval_setting: 審核設定 approve_bulletin_fail: 審核失敗 approve_bulletin_success: 審核成功 @@ -28,6 +29,8 @@ zh_tw: frontend: bulletins: 公告前台 search_result: 搜尋結果頁 + image: 封面圖片 + image_note: 此處上傳的圖片不會在公告內文出現 link_name: 連結名稱 new_bulletin_category: 新增公告類別 picture: 刊頭圖片 @@ -57,4 +60,4 @@ zh_tw: mail_url_view: 此封信件為公告事件提醒,請點選以下連結詳細觀看 mail_source: 來源 mail_time: 時間 - image_upload_size_note: 建議檔案小於%{image_upload_size} \ No newline at end of file + image_upload_size_note: 建議檔案小於%{image_upload_size}