From d0ced39c746c229525de57ba1035906dfba3097e Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 24 Apr 2012 16:06:42 +0800 Subject: [PATCH] R4-Billingual --- app/views/layouts/_side_bar.html.erb | 22 +++--- config/locales/en.yml | 6 +- config/locales/zh_tw.yml | 8 +- .../back_end/approvals_controller.rb | 75 +++++++++++++++++++ .../approvals/_list_table.html.erb.can_del | 15 ++++ .../approvals/_privilege_user.html.erb | 26 +++++++ .../back_end/approvals/index.html.erb.can_del | 50 +++++++++++++ .../back_end/approvals/setting.html.erb | 41 ++++++++++ .../back_end/approvals/setting.js.erb | 1 + .../back_end/bulletins/_bulletin.html.erb | 2 +- .../back_end/bulletins/_form.html.erb | 8 +- .../announcement/config/locales/en.yml | 27 +++++-- .../announcement/config/locales/zh_tw.yml | 32 ++++---- .../announcement/config/routes.rb | 4 +- 14 files changed, 270 insertions(+), 47 deletions(-) create mode 100644 vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_list_table.html.erb.can_del create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_privilege_user.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/index.html.erb.can_del create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.js.erb diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 4acaa0c1..887f09be 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -1,6 +1,6 @@ -<%= content_tag :li, :class => active_for_controllers('purchases') do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> -<% end -%> +<%#= content_tag :li, :class => active_for_controllers('purchases') do -%> + <%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> +<%# end -%> <%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'fact_checks') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> @@ -9,14 +9,14 @@ <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %> + <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %> <% end -%> <% end -%> -<%= content_tag :li, :class => active_for_controllers('users') do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> -<% end -%> +<%#= content_tag :li, :class => active_for_controllers('users') do -%> + <%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> +<%# end -%> <%= content_tag :li, :class => active_for_controllers('page_contexts') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %> @@ -41,10 +41,10 @@ <%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%> - <%= content_tag :li, link_to(t('admin.announcement.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> - <%= content_tag :li, link_to(t('admin.announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %> - <%= content_tag :li, link_to(t('admin.announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> - <%= content_tag :li, link_to(t('admin.announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> + <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %> + <%= content_tag :li, link_to(t('announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> + <%= content_tag :li, link_to(t('announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %> <% end -%> <% end -%> diff --git a/config/locales/en.yml b/config/locales/en.yml index 46c86825..8564c364 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -62,6 +62,7 @@ en: add_drop_down_item: +Add Menu Item admin: Admin action: Action + all_articles: List announcement: Announcement asset: Asset assets: @@ -89,7 +90,7 @@ en: dashboard: Dashboard delete_language: Delete language description: Description - design: Design + design: Template disable_language: Disable language editing_home: Editing homepage editing_layout: Editing layout @@ -114,6 +115,7 @@ en: layout: Layout layout_name: Layout name links: Links + link: Links list_assets: Assets list list_designs: Designs list list_items: Items list @@ -156,7 +158,7 @@ en: setup_translations: Translations setup setup_designs: Designs setup site: Site - site_setting: Site Setting + site_settings: Site Setting super_pages: Super pages structure: Structure title: Title diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 4466caae..af36d7bc 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -58,6 +58,7 @@ zh_tw: add_language: 新增語言 add_drop_down_item: +增加Orbit選單 admin: 管理 + all_articles: 列表 announcement: 公告管理 asset: 資產 assets: @@ -89,7 +90,7 @@ zh_tw: data: 資料數據 delete_language: 刪除語言 description: 描述 - design: 網站版型 + design: 版型管理 disable_language: 禁用語言 editing_home: 編輯首頁 editing_layout: 編輯樣板 @@ -113,6 +114,7 @@ zh_tw: language: 語言 layout: 佈局 layout_name: 佈局名字 + link: 連結管理 links: 網路資源 list_assets: 資產列表 list_designs: 設計列表 @@ -145,13 +147,13 @@ zh_tw: non_multilingual: 非多種語言 options: 選項 orig_upload_file: 原上傳檔名 - page: Page + page: 頁面管理 position: 位置 published?: 發布? purchase: 購買 role: 角色 roles: 角色 - site_setting: 基本設定 + site_settings: 基本設定 setup_member: 成員設置 setup_translations: 語系設定 setup_designs: 版型設定 diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb new file mode 100644 index 00000000..4bfc8136 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb @@ -0,0 +1,75 @@ +class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController + before_filter :authenticate_user! + include AdminHelper + # layout 'admin' + + def setting + @bulletin_categorys = BulletinCategory.all + if params.has_key?(:category_id) + first_category = BulletinCategory.find params[:category_id] + if params[:commit] == 'Update' + privilege_users = params[:users].collect{|key,value| User.find key } rescue [] + preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check') + preload_object_auth = preload_object_auth_ary.first + preload_object_auth.privilege_users = privilege_users + preload_object_auth.save! + end + else + first_category = @bulletin_categorys.first + end + preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check') + @users_array = preload_object_auth.first.privilege_users rescue [] + respond_to do |format| + format.html + format.js + end + end + + def update_setting + + end + # def index + # get_categorys(params[:bulletin_category_id]) + # + # @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all + # @bulletin_categories = BulletinCategory.all + # + # module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) + # @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) + # + # respond_to do |format| + # format.html # index.html.erb + # format.js + # format.xml { render :xml => @bulletins } + # end + # end + # + # def new + # + # end + # + # def create + # + # end + # + # def update + # + # end + # + # def edit + # + # end + # + # def destroy + # + # end + protected + def get_categorys(id = nil) + @bulletin_categorys = [] + if(is_manager? || is_admin?) + @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) + elsif is_sub_manager? + @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') + end + end +end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_list_table.html.erb.can_del b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_list_table.html.erb.can_del new file mode 100644 index 00000000..59bac03a --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_list_table.html.erb.can_del @@ -0,0 +1,15 @@ +

