delete with tabs

This commit is contained in:
jvelilla
2015-05-13 12:27:02 -03:00
parent 9514f1de9c
commit 44d14c4100
3 changed files with 24 additions and 10 deletions

View File

@@ -167,6 +167,17 @@ feature -- Output
lnk.set_weight (2) lnk.set_weight (2)
a_response.add_to_primary_tabs (lnk) 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
a_response.has_permission ("delete " + node_api.permission_scope (a_response.current_user (a_response.request), a_node) + " " + l_type.name)
then
create lnk.make ("Delete", node_api.node_path (a_node) + "/delete")
lnk.set_weight (3)
a_response.add_to_primary_tabs (lnk)
end
create s.make_empty create s.make_empty
s.append ("<div class=%"info%"> ") s.append ("<div class=%"info%"> ")
if attached a_node.author as l_author then if attached a_node.author as l_author then

View File

@@ -61,13 +61,13 @@ feature -- Execution
-- FIXME: Hack for now -- FIXME: Hack for now
set_title (l_node.title) set_title (l_node.title)
add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs) add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Delete", "/node/" + l_node.id.out + "/delete"), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs) add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs)
b.append (html_encoded (l_type.title) + " saved") b.append (html_encoded (l_type.title) + " saved")
else else
set_title ("Edit " + html_encoded (l_type.title) + " #" + l_node.id.out) set_title ("Edit " + html_encoded (l_type.title) + " #" + l_node.id.out)
add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs) add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Delete", "/node/" + l_node.id.out + "/delete"), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs) add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs)
f.append_to_html (wsf_theme, b) f.append_to_html (wsf_theme, b)
@@ -228,14 +228,14 @@ feature -- Form
ts.set_default_value ("Preview") ts.set_default_value ("Preview")
f.extend (ts) f.extend (ts)
if a_node /= Void and then a_node.id > 0 and then has_permission ("delete " + a_name) then -- if a_node /= Void and then a_node.id > 0 and then has_permission ("delete " + a_name) then
create ts.make ("op") -- create ts.make ("op")
ts.set_default_value ("Delete") -- ts.set_default_value ("Delete")
fixme ("[ -- fixme ("[
ts.set_default_value (i18n ("Delete"))i18n or other name such as "translated" or "translation -- ts.set_default_value (i18n ("Delete"))i18n or other name such as "translated" or "translation
]") -- ]")
f.extend (ts) -- f.extend (ts)
end -- end
Result := f Result := f
end end

View File

@@ -177,6 +177,9 @@ feature -- Hooks
create lnk.make ("List of nodes", a_response.url ("/nodes", Void)) create lnk.make ("List of nodes", a_response.url ("/nodes", Void))
a_menu_system.primary_menu.extend (lnk) a_menu_system.primary_menu.extend (lnk)
create lnk.make ("Trash nodes", a_response.url ("/trash", Void))
a_menu_system.primary_menu.extend (lnk)
create lnk.make ("Create ..", a_response.url ("/node/", Void)) create lnk.make ("Create ..", a_response.url ("/node/", Void))
a_menu_system.primary_menu.extend (lnk) a_menu_system.primary_menu.extend (lnk)
end end