I replaced some code in the layout.lisp file (weblocks-clsql-demo package) (see below), and it works partially : within the same session, if i add a new company, the menu is not refreshed, i need to reset the session.
My Questions :
1) Use of "find-persistent-objects" is it the right way ?
2) How to refresh the menu without reset the session ?
(defun make-company-page (company)
(make-instance 'composite :widgets
(list
(lambda ()
(with-html (:p "Company data")
(:ul
(:li "Name : " (str (company-name company)))
(:li "ID : " (str (company-id
company)))))))))
(defun make-main-page ()
"Lays out the main page. It consists of a FLASH widget for
showing
initial message, and a NAVIGATION widget with panes that
hold
employees page and companies page."
(make-instance 'composite :widgets
(list
(make-instance 'flash :messages
(list "Welcome to weblocks demo -
a
technology demonstration for
a
continuations-based
web
framework written in
Common
Lisp."))
(let ((companies (weblocks:find-persistent-objects
(class-store 'company) 'company)))
(if companies
(apply #'make-navigation
(cons 'main-menu
(loop for comp in companies
append (list
(company-name comp)
(make-company-page comp)))))
"")))))
;; (make-navigation
'main-menu
;; 'employees
(make-employees-page)
;; 'companies
(make-companies-page)))))
thanks
--
Fred
Le vendredi 31 août 2012 12:05:51 UTC+2, (inconnu) a écrit :
>
> Hello,
>
> i want to rewrite a php/mysql app with weblocks.
>
> I'm a beginner, so i ask beginner questions.
>
> First i start with weblocks-clsql-demo.
>
> I want to make a page with two part :
>
> 1) a menu 'Company'
> Menu items will be name companies
>
> 2) Employees of the selected company or blank if the company has no
> employees
>
>
> Do i have to use navigation widget to the menu (which is not static)?
> Can i use an existing view class to get data from DB or create a specific
> one ?
> Which code can i read to learn about this question ?
>
> Thanks,
>
> (i apologize about my english)
> --
> Fred
>
>
>
--
You received this message because you are subscribed to the Google Groups
"weblocks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/weblocks/-/0uWoWHPpo2IJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/weblocks?hl=en.