<%= bulletin_category.key %>

+ + + + + + + + + + +<% bulletin_category.bulletins.each do |post| %> + <%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %> +<% end %> +
<%= t('bulletin.status') %><%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.postdate') %><%= t('bulletin.deadline') %><%= t('bulletin.action') %>
\ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_privilege_user.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_privilege_user.html.erb new file mode 100644 index 00000000..659fbc43 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_privilege_user.html.erb @@ -0,0 +1,26 @@ +<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%> +<% sys_users = User.all -%> + <% sys_users.each do |user| -%> + +
+ + <% user.sub_roles.each do |sr| %> + + <% end %> + <%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{user.sub_roles.collect{|sr| sr.key}.join(',')}"},:class=>"checkbox clear" do %> +
+
+
+ <% if user.avatar? %> + <%= image_tag(user.avatar.thumb.url,:class => "member-img") %> + <% else %> + <%= image_tag "person.png",:class => "member-img" %> + <% end %> +
+ <%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%> + <%= check_box_tag "[users][#{user.id}]", 'true',users.include?(user),:class => "check" -%> + <%end -%> +
+ + <% end -%> +<% end -%> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/index.html.erb.can_del b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/index.html.erb.can_del new file mode 100644 index 00000000..32f3d820 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/index.html.erb.can_del @@ -0,0 +1,50 @@ +<%= render 'panel/announcement/back_end/bulletins/filter' %> + + <%= render 'panel/announcement/back_end/bulletins/bulletins' %> +
+
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %> +
+ + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb new file mode 100644 index 00000000..d1cf86ed --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb @@ -0,0 +1,41 @@ +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "inc/permission-checkbox" %> +<% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "bootstrap" %> + <%#= javascript_include_tag "inc/permission-checkbox" %> + <%#= javascript_include_tag "inc/search" %> +<% end %> +<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %> +<%= form_tag('', :remote => true) %> + +<%#= label_tag :role, t("admin.roles") %> +
+<%= content_tag :div do -%> + <% form_tag :action => "update_setting" do %> + <%= render :partial => "privilege_user", :locals => {:users => @users_array} %> +
+ <%= submit_tag "Update", :class => 'btn' %> +
+ <% end -%> +<% end -%> +
+ + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.js.erb new file mode 100644 index 00000000..a01c9d6a --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.js.erb @@ -0,0 +1 @@ +$("#users_checkbox_ary").replaceWith('<%= (render :partial => 'privilege_user', :locals => {:users => @users_array}).html_safe%>'); \ No newline at end of file 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 7db70593..5ffdfa16 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 @@ -40,7 +40,7 @@ <%#= debugger %> <%#= a=1 %> <% if (bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !bulletin.is_expired? %> -
  • <%= link_to t('bulletin.fact_check'), edit_panel_announcement_back_end_bulletin_path(bulletin) %>
  • <%#= #TODO add ancher so user can quick access into that part %> +
  • <%= link_to t('announcement.bulletin.approval'), edit_panel_announcement_back_end_bulletin_path(bulletin) %>
  • <%#= #TODO add ancher so user can quick access into that part %> <% end %> <% 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 d9c62078..c190fc64 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 @@ -110,17 +110,17 @@ <% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
    - <%= f.label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %> + <%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %> <%= content_tag :label,:class => "radio inline" do -%> <%= f.radio_button :is_checked, true , {:class => 'privacy'} %> - <%= t('announcement.bulletin.fact_check_pass') %> + <%= t('announcement.bulletin.approval_pass') %> <% end -%> <%= content_tag :label,:class => "radio inline" do -%> <%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%> - <%= t('announcement.bulletin.fact_check_not_pass') %> + <%= t('announcement.bulletin.approval_not_pass') %> <% end -%>
    - <%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %> + <%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %> <%= f.text_field :not_checked_reason %>
    diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 2af39968..7614a4da 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -23,7 +23,18 @@ en: update: Update yes_: "Yes" + hot: Hot + top: Top + hidden: Hidden + passed: Approved + pending: Pending + rejected: Rejected + clear: Clear + + announcement: + all_articles: List + add_new: Add sure?: Sure? campus_news: Campus News more: more+ @@ -35,14 +46,14 @@ en: list_lower: " list" title: Title postdate: Postdate - fact_check: Fact Check - fact_check_setting: Fact Check Setting - fact_check_stat: Fact Check Status - fact_check_not_pass: 'Not Pass' - fact_check_not_pass_reason: 'Reason' - fact_check_pending: 'Pending' - fact_check_pass: 'Pass' - fact_check_setting_window_title: 'Unit' + approval: Approval + approval_setting: Approval Setting + approval_stat: Fact Check Status + approval_not_pass: 'Not Pass' + approval_not_pass_reason: 'Reason' + approval_pending: 'Pending' + approval_pass: 'Pass' + approval_setting_window_title: 'Unit' # admin: # action: Action 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 23ae38b8..27e92e30 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -24,19 +24,19 @@ zh_tw: update: 更新 yes_: "Yes" - is_hot: 熱門 - is_top: 置頂 - is_hidden: 隱藏 - is_checked: 通過 - is_pending: 待審核 - is_rejected: 不通過 + hot: 熱門 + top: 置頂 + hidden: 隱藏 + passed: 審核通過 + pending: 待審查 + rejected: 不通過 clear: 清除 quick_edit: 快速編輯 announcement: - add_new: 新增公告 - all_articles: 公告列表 + add_new: 新增 + all_articles: 列表 tags: 標籤 categories: 分類 status: 狀態 @@ -51,14 +51,14 @@ zh_tw: list_lower: 列表 title: 標題 postdate: 張貼日期 - fact_check: 公告審核 - fact_check_setting: 審核設定 - fact_check_stat: 審核狀況 - fact_check_pending: 待審核 - fact_check_not_pass: '不通過' - fact_check_pass: '通過' - fact_check_not_pass_reason: '不通過原因' - fact_check_setting_window_title: '單位' + approval: 公告審核 + approval_setting: 審核設定 + approval_stat: 審核狀況 + approval_pending: 待審核 + approval_not_pass: '不通過' + approval_pass: '通過' + approval_not_pass_reason: '不通過原因' + approval_setting_window_title: '單位' bulletin: last_modified: 最後修改於 diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 048926cb..0d5e1b99 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -3,8 +3,8 @@ Rails.application.routes.draw do namespace :announcement do namespace :back_end do match 'public' => "announcements#public",:as => :public - match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting - match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting + match 'approval_setting' => "approvals#setting" ,:as => :approval_setting + match 'update_setting' => "approvals#update_setting" ,:as => :approval_update_setting resources :bulletins do match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add