Skip to content
Permalink
Browse files

m

  • Loading branch information...
kea14 committed Apr 23, 2019
1 parent 5324015 commit bb0d959b81171053493fa98bf4c5e19727aa8cba
@@ -1543,14 +1543,6 @@ options.registry.anchorName = options.Class.extend({
options.registry.megaMenu = options.Class.extend({
xmlDependencies: ['/website/static/src/xml/website.editor.xml'],

/**
* @override
*/
start: function () {
this.megaMenuDropdownID = this.$target.closest('.dropdown_mega_menu').data('oe-id');
this.$navLink = this.$target.closest('.dropdown_mega_menu').siblings('a');
},

//--------------------------------------------------------------------------
// Options
//--------------------------------------------------------------------------
@@ -1560,11 +1552,16 @@ options.registry.megaMenu = options.Class.extend({
*/
openMegaMenuDialog: function (previewMode, value, $opt) {
var self = this;
var $megaMenuContent = this.$target.find('.s_mega_menu_content');
new Dialog(this, {
title: _t("Mega Menu"),
$content: $(qweb.render('website.dialog.megaMenu', {
currentAlignment: self.$target.attr('data-dropdown-alignment'),
currentWidth: self.$target.attr('data-dropdown-width'),
alignmentLeft: $megaMenuContent.hasClass('text-left'),
alignmentCenter: $megaMenuContent.hasClass('text-center'),
alignmentRight: $megaMenuContent.hasClass('text-right'),
fullwidth: $megaMenuContent.hasClass('full'),
// currentAlignment: self.$target.attr('data-dropdown-alignment'),
// currentWidth: self.$target.attr('data-dropdown-width'),
})),
buttons: [
{
@@ -1574,7 +1571,7 @@ options.registry.megaMenu = options.Class.extend({
var $dropdownContentAlignment = $('[name="dropdown_content_alignment"]');
var $dropdownWidth = $('[name="dropdown_width"]');
var $dropdownMenu = self.$target.parent();
var $megaMenuContent = self.$target.find('.s_mega_menu_content');
// var $megaMenuContent = self.$target.find('.s_mega_menu_content');
var containerWidth = $dropdownWidth.val() === 'container';

$dropdownMenu.toggleClass('position-static', !containerWidth);
@@ -1586,11 +1583,13 @@ options.registry.megaMenu = options.Class.extend({
.toggleClass('mega_menu_max_content', containerWidth);
self.$target
.toggleClass('dropdown-menu-right', containerWidth)
.toggleClass('w-100', !containerWidth)
.attr({
'data-dropdown-alignment': $dropdownContentAlignment.val(),
'data-dropdown-width': $dropdownWidth.val(),
});
.toggleClass('w-100', !containerWidth);
// BUGGY ON SAVE
// .attr({
// 'data-dropdown-alignment': $dropdownContentAlignment.val(),
// 'data-dropdown-width': $dropdownWidth.val(),
// });

$dropdownMenu.trigger('content_changed');
this.close();
}
@@ -103,16 +103,21 @@
<div class="form-group">
<label for="alignment">Dropdown Content Alignment</label>
<select id="dropdown_aligment" class="custom-select" name="dropdown_content_alignment">
<option t-att-selected="currentAlignment == 'text-left' ? 'selected' : undefined" value="text-left">Left</option>
<!-- <option t-att-selected="currentAlignment == 'text-left' ? 'selected' : undefined" value="text-left">Left</option>
<option t-att-selected="currentAlignment == 'text-center' ? 'selected' : undefined" value="text-center">Center</option>
<option t-att-selected="currentAlignment == 'text-right' ? 'selected' : undefined" value="text-right">Right</option>
<option t-att-selected="currentAlignment == 'text-right' ? 'selected' : undefined" value="text-right">Right</option> -->
<option t-att-selected="alignmentLeft ? 'selected' : undefined" value="text-left">Left</option>
<option t-att-selected="alignmentCenter ? 'selected' : undefined" value="text-center">Center</option>
<option t-att-selected="alignmentRight ? 'selected' : undefined" value="text-right">Right</option>
</select>
</div>
<div class="form-group">
<label for="width">Dropdown Width</label>
<select id="dropdown_width" class="custom-select" name="dropdown_width">
<option t-att-selected="currentWidth == 'full' ? 'selected' : undefined" value="full">Full-width</option>
<option t-att-selected="currentWidth == 'container' ? 'selected' : undefined" value="container">Container-width</option>
<!-- <option t-att-selected="currentWidth == 'full' ? 'selected' : undefined" value="full">Full-width</option>
<option t-att-selected="currentWidth == 'container' ? 'selected' : undefined" value="container">Container-width</option> -->
<option t-att-selected="fullwidth ? 'selected' : undefined" value="full">Full-width</option>
<option t-att-selected="not fullwidth ? 'selected' : undefined" value="container">Container-width</option>
</select>
</div>
</div>
@@ -161,7 +161,7 @@
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
<span t-field="submenu.name"/>
</a>
<div class="dropdown-menu w-100 dropdown_mega_menu" t-field="submenu.mega_menu_content"/>
<div t-attf-class="dropdown-menu w-100 dropdown_mega_menu" t-field="submenu.mega_menu_content" t-attf-data-dropdown-alignment="text-center" t-attf-data-dropdown-width="full"/> <!-- TODO -->
</li>
</template>

0 comments on commit bb0d959

Please sign in to comment.
You can’t perform that action at this time.