diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/website_profile/static | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/website_profile/static')
8 files changed, 405 insertions, 0 deletions
diff --git a/addons/website_profile/static/src/img/badge_bronze.svg b/addons/website_profile/static/src/img/badge_bronze.svg new file mode 100644 index 00000000..a94491e8 --- /dev/null +++ b/addons/website_profile/static/src/img/badge_bronze.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><g fill="none"><circle cx="150" cy="150" r="150" fill="#FFF"/><path fill="#C37933" d="M150 300C67.157 300 0 232.843 0 150S67.157 0 150 0s150 67.157 150 150-67.157 150-150 150zm0-9.375c77.665 0 140.625-62.96 140.625-140.625 0-77.665-62.96-140.625-140.625-140.625C72.335 9.375 9.375 72.335 9.375 150c0 77.665 62.96 140.625 140.625 140.625zm0-14.063C80.101 276.563 23.437 219.9 23.437 150S80.102 23.437 150 23.437 276.563 80.102 276.563 150 219.899 276.563 150 276.563zm56.757-126.57l12.882-12.602c1.867-1.743 2.49-3.922 1.867-6.536-.747-2.551-2.365-4.139-4.854-4.76l-17.55-4.482 4.947-17.365c.747-2.552.156-4.73-1.773-6.535-1.805-1.93-3.983-2.52-6.535-1.774l-17.363 4.948-4.48-17.551c-.623-2.552-2.21-4.14-4.761-4.761-2.552-.685-4.73-.094-6.535 1.773L150 93.324l-12.602-12.977c-1.805-1.93-3.983-2.52-6.535-1.773-2.551.622-4.138 2.209-4.76 4.76l-4.481 17.552-17.363-4.948c-2.552-.747-4.73-.155-6.535 1.774-1.929 1.805-2.52 3.983-1.773 6.535l4.947 17.365-17.55 4.481c-2.489.623-4.107 2.21-4.854 4.761-.622 2.614 0 4.793 1.867 6.536l12.882 12.603-12.882 12.603c-1.867 1.743-2.49 3.921-1.867 6.535.747 2.552 2.365 4.14 4.854 4.762l17.55 4.481-4.947 17.365c-.747 2.552-.156 4.73 1.773 6.535 1.805 1.93 3.983 2.52 6.535 1.774l17.363-4.948 4.48 17.551c.623 2.552 2.21 4.17 4.761 4.855 2.614.622 4.792 0 6.535-1.867L150 206.755l12.602 12.884c1.245 1.369 2.832 2.053 4.761 2.053.436 0 1.027-.062 1.774-.186 2.551-.747 4.138-2.365 4.76-4.855l4.481-17.551 17.363 4.948c2.552.747 4.73.155 6.535-1.774 1.929-1.805 2.52-3.983 1.773-6.535l-4.947-17.365 17.55-4.481c2.489-.623 4.107-2.21 4.854-4.762.622-2.614 0-4.792-1.867-6.535l-12.882-12.603z"/></g></svg>
\ No newline at end of file diff --git a/addons/website_profile/static/src/img/badge_gold.svg b/addons/website_profile/static/src/img/badge_gold.svg new file mode 100644 index 00000000..423f63e6 --- /dev/null +++ b/addons/website_profile/static/src/img/badge_gold.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><g fill="none"><circle cx="150" cy="150" r="150" fill="#FFF"/><path fill="#E2BE00" d="M150 300C67.157 300 0 232.843 0 150S67.157 0 150 0s150 67.157 150 150-67.157 150-150 150zm0-9.375c77.665 0 140.625-62.96 140.625-140.625 0-77.665-62.96-140.625-140.625-140.625C72.335 9.375 9.375 72.335 9.375 150c0 77.665 62.96 140.625 140.625 140.625zm0-14.063C80.101 276.563 23.437 219.9 23.437 150S80.102 23.437 150 23.437 276.563 80.102 276.563 150 219.899 276.563 150 276.563zm56.757-126.57l12.882-12.602c1.867-1.743 2.49-3.922 1.867-6.536-.747-2.551-2.365-4.139-4.854-4.76l-17.55-4.482 4.947-17.365c.747-2.552.156-4.73-1.773-6.535-1.805-1.93-3.983-2.52-6.535-1.774l-17.363 4.948-4.48-17.551c-.623-2.552-2.21-4.14-4.761-4.761-2.552-.685-4.73-.094-6.535 1.773L150 93.324l-12.602-12.977c-1.805-1.93-3.983-2.52-6.535-1.773-2.551.622-4.138 2.209-4.76 4.76l-4.481 17.552-17.363-4.948c-2.552-.747-4.73-.155-6.535 1.774-1.929 1.805-2.52 3.983-1.773 6.535l4.947 17.365-17.55 4.481c-2.489.623-4.107 2.21-4.854 4.761-.622 2.614 0 4.793 1.867 6.536l12.882 12.603-12.882 12.603c-1.867 1.743-2.49 3.921-1.867 6.535.747 2.552 2.365 4.14 4.854 4.762l17.55 4.481-4.947 17.365c-.747 2.552-.156 4.73 1.773 6.535 1.805 1.93 3.983 2.52 6.535 1.774l17.363-4.948 4.48 17.551c.623 2.552 2.21 4.17 4.761 4.855 2.614.622 4.792 0 6.535-1.867L150 206.755l12.602 12.884c1.245 1.369 2.832 2.053 4.761 2.053.436 0 1.027-.062 1.774-.186 2.551-.747 4.138-2.365 4.76-4.855l4.481-17.551 17.363 4.948c2.552.747 4.73.155 6.535-1.774 1.929-1.805 2.52-3.983 1.773-6.535l-4.947-17.365 17.55-4.481c2.489-.623 4.107-2.21 4.854-4.762.622-2.614 0-4.792-1.867-6.535l-12.882-12.603z"/></g></svg>
\ No newline at end of file diff --git a/addons/website_profile/static/src/img/badge_silver.svg b/addons/website_profile/static/src/img/badge_silver.svg new file mode 100644 index 00000000..dd16d4f2 --- /dev/null +++ b/addons/website_profile/static/src/img/badge_silver.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><g fill="none"><circle cx="150" cy="150" r="150" fill="#FFF"/><path fill="#838997" d="M150 300C67.157 300 0 232.843 0 150S67.157 0 150 0s150 67.157 150 150-67.157 150-150 150zm0-9.375c77.665 0 140.625-62.96 140.625-140.625 0-77.665-62.96-140.625-140.625-140.625C72.335 9.375 9.375 72.335 9.375 150c0 77.665 62.96 140.625 140.625 140.625zm0-14.063C80.101 276.563 23.437 219.9 23.437 150S80.102 23.437 150 23.437 276.563 80.102 276.563 150 219.899 276.563 150 276.563zm56.757-126.57l12.882-12.602c1.867-1.743 2.49-3.922 1.867-6.536-.747-2.551-2.365-4.139-4.854-4.76l-17.55-4.482 4.947-17.365c.747-2.552.156-4.73-1.773-6.535-1.805-1.93-3.983-2.52-6.535-1.774l-17.363 4.948-4.48-17.551c-.623-2.552-2.21-4.14-4.761-4.761-2.552-.685-4.73-.094-6.535 1.773L150 93.324l-12.602-12.977c-1.805-1.93-3.983-2.52-6.535-1.773-2.551.622-4.138 2.209-4.76 4.76l-4.481 17.552-17.363-4.948c-2.552-.747-4.73-.155-6.535 1.774-1.929 1.805-2.52 3.983-1.773 6.535l4.947 17.365-17.55 4.481c-2.489.623-4.107 2.21-4.854 4.761-.622 2.614 0 4.793 1.867 6.536l12.882 12.603-12.882 12.603c-1.867 1.743-2.49 3.921-1.867 6.535.747 2.552 2.365 4.14 4.854 4.762l17.55 4.481-4.947 17.365c-.747 2.552-.156 4.73 1.773 6.535 1.805 1.93 3.983 2.52 6.535 1.774l17.363-4.948 4.48 17.551c.623 2.552 2.21 4.17 4.761 4.855 2.614.622 4.792 0 6.535-1.867L150 206.755l12.602 12.884c1.245 1.369 2.832 2.053 4.761 2.053.436 0 1.027-.062 1.774-.186 2.551-.747 4.138-2.365 4.76-4.855l4.481-17.551 17.363 4.948c2.552.747 4.73.155 6.535-1.774 1.929-1.805 2.52-3.983 1.773-6.535l-4.947-17.365 17.55-4.481c2.489-.623 4.107-2.21 4.854-4.762.622-2.614 0-4.792-1.867-6.535l-12.882-12.603z"/></g></svg>
\ No newline at end of file diff --git a/addons/website_profile/static/src/img/rank_1.svg b/addons/website_profile/static/src/img/rank_1.svg new file mode 100644 index 00000000..6477a906 --- /dev/null +++ b/addons/website_profile/static/src/img/rank_1.svg @@ -0,0 +1 @@ +<svg height="37" viewBox="0 0 35 37" width="35" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient id="a" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0" stop-color="#ffe897"/><stop offset="1" stop-color="#f1c363"/></linearGradient><circle id="b" cx="17.5" cy="17.5" r="17.5"/><filter id="c" height="111.4%" width="105.7%" x="-2.9%" y="-2.9%"><feOffset dy="2" in="SourceAlpha" result="shadowOffsetOuter1"/><feColorMatrix in="shadowOffsetOuter1" values="0 0 0 0 0.564705882 0 0 0 0 0.37254902 0 0 0 0 0.192156863 0 0 0 1 0"/></filter></defs><g fill="none" fill-rule="evenodd"><g fill-rule="nonzero"><use fill="#000" filter="url(#c)" xlink:href="#b"/><use fill="url(#a)" xlink:href="#b"/></g><text fill="#905f31" font-family="Montserrat-Bold, Montserrat" font-size="11" font-weight="bold"><tspan x="10.031" y="22">1st</tspan></text></g></svg>
\ No newline at end of file diff --git a/addons/website_profile/static/src/img/rank_2.svg b/addons/website_profile/static/src/img/rank_2.svg new file mode 100644 index 00000000..e9ae886a --- /dev/null +++ b/addons/website_profile/static/src/img/rank_2.svg @@ -0,0 +1 @@ +<svg height="37" viewBox="0 0 35 37" width="35" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient id="a" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0" stop-color="#d7dde1"/><stop offset="1" stop-color="#b7c3c8"/></linearGradient><circle id="b" cx="17.5" cy="17.5" r="17.5"/><filter id="c" height="111.4%" width="105.7%" x="-2.9%" y="-2.9%"><feOffset dy="2" in="SourceAlpha" result="shadowOffsetOuter1"/><feColorMatrix in="shadowOffsetOuter1" values="0 0 0 0 0.360784314 0 0 0 0 0.388235294 0 0 0 0 0.403921569 0 0 0 1 0"/></filter></defs><g fill="none" fill-rule="evenodd"><g fill-rule="nonzero"><use fill="#000" filter="url(#c)" xlink:href="#b"/><use fill="url(#a)" xlink:href="#b"/></g><text fill="#5c6367" font-family="Montserrat-Bold, Montserrat" font-size="11" font-weight="bold"><tspan x="6.615" y="22">2nd</tspan></text></g></svg>
\ No newline at end of file diff --git a/addons/website_profile/static/src/img/rank_3.svg b/addons/website_profile/static/src/img/rank_3.svg new file mode 100644 index 00000000..8c22af97 --- /dev/null +++ b/addons/website_profile/static/src/img/rank_3.svg @@ -0,0 +1 @@ +<svg height="37" viewBox="0 0 35 37" width="35" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient id="a" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0" stop-color="#ecc29f"/><stop offset="1" stop-color="#d09e7d"/></linearGradient><circle id="b" cx="17.5" cy="17.5" r="17.5"/><filter id="c" height="111.4%" width="105.7%" x="-2.9%" y="-2.9%"><feOffset dy="2" in="SourceAlpha" result="shadowOffsetOuter1"/><feColorMatrix in="shadowOffsetOuter1" values="0 0 0 0 0.62745098 0 0 0 0 0.462745098 0 0 0 0 0.329411765 0 0 0 1 0"/></filter></defs><g fill="none" fill-rule="evenodd"><g fill-rule="nonzero"><use fill="#000" filter="url(#c)" xlink:href="#b"/><use fill="url(#a)" xlink:href="#b"/></g><text fill="#5e4129" font-family="Montserrat-Bold, Montserrat" font-size="11" font-weight="bold"><tspan x="8.117" y="22">3rd</tspan></text></g></svg>
\ No newline at end of file diff --git a/addons/website_profile/static/src/js/website_profile.js b/addons/website_profile/static/src/js/website_profile.js new file mode 100644 index 00000000..105bdb03 --- /dev/null +++ b/addons/website_profile/static/src/js/website_profile.js @@ -0,0 +1,143 @@ +odoo.define('website_profile.website_profile', function (require) { +'use strict'; + +var publicWidget = require('web.public.widget'); +var wysiwygLoader = require('web_editor.loader'); + +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; + } + + // Warning: Do not activate any option that adds inline style. + // Because the style is deleted after save. + var toolbar = [ + ['style', ['style']], + ['font', ['bold', 'italic', 'underline', 'clear']], + ['para', ['ul', 'ol', 'paragraph']], + ['table', ['table']], + ['insert', ['link', 'picture']], + ['history', ['undo', 'redo']], + ]; + + var $textarea = this.$('textarea.o_wysiwyg_loader'); + var loadProm = wysiwygLoader.load(this, $textarea[0], { + toolbar: toolbar, + recordInfo: { + context: this._getContext(), + res_model: 'res.users', + res_id: parseInt(this.$('input[name=user_id]').val()), + }, + disableResizeImage: true, + }).then(wysiwyg => { + this._wysiwyg = wysiwyg; + }); + + return Promise.all([def, loadProm]); + }, + + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + + /** + * @private + * @param {Event} ev + */ + _onEditProfilePicClick: function (ev) { + ev.preventDefault(); + $(ev.currentTarget).closest('form').find('.o_forum_file_upload').trigger('click'); + }, + /** + * @private + * @param {Event} ev + */ + _onFileUploadChange: function (ev) { + if (!ev.currentTarget.files.length) { + return; + } + var $form = $(ev.currentTarget).closest('form'); + var reader = new window.FileReader(); + reader.readAsDataURL(ev.currentTarget.files[0]); + reader.onload = function (ev) { + $form.find('.o_forum_avatar_img').attr('src', ev.target.result); + }; + $form.find('#forum_clear_image').remove(); + }, + /** + * @private + * @param {Event} ev + */ + _onProfilePicClearClick: function (ev) { + var $form = $(ev.currentTarget).closest('form'); + $form.find('.o_forum_avatar_img').attr('src', '/web/static/src/img/placeholder.png'); + $form.append($('<input/>', { + name: 'clear_image', + id: 'forum_clear_image', + type: 'hidden', + })); + }, + /** + * @private + */ + _onSubmitClick: function () { + if (this._wysiwyg) { + this._wysiwyg.save(); + } + }, +}); + +return publicWidget.registry.websiteProfile; + +}); diff --git a/addons/website_profile/static/src/scss/website_profile.scss b/addons/website_profile/static/src/scss/website_profile.scss new file mode 100644 index 00000000..98e7da85 --- /dev/null +++ b/addons/website_profile/static/src/scss/website_profile.scss @@ -0,0 +1,256 @@ +// Retrive the tab's height by summ its properties +$owprofile-tabs-height: ($nav-link-padding-y*2) + ($font-size-base * $line-height-base); + +// Overal page bg-color: Blend it 'over' the color chosen by the user +// ($body-bg), rather than force it replacing the variable's value. +$owprofile-color-bg: mix($body-bg, #efeff4); + +.o_wprofile_body { + background-color: $owprofile-color-bg; +} + +.o_wprofile_gradient { + background-image: linear-gradient(120deg, #875A7B, darken(#875A7B, 10%)); +} + +.o_wprofile_pict { + @include size(100%); + padding-top: 30%; + background-size: cover; + background-position: center; + + @include media-breakpoint-up(md) { + padding-top: 70%; + border: 1px solid darken(#875A7B, 10%); + border-bottom-width: 0; + } +} + +.o_wprofile_header { + @include media-breakpoint-up(md) { + &:before { + content: ""; + @include o-position-absolute(auto, 0, 0, 0); + height: $owprofile-tabs-height; + background: rgba(black, 0.2); + } + } +} + +.o_wprofile_sidebar { + border: 1px solid $border-color; + + @include media-breakpoint-up(md) { + border-top-width: 0; + } +} + +.o_wprofile_nav_tabs { + @include media-breakpoint-up(md) { + margin-top: $owprofile-tabs-height * -1; + border-bottom: 0; + + .nav-link { + border-radius: 0; + border-width: 0 1px; + line-height: $line-height-base; + @include o-hover-text-color(rgba(white, 0.8), white); + + & { + border-color: transparent; + } + + &:hover { + border-color: transparent; + background: #3d2938; + } + + &.active { + color: color-yiq($owprofile-color-bg); + background: $owprofile-color-bg; + border-color: $owprofile-color-bg; + } + } + } + + @include media-breakpoint-only(xs) { + overflow-x: auto; + overflow-y: hidden; + + li { + white-space: nowrap; + } + } +} + +.o_wprofile_tabs_content { + @include media-breakpoint-down(sm) { + background-color: $nav-tabs-link-active-bg; + padding:0 ($grid-gutter-width * 0.5); + } + + @include media-breakpoint-only(xs) { + margin: 0 ($grid-gutter-width * -0.5); + } +} + +/// Progress Circle +.o_wprofile_progress_circle { + position: relative; + + svg.o_pc_circular_chart { + display: block; + max-width: 100%; + + .o_pc_circle_bg, .o_pc_circle { + fill: none; + stroke-width: 1.5px; + stroke-linecap: round; + } + + .o_pc_circle_bg { + stroke: rgba(black, 0.1); + } + + .o_pc_circle { + animation: progress 1s ease-out forwards; + } + + #gradient { + --o-pc-color-stop-1: lighten(theme-color('primary'), 10%); + --o-pc-color-stop-2: theme-color('primary'); + } + } + + .o_pc_overlay { + @include o-position-absolute(0,0,0,0); + } + + @keyframes progress { + 0% { + stroke-dasharray: 0 100; + } + } +} + +// All Users Page +.o_wprofile_all_users_nav { + border-width: 1px 0; + + &, .o_wprofile_course_nav_search, .o_wprofile_all_users_nav_btn { + background-color: rgba(white, 0.05); + border-color: rgba(white, 0.1); + border-style: solid; + } + + .o_wprofile_course_nav_search, .o_wprofile_all_users_nav_btn { + border-width: 0 1px; + } + + .o_wprofile_all_users_nav_btn { + @include media-breakpoint-up(md) { + @include o-hover-text-color(white, $gray-800); + margin-top: -1px; + border-radius: 0; + min-height: 35px; + + &:hover { + background-color: white; + } + } + } + + .o_wprofile_all_users_nav_btn_container { + @include media-breakpoint-down(sm) { + ~ .o_wprofile_user_profile_sub_nav_mobile_col { + padding-left: 0; + } + + .o_wprofile_all_users_nav_btn { + @include o-hover-text-color(white, white); + border-radius: $btn-border-radius; + background-color: rgba(black, 0.25); + } + } + } + + .breadcrumb-item.active a, .breadcrumb-item a:hover { + color: white; + } + + .breadcrumb-item a, .breadcrumb-item + .breadcrumb-item::before, .o_wprofile_course_nav_search input::placeholder { + color: rgba(white, 0.8); + } +} + +.o_wprofile_top3_card_footer div { + border-color: $border-color; + border-style: solid; + border-width: 1px 0; + margin-top: -1px; + + + div { + border-left-width: 1px; + margin-left: -1px; + } +} + +.o_wprofile_pager { + li.page-item { + a.page-link { + background-color: transparent; + border: 0; + color: $gray-600; + transition-duration: .3s; + + &:hover { + color: $primary; + } + } + + &.active { + a.page-link { + color: $white; + } + } + + &.o_wprofile_pager_arrow a { + color: $primary; + + &:hover { + transform: scaleX(1.50) scaleY(1.50); + } + } + + &.o_wprofile_pager_arrow.disabled a { + color: $gray-600; + } + + .page-link:focus { + box-shadow: 0 0 0 0; + } + } +} + +.wprofile_badge_img { + height: 2.5em; +} + + +// Other stuffs +.country_flag { + display: inline-block; + margin-left: 2px; + max-height: 13px; + width: auto !important; +} + +// Tools +.o_wprofile_pointer { + cursor: pointer; +} + +// Own profile border +.o_wprofile_border_focus { + border-left: 4px solid theme-color('secondary'); +} |
