Module Os_user_view
This module defines functions to create password forms, connection forms, settings buttons and other common contents arising in applications. As Eliom_content.Html.F is opened by default, if the module D is not explicitly used, HTML tags will be functional.
val generic_email_form :
?a:[< Html_types.form_attrib ] Eliom_content.Html.D.attrib list ->
?label:string Eliom_content.Html.F.wrap ->
?a_placeholder_email:string ->
?text:string ->
?email:string ->
service:
(unit,
'a,
Eliom_service.post,
'b,
'c,
'd,
'e,
[< `WithSuffix | `WithoutSuffix ],
'f,
[< string Eliom_parameter.setoneradio ] Eliom_parameter.param_name,
Eliom_service.non_ocaml)
Eliom_service.t ->
unit ->
[> Html_types.form ] Eliom_content.Html.D.eltgeneric_email_form ?a ?label ?text ?email ~service () creates an email POST form with an input of type email and a submit button. Placeholder value "e-mail address" is used for the email input.
val connect_form :
?a_placeholder_email:string ->
?a_placeholder_phone:string ->
?a_placeholder_pwd:string ->
?text_keep_me_logged_in:string ->
?text_sign_in:string ->
?a:[< Html_types.form_attrib ] Eliom_content.Html.D.attrib list ->
?email:string ->
unit ->
[> Html_types.form ] Eliom_content.Html.D.eltconnect_form ?a ?email () creates a POST login form with email, password, a checkbox to stay logged in (with default text to "keep me logged in" in a span) and a submit button. Default placeholders for input email (resp. password) is "Your email" (resp. "Your password").
The data is sent to Os_services.connect_service.
val disconnect_button :
?a:[< Html_types.form_attrib ] Eliom_content.Html.F.attrib list ->
?text_logout:string ->
unit ->
[> Html_types.form ] Eliom_content.Html.F.eltdisconnect_button ?a () creates a disconnect POST form with a button without value, a signout icon and a text message "logout".
val sign_up_form :
?a:[< Html_types.form_attrib ] Eliom_content.Html.D.attrib list ->
?a_placeholder_email:string ->
?text:string ->
?email:string ->
unit ->
[> Html_types.form ] Eliom_content.Html.D.eltsign_up_form ?a ?email () creates a generic_email_form with the service Os_services.sign_up_service.
val forgot_password_form :
?a:[< Html_types.form_attrib ] Eliom_content.Html.D.attrib list ->
unit ->
[> Html_types.form ] Eliom_content.Html.D.eltforgot_password_form ~a () creates a generic_email_form with the service Os_services.forgot_password_service.
val information_form :
?a:[< Html_types.form_attrib ] Eliom_content.Html.D.attrib list ->
?a_placeholder_password:string ->
?a_placeholder_retype_password:string ->
?a_placeholder_firstname:string ->
?a_placeholder_lastname:string ->
?text_submit:string ->
?firstname:string ->
?lastname:string ->
?password1:string ->
?password2:string ->
unit ->
[> Html_types.form ] Eliom_content.Html.D.eltinformation_form ~a ~firstname ~lastname ~password1 ~password2 () creates a POST form to update the user information like first name, last name and password. It also checks (client-side) if the passwords match when the send button is pressed and a custom validity message is showed if they don't match. The data is sent to Os_services.set_personal_data_service.
val preregister_form :
?a:[< Html_types.form_attrib OnSubmit ] Eliom_content.Html.D.attrib list ->
string Eliom_content.Html.F.wrap ->
[> Html_types.form ] Eliom_content.Html.D.eltpreregister_form ~a label creates a generic_email_form with the service Os_services.preregister_service and add the label label to the email input form.
val home_button :
?a:[< Html_types.form_attrib ] Eliom_content.Html.F.attrib list ->
unit ->
[> Html_types.form ] Eliom_content.Html.F.elthome_button ~a () creates an input button with value "home" which redirects to the main service.
val avatar : Os_types.User.t -> [> `I | `Img ] Eliom_content.Html.F.eltavatar user creates an image HTML tag (with Eliom_content.HTML.F) with an alt attribute to "picture" and with class "os-avatar". If the user has no avatar, the default icon representing the user (see Ot_icons.F.user) is returned.
val username : Os_types.User.t -> [> Html_types.div ] Eliom_content.Html.F.eltusername user creates a div with class "os_username" containing:
firstnamelastnameif the user has a firstname."User "concatenated with the userid in other cases.
FIXME/IMPROVEME: use an option for the case the user has no firstname? Firstname must be empty because it must be optional.
val password_form :
?a_placeholder_pwd:string ->
?a_placeholder_confirmation:string ->
?text_send_button:string ->
?a:[< Html_types.form_attrib ] Eliom_content.Html.D.attrib list ->
service:
(unit,
'a,
Eliom_service.post,
'b,
'c,
'd,
'e,
[< `WithSuffix | `WithoutSuffix ],
'f,
[< string Eliom_parameter.setoneradio ] Eliom_parameter.param_name
* [< string Eliom_parameter.setoneradio ] Eliom_parameter.param_name,
Eliom_service.non_ocaml)
Eliom_service.t ->
unit ->
[> Html_types.form ] Eliom_content.Html.D.eltpassword_form ~a ~service () defines a POST form with two inputs for a password form (password and password confirmation) and a send button. It also checks (client-side) if the passwords match when the send button is pressed.
val upload_pic_link :
?a:[< Html_types.a_attrib OnClick ] Eliom_content.Html.D.Raw.attrib list ->
?content:Html_types.a_content Eliom_content.Html.D.Raw.elt list ->
?crop:float option ->
?input:
(Html_types.label_attrib Eliom_content.Html.D.Raw.attrib list
* Html_types.label_content_fun Eliom_content.Html.D.Raw.elt list) ->
?submit:
(Html_types.button_attrib Eliom_content.Html.D.Raw.attrib list
* Html_types.button_content_fun Eliom_content.Html.D.Raw.elt list) ->
?onclick:(unit -> unit) Eliom_client_value.t ->
(unit, unit) Ot_picture_uploader.service ->
[> `A of Html_types.a_content ] Eliom_content.Html.D.Raw.eltupload_pic_link ?a ?content ?crop ?input ?submit action_after_submit service userid
Creates a link with a label and a submit button to upload a picture.
The client function action_after_submit will be called first, for example to close the menu containing the link.
You can add attributes to the HTML tag with the optional parameter ?a. ?input and ?submit are couples (attributes, content_children) for the label and the submit button where attributes is a list of attributes for the tag and content_children is a list of children. By default, they are empty.
?content is the link text. The default value is "Change profile picture".
service is the service called to upload the picture.
You can crop the picture by giving a value to ?crop.
val reset_tips_link :
?text_link:string ->
?close:(unit -> unit) Eliom_client_value.t ->
unit ->
[> `A of [> `PCDATA ] ] Eliom_content.Html.D.Raw.eltLink to start to see the help from the beginning. The client function given as first parameter will be called first, for example to close the menu containing the link.
val disconnect_all_link :
?text_link:string ->
unit ->
[> `A of [> `PCDATA ] ] Eliom_content.Html.D.Raw.eltLink to disconnect all user sessions.
val disconnect_link :
?text_logout:string ->
?a:[< Html_types.a_attrib OnClick ] Eliom_content.Html.attrib list ->
unit ->
[> `A of Html_types.flow5_without_interactive ] Eliom_content.Html.F.eltA link to Os_services.disconnect_service.
val connected_user_box :
user:Os_types.User.t ->
[> Html_types.div ] Eliom_content.Html.D.eltAn userbox (in a div with the CSS class "connected-user-box") for connected users with an icon and the username.
val connection_box :
?a_placeholder_email:string ->
?a_placeholder_phone:string ->
?a_placeholder_pwd:string ->
?text_keep_me_logged_in:string ->
?content_popup_forgotpwd:string ->
?text_button_forgotpwd:string ->
?text_sign_in:string ->
?text_sign_up:string ->
?text_send_button:string ->
unit ->
[> Html_types.div ] Eliom_content.Html.D.elt Lwt.tA box (in a div with the CSS class "os-connection-box") with a sign in and a sign out button. ?text_sign_in (resp. text_sign_up) is the text for the sign in (resp. sign up) button, default is "Sign in" (resp. "Sign up").
val user_box :
?a_placeholder_email:string ->
?a_placeholder_pwd:string ->
?text_keep_me_logged_in:string ->
?content_popup_forgotpwd:string ->
?text_button_forgotpwd:string ->
?text_sign_in:string ->
?text_sign_up:string ->
?text_send_button:string ->
?user:Os_types.User.t ->
unit ->
[> Html_types.div ] Eliom_content.Html.F.elt Lwt.tReturn connection_box if no user is connected (i.e. user is None). Else connected_user_box.