Browse Source

refactor update-nav-menu in nera package.

The function now loops through the values passes to it and sets the
'enable-nav-menu- column in the database for the currently selected
page in the loop.
stable
Craig Oates 2 years ago
parent
commit
9a30da1a44
  1. 14
      src/nera.lisp

14
src/nera.lisp

@ -225,12 +225,14 @@
(setf (site-settings::site-name-of settings-to-update) name)
(mito:save-dao settings-to-update))))
(defun update-nav-menu (page-slug value)
"Updates the `ENABLE-NAV-MENU' property in `PAGES' database."
(with-connection (db)
(let ((page-to-update (mito:find-dao 'page :slug page-slug)))
(setf (pages::enable-nav-menu-p page-to-update) value)
(mito:save-dao page-to-update))))
(defun update-nav-menu (selected-pages)
"Updates the `ENABLE-NAV-MENU' property in `PAGE' database."
(loop for page in selected-pages
do (with-connection (db)
(let ((page-to-update (mito:find-dao 'page :slug (car page))))
(setf (pages::enable-nav-menu-p page-to-update)
(utils:checkbox-to-bool (cdr page)))
(mito:save-dao page-to-update)))))
(defun nav-menu-slugs ()
(with-connection (db)

Loading…
Cancel
Save