Show tabs iff a user is authenticated
This commit is contained in:
@@ -12,6 +12,8 @@ deferred class
|
||||
inherit
|
||||
CMS_API_ACCESS
|
||||
|
||||
CMS_REQUEST_UTIL
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_type: like content_type)
|
||||
|
||||
@@ -265,32 +265,37 @@ feature -- Output
|
||||
node_api := a_response.node_api
|
||||
|
||||
a_response.add_variable (a_node, "node")
|
||||
lnk := a_response.node_local_link (a_node, a_response.translation ("View", Void))
|
||||
lnk.set_weight (1)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
|
||||
if a_node.status = {CMS_NODE_API}.trashed then
|
||||
create lnk.make ("Trash", node_api.node_path (a_node) + "/trash")
|
||||
lnk.set_weight (2)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
else
|
||||
-- Node in {{CMS_NODE_API}.published} or {CMS_NODE_API}.not_published} status.
|
||||
create lnk.make ("Edit", node_api.node_path (a_node) + "/edit")
|
||||
lnk.set_weight (2)
|
||||
-- Show tabs only if a user is authenticated.
|
||||
if
|
||||
attached current_user (a_response.request) as l_user
|
||||
then
|
||||
lnk := a_response.node_local_link (a_node, a_response.translation ("View", Void))
|
||||
lnk.set_weight (1)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
|
||||
if
|
||||
a_node /= Void and then
|
||||
a_node.id > 0 and then
|
||||
attached node_api.node_type_for (a_node) as l_type and then
|
||||
node_api.has_permission_for_action_on_node ("delete", a_node, a_response.current_user (a_response.request))
|
||||
then
|
||||
create lnk.make ("Delete", node_api.node_path (a_node) + "/delete")
|
||||
lnk.set_weight (3)
|
||||
if a_node.status = {CMS_NODE_API}.trashed then
|
||||
create lnk.make ("Trash", node_api.node_path (a_node) + "/trash")
|
||||
lnk.set_weight (2)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
else
|
||||
-- Node in {{CMS_NODE_API}.published} or {CMS_NODE_API}.not_published} status.
|
||||
create lnk.make ("Edit", node_api.node_path (a_node) + "/edit")
|
||||
lnk.set_weight (2)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
|
||||
if
|
||||
a_node /= Void and then
|
||||
a_node.id > 0 and then
|
||||
attached node_api.node_type_for (a_node) as l_type and then
|
||||
node_api.has_permission_for_action_on_node ("delete", a_node, a_response.current_user (a_response.request))
|
||||
then
|
||||
create lnk.make ("Delete", node_api.node_path (a_node) + "/delete")
|
||||
lnk.set_weight (3)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
create s.make_empty
|
||||
s.append ("<div class=%"info%"> ")
|
||||
if attached a_node.author as l_author then
|
||||
|
||||
Reference in New Issue
Block a user