Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Os_user_view

module Os_user_view : sig..end

val check_password_confirmation : 
  password:[< Html_types.input ] Eliom_content.Html.elt ->
  confirmation:[< Html_types.input ] Eliom_content.Html.elt -> unit

check_password_confirmation ~password ~confirmation adds a listener to the element confirmation which checks if the value of password and confirmation match.

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.elt

generic_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.

a : add attributes of the form.

label : add a label (default is None) to the email input.

text : text for the button (default is "Send").

email : the default value of the email input (default is empty).

service : service which the data is sent to.

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.elt

connect_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.

a_placeholder_email : text for the placeholder of the email input.

a_placeholder_pwd : text for the placeholder of the password input.

text_keep_me_logged_in : text for the check box to stay connected.

text_sign_in : text for the sign in button.

a : attributes of the form.

email : the default value of the email input (default is empty).

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.elt

disconnect_button ?a () creates a disconnect POST form with a button without value, a signout icon and a text message "logout".

a : attributes of the form.

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.elt

sign_up_form ?a ?email () creates a Os_user_view.generic_email_form with the service Os_services.sign_up_service.

a : attributes of the form.

email : the default value of the email input (default is empty).

val forgot_password_form : 
  ?a:[< Html_types.form_attrib ] Eliom_content.Html.D.attrib list ->
  unit -> [> Html_types.form ] Eliom_content.Html.D.elt

forgot_password_form ~a () creates a Os_user_view.generic_email_form with the service Os_services.forgot_password_service.

a : attributes of the form.

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.elt

information_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.

a : attributes of the form.

a_placeholder_password : text for the placeholder of the password input.

a_placeholder_retype_password : text for the placeholder of the confirmation password input.

a_placeholder_firstname : text for the placeholder of the firstname input.

a_placeholder_lastname : text for the placeholder of the lastname input.

text_submit : text for the submit button.

firstname : the default value for the first name.

lastname : the default value for the last name.

password1 : the default value for the password1.

password2 : the default value for the password2 (ie the confirmation password).

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.elt

preregister_form ~a label creates a Os_user_view.generic_email_form with the service Os_services.preregister_service and add the label label to the email input form.

a : attributes of the form.

val home_button : 
  ?a:[< Html_types.form_attrib ] Eliom_content.Html.F.attrib list ->
  unit -> [> Html_types.form ] Eliom_content.Html.F.elt

home_button ~a () creates an input button with value "home" which redirects to the main service.

a : attributes of the form.

val avatar : Os_types.User.t -> [> `I | `Img ] Eliom_content.Html.F.elt

avatar 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 <<a_api project="ocsigen-toolkit" | val Ot_icons.F.user >>) is returned.

val username : 
  Os_types.User.t -> [> Html_types.div ] Eliom_content.Html.F.elt

username user creates a div with class "os_username" containing:

  • firstname lastname if 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.elt

password_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.

a_placeholder_pwd : placeholder test for the password input.

a_placeholder_confirmation : placeholder test for the confirmation input.

text_send_button : text for the send button.

a : attributes of the form.

service : service which the data is sent to.

upload_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.

Link 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.

text_link : link text.

Link to disconnect all user sessions.

text_link : link text.

text_logout : the link text.

a : attributes for the link.

val connected_user_box : 
  user:Os_types.User.t -> [> Html_types.div ] Eliom_content.Html.D.elt

An 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.t

A 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.t

Return Os_user_view.connection_box if no user is connected (i.e. user is None). Else Os_user_view.connected_user_box.