diff options
Diffstat (limited to 'editor/actions')
-rwxr-xr-x | editor/actions/actions.ml | 14 | ||||
-rwxr-xr-x | editor/actions/add_page.ml | 10 | ||||
-rwxr-xr-x | editor/actions/delete_page.ml | 10 | ||||
-rwxr-xr-x | editor/actions/event.ml | 9 | ||||
-rwxr-xr-x | editor/actions/load_page.ml | 2 |
5 files changed, 17 insertions, 28 deletions
diff --git a/editor/actions/actions.ml b/editor/actions/actions.ml index b150279..f35beef 100755 --- a/editor/actions/actions.ml +++ b/editor/actions/actions.ml @@ -3,12 +3,10 @@ open Js_of_ocaml open Brr open Brr_note -module Event = Event - type button_actions = - { delete : Event.t Note.event - ; redirect : Event.t Note.event - ; add: Event.t Note.event + { delete : State.event Note.event + ; redirect : State.event Note.event + ; add: State.event Note.event } let populate_menu @@ -87,19 +85,19 @@ let populate_menu - the list for all the pages presents in the sidebar *) let redirect_handler = - (module Load_page.M : Event.Handler with type t = Load_page.M.t ) in + (module Load_page.M : State.Event with type t = Load_page.M.t ) in let redirect_event = Note.E.select (( Evr.on_el Ev.click - (fun _ -> Event.E (None, redirect_handler)) + (fun _ -> State.E (None, redirect_handler)) home_button ) :: ( List.map2 stored_pages pages ~f:(fun name el -> Evr.on_el Ev.click - (fun _ -> Event.E ((Some name), redirect_handler)) + (fun _ -> State.E ((Some name), redirect_handler)) el ))) in let childs = diff --git a/editor/actions/add_page.ml b/editor/actions/add_page.ml index 3ada726..4a3fcf3 100755 --- a/editor/actions/add_page.ml +++ b/editor/actions/add_page.ml @@ -9,7 +9,7 @@ module M = struct = fun title -> title - let apply + let update : t -> State.t -> State.t = fun {title} state -> let page_id = key_of_title title in @@ -24,17 +24,17 @@ end (** Create a new element *) let create - : unit -> Event.t Note.event + : unit -> State.event Note.event = fun () -> let title = Jstr.v "Nouvelle page" in - let ev = Forms.Ui.popup + let ev = Elements.Popup.create ~title ~form:(Some (Forms.Add_page.create ())) in Note.E.map - (fun v -> Event.E + (fun v -> State.E (v - , (module M : Event.Handler with type t = M.t ))) + , (module M : State.Event with type t = M.t ))) (* Option.on_some trigger the event only when the pop up is validated. Closing the popup doesn't do anything. *) diff --git a/editor/actions/delete_page.ml b/editor/actions/delete_page.ml index 5c625bd..9086fc3 100755 --- a/editor/actions/delete_page.ml +++ b/editor/actions/delete_page.ml @@ -2,7 +2,7 @@ module M = struct type t = unit - let apply + let update : t -> State.t -> State.t = fun () state -> match state.page_id with @@ -15,15 +15,15 @@ module M = struct end let create - : unit -> Event.t Note.event + : unit -> State.event Note.event = fun () -> let title = Jstr.v "Confirmation" in - let ev = Forms.Ui.popup + let ev = Elements.Popup.create ~title ~form:(Some (Forms.Delete_page.create () )) in Note.E.map - (fun v -> Event.E + (fun v -> State.E ( v - , (module M : Event.Handler with type t = M.t ))) + , (module M : State.Event with type t = M.t ))) (Note.E.Option.on_some ev) diff --git a/editor/actions/event.ml b/editor/actions/event.ml deleted file mode 100755 index 21e3d3a..0000000 --- a/editor/actions/event.ml +++ /dev/null @@ -1,9 +0,0 @@ -module type Handler = sig - - type t - - val apply: t -> State.t -> State.t - -end - -type t = E : 'a * (module Handler with type t = 'a) -> t diff --git a/editor/actions/load_page.ml b/editor/actions/load_page.ml index eb4afac..ceee038 100755 --- a/editor/actions/load_page.ml +++ b/editor/actions/load_page.ml @@ -2,7 +2,7 @@ module M = struct type t = Jstr.t option - let apply + let update : t -> State.t -> State.t = fun page_id state -> let json = State.Storage.load page_id in |