diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 15:17:51 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 16:43:33 +0100 |
commit | 4ba4951e530cbdfb6fa7bee811456208a83ce1dd (patch) | |
tree | a336f1bd979da47864b3899ea340378015e72dd6 /editor/actions | |
parent | 179720a7f2c790ea5557bb5caabe22a926b3e106 (diff) |
In popup, added a predicate to validate the form
Diffstat (limited to 'editor/actions')
-rwxr-xr-x | editor/actions/add_page.ml | 3 | ||||
-rwxr-xr-x | editor/actions/delete_page.ml | 3 | ||||
-rwxr-xr-x | editor/actions/import.ml | 7 | ||||
-rwxr-xr-x | editor/actions/load_page.ml | 1 |
4 files changed, 10 insertions, 4 deletions
diff --git a/editor/actions/add_page.ml b/editor/actions/add_page.ml index e5e8541..ec9768b 100755 --- a/editor/actions/add_page.ml +++ b/editor/actions/add_page.ml @@ -23,7 +23,8 @@ let create let title = Jstr.v "Nouvelle page" in let ev = Elements.Popup.create ~title - ~form:(Some (Forms.Add_page.create ())) + ~form:(Forms.Add_page.create ()) + () in Note.E.map (fun v -> State.E diff --git a/editor/actions/delete_page.ml b/editor/actions/delete_page.ml index 58c1d32..fbd4fde 100755 --- a/editor/actions/delete_page.ml +++ b/editor/actions/delete_page.ml @@ -22,7 +22,8 @@ let create in let ev = Elements.Popup.create ~title - ~form:(Some (Forms.Validation.create message )) + ~form:(Forms.Validation.create message) + () in Note.E.map (fun v -> State.E diff --git a/editor/actions/import.ml b/editor/actions/import.ml index 4cac76c..13ed938 100755 --- a/editor/actions/import.ml +++ b/editor/actions/import.ml @@ -44,9 +44,14 @@ end let create () = let title = Jstr.v "Importer des notes" in + let form = Forms.Selector.create () in let ev = Elements.Popup.create ~title - ~form:(Some (Forms.Selector.create ())) in + ~form + ~valid_on:(Note.S.map (fun form -> form.Forms.Selector.file != None) (fst form)) + () + in + Note.E.map (fun v -> State.E ( v diff --git a/editor/actions/load_page.ml b/editor/actions/load_page.ml index 349eaad..bcce51c 100755 --- a/editor/actions/load_page.ml +++ b/editor/actions/load_page.ml @@ -8,4 +8,3 @@ module M = struct State.load_page page_id state end - |