From f427c3803f64b592685227ed73de4d0056f1c769 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 30 Apr 2012 15:51:22 +0800 Subject: [PATCH] clean up useless flash msgs. add i18n vars for app auth and object auth --- app/controllers/application_controller.rb | 10 ++--- app/views/admin/dashboards/index.html.erb | 2 - app/views/layouts/_side_bar.html.erb | 1 - config/locales/en.yml | 8 ++++ config/locales/zh_tw.yml | 42 +++++++++++-------- public/static/kernel.js | 1 - .../back_end/bulletins_controller.rb | 2 +- .../announcement/config/locales/en.yml | 2 + .../announcement/config/locales/zh_tw.yml | 2 + 9 files changed, 43 insertions(+), 27 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2f6636b9..8fc3a90b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -57,7 +57,7 @@ class ApplicationController < ActionController::Base if is_admin? true else - flash[:notice] = "Access Denied for you are not Admin" + flash[:error] = t("admin.access.denied.not_admin") auth_failed_in_backend end end @@ -66,7 +66,7 @@ class ApplicationController < ActionController::Base if is_manager? true else - flash[:notice] = "Access Denied for you are not Manager for this app" + flash[:error] = t("admin.access.denied.app.not_manager") auth_failed_in_backend end end @@ -75,7 +75,7 @@ class ApplicationController < ActionController::Base if (@module_app.sub_managing_users.include?(current_user) || is_manager?) true else - flash[:notice] = "Access Denied for you are not SubManager for this app" + flash[:error] = t("admin.access.denied.app.not_sub_manager") auth_failed_in_backend end end @@ -84,13 +84,13 @@ class ApplicationController < ActionController::Base if (@module_app.app_auth.auth_users.include?(current_user) || for_app_sub_manager ) true else - flash[:notice] = "Access Denied for you are not User for this app" + flash[:error] = t("admin.access.denied.app.not_authed_user") auth_failed_in_backend end end def check_object_premission(obj,title) - flash[:notice] = "Access Denied for you don't have permission for this object" + flash[:error] = t("admin.access.denied.object") auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_user) || is_manager? || is_admin? ) end diff --git a/app/views/admin/dashboards/index.html.erb b/app/views/admin/dashboards/index.html.erb index 21bc7ffb..e22d7dac 100644 --- a/app/views/admin/dashboards/index.html.erb +++ b/app/views/admin/dashboards/index.html.erb @@ -1,5 +1,3 @@ -<%= flash_messages %> -

<%= t(:content) %>

diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 1a303a31..dd8ffa83 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -4,7 +4,6 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "/static/kernel.js" %> <% end %> -<%= flash_messages %> <%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys','module_apps', 'approvals') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 69491cbc..4427e890 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -68,6 +68,14 @@ en: traffic: Traffic admin: + access: + denied: + app: + not_sub_manager: Access Denied for you are not SubManager for this app + not_manager: Access Denied for you are not SubManager for this app + not_authed_user: Access Denied for you are not User for this app + not_admin: Access Denied for you are not Admin + object: "Access Denied for you don't have permission for this object" action: Action ad_banner: AD Banner ad: diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 19f666c4..dfbcdf95 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -8,12 +8,12 @@ zh_tw: back: 回上一步 browse: 選擇檔案 cancel: 取消 - create: 創建 + create: 新增 delete: 刪除 desktop: 桌面 disable: 禁用 dots: … - downloaded: 已經下載 + downloaded: 已下載 download: 下載 edit: 編輯 email: 電子郵件 @@ -47,7 +47,7 @@ zh_tw: file_type: 檔案類型 hits: 點擊率 item: 項目 - member: 成員 + member: 會員 module: 模組 most_visited_page: 熱門頁面 quantity: 數量 @@ -62,6 +62,14 @@ zh_tw: traffic: 流量 admin: + access: + denied: + app: + not_sub_manager: 拒絕存取因你不是此應用程式次管理員 + not_manager: 拒絕存取因你不是此應用程式管理員 + not_authed_user: 拒絕存取因你不是此應用程式授權使用者 + not_admin: 拒絕存取因你不是此應用程式次管理員 + object: 拒絕存取因你不是網站管理者 action: 操作 ad_banner: 廣告輪播 ad: @@ -81,7 +89,7 @@ zh_tw: add_item: 新增項目 add_language: 新增語言 add_drop_down_item: +增加Orbit選單 - admin: 管理 + admin: 網站管理者 all_articles: 列表 announcement: 公告管理 asset: 資產 @@ -94,22 +102,22 @@ zh_tw: author: 作者 calendar: 行事曆 cant_delete_self: 您不可以刪除自己。 - cant_revoke_self_admin: 您不可以撤銷自己的管理作用。 + cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 choose_file: 請選擇一個文件... class: 階級 content: 內容 - create_error_link: 創建連接時出錯。 - create_error_page: 創建頁面時出錯。 - create_success_home: 首頁已成功創建。 - create_success_layout: 樣板已成功創建。 - create_success_link: 連結已成功創建。 - create_success_page: 頁面已成功創建。 - create_success_home: 首頁已成功創建。 - create_success_layout: 佈局已成功創建。 - create_success_link: 連結已成功創建。 - create_success_page: 頁面已成功創建。 - create_success_snippet: 片段已成功創建。 - create_success_user: 用戶已成功創建。。 + create_error_link: 新增連接時出錯。 + create_error_page: 新增頁面時出錯。 + create_success_home: 首頁已成功新增。 + create_success_layout: 樣板已成功新增。 + create_success_link: 連結已成功新增。 + create_success_page: 頁面已成功新增。 + create_success_home: 首頁已成功新增。 + create_success_layout: 佈局已成功新增。 + create_success_link: 連結已成功新增。 + create_success_page: 頁面已成功新增。 + create_success_snippet: 片段已成功新增。 + create_success_user: 用戶已成功新增。。 dashboard: 儀表板 data: 資料數據 delete_language: 刪除語言 diff --git a/public/static/kernel.js b/public/static/kernel.js index ba5b81c3..c5b9a8a6 100644 --- a/public/static/kernel.js +++ b/public/static/kernel.js @@ -1,5 +1,4 @@ $(document).ready(function() { - $.each($(".notice"),function(k,v){ alert("EMPTY Cate");}); $.each($(".dymanic_load"),function(){ if($(this).attr("path")==''){$(this).html("App setting Failed");} 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 6cf11158..a1f5227e 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 @@ -86,7 +86,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # @bulletin.bulletin_files.new if get_categorys.empty? - flash[:notice] = "You dont have any permission for post on cate" + flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") redirect_to :action => :index else get_tags diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 5f319340..cdb0d0c1 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -59,6 +59,8 @@ en: all_articles: List add_new: Add categories: Categories + error: + no_avilb_cate_for_posting: You need a category to submit your post,please contact admin sure?: Sure? campus_news: Campus News more: more+ 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 11e79fcc..248d3e92 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -37,6 +37,8 @@ zh_tw: announcement: add_new: 新增 all_articles: 列表 + error: + no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類 tags: 標籤 categories: 分類 status: 狀態