Better handling of path or location for administration links.
This commit is contained in:
@@ -90,6 +90,10 @@ feature -- Element change
|
||||
children := lst
|
||||
end
|
||||
lst.force (lnk)
|
||||
if not is_expanded then
|
||||
set_expandable (True)
|
||||
set_collapsed (True)
|
||||
end
|
||||
end
|
||||
|
||||
remove_link (lnk: CMS_LINK)
|
||||
@@ -102,6 +106,8 @@ feature -- Element change
|
||||
lst.prune_all (lnk)
|
||||
if lst.is_empty then
|
||||
children := Void
|
||||
set_collapsed (False)
|
||||
set_expandable (False)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -110,6 +116,12 @@ feature -- Element change
|
||||
-- Set `children' to `lst'.
|
||||
do
|
||||
children := lst
|
||||
if lst /= Void and then not lst.is_empty then
|
||||
if not is_expanded then
|
||||
set_expandable (True)
|
||||
set_collapsed (True)
|
||||
end
|
||||
end
|
||||
ensure
|
||||
children_set: children = lst
|
||||
end
|
||||
@@ -184,6 +196,6 @@ feature {NONE} -- Implementation
|
||||
invariant
|
||||
|
||||
note
|
||||
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2017, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -256,13 +256,17 @@ feature -- Access: url
|
||||
administration_path (a_relative_path: detachable READABLE_STRING_8): STRING_8
|
||||
do
|
||||
create Result.make_from_string (setup.administration_base_path)
|
||||
if a_relative_path /= Void and then not a_relative_path.is_empty then
|
||||
if a_relative_path /= Void then
|
||||
if a_relative_path.is_empty then
|
||||
Result.append_character ('/')
|
||||
else
|
||||
if a_relative_path[1] /= '/' then
|
||||
Result.append_character ('/')
|
||||
end
|
||||
Result.append (a_relative_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
administration_path_location (a_relative_location: detachable READABLE_STRING_8): STRING_8
|
||||
require
|
||||
@@ -270,10 +274,16 @@ feature -- Access: url
|
||||
do
|
||||
create Result.make_from_string (administration_base_path_location)
|
||||
if a_relative_location /= Void then
|
||||
if a_relative_location.is_empty then
|
||||
Result.append_character ('/')
|
||||
else
|
||||
if a_relative_location[1] /= '/' then
|
||||
Result.append_character ('/')
|
||||
end
|
||||
Result.append (a_relative_location)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Url implementation.
|
||||
|
||||
@@ -282,9 +292,11 @@ feature {NONE} -- Url implementation.
|
||||
|
||||
feature -- CMS links
|
||||
|
||||
administration_link (a_title: READABLE_STRING_GENERAL; a_location: READABLE_STRING_8): CMS_LOCAL_LINK
|
||||
administration_link (a_title: READABLE_STRING_GENERAL; a_relative_location: detachable READABLE_STRING_8): CMS_LOCAL_LINK
|
||||
require
|
||||
no_first_slash: a_relative_location = Void or else not a_relative_location.starts_with_general ("/")
|
||||
do
|
||||
Result := local_link (a_title, administration_path_location (a_location))
|
||||
Result := local_link (a_title, administration_path_location (a_relative_location))
|
||||
end
|
||||
|
||||
local_link (a_title: READABLE_STRING_GENERAL; a_location: READABLE_STRING_8): CMS_LOCAL_LINK
|
||||
|
||||
@@ -160,7 +160,7 @@ feature -- Settings: router
|
||||
l_api.logger.put_debug (generator + ".setup_router_for_administration", Void)
|
||||
|
||||
-- Configure root of api handler.
|
||||
l_router.set_base_url (l_api.administration_path (""))
|
||||
l_router.set_base_url (l_api.administration_path (Void))
|
||||
|
||||
-- Include routes from modules.
|
||||
across
|
||||
|
||||
@@ -105,7 +105,7 @@ feature -- HTTP Methods
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
s.append ("</ul>")
|
||||
s.append ("<div>Back to the " + r.link ("Administration", api.administration_path (""), Void) + " ...</div>")
|
||||
s.append ("<div>Back to the " + r.link ("Administration", api.administration_path (Void), Void) + " ...</div>")
|
||||
r.set_main_content (s)
|
||||
end
|
||||
r.set_title (r.translation ("CMS Installation ...", Void))
|
||||
|
||||
@@ -1333,9 +1333,11 @@ feature -- Generation
|
||||
|
||||
feature -- Helpers: cms link
|
||||
|
||||
administration_link (a_title: READABLE_STRING_GENERAL; a_location: READABLE_STRING_8): CMS_LOCAL_LINK
|
||||
administration_link (a_title: READABLE_STRING_GENERAL; a_relative_location: detachable READABLE_STRING_8): CMS_LOCAL_LINK
|
||||
require
|
||||
no_first_slash: a_relative_location = Void or else not a_relative_location.starts_with_general ("/")
|
||||
do
|
||||
Result := api.administration_link (a_title, a_location)
|
||||
Result := api.administration_link (a_title, a_relative_location)
|
||||
end
|
||||
|
||||
local_link (a_title: READABLE_STRING_GENERAL; a_location: READABLE_STRING_8): CMS_LOCAL_LINK
|
||||
|
||||
Reference in New Issue
Block a user