From a6e30a95b5dcd34fb9e65d9a26f0844ec75bb004 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 3 Jun 2021 11:41:28 +0200 Subject: Greyed the delete button on main page --- editor/actions/editor_actions.ml | 23 +++++++++++++++-------- editor/actions/editor_actions.mli | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'editor/actions') diff --git a/editor/actions/editor_actions.ml b/editor/actions/editor_actions.ml index 0053890..5b2a3d3 100755 --- a/editor/actions/editor_actions.ml +++ b/editor/actions/editor_actions.ml @@ -13,6 +13,7 @@ type t = ; childs : El.t list ; ul : El.t ; mutable completed : bool + ; delete_button : El.t } let build @@ -153,6 +154,7 @@ let build { ev = result_event ; childs ; ul + ; delete_button ; completed = false } @@ -175,23 +177,28 @@ let get_notes _ = [ El.txt name ] ]) let complete - : t -> State.t Note.event -> El.t list - = fun ({ childs; ul ; completed ; _ } as t) change -> + : t -> State.t Note.signal -> El.t list + = fun ({ childs; ul ; completed ; delete_button ; _ } as t) change -> let () = if completed then raise (Failure "The action panel is already registered") in let note_list = - Note.E.map get_notes + Note.S.map get_notes change in t.completed <- true; - (* Register all the notes at the creation time *) - El.set_children ul (get_notes ()); - - (* Then register updates *) - Elr.set_children ul ~on:note_list; + Elr.def_children ul note_list; + Elr.def_at + (Jstr.v "disabled") + (Note.S.map + (fun state -> + match state.State.page_id with + | None -> Some Jstr.empty + | Some _ -> None) + change) + delete_button; childs diff --git a/editor/actions/editor_actions.mli b/editor/actions/editor_actions.mli index 48d5676..27b09d7 100755 --- a/editor/actions/editor_actions.mli +++ b/editor/actions/editor_actions.mli @@ -14,4 +14,4 @@ val get_event *) val complete - : t -> State.t Note.event -> Brr.El.t list + : t -> State.t Note.signal -> Brr.El.t list -- cgit v1.2.3