Integrate App & Object Auth to announcement with i18n variables. Also changed Role and SubRole i18n var. Checked with Allen
This commit is contained in:
parent
3fcb902663
commit
4a51355b1a
|
@ -2,7 +2,7 @@ class Admin::ModuleAppsController < ApplicationController
|
|||
before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ]
|
||||
before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ]
|
||||
|
||||
layout "admin"
|
||||
layout "new_admin"
|
||||
|
||||
def index
|
||||
@module_apps = ModuleApp.all.entries
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Admin::ObjectAuthsController < ApplicationController
|
||||
include OrbitCoreLib::PermissionUnility
|
||||
layout "admin"
|
||||
layout "new_admin"
|
||||
before_filter :force_order
|
||||
# before_filter :is_admin? ,:only => :index
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ module Admin::ModuleAppHelper
|
|||
end
|
||||
|
||||
def get_auth_by(manager_obj)
|
||||
"-AuthBy: " +( manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name)
|
||||
showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name
|
||||
t("admin.user_role.auth.auth_by",:user_display_name => showing_name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<div id="open_for_all_user">
|
||||
<h1>All User</h1>
|
||||
<h1><%= t("admin.user_role.auth.all_member") %></h1>
|
||||
<%= form_tag(submit_url) do %>
|
||||
<%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %><br/>
|
||||
<%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag t("admin.user_role.auth.all_member") %><br/>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="user_role_management">
|
||||
<h1>User Role</h1>
|
||||
<h1><%= t("admin.user_role.auth.user") %></h1>
|
||||
<%= form_tag(submit_url) do %>
|
||||
<%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %>
|
||||
<%= submit_tag 'Add Role' %><br/>
|
||||
<%= submit_tag t("admin.user_role.auth.by_role") %><br/>
|
||||
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %>
|
||||
<%= submit_tag 'Add SubRole' %><br/>
|
||||
<%= submit_tag t("admin.user_role.auth.by_sub_role") %><br/>
|
||||
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %>
|
||||
<%= submit_tag 'Add PrivilegeList' %><br/>
|
||||
<%= submit_tag t("admin.user_role.auth.add_to_privilege_list") %><br/>
|
||||
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
|
||||
<%= submit_tag 'Add BlockedList' %><br/>
|
||||
<%= submit_tag t("admin.user_role.auth.add_to_block_list") %><br/>
|
||||
<% end %>
|
||||
<% unless auth.nil? %>
|
||||
<% auth.roles.each do |role| %>
|
||||
|
|
|
@ -1,37 +1,30 @@
|
|||
<% content_for :secondary do %>
|
||||
<% end %>
|
||||
|
||||
<!-- Remove if CSS done-->
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<!-- Remove if CSS done-->
|
||||
<h3><%= @module_app.title%></h3>
|
||||
|
||||
<div id="manager_management">
|
||||
<h1>Manager</h1>
|
||||
|
||||
<dl id="manager">
|
||||
<dt>Manager</ht>
|
||||
<dt><%= t("admin.user_role.auth.manager") %></ht>
|
||||
<% @module_app.managers.each do |manager| %>
|
||||
<dd><%= manager.user.name %> <%= get_auth_by(manager) %> <%= link_to '[X]',remove_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:manager) && manager.user != current_user %> </dd>
|
||||
<% end %>
|
||||
<dd>Add:
|
||||
<dd>
|
||||
<%= form_tag(assign_manager_admin_module_app_path) do %>
|
||||
<%= collection_select(:manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:manager))%>
|
||||
<%= submit_tag 'Add Manager' %>
|
||||
<%= submit_tag t("admin.user_role.auth.add_manager") %>
|
||||
<% end %>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl id="sub_manager">
|
||||
<dt>Sub Manager</ht>
|
||||
<dt><%= t("admin.user_role.auth.sub_manager") %></ht>
|
||||
<% @module_app.sub_managers.each do |manager| %>
|
||||
<dd><%= manager.user.name %> -AuthBy:<%= manager.rule_creator.name %> <%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd>
|
||||
<dd><%= manager.user.name %> <%= get_auth_by(manager) %><%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %> </dd>
|
||||
<% end %>
|
||||
<dd>Add:
|
||||
<dd>
|
||||
<%= form_tag(assign_sub_manager_admin_module_app_path) do %>
|
||||
<%= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%>
|
||||
<%= submit_tag 'Add Sub Manager' %>
|
||||
<%= submit_tag t("admin.user_role.auth.add_sub_manager") %>
|
||||
<% end %>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
<% content_for :secondary do %>
|
||||
<% end %>
|
||||
|
||||
<!-- Remove if CSS done-->
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<!-- Remove if CSS done-->
|
||||
<h3><%= @object_auth.title %></h3>
|
||||
|
||||
<%= render :partial => "admin/components/user_role_management", :locals => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<%#= 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', 'approvals') do -%>
|
||||
<%= 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 %>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%>
|
||||
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
|
||||
|
@ -10,6 +10,8 @@
|
|||
<%= 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.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %>
|
||||
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_for_action('module_apps', 'edit') if (is_admin? rescue nil) %>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<% end -%>
|
||||
|
|
|
@ -125,6 +125,8 @@ en:
|
|||
list_infos: User information list
|
||||
list_roles: User roles list
|
||||
member: Member
|
||||
module:
|
||||
authorization: Module Authorization
|
||||
move_down: Move down
|
||||
move_up: Move up
|
||||
multilingual: Multilingual
|
||||
|
@ -177,6 +179,20 @@ en:
|
|||
upload_design: Upload design
|
||||
url: URL
|
||||
user: User
|
||||
user_role:
|
||||
auth:
|
||||
all_member: All Member
|
||||
manager: Manager
|
||||
sub_mamanger: SubManager
|
||||
by_role: By Role
|
||||
by_sub_role: By SubRole
|
||||
block_list: Block List
|
||||
privilege_list: Privilege List
|
||||
add_manager: Add Manager
|
||||
add_sub_manager: Add SubManager
|
||||
add_to_block_list: Add to block List
|
||||
add_to_privilege_list: Add to privilege List
|
||||
auth_by: -AuthBy %{user_display_name}
|
||||
info: User information
|
||||
panel: User panel
|
||||
role: User role
|
||||
|
|
|
@ -98,7 +98,7 @@ zh_tw:
|
|||
editing_page: 編輯頁面
|
||||
editing_snippet: 編輯片段
|
||||
editing_info: 編輯用戶資料
|
||||
editing_role: 編輯用戶角色
|
||||
editing_role: 編輯用戶身份
|
||||
email: Email
|
||||
enable_language: 啟用語言
|
||||
file_name: 檔名
|
||||
|
@ -123,8 +123,10 @@ zh_tw:
|
|||
list_snippets: 斷片列表
|
||||
list_users: 使用列表
|
||||
list_infos: 用戶資料列表
|
||||
list_roles: 用戶角色列表
|
||||
list_roles: 用戶身份列表
|
||||
member: 會員
|
||||
module:
|
||||
authorization: 模組授權
|
||||
move_down: 往下移
|
||||
move_up: 往上移
|
||||
multilingual: 多種語言
|
||||
|
@ -143,7 +145,7 @@ zh_tw:
|
|||
new_snippet: 新增片段
|
||||
new_user: 新增使用
|
||||
new_info: 新增用戶資料
|
||||
new_role: 新增用戶角色
|
||||
new_role: 新增用戶身份
|
||||
non_multilingual: 非多種語言
|
||||
options: 選項
|
||||
orig_upload_file: 原上傳檔名
|
||||
|
@ -151,8 +153,8 @@ zh_tw:
|
|||
position: 位置
|
||||
published?: 發布?
|
||||
purchase: 購買
|
||||
role: 角色
|
||||
roles: 角色
|
||||
role: 身份
|
||||
roles: 身份
|
||||
site_settings: 基本設定
|
||||
setup_member: 成員設置
|
||||
setup_translations: 語系設定
|
||||
|
@ -177,9 +179,23 @@ zh_tw:
|
|||
upload_design: 上傳設計
|
||||
url: URL
|
||||
user: 用戶
|
||||
user_role:
|
||||
auth:
|
||||
all_member: 所有會員
|
||||
manager: 管理員
|
||||
sub_manager: 次管理員
|
||||
by_role: 根據身份
|
||||
by_sub_role: 根據次身份
|
||||
block_list: 封鎖名單
|
||||
add_manager: 增加到管理員
|
||||
add_sub_manager: 增加到次管理員
|
||||
add_to_block_list: 封鎖名單
|
||||
add_to_privilege_list: 特許名單
|
||||
auth_by: -由%{user_display_name}授權
|
||||
user: 使用會員
|
||||
info: 用戶資料
|
||||
panel: 用戶面板
|
||||
role: 用戶角色
|
||||
role: 用戶身份
|
||||
|
||||
panel:
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@ module OrbitCoreLib
|
|||
|
||||
end
|
||||
|
||||
def get_object_auth_by_title(title)
|
||||
self.object_auths.where({title: title }).first
|
||||
end
|
||||
|
||||
def authed_users(title=nil)
|
||||
users = []
|
||||
users = case title
|
||||
|
@ -33,7 +37,7 @@ module OrbitCoreLib
|
|||
[]
|
||||
end
|
||||
else
|
||||
self.object_auths.where(title: title).first.auth_users rescue []
|
||||
get_object_auth_by_title(title).auth_users rescue []
|
||||
end
|
||||
users
|
||||
end
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
module Panel::Announcement::BackEnd::BulletinCategorysHelper
|
||||
include ActionView::Helpers::UrlHelper
|
||||
|
||||
|
||||
def show_submit_permission_link(bulletin_category)
|
||||
oa = bulletin_category.get_object_auth_by_title('submit')
|
||||
if oa.nil?
|
||||
bulletin_category.object_auths.new(title: 'submit' ).save
|
||||
oa = bulletin_category.get_object_auth_by_title('submit')
|
||||
end
|
||||
link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
||||
end
|
||||
|
||||
end
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="clear">
|
||||
<% bulletin_category.object_auths.where(title: 'fact_check').first.auth_users.each do |user| %>
|
||||
<% bulletin_category.get_object_auth_by_title('fact_check').auth_users.each do |user| %>
|
||||
<div class="checkbox clear checked">
|
||||
<div class='member-avatar'>
|
||||
<% if user.avatar? %>
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= show_submit_permission_link(bulletin_category) %></li>
|
||||
<li><%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -78,6 +78,7 @@ en:
|
|||
approval_pass: 'Pass'
|
||||
approval_setting_window_title: 'Unit'
|
||||
approval_user_list: 'Approval Users'
|
||||
cate_auth: Category Authorization
|
||||
# admin:
|
||||
# action: Action
|
||||
# add_language: Add language
|
||||
|
|
|
@ -60,6 +60,8 @@ zh_tw:
|
|||
approval_not_pass_reason: '不通過原因'
|
||||
approval_setting_window_title: '單位'
|
||||
approval_user_list: '審核者'
|
||||
cate_auth: '分類授權'
|
||||
|
||||
bulletin:
|
||||
last_modified: 最後修改於
|
||||
tags: 標籤
|
||||
|
|
Loading…
Reference in New Issue