From 83279461c5de10d80c308e42c33f4865dad0eeaa Mon Sep 17 00:00:00 2001 From: Vincent Balat Date: Sun, 18 Feb 2024 17:14:55 +0100 Subject: [PATCH] ocamlformat update to 0.26.1 for template --- template.distillery/PROJECT_NAME.eliom | 26 ++++------ template.distillery/PROJECT_NAME_base.eliom | 17 +++---- template.distillery/PROJECT_NAME_config.eliom | 15 +++--- .../PROJECT_NAME_container.eliom | 10 ++-- template.distillery/PROJECT_NAME_drawer.eliom | 7 +-- .../PROJECT_NAME_handlers.eliom | 17 +++---- .../PROJECT_NAME_language.eliom | 38 +++++++-------- template.distillery/PROJECT_NAME_mobile.eliom | 47 +++++++++---------- template.distillery/PROJECT_NAME_page.eliom | 12 ++--- .../PROJECT_NAME_phone_connect.eliom | 4 +- .../PROJECT_NAME_services.eliom | 10 ++-- .../PROJECT_NAME_settings.eliom | 32 ++++++------- template.distillery/demo.eliom | 6 +-- template.distillery/demo_cache.eliom | 6 +-- template.distillery/demo_calendar.eliom | 6 +-- template.distillery/demo_carousel1.eliom | 14 +++--- template.distillery/demo_carousel2.eliom | 16 +++---- template.distillery/demo_carousel3.eliom | 10 ++-- template.distillery/demo_i18n.eliom | 6 +-- template.distillery/demo_links.eliom | 6 +-- template.distillery/demo_notif.eliom | 39 +++++++-------- template.distillery/demo_pagetransition.eliom | 16 ++++--- template.distillery/demo_pgocaml.eliom | 6 +-- template.distillery/demo_popup.eliom | 23 ++++----- template.distillery/demo_pulltorefresh.eliom | 5 +- template.distillery/demo_react.eliom | 9 ++-- template.distillery/demo_ref.eliom | 6 +-- template.distillery/demo_rpc.eliom | 12 ++--- template.distillery/demo_spinner.eliom | 6 +-- template.distillery/demo_timepicker.eliom | 10 ++-- template.distillery/demo_tips.eliom | 10 ++-- template.distillery/demo_tongue.eliom | 6 +-- template.distillery/demo_tools.eliom | 4 +- template.distillery/demo_users.eliom | 6 +-- 34 files changed, 220 insertions(+), 243 deletions(-) diff --git a/template.distillery/PROJECT_NAME.eliom b/template.distillery/PROJECT_NAME.eliom index 197f45dde..6efff47e2 100644 --- a/template.distillery/PROJECT_NAME.eliom +++ b/template.distillery/PROJECT_NAME.eliom @@ -30,28 +30,22 @@ let%shared () = (Os_session.Opt.connected_fun %%%MODULE_NAME%%%_handlers.action_link_handler); Eliom_registration.Action.register ~service:Os_services.add_email_service (fun () email -> - let%lwt () = Os_handlers.add_email_handler () email in - add_email_notif (); Lwt.return_unit); + let%lwt () = Os_handlers.add_email_handler () email in + add_email_notif (); Lwt.return_unit); Eliom_registration.Action.register ~service:Os_services.update_language_service %%%MODULE_NAME%%%_handlers.update_language_handler; %%%MODULE_NAME%%%_base.App.register ~service:Os_services.main_service - (%%%MODULE_NAME%%%_page.Opt.connected_page - %%%MODULE_NAME%%%_handlers.main_service_handler); - %%%MODULE_NAME%%%_base.App.register - ~service:%%%MODULE_NAME%%%_services.about_service - (%%%MODULE_NAME%%%_page.Opt.connected_page - %%%MODULE_NAME%%%_handlers.about_handler); - %%%MODULE_NAME%%%_base.App.register - ~service:%%%MODULE_NAME%%%_services.settings_service - (%%%MODULE_NAME%%%_page.Opt.connected_page - %%%MODULE_NAME%%%_handlers.settings_handler) + (%%%MODULE_NAME%%%_page.Opt.connected_page %%%MODULE_NAME%%%_handlers.main_service_handler); + %%%MODULE_NAME%%%_base.App.register ~service:%%%MODULE_NAME%%%_services.about_service + (%%%MODULE_NAME%%%_page.Opt.connected_page %%%MODULE_NAME%%%_handlers.about_handler); + %%%MODULE_NAME%%%_base.App.register ~service:%%%MODULE_NAME%%%_services.settings_service + (%%%MODULE_NAME%%%_page.Opt.connected_page %%%MODULE_NAME%%%_handlers.settings_handler) let%server () = Eliom_registration.Ocaml.register ~service:%%%MODULE_NAME%%%_services.upload_user_avatar_service - (Os_session.connected_fun - %%%MODULE_NAME%%%_handlers.upload_user_avatar_handler) + (Os_session.connected_fun %%%MODULE_NAME%%%_handlers.upload_user_avatar_handler) (* Print more debugging information when is in config file (DEBUG = yes in Makefile.options). @@ -60,7 +54,7 @@ let%server () = ... Lwt_log.ign_info ~section "This is an information"; (or ign_debug, ign_warning, ign_error etc.) - *) +*) let%server _ = if Eliom_config.get_debugmode () then ( @@ -71,7 +65,7 @@ let%server _ = (* Lwt_log_core.add_rule "os*" Lwt_log_js.Debug; *) Lwt_log_core.add_rule "%%%MODULE_NAME%%%*" Lwt_log_js.Debug (* Lwt_log_core.add_rule "*" Lwt_log_js.Debug *) - : unit)]; + : unit)]; (* Lwt_log_core.add_rule "*" Lwt_log.Debug *) Lwt_log_core.add_rule "%%%MODULE_NAME%%%*" Lwt_log.Debug) diff --git a/template.distillery/PROJECT_NAME_base.eliom b/template.distillery/PROJECT_NAME_base.eliom index 6603c039e..60d28cfc5 100644 --- a/template.distillery/PROJECT_NAME_base.eliom +++ b/template.distillery/PROJECT_NAME_base.eliom @@ -7,29 +7,24 @@ let%shared displayed_app_name = "%%%PROJECT_NAME%%%" (* Database initialization *) let () = - Os_db.init - ?host:!%%%MODULE_NAME%%%_config.os_db_host - ?port:!%%%MODULE_NAME%%%_config.os_db_port + Os_db.init ?host:!%%%MODULE_NAME%%%_config.os_db_host ?port:!%%%MODULE_NAME%%%_config.os_db_port ?user:!%%%MODULE_NAME%%%_config.os_db_user ?password:!%%%MODULE_NAME%%%_config.os_db_password ?database:!%%%MODULE_NAME%%%_config.os_db_database - ?unix_domain_socket_dir: - !%%%MODULE_NAME%%%_config.os_db_unix_domain_socket_dir + ?unix_domain_socket_dir:!%%%MODULE_NAME%%%_config.os_db_unix_domain_socket_dir () let () = Os_email.set_mailer "/usr/sbin/sendmail" - -let () = - Os_email.set_from_addr ("%%%PROJECT_NAME%%% team", "noreply@DEFAULT.DEFAULT") +let () = Os_email.set_from_addr ("%%%PROJECT_NAME%%% team", "noreply@DEFAULT.DEFAULT") (* Create a module for the application. See https://ocsigen.org/eliom/manual/clientserver-applications for more information. *) [%%shared module App = Eliom_registration.App (struct - let application_name = application_name - let global_data_path = Some ["__global_data__"] -end)] + let application_name = application_name + let global_data_path = Some ["__global_data__"] + end)] (* As the headers (stylesheets, etc) won't change, we ask Eliom not to update the of the page when changing page. (This also avoids diff --git a/template.distillery/PROJECT_NAME_config.eliom b/template.distillery/PROJECT_NAME_config.eliom index d97e604fe..b958b3c65 100644 --- a/template.distillery/PROJECT_NAME_config.eliom +++ b/template.distillery/PROJECT_NAME_config.eliom @@ -47,7 +47,7 @@ let avatars = let open Ocsigen_extensions.Configuration in let attributes = [ attribute ~name:"dir" ~obligatory:true (fun h -> - avatar_dir := Eliom_lib.String.split '/' h) ] + avatar_dir := Eliom_lib.String.split '/' h) ] in element ~name:"avatars" ~obligatory:true ~attributes () @@ -57,17 +57,16 @@ let os_db = let attributes = [ attribute ~name:"host" (fun h -> os_db_host := Some h) ; attribute ~name:"port" (fun h -> - os_db_port := - try Some (int_of_string h) - with Failure _ -> - raise - @@ Ocsigen_extensions.Error_in_config_file - "port is not an integer") + os_db_port := + try Some (int_of_string h) + with Failure _ -> + raise + @@ Ocsigen_extensions.Error_in_config_file "port is not an integer") ; attribute ~name:"user" (fun h -> os_db_user := Some h) ; attribute ~name:"password" (fun h -> os_db_password := Some h) ; attribute ~name:"database" (fun h -> os_db_database := Some h) ; attribute ~name:"unix_domain_socket_dir" (fun h -> - os_db_unix_domain_socket_dir := Some h) ] + os_db_unix_domain_socket_dir := Some h) ] in element ~name:"os-db" ~attributes () diff --git a/template.distillery/PROJECT_NAME_container.eliom b/template.distillery/PROJECT_NAME_container.eliom index 946fe8cc2..4fe0b2dbd 100644 --- a/template.distillery/PROJECT_NAME_container.eliom +++ b/template.distillery/PROJECT_NAME_container.eliom @@ -30,14 +30,14 @@ let%shared os_footer () = [ p [ txt [%i18n S.footer_generated] ; a ~service:%%%MODULE_NAME%%%_services.os_github_service - [txt " Ocsigen Start "] () + [txt " Ocsigen Start "] + () ; txt [%i18n S.footer_eliom_distillery] - ; a ~service:%%%MODULE_NAME%%%_services.ocsigen_service - [txt " Ocsigen "] () + ; a ~service:%%%MODULE_NAME%%%_services.ocsigen_service [txt " Ocsigen "] () ; txt [%i18n S.footer_technology] ] ] -let%rpc get_wrong_pdata () - : ((string * string) * (string * string)) option Lwt.t +let%rpc get_wrong_pdata () : + ((string * string) * (string * string)) option Lwt.t = Lwt.return @@ Eliom_reference.Volatile.get Os_msg.wrong_pdata diff --git a/template.distillery/PROJECT_NAME_drawer.eliom b/template.distillery/PROJECT_NAME_drawer.eliom index 7cc2b504f..9a9853e61 100644 --- a/template.distillery/PROJECT_NAME_drawer.eliom +++ b/template.distillery/PROJECT_NAME_drawer.eliom @@ -9,9 +9,7 @@ let%shared item text service = li [a ~a:[a_class ["os-drawer-item"]] ~service [txt text] ()] let%shared user_menu () = - [ item - [%i18n S.settings ~capitalize:true] - %%%MODULE_NAME%%%_services.settings_service + [ item [%i18n S.settings ~capitalize:true] %%%MODULE_NAME%%%_services.settings_service ; Eliom_content.Html.F.li [ Os_user_view.disconnect_link ~text_logout:[%i18n S.logout ~capitalize:true] @@ -22,8 +20,7 @@ let%shared make ?user () = let items = if user = None then [] else user_menu () in let items = item [%i18n S.home ~capitalize:true] Os_services.main_service - :: item [%i18n S.about ~capitalize:true] - %%%MODULE_NAME%%%_services.about_service + :: item [%i18n S.about ~capitalize:true] %%%MODULE_NAME%%%_services.about_service :: Demo_tools.drawer_contents () :: items in diff --git a/template.distillery/PROJECT_NAME_handlers.eliom b/template.distillery/PROJECT_NAME_handlers.eliom index feefe4916..6171126db 100644 --- a/template.distillery/PROJECT_NAME_handlers.eliom +++ b/template.distillery/PROJECT_NAME_handlers.eliom @@ -25,8 +25,8 @@ let upload_user_avatar_handler myid () ((), (cropping, photo)) = let%server set_personal_data_handler = Os_session.connected_fun Os_handlers.set_personal_data_handler -let%rpc set_personal_data_rpc (data : (string * string) * (string * string)) - : unit Lwt.t +let%rpc set_personal_data_rpc (data : (string * string) * (string * string)) : + unit Lwt.t = set_personal_data_handler () data @@ -35,8 +35,7 @@ let%client set_personal_data_handler () = set_personal_data_rpc (* Forgot password *) let%server forgot_password_handler = - Os_handlers.forgot_password_handler - %%%MODULE_NAME%%%_services.settings_service + Os_handlers.forgot_password_handler %%%MODULE_NAME%%%_services.settings_service let%rpc forgot_password_rpc (email : string) : unit Lwt.t = forgot_password_handler () email @@ -96,8 +95,7 @@ let%shared action_link_handler myid_o akey () = ~a_placeholder_email:[%i18n S.your_email] ~text:[%i18n S.sign_up] ~email () ] ] in - %%%MODULE_NAME%%%_base.App.send - (%%%MODULE_NAME%%%_page.make_page (Os_page.content page)) + %%%MODULE_NAME%%%_base.App.send (%%%MODULE_NAME%%%_page.make_page (Os_page.content page)) else let page = [ div @@ -108,8 +106,7 @@ let%shared action_link_handler myid_o akey () = ~text_keep_me_logged_in:[%i18n S.keep_logged_in] ~text_sign_in:[%i18n S.sign_in] ~email () ] ] in - %%%MODULE_NAME%%%_base.App.send - (%%%MODULE_NAME%%%_page.make_page (Os_page.content page)) + %%%MODULE_NAME%%%_base.App.send (%%%MODULE_NAME%%%_page.make_page (Os_page.content page)) else (*VVV In that case we must do something more complex. Check whether myid = userid and ask the user what he wants to @@ -122,8 +119,8 @@ let%shared action_link_handler myid_o akey () = let%server set_password_handler = Os_session.connected_fun (fun myid () (pwd, pwd2) -> - let%lwt () = Os_handlers.set_password_handler myid () (pwd, pwd2) in - Lwt.return (Eliom_registration.Redirection Eliom_service.reload_action)) + let%lwt () = Os_handlers.set_password_handler myid () (pwd, pwd2) in + Lwt.return (Eliom_registration.Redirection Eliom_service.reload_action)) let%client set_password_handler () (pwd, pwd2) = let%lwt () = Os_handlers.set_password_rpc (pwd, pwd2) in diff --git a/template.distillery/PROJECT_NAME_language.eliom b/template.distillery/PROJECT_NAME_language.eliom index 195dd2b82..dc32fb9f1 100644 --- a/template.distillery/PROJECT_NAME_language.eliom +++ b/template.distillery/PROJECT_NAME_language.eliom @@ -35,24 +35,22 @@ let%server update_language lang = let%server _ = Os_session.on_start_process (fun _ -> - (* Guess a default language. *) - let%lwt lang = best_matched_language () in - ignore (update_language lang); - Lwt.return_unit); + (* Guess a default language. *) + let%lwt lang = best_matched_language () in + ignore (update_language lang); + Lwt.return_unit); Os_session.on_start_connected_process (fun userid -> - (* Set language according to user preferences. *) - let%lwt language = - match%lwt Os_user.get_language userid with - | Some lang -> - Lwt.return (%%%MODULE_NAME%%%_i18n.guess_language_of_string lang) - | None -> - let%lwt best_language = best_matched_language () in - ignore - (Os_user.update_language ~userid - ~language: - (%%%MODULE_NAME%%%_i18n.string_of_language best_language)); - Lwt.return best_language - in - %%%MODULE_NAME%%%_i18n.set_language language; - ignore [%client (%%%MODULE_NAME%%%_i18n.set_language ~%language : unit)]; - Lwt.return_unit) + (* Set language according to user preferences. *) + let%lwt language = + match%lwt Os_user.get_language userid with + | Some lang -> Lwt.return (%%%MODULE_NAME%%%_i18n.guess_language_of_string lang) + | None -> + let%lwt best_language = best_matched_language () in + ignore + (Os_user.update_language ~userid + ~language:(%%%MODULE_NAME%%%_i18n.string_of_language best_language)); + Lwt.return best_language + in + %%%MODULE_NAME%%%_i18n.set_language language; + ignore [%client (%%%MODULE_NAME%%%_i18n.set_language ~%language : unit)]; + Lwt.return_unit) diff --git a/template.distillery/PROJECT_NAME_mobile.eliom b/template.distillery/PROJECT_NAME_mobile.eliom index f923b006c..ca2161f33 100644 --- a/template.distillery/PROJECT_NAME_mobile.eliom +++ b/template.distillery/PROJECT_NAME_mobile.eliom @@ -30,12 +30,11 @@ let to_lwt f = let ondeviceready = to_lwt (fun cont -> - ignore - @@ Js_of_ocaml.Dom.addEventListener Js_of_ocaml.Dom_html.document - (Js_of_ocaml.Dom_html.Event.make "deviceready") - (Js_of_ocaml.Dom_html.handler (fun _ -> - cont (); Js_of_ocaml.Js._true)) - Js_of_ocaml.Js._false) + ignore + @@ Js_of_ocaml.Dom.addEventListener Js_of_ocaml.Dom_html.document + (Js_of_ocaml.Dom_html.Event.make "deviceready") + (Js_of_ocaml.Dom_html.handler (fun _ -> cont (); Js_of_ocaml.Js._true)) + Js_of_ocaml.Js._false) let app_started = ref false let initial_change_page = ref None @@ -80,9 +79,9 @@ let () = @@ Js_of_ocaml.Dom.addEventListener Js_of_ocaml.Dom_html.document (Js_of_ocaml.Dom_html.Event.make ev) (Js_of_ocaml.Dom_html.handler (fun _ -> - Firebug.console##log (Js_of_ocaml.Js.string ev); - Eliom_comet.activate (); - Js_of_ocaml.Js._true)) + Firebug.console##log (Js_of_ocaml.Js.string ev); + Eliom_comet.activate (); + Js_of_ocaml.Js._true)) Js_of_ocaml.Js._false in activate "online"; activate "resume" @@ -102,8 +101,8 @@ let () = (st##getItem lc) (fun () -> ()) (fun url -> - st##removeItem lc; - change_page_uri (Js_of_ocaml.Js.to_string url)) + st##removeItem lc; + change_page_uri (Js_of_ocaml.Js.to_string url)) (* Handle universal links *) @@ -121,15 +120,15 @@ let universal_links () = let%lwt () = ondeviceready in Lwt.return @@ Js_of_ocaml.Js.Optdef.to_option @@ (Js_of_ocaml.Js.Unsafe.global##.universalLinks - : < subscribe : - Js_of_ocaml.Js.js_string Js_of_ocaml.Js.opt - -> (event Js_of_ocaml.Js.t -> unit) Js_of_ocaml.Js.callback - -> unit Js_of_ocaml.Js.meth - ; unsubscribe : - Js_of_ocaml.Js.js_string Js_of_ocaml.Js.opt - -> unit Js_of_ocaml.Js.meth > - Js_of_ocaml.Js.t - Js_of_ocaml.Js.Optdef.t) + : < subscribe : + Js_of_ocaml.Js.js_string Js_of_ocaml.Js.opt + -> (event Js_of_ocaml.Js.t -> unit) Js_of_ocaml.Js.callback + -> unit Js_of_ocaml.Js.meth + ; unsubscribe : + Js_of_ocaml.Js.js_string Js_of_ocaml.Js.opt + -> unit Js_of_ocaml.Js.meth > + Js_of_ocaml.Js.t + Js_of_ocaml.Js.Optdef.t) let _ = match%lwt universal_links () with @@ -138,10 +137,10 @@ let _ = (Js_of_ocaml.Js.string "Universal links: registering"); universal_links##subscribe Js_of_ocaml.Js.null (Js_of_ocaml.Js.wrap_callback (fun (ev : event Js_of_ocaml.Js.t) -> - Js_of_ocaml.Firebug.console##log_2 - (Js_of_ocaml.Js.string "Universal links: got link") - ev##.url; - change_page_uri (Js_of_ocaml.Js.to_string ev##.url))); + Js_of_ocaml.Firebug.console##log_2 + (Js_of_ocaml.Js.string "Universal links: got link") + ev##.url; + change_page_uri (Js_of_ocaml.Js.to_string ev##.url))); Js_of_ocaml.Firebug.console##log (Js_of_ocaml.Js.string "Universal links: registered"); Lwt.return_unit diff --git a/template.distillery/PROJECT_NAME_page.eliom b/template.distillery/PROJECT_NAME_page.eliom index 9327b1e66..698f9da19 100644 --- a/template.distillery/PROJECT_NAME_page.eliom +++ b/template.distillery/PROJECT_NAME_page.eliom @@ -22,9 +22,7 @@ let%client css_name_script = [] (* Warning: either we use exactly the same global node (and make sure global nodes work properly on client side), or we do not add the script on client side. We chose the second solution. *) -let%server app_js = - [%%%MODULE_NAME%%%_base.App.application_script ~defer:true ()] - +let%server app_js = [%%%MODULE_NAME%%%_base.App.application_script ~defer:true ()] let%client app_js = [] let%server the_local_js = [] let%client the_local_js = [] (* in index.html *) @@ -53,14 +51,14 @@ module Page_config = struct let default_error_page _ _ exn = %%%MODULE_NAME%%%_container.page None (if Ocsigen_config.get_debugmode () - then [p [txt (Printexc.to_string exn)]] - else [p [txt "Error"]]) + then [p [txt (Printexc.to_string exn)]] + else [p [txt "Error"]]) let default_connected_error_page myid_o _ _ exn = %%%MODULE_NAME%%%_container.page myid_o (if Ocsigen_config.get_debugmode () - then [p [txt (Printexc.to_string exn)]] - else [p [txt "Error"]]) + then [p [txt (Printexc.to_string exn)]] + else [p [txt "Error"]]) end include Os_page.Make (Page_config)] diff --git a/template.distillery/PROJECT_NAME_phone_connect.eliom b/template.distillery/PROJECT_NAME_phone_connect.eliom index ea5da8c0c..5859727e6 100644 --- a/template.distillery/PROJECT_NAME_phone_connect.eliom +++ b/template.distillery/PROJECT_NAME_phone_connect.eliom @@ -18,8 +18,8 @@ let%server () = if enable then Os_connect_phone.set_send_sms_handler (fun ~number message -> - Printf.printf "Send SMS %s to %s\n%!" message number; - Lwt.return (Ok ())) + Printf.printf "Send SMS %s to %s\n%!" message number; + Lwt.return (Ok ())) let () = if enable diff --git a/template.distillery/PROJECT_NAME_services.eliom b/template.distillery/PROJECT_NAME_services.eliom index ac9940139..041a4ad8e 100644 --- a/template.distillery/PROJECT_NAME_services.eliom +++ b/template.distillery/PROJECT_NAME_services.eliom @@ -2,8 +2,7 @@ Feel free to use it, modify it, and redistribute it as you wish. *) let%server about_service = - Eliom_service.create - ~path:(Eliom_service.Path ["about"]) + Eliom_service.create ~path:(Eliom_service.Path ["about"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () let%server upload_user_avatar_service : (unit, unit) Ot_picture_uploader.service @@ -11,13 +10,11 @@ let%server upload_user_avatar_service : (unit, unit) Ot_picture_uploader.service Ot_picture_uploader.mk_service "upload_user_avatar_service" [%json: unit] let%server demo_service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () let%server settings_service = - Eliom_service.create - ~path:(Eliom_service.Path ["settings"]) + Eliom_service.create ~path:(Eliom_service.Path ["settings"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () let%server os_github_service = @@ -35,6 +32,7 @@ let%client demo_service = ~%demo_service let%client settings_service = ~%settings_service let%client ocsigen_service = ~%ocsigen_service let%client os_github_service = ~%os_github_service + (* The OS lib needs access to the settings service to perform redirections to it. We need to register it *) let%server () = Os_services.register_settings_service settings_service diff --git a/template.distillery/PROJECT_NAME_settings.eliom b/template.distillery/PROJECT_NAME_settings.eliom index ad8341f96..f0eb98ae7 100644 --- a/template.distillery/PROJECT_NAME_settings.eliom +++ b/template.distillery/PROJECT_NAME_settings.eliom @@ -13,12 +13,12 @@ let%shared update_main_email_button email = ignore [%client (Lwt.async (fun () -> - Lwt_js_events.clicks (Eliom_content.Html.To_dom.of_element ~%button) - (fun _ _ -> - let%lwt () = Os_current_user.update_main_email ~%email in - Eliom_client.change_page - ~service:%%%MODULE_NAME%%%_services.settings_service () ())) - : unit)]; + Lwt_js_events.clicks (Eliom_content.Html.To_dom.of_element ~%button) + (fun _ _ -> + let%lwt () = Os_current_user.update_main_email ~%email in + Eliom_client.change_page + ~service:%%%MODULE_NAME%%%_services.settings_service () ())) + : unit)]; button (* A button to remove the email from the database *) @@ -32,12 +32,12 @@ let%shared delete_email_button email = ignore [%client (Lwt.async (fun () -> - Lwt_js_events.clicks (Eliom_content.Html.To_dom.of_element ~%button) - (fun _ _ -> - let%lwt () = Os_current_user.remove_email_from_user ~%email in - Eliom_client.change_page - ~service:%%%MODULE_NAME%%%_services.settings_service () ())) - : unit)]; + Lwt_js_events.clicks (Eliom_content.Html.To_dom.of_element ~%button) + (fun _ _ -> + let%lwt () = Os_current_user.remove_email_from_user ~%email in + Eliom_client.change_page + ~service:%%%MODULE_NAME%%%_services.settings_service () ())) + : unit)]; button (* A list of buttons to update or to remove the email depending on the @@ -93,8 +93,8 @@ let%rpc get_emails myid () : (string option * (string * bool) list) Lwt.t = let%lwt emails = Lwt_list.map_s (fun email -> - let%lwt v = Os_current_user.is_email_validated email in - Lwt.return (email, v)) + let%lwt v = Os_current_user.is_email_validated email in + Lwt.return (email, v)) emails in Lwt.return (main_email, emails) @@ -103,9 +103,7 @@ let%shared select_language_form select_language_name = let open Eliom_content.Html in let current_language = %%%MODULE_NAME%%%_i18n.get_language () in let all_languages_except_current = - List.filter - (fun l -> l <> current_language) - %%%MODULE_NAME%%%_i18n.languages + List.filter (fun l -> l <> current_language) %%%MODULE_NAME%%%_i18n.languages in let form_option_of_language language is_current_language = D.Form.Option diff --git a/template.distillery/demo.eliom b/template.distillery/demo.eliom index 997cd9306..a4d96dd7e 100644 --- a/template.distillery/demo.eliom +++ b/template.distillery/demo.eliom @@ -25,8 +25,7 @@ let%shared () = %%%MODULE_NAME%%%_container.page ~a:[a_class [D.page_class]] myid_o p ) in List.iter registerDemo Demo_tools.demos; - %%%MODULE_NAME%%%_base.App.register - ~service:%%%MODULE_NAME%%%_services.demo_service + %%%MODULE_NAME%%%_base.App.register ~service:%%%MODULE_NAME%%%_services.demo_service (%%%MODULE_NAME%%%_page.Opt.connected_page handler) (* [detail_page_handler] is not registered in [Demo_tools] because we @@ -38,6 +37,5 @@ let%shared () = myid_o (Demo_pagetransition.make_detail_page page ()) in - %%%MODULE_NAME%%%_base.App.register - ~service:Demo_pagetransition.detail_page_service + %%%MODULE_NAME%%%_base.App.register ~service:Demo_pagetransition.detail_page_service (%%%MODULE_NAME%%%_page.Opt.connected_page detail_page_handler) diff --git a/template.distillery/demo_cache.eliom b/template.distillery/demo_cache.eliom index 01e1cac77..1a0d7582a 100644 --- a/template.distillery/demo_cache.eliom +++ b/template.distillery/demo_cache.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Eliom_cscache demo *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-cache"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-cache"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.cache] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-cache" diff --git a/template.distillery/demo_calendar.eliom b/template.distillery/demo_calendar.eliom index b1471b442..52c76b4db 100644 --- a/template.distillery/demo_calendar.eliom +++ b/template.distillery/demo_calendar.eliom @@ -2,17 +2,16 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Calendar demo *) - open Eliom_content.Html.D] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-calendar"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-calendar"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* A reactive value containing the currently selected date *) (* NOTE: in this example, we define a shared signal on the server side. Its original value can only be read when the server generates the first page @@ -48,6 +47,7 @@ let%rpc date_reactive () : string Eliom_shared.React.S.t Lwt.t = (* Name for demo menu *) let%shared name () = [%i18n Demo.S.calendar] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-calendar" diff --git a/template.distillery/demo_carousel1.eliom b/template.distillery/demo_carousel1.eliom index 63ba9ea1c..bae449729 100644 --- a/template.distillery/demo_carousel1.eliom +++ b/template.distillery/demo_carousel1.eliom @@ -2,21 +2,21 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Carousel demo *) - open Eliom_content.Html] [%%shared open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-carousel1"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-carousel1"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.carousel_1] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-carousel1" @@ -37,7 +37,7 @@ let%shared bind_keys (* Do not forget to cancel the thread when we remove the carousel (here, when we go to another page): *) Eliom_client.onunload (fun () -> Lwt.cancel arrow_thread) - : unit)] + : unit)] (* Page for this demo *) let%shared page () = @@ -49,14 +49,14 @@ let%shared page () = let carousel_change_signal = [%client (React.E.create () - : ([`Goto of int | `Next | `Prev] as 'a) React.E.t - * (?step:React.step -> 'a -> unit))] + : ([`Goto of int | `Next | `Prev] as 'a) React.E.t + * (?step:React.step -> 'a -> unit))] in let update = [%client fst ~%carousel_change_signal] in let change = [%client (fun a -> snd ~%carousel_change_signal ?step:None a - : [`Goto of int | `Next | `Prev] -> unit)] + : [`Goto of int | `Next | `Prev] -> unit)] in let carousel_pages = ["1"; "2"; "3"; "4"] in let length = List.length carousel_pages in diff --git a/template.distillery/demo_carousel2.eliom b/template.distillery/demo_carousel2.eliom index 2143e2297..bdc4e5d1c 100644 --- a/template.distillery/demo_carousel2.eliom +++ b/template.distillery/demo_carousel2.eliom @@ -2,7 +2,6 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Page with several tabs *) - open Eliom_content.Html] [%%shared open Eliom_content.Html.F] @@ -23,14 +22,15 @@ let%shared lorem_ipsum = (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-carousel2"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-carousel2"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.carousel_2] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-carousel2" @@ -46,8 +46,8 @@ let%shared page () = let carousel_change_signal = [%client (React.E.create () - : ([`Goto of int | `Next | `Prev] as 'a) React.E.t - * (?step:React.step -> 'a -> unit))] + : ([`Goto of int | `Next | `Prev] as 'a) React.E.t + * (?step:React.step -> 'a -> unit))] in let update = [%client fst ~%carousel_change_signal] in let change = [%client fun a -> snd ~%carousel_change_signal ?step:None a] in @@ -82,9 +82,9 @@ let%shared page () = ignore [%client (Lwt.async (fun () -> - Lwt.map ignore - (Ot_sticky.make_sticky ~ios_html_scroll_hack:true ~dir:`Top ~%tabs)) - : unit)]; + Lwt.map ignore + (Ot_sticky.make_sticky ~ios_html_scroll_hack:true ~dir:`Top ~%tabs)) + : unit)]; Lwt.return [ h1 [%i18n Demo.carousel_2] ; p [%i18n Demo.ot_carousel_second_example_1] diff --git a/template.distillery/demo_carousel3.eliom b/template.distillery/demo_carousel3.eliom index 3e413d71c..82d472461 100644 --- a/template.distillery/demo_carousel3.eliom +++ b/template.distillery/demo_carousel3.eliom @@ -2,21 +2,21 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Wheel demo *) - open Eliom_content.Html] [%%shared open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-carousel3"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-carousel3"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.carousel_wheel] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-carousel3" @@ -64,8 +64,8 @@ let%shared page () = let carousel_change_signal = [%client (React.E.create () - : ([`Goto of int | `Next | `Prev] as 'a) React.E.t - * (?step:React.step -> 'a -> unit))] + : ([`Goto of int | `Next | `Prev] as 'a) React.E.t + * (?step:React.step -> 'a -> unit))] in let update = [%client fst ~%carousel_change_signal] in let change = [%client fun a -> snd ~%carousel_change_signal ?step:None a] in diff --git a/template.distillery/demo_i18n.eliom b/template.distillery/demo_i18n.eliom index da86e914d..6788d5dc7 100644 --- a/template.distillery/demo_i18n.eliom +++ b/template.distillery/demo_i18n.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Ocsigen_i18n demo *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-i18n"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-i18n"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.internationalization ~capitalize:true] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-i18n" diff --git a/template.distillery/demo_links.eliom b/template.distillery/demo_links.eliom index 561613c6c..4e9a3e9fc 100644 --- a/template.distillery/demo_links.eliom +++ b/template.distillery/demo_links.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Static files demo *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-static-files"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-static-files"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.links_and_static_files] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-links" diff --git a/template.distillery/demo_notif.eliom b/template.distillery/demo_notif.eliom index 9e7f8f91f..1dc124160 100644 --- a/template.distillery/demo_notif.eliom +++ b/template.distillery/demo_notif.eliom @@ -6,14 +6,15 @@ open Js_of_ocaml_lwt] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-notif"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-notif"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.notification] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-notif" @@ -24,13 +25,13 @@ let%shared page_class = "os-page-demo-notif" (for example type key = int64). *) module Notif = Os_notif.Make_Simple (struct - type key = unit + type key = unit - (* The resources identifiers. + (* The resources identifiers. Here unit because we have only one resource. *) - type notification = string -end) + type notification = string + end) (* Broadcast message [v] *) let%rpc notify (v : string) : unit Lwt.t = @@ -50,18 +51,18 @@ let%rpc listen () : unit Lwt.t = Notif.listen (); Lwt.return_unit happens. *) let%server () = Os_session.on_start_process (fun _ -> - let e : (unit * string) Eliom_react.Down.t = Notif.client_ev () in - ignore - [%client - (Eliom_lib.Dom_reference.retain Js_of_ocaml.Dom_html.window - ~keep: - (React.E.map - (fun (_, msg) -> - (* Eliom_lib.alert "%s" msg *) - Os_msg.msg ~level:`Msg (Printf.sprintf "%s" msg)) - ~%e) - : unit)]; - Lwt.return_unit) + let e : (unit * string) Eliom_react.Down.t = Notif.client_ev () in + ignore + [%client + (Eliom_lib.Dom_reference.retain Js_of_ocaml.Dom_html.window + ~keep: + (React.E.map + (fun (_, msg) -> + (* Eliom_lib.alert "%s" msg *) + Os_msg.msg ~level:`Msg (Printf.sprintf "%s" msg)) + ~%e) + : unit)]; + Lwt.return_unit) (* Make a text input field that calls [f s] for each [s] submitted *) let%shared make_form msg f = @@ -79,7 +80,7 @@ let%shared make_form msg f = let%lwt () = ~%f v in inp##.value := Js_of_ocaml.Js.string ""; Lwt.return_unit - : unit)]; + : unit)]; Eliom_content.Html.D.div [inp; btn] let%rpc unlisten () : unit Lwt.t = Notif.unlisten (); Lwt.return_unit diff --git a/template.distillery/demo_pagetransition.eliom b/template.distillery/demo_pagetransition.eliom index cc4a3a028..2910cc336 100644 --- a/template.distillery/demo_pagetransition.eliom +++ b/template.distillery/demo_pagetransition.eliom @@ -28,8 +28,10 @@ let%server detail_page_service = (* Make service available on the client *) let%client service = ~%service let%client detail_page_service = ~%detail_page_service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.pagetransition] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-transition" @@ -67,9 +69,9 @@ let%shared page () = !r in Lwt_js_events.clicks (To_dom.of_element ~%add_button) (fun _ _ -> - Html.Manip.appendChild ~%l (create_item (counter ())); - Lwt.return_unit) - : unit Lwt.t)]; + Html.Manip.appendChild ~%l (create_item (counter ())); + Lwt.return_unit) + : unit Lwt.t)]; Lwt.return [ h1 [%i18n Demo.pagetransition_list_page] ; p [%i18n Demo.pagetransition_intro] @@ -83,10 +85,10 @@ let%shared make_detail_page page () = ignore [%client (Lwt.async (fun () -> - Lwt_js_events.clicks (To_dom.of_element ~%back_button) (fun _ _ -> - Js_of_ocaml.Dom_html.window##.history##back; - Lwt.return_unit)) - : unit)]; + Lwt_js_events.clicks (To_dom.of_element ~%back_button) (fun _ _ -> + Js_of_ocaml.Dom_html.window##.history##back; + Lwt.return_unit)) + : unit)]; [ h1 ([%i18n Demo.pagetransition_detail_page] @ [txt (Printf.sprintf " %d" page)]) diff --git a/template.distillery/demo_pgocaml.eliom b/template.distillery/demo_pgocaml.eliom index b1c6e4ae4..6a20c2a8a 100644 --- a/template.distillery/demo_pgocaml.eliom +++ b/template.distillery/demo_pgocaml.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* PGOcaml demo *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-pgocaml"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-pgocaml"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.pgocaml] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-pgocaml" diff --git a/template.distillery/demo_popup.eliom b/template.distillery/demo_popup.eliom index 4cfeb736c..910bb9379 100644 --- a/template.distillery/demo_popup.eliom +++ b/template.distillery/demo_popup.eliom @@ -2,7 +2,6 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Popup button demo *) - open Eliom_content.Html] [%%shared open Eliom_content.Html.F] @@ -10,14 +9,15 @@ open Eliom_content.Html] (* Service for this demo, defined in the server-side app *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-popup"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-popup"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu. This value is defined both server and client-side. *) let%shared name () = [%i18n Demo.S.popup] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-popup" @@ -52,15 +52,16 @@ let%shared page () = (* This client section will be executed after the page is displayed by the browser. *) (Lwt.async (fun () -> - (* Lwt_js_events.clicks returns a Lwt thread, which never terminates. + (* Lwt_js_events.clicks returns a Lwt thread, which never terminates. We run it asynchronously. *) - Lwt_js_events.clicks (To_dom.of_element ~%button) (fun _ _ -> - let%lwt _ = - Ot_popup.popup ~close_button:[Os_icons.F.close ()] (fun _ -> - Lwt.return @@ p [%i18n Demo.popup_message]) - in - Lwt.return_unit)) - : unit)]; + Lwt_js_events.clicks (To_dom.of_element ~%button) (fun _ _ -> + let%lwt _ = + Ot_popup.popup + ~close_button:[Os_icons.F.close ()] + (fun _ -> Lwt.return @@ p [%i18n Demo.popup_message]) + in + Lwt.return_unit)) + : unit)]; (* Page elements, using module Eliom_content.Html.F (as we don't want to add a unique identifier). See internationalization demo for i18n syntax. diff --git a/template.distillery/demo_pulltorefresh.eliom b/template.distillery/demo_pulltorefresh.eliom index a65e9e05e..59fd3b947 100644 --- a/template.distillery/demo_pulltorefresh.eliom +++ b/template.distillery/demo_pulltorefresh.eliom @@ -7,14 +7,15 @@ (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-pull-to-refresh"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-pull-to-refresh"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.pull_to_refresh] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-pull" diff --git a/template.distillery/demo_react.eliom b/template.distillery/demo_react.eliom index 38ed9a553..a61f3914e 100644 --- a/template.distillery/demo_react.eliom +++ b/template.distillery/demo_react.eliom @@ -7,14 +7,15 @@ (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-react"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-react"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.reactive_programming] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-react" @@ -34,7 +35,7 @@ let%shared make_form msg f = let%lwt () = ~%f v in inp##.value := Js_of_ocaml.Js.string ""; Lwt.return_unit - : unit)]; + : unit)]; Eliom_content.Html.D.div [inp; btn] (* Page for this demo *) @@ -51,7 +52,7 @@ let%shared page () = make_form [%i18n Demo.S.reactive_programming_button] [%client (fun v -> Lwt.return (Eliom_shared.ReactiveData.RList.cons v ~%h) - : string -> unit Lwt.t)] + : string -> unit Lwt.t)] and l = (* Produce
  • items from l contents. The shared function will first be called once server or client-side diff --git a/template.distillery/demo_ref.eliom b/template.distillery/demo_ref.eliom index e0759751c..7d0219679 100644 --- a/template.distillery/demo_ref.eliom +++ b/template.distillery/demo_ref.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Demo for Eliom references and Os_date *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-ref"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-ref"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.eliom_ref] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-ref" diff --git a/template.distillery/demo_rpc.eliom b/template.distillery/demo_rpc.eliom index 1ece9ccbb..0bf9fac11 100644 --- a/template.distillery/demo_rpc.eliom +++ b/template.distillery/demo_rpc.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* RPC button demo *) - open Js_of_ocaml_lwt] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-rpc"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-rpc"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.rpc_button] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-rpc" @@ -22,7 +22,7 @@ let%shared page_class = "os-page-demo-rpc" (scope = session). It's also possible to define Eliom references with other scopes, like client-process (a tab of a browser) or session-group (a user). - *) +*) let%server my_ref = Eliom_reference.eref ~scope:Eliom_common.default_session_scope 0 @@ -42,7 +42,7 @@ let%shared button msg f = (Lwt.async @@ fun () -> Lwt_js_events.clicks (Eliom_content.Html.To_dom.of_element ~%btn) (fun _ _ -> ~%f ()) - : unit)]; + : unit)]; btn (* Page for this demo *) @@ -54,7 +54,7 @@ let%shared page () = let%lwt v = incr_my_ref () in Eliom_lib.alert "Update: %d" v; Lwt.return_unit - : unit -> unit Lwt.t)] + : unit -> unit Lwt.t)] in Lwt.return Eliom_content.Html. diff --git a/template.distillery/demo_spinner.eliom b/template.distillery/demo_spinner.eliom index a5affc2a0..7b3c5bda3 100644 --- a/template.distillery/demo_spinner.eliom +++ b/template.distillery/demo_spinner.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Spinner demo *) - open Js_of_ocaml_lwt] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-spinner"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-spinner"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.spinner] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-spinner" diff --git a/template.distillery/demo_timepicker.eliom b/template.distillery/demo_timepicker.eliom index 397dc5e2d..259b11945 100644 --- a/template.distillery/demo_timepicker.eliom +++ b/template.distillery/demo_timepicker.eliom @@ -9,8 +9,7 @@ open Eliom_content.Html.D] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-timepicker"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-timepicker"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) @@ -34,6 +33,7 @@ let%rpc time_reactive () : string Eliom_shared.React.S.t Lwt.t = (* Name for demo menu *) let%shared name () = [%i18n Demo.S.timepicker] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-timepicker" @@ -48,9 +48,9 @@ let%shared page () = ignore [%client (Lwt.async (fun () -> - Lwt_js_events.clicks (Eliom_content.Html.To_dom.of_element ~%button) - (fun _ _ -> ~%back_f (); Lwt.return_unit)) - : _)]; + Lwt_js_events.clicks (Eliom_content.Html.To_dom.of_element ~%button) + (fun _ _ -> ~%back_f (); Lwt.return_unit)) + : _)]; let%lwt tr = time_reactive () in Lwt.return [ h1 [%i18n Demo.timepicker] diff --git a/template.distillery/demo_tips.eliom b/template.distillery/demo_tips.eliom index d29d6b8e2..c688add6b 100644 --- a/template.distillery/demo_tips.eliom +++ b/template.distillery/demo_tips.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Os_tips demo *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-tips"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-tips"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.tips] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-tips" @@ -44,5 +44,5 @@ let%shared page () = [%i18n Demo.tips4 ~set_page: - [ a ~service:%%%MODULE_NAME%%%_services.settings_service - [%i18n Demo.tips5] () ]] ] + [ a ~service:%%%MODULE_NAME%%%_services.settings_service [%i18n Demo.tips5] + () ]] ] diff --git a/template.distillery/demo_tongue.eliom b/template.distillery/demo_tongue.eliom index 27c407c3e..869adfee9 100644 --- a/template.distillery/demo_tongue.eliom +++ b/template.distillery/demo_tongue.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Tongue demo *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-tongue"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-tongue"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.tongue_1] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-tongue" diff --git a/template.distillery/demo_tools.eliom b/template.distillery/demo_tools.eliom index 362e80e02..585dc9b03 100644 --- a/template.distillery/demo_tools.eliom +++ b/template.distillery/demo_tools.eliom @@ -7,8 +7,8 @@ module type Page = sig val name : unit -> string val page_class : string - val service - : ( unit + val service : + ( unit , unit , Eliom_service.get , Eliom_service.att diff --git a/template.distillery/demo_users.eliom b/template.distillery/demo_users.eliom index fd04ebac2..85ab3f360 100644 --- a/template.distillery/demo_users.eliom +++ b/template.distillery/demo_users.eliom @@ -2,19 +2,19 @@ (* This file was generated by Ocsigen Start. Feel free to use it, modify it, and redistribute it as you wish. *) (* Os_current_user demo *) - open Eliom_content.Html.F] (* Service for this demo *) let%server service = - Eliom_service.create - ~path:(Eliom_service.Path ["demo-users"]) + Eliom_service.create ~path:(Eliom_service.Path ["demo-users"]) ~meth:(Eliom_service.Get Eliom_parameter.unit) () (* Make service available on the client *) let%client service = ~%service + (* Name for demo menu *) let%shared name () = [%i18n Demo.S.users] + (* Class for the page containing this demo (for internal use) *) let%shared page_class = "os-page-demo-users"