From e51aa94a8413d84031205859d9caa225fd714a10 Mon Sep 17 00:00:00 2001 From: the lemons Date: Wed, 9 Feb 2022 03:27:41 -0600 Subject: "cancel" link in act page now takes you to the correct location --- zzcxz.cgi | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/zzcxz.cgi b/zzcxz.cgi index cbd93e4..c9a71d5 100755 --- a/zzcxz.cgi +++ b/zzcxz.cgi @@ -374,8 +374,10 @@ map["^/g/(%w%w%w%w%w)$"] = function(p) if not directives.deadend then table.insert(actions, ([[ -
  • %s
  • - ]]):format(page.id, #page.actions == 0 and +
  • + %s +
  • + ]]):format(page.id, p, #page.actions == 0 and "do something..." or "do something else...") ) end @@ -452,8 +454,8 @@ local edit_template = template [[ maxlength="10000" required >$editing
    - cancel - + cancel + $submit
    $log @@ -474,6 +476,9 @@ map["^/g/(%w%w%w%w%w)/act$"] = function(p) local _, directives = convert_markup(page.content) if directives.deadend then return not_found() end + local query = parse_qs(env "QUERY_STRING" or "") + local cancel = '/g/'..(query.back or p) + if env "REQUEST_METHOD" ~= "POST" then return base { title = "do something new", @@ -481,6 +486,7 @@ map["^/g/(%w%w%w%w%w)/act$"] = function(p) page = p, content = convert_markup(page.content), log = show_hist(true), + cancel = html_encode(cancel), }, } else @@ -500,7 +506,7 @@ map["^/g/(%w%w%w%w%w)/act$"] = function(p) :format(prev_direct.redirect.id) prev = note..prev end - + return base { title = "do something new", content = edit_template { @@ -513,6 +519,7 @@ map["^/g/(%w%w%w%w%w)/act$"] = function(p) title = html_encode(form.wyd), editing = html_encode(form.happens), submit = submit_template { page = p }, + cancel = html_encode(cancel), log = show_hist(true), }, } -- cgit v1.2.3