Browse Source

A bit of frontend changes.

master
Silas Vedder 2 years ago
parent
commit
4888987971
  1. 4
      chapter.lisp
  2. 45
      clog.lisp

4
chapter.lisp

@ -27,7 +27,9 @@
(create-div (create-web-content (create-web-main canvas)))) (create-div (create-web-content (create-web-main canvas))))
(defmethod display-chapter-or-book (canvas (chapter chapter)) (defmethod display-chapter-or-book (canvas (chapter chapter))
(chapter-to-clog chapter (book/chapter-window canvas))) (let ((div (book/chapter-window canvas)))
(chapter-to-clog chapter div)
div))
(defmethod load-chapter (canvas (book string) (chapter string)) (defmethod load-chapter (canvas (book string) (chapter string))
(let* ((bk (s:find-book d:*bible* book)) (let* ((bk (s:find-book d:*bible* book))

45
clog.lisp

@ -3,6 +3,7 @@
(in-package #:cl-bible.clog) (in-package #:cl-bible.clog)
(defvar *body*) (defvar *body*)
(defvar *text* nil)
(defun lift-search-window (body search) (defun lift-search-window (body search)
(let ((result (mapcar #'car (l:lift-search search)))) (let ((result (mapcar #'car (l:lift-search search))))
@ -32,27 +33,29 @@
(v:verse-to-string verse))) (v:verse-to-string verse)))
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(ch:load-chapter canvas (when *text* (destroy *text*))
(v:bname verse) (setf *text* (ch:load-chapter canvas
(v:chapter verse))))) (v:bname verse)
results))) (v:chapter verse))))))
results)
content))
(defun reload (window) (defun reload (window)
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(let ((dialog (clog-web-form window "Which bible do you want?" (let ((dialog (clog-web-form window "Which bible do you want?"
'(("Bible" "bible" :select (("Menge" :mng) '(("Bible" "bible" :select (("Menge" :mng)
("King James Version" :kjv) ("King James Version" :kjv)
("Vulgata" :vul) ("Vulgata" :vul)
("Greek Bible" :grb) ("Greek Bible" :grb)
("Elberfelder Übersetzung 1871" :elb1871) ("Elberfelder Übersetzung 1871" :elb1871)
("NEÜ" :neue) ("NEÜ" :neue)
("Luther 1545" :luth1545) ("Luther 1545" :luth1545)
("Luther 1912" :luth1912) ("Luther 1912" :luth1912)
("Schlachter 1951" :sch1951) ("Schlachter 1951" :sch1951)
("Ukrainische Version" :ukr)))) ("Ukrainische Version" :ukr))))
(lambda (results) (lambda (results)
(d:update-bible (form-result results "bible"))))))))) (d:update-bible (form-result results "bible")))))))))
(defun load-book-or-chapter (canvas) (defun load-book-or-chapter (canvas)
(lambda (data) (lambda (data)
@ -63,8 +66,8 @@
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(clog-web-form body "Which passage do you want?" (clog-web-form body "Which passage do you want?"
'(("" "pos" :text)) '(("" "pos" :text))
(load-book-or-chapter body)))) (load-book-or-chapter body))))
(defun setup-menu-bar (body) (defun setup-menu-bar (body)
(let* ((form-space (create-web-content body)) (let* ((form-space (create-web-content body))
@ -85,12 +88,14 @@
(set-on-submit form1 (set-on-submit form1
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(ch:load-position body (value passage)))) (when *text* (destroy *text*))
(setf *text* (ch:load-position body (value passage)))))
(create-form-element form3 :submit :value "Search phrase") (create-form-element form3 :submit :value "Search phrase")
(set-on-submit form3 (set-on-submit form3
(lambda (obj) (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(search-in-bible (value search) d:*bible* body))))) (when *text* (destroy *text*))
(setf *text* (search-in-bible (value search) d:*bible* body))))))
(defun on-new-window (body) (defun on-new-window (body)
(setf *body* body) (setf *body* body)

Loading…
Cancel
Save