Fix approval issue

This commit is contained in:
Spen 2014-02-13 16:13:54 +08:00 committed by Manson Wang
parent 38124e41b5
commit f308b8a34c
6 changed files with 15 additions and 4 deletions

View File

@ -1,6 +1,7 @@
class OrbitBackendController < ApplicationController
include OrbitCategory::Categorizing
include OrbitCoreLib::Authorization
include OrbitCoreLib::PermissionUtility
include OrbitTag::Tagging
include AdminHelper
include ApplicationHelper

View File

@ -12,13 +12,13 @@ module OrbitBackendHelper
def show_form_status_field(object)
#by_object = (!object.is_expired? and object.is_pending?)
by_user = ((object.category.authed_users("approval_#{@module_app.key}").include?(current_user) rescue nil) or is_manager? or is_admin? or is_sub_manager?)
by_user = ((object.category.user_is_authorized_by_title?(current_user,"category_approval_#{@module_app.key}") rescue nil) or is_manager? or is_admin?)
by_user
end
def show_approval_link(object)
by_object = (!object.is_expired? and object.is_pending?)
by_user = ((object.category.authed_users("approval_#{@module_app.key}").include?(current_user) rescue nil) or is_manager? or is_admin? or is_sub_manager?)
by_user = ((object.category.user_is_authorized_by_title?(current_user,"category_approval_#{@module_app.key}") rescue nil) or is_manager? or is_admin?)
by_object and by_user
end
@ -306,7 +306,7 @@ module OrbitBackendHelper
content_tag :li, link_to(t(quick[:translation] || :authorization_), eval("#{quick[:link]}"), class: "preview_trigger #{quick[:class]}")
end
when 'edit'
if authorization && approvable
if authorization && approvable || is_manager?
content_tag :li, link_to(t(quick[:translation] || :edit), quick[:link].nil? ? '#' : eval("#{quick[:link]}('#{object.id}'#{link_option})"), class: quick[:class], data: eval("#{quick[:data]}"))
end
when 'delete'

View File

@ -194,6 +194,7 @@ class ModuleApp
# authorization
def update_auth_approval_users
user_ids = self.auth_approvals.inject([]) do |users, auth|
auth = auth.class.find(auth.id)
users += auth.authorized_users.map{|user| user.id}
end
self.update_attribute(:auth_approval_users, user_ids.uniq)

View File

@ -229,11 +229,13 @@ en:
groups: Groups
help: Help
hidden: Hidden
is_hidden: Hidden
hide: Hide
hits: Hits
homepage: Homepage
horizontal: Horizontal
hot: Hot
is_hot: Hot
image: Image
images: Images
info: Information
@ -352,11 +354,13 @@ en:
public_r_tag: System Widget
text: Text Area
passed: Approved
is_checked: Approved
password: Password
password_change: Change password
password_confirmation: Password confirmation
password_current: Current password
pending: Pending
is_pending: Pending
personal_plugins:
author : "Author"
edit_brief_intro : "Edit Brief Intro."
@ -400,6 +404,7 @@ en:
register: Register
registered: Registered
rejected: Rejected
is_rejected: Rejected
rejected_reason: 'Reason:'
rejected_reason_empty: "Approval rejected, no referencable information"
related_links: Related Links
@ -527,6 +532,7 @@ en:
to_search: Set as Search Key
to_show: Display in frontend
top: Top
is_top: Top
total_visitors: Total Visitors
traffic: Traffic
type: Field Type

View File

@ -355,11 +355,13 @@ zh_tw:
public_r_tag: 系統模塊
text: 文字區域
passed: 通過審核
is_checked: 通過審核
password: 密碼
password_change: 更改密碼
password_confirmation: 確認密碼
password_current: 目前的密碼
pending: 待審核
is_pending: 待審核
personal_plugins:
author : "著作人"
edit_brief_intro : "編輯摘要"
@ -402,6 +404,7 @@ zh_tw:
register: 註冊
registered: 已註冊
rejected: 拒絕
is_rejected: 拒絕
rejected_reason: 拒絕原因:'
rejected_reason_empty: "拒絕核准, 沒有參考資訊"
related_links: 相關連結

View File

@ -234,7 +234,7 @@ module OrbitCoreLib
when :sub_manager
@open ||= check_sub_manager
when :approver
@open ||= check_sub_manager
@open ||= check_approver
when :user
@open ||= true
when :visitor