diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d4f4cd..0ea6a55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,41 +24,15 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" - }, - { - "name": "Grant All Perms to Make Cache Restoring Possible", - "run": "sudo mkdir -p /usr/local/etc/roswell\n sudo chown \"${USER}\" /usr/local/etc/roswell\n # Here the ros binary will be restored:\n sudo chown \"${USER}\" /usr/local/bin", - "shell": "bash" - }, - { - "name": "Get Current Month", - "id": "current-month", - "run": "echo \"value=$(date -u \"+%Y-%m\")\" >> $GITHUB_OUTPUT", - "shell": "bash" - }, - { - "name": "Cache Roswell Setup", - "id": "cache", - "uses": "actions/cache@v3", - "with": { - "path": "qlfile\nqlfile.lock\n~/.cache/common-lisp/\n~/.roswell\n/usr/local/etc/roswell\n/usr/local/bin/ros\n/usr/local/Cellar/roswell\n.qlot", - "key": "a-${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-ubuntu-latest-quicklisp-sbcl-bin-${{ hashFiles('qlfile.lock', '*.asd') }}" - } - }, - { - "name": "Restore Path To Cached Files", - "run": "echo $HOME/.roswell/bin >> $GITHUB_PATH\n echo .qlot/bin >> $GITHUB_PATH", - "shell": "bash", - "if": "steps.cache.outputs.cache-hit == 'true'" + "uses": "actions/checkout@v4" }, { "name": "Setup Common Lisp Environment", - "uses": "40ants/setup-lisp@v3", + "uses": "40ants/setup-lisp@v4", "with": { - "asdf-system": "reblocks-ui" - }, - "if": "steps.cache.outputs.cache-hit != 'true'" + "asdf-system": "reblocks-ui", + "cache": "true" + } }, { "name": "Change dist to Ultralisp if qlfile does not exist", @@ -92,41 +66,15 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" - }, - { - "name": "Grant All Perms to Make Cache Restoring Possible", - "run": "sudo mkdir -p /usr/local/etc/roswell\n sudo chown \"${USER}\" /usr/local/etc/roswell\n # Here the ros binary will be restored:\n sudo chown \"${USER}\" /usr/local/bin", - "shell": "bash" - }, - { - "name": "Get Current Month", - "id": "current-month", - "run": "echo \"value=$(date -u \"+%Y-%m\")\" >> $GITHUB_OUTPUT", - "shell": "bash" - }, - { - "name": "Cache Roswell Setup", - "id": "cache", - "uses": "actions/cache@v3", - "with": { - "path": "qlfile\nqlfile.lock\n~/.cache/common-lisp/\n~/.roswell\n/usr/local/etc/roswell\n/usr/local/bin/ros\n/usr/local/Cellar/roswell\n.qlot", - "key": "a-${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-ubuntu-latest-quicklisp-sbcl-bin-${{ hashFiles('qlfile.lock', '*.asd') }}" - } - }, - { - "name": "Restore Path To Cached Files", - "run": "echo $HOME/.roswell/bin >> $GITHUB_PATH\n echo .qlot/bin >> $GITHUB_PATH", - "shell": "bash", - "if": "steps.cache.outputs.cache-hit == 'true'" + "uses": "actions/checkout@v4" }, { "name": "Setup Common Lisp Environment", - "uses": "40ants/setup-lisp@v3", + "uses": "40ants/setup-lisp@v4", "with": { - "asdf-system": "reblocks-ui" - }, - "if": "steps.cache.outputs.cache-hit != 'true'" + "asdf-system": "reblocks-ui", + "cache": "true" + } }, { "name": "Change dist to Ultralisp", diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c3fba87..a6afa81 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -19,41 +19,15 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" - }, - { - "name": "Grant All Perms to Make Cache Restoring Possible", - "run": "sudo mkdir -p /usr/local/etc/roswell\n sudo chown \"${USER}\" /usr/local/etc/roswell\n # Here the ros binary will be restored:\n sudo chown \"${USER}\" /usr/local/bin", - "shell": "bash" - }, - { - "name": "Get Current Month", - "id": "current-month", - "run": "echo \"value=$(date -u \"+%Y-%m\")\" >> $GITHUB_OUTPUT", - "shell": "bash" - }, - { - "name": "Cache Roswell Setup", - "id": "cache", - "uses": "actions/cache@v3", - "with": { - "path": "qlfile\nqlfile.lock\n~/.cache/common-lisp/\n~/.roswell\n/usr/local/etc/roswell\n/usr/local/bin/ros\n/usr/local/Cellar/roswell\n.qlot", - "key": "a-${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-ubuntu-latest-quicklisp-sbcl-bin-${{ hashFiles('qlfile.lock', '*.asd') }}" - } - }, - { - "name": "Restore Path To Cached Files", - "run": "echo $HOME/.roswell/bin >> $GITHUB_PATH\n echo .qlot/bin >> $GITHUB_PATH", - "shell": "bash", - "if": "steps.cache.outputs.cache-hit == 'true'" + "uses": "actions/checkout@v4" }, { "name": "Setup Common Lisp Environment", - "uses": "40ants/setup-lisp@v3", + "uses": "40ants/setup-lisp@v4", "with": { - "asdf-system": "reblocks-ui-docs" - }, - "if": "steps.cache.outputs.cache-hit != 'true'" + "asdf-system": "reblocks-ui-docs", + "cache": "true" + } }, { "name": "Build Docs", diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 954a253..4362396 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ "steps": [ { "name": "Checkout Code", - "uses": "actions/checkout@v3" + "uses": "actions/checkout@v4" }, { "name": "Create release tag", diff --git a/.gitignore b/.gitignore index 8a7730e..49eb990 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /.qlot/ .DS_Store *.fasl +*.~undo-tree~ diff --git a/docs/changelog.lisp b/docs/changelog.lisp index ccb181d..febbc81 100644 --- a/docs/changelog.lisp +++ b/docs/changelog.lisp @@ -9,6 +9,13 @@ "JS" "UI" "40ANTS-DOC")) + (0.17.0 2024-07-28 + " +Fixed +===== + +- Code was fixed to work with latest changed to Reblocks, introduced in [PR 57](https://github.com/40ants/reblocks/pull/57). +") (0.16.0 2022-12-12 " Changed diff --git a/qlfile.lock b/qlfile.lock index abd6458..7989cb2 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -1,8 +1,8 @@ ("quicklisp" . (:class qlot/source/dist:source-dist - :initargs (:distribution "http://beta.quicklisp.org/dist/quicklisp.txt" :%version :latest) + :initargs (:distribution "https://beta.quicklisp.org/dist/quicklisp.txt" :%version :latest) :version "2023-10-21")) ("ultralisp" . (:class qlot/source/dist:source-dist - :initargs (:distribution "http://dist.ultralisp.org" :%version :latest) - :version "20240303155001")) + :initargs (:distribution "https://dist.ultralisp.org" :%version :latest) + :version "20240723211501")) diff --git a/src/form.lisp b/src/form.lisp index 8dc4d1b..c710ce0 100644 --- a/src/form.lisp +++ b/src/form.lisp @@ -2,6 +2,9 @@ (:use #:cl) (:import-from #:log) (:import-from #:spinneret) + (:import-from #:serapeum + #:defvar-unbound + #:eval-always) (:import-from #:reblocks/actions #:make-action-url #:make-action) @@ -36,8 +39,12 @@ #:get-field-errors-count)) (in-package reblocks-ui/form) +(defvar *js-default-action* "return initiateAction(\"~A\")") -(serapeum:defvar-unbound *form-field-errors* +(eval-always + (defvar *js-default-form-action* "return initiateFormAction(\"~A\", event, this)")) + +(defvar-unbound *form-field-errors* "This variable will hold a hash-table where keys are field names and values are lists of strings of error messages.") @@ -174,7 +181,7 @@ $('~A').foundation(); extra-submit-code requires-confirmation-p (confirm-question "Are you sure?") - (submit-fn "initiateFormAction(\"~A\", $(this), \"~A\")") + (submit-fn *js-default-form-action*) ;; A hashmap with placeholders widgets error-placeholders) (let* ((action (if (functionp action) @@ -230,16 +237,9 @@ $('~A').foundation(); action)) (action-code (make-action action)) (on-submit (when use-ajax-p - (format nil "~@[~A~]~A; return false;" - extra-submit-code - (format nil submit-fn - (url-encode (or action-code "")) - ;; Function session-name-string-pair was removed - ;; during reblocks refactoring, so we just - ;; - "" - ;; (reblocks::session-name-string-pair) - )))) + (concatenate 'string + (or extra-submit-code "") + (format nil submit-fn (url-encode (or action-code "")))))) (popup-name (when requires-confirmation-p (symbol-name (gensym "popup")))) @@ -364,7 +364,6 @@ $('~A').foundation(); (t confirm-question)) env)))) - (defmacro with-html-form ((method-type action &key id @@ -374,7 +373,7 @@ $('~A').foundation(); extra-submit-code requires-confirmation-p (confirm-question "Are you sure?") - (submit-fn "initiateFormAction(\"~A\", $(this), \"~A\")")) + (submit-fn *js-default-form-action*)) &body body &environment env) "Wraps a body with (:form ...) using REBLOCKS/HTML:WITH-HTML. @@ -500,8 +499,7 @@ bot, crawling the internet will hit this action with GET request." (action-code (make-action action)) (url (make-action-url action-code)) (on-click (when ajaxp - (format nil "initiateAction(\"~A\"); return false;" - action-code)))) + (format nil *js-default-action* action-code)))) (with-html (:a :id id