odoo.define('website_profile.website_profile', function (require) { 'use strict'; var publicWidget = require('web.public.widget'); var Wysiwyg = require('web_editor.wysiwyg.root'); publicWidget.registry.websiteProfile = publicWidget.Widget.extend({ selector: '.o_wprofile_email_validation_container', read_events: { 'click .send_validation_email': '_onSendValidationEmailClick', 'click .validated_email_close': '_onCloseValidatedEmailClick', }, //-------------------------------------------------------------------------- // Handlers //-------------------------------------------------------------------------- /** * @private * @param {Event} ev */ _onSendValidationEmailClick: function (ev) { ev.preventDefault(); var self = this; var $element = $(ev.currentTarget); this._rpc({ route: '/profile/send_validation_email', params: {'redirect_url': $element.data('redirect_url')}, }).then(function (data) { if (data) { self.$('button.validation_email_close').click(); } }); }, /** * @private */ _onCloseValidatedEmailClick: function () { this._rpc({ route: '/profile/validate_email/close', }); }, }); publicWidget.registry.websiteProfileEditor = publicWidget.Widget.extend({ selector: '.o_wprofile_editor_form', read_events: { 'click .o_forum_profile_pic_edit': '_onEditProfilePicClick', 'change .o_forum_file_upload': '_onFileUploadChange', 'click .o_forum_profile_pic_clear': '_onProfilePicClearClick', 'click .o_wprofile_submit_btn': '_onSubmitClick', }, /** * @override */ start: function () { var def = this._super.apply(this, arguments); if (this.editableMode) { return def; } var $textarea = this.$('textarea.load_editor'); var wysiwyg = new Wysiwyg(this, { recordInfo: { context: this._getContext(), res_model: 'res.users', res_id: parseInt(this.$('input[name=user_id]').val()), }, }); if (!$textarea.val().match(/\S/)) { $textarea.val('