一级菜单点击收起
This commit is contained in:
@@ -17,9 +17,11 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
var {useService} = require("@web/core/utils/hooks");
|
||||
|
||||
var {loadCSS, loadJS} = require("@web/core/assets");
|
||||
var last_class = null
|
||||
|
||||
const {useExternalListener, onMounted} = owl;
|
||||
|
||||
|
||||
function findNames(memo, menu) {
|
||||
if (menu.actionID) {
|
||||
memo[menu.name.trim()] = menu;
|
||||
@@ -55,44 +57,100 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
this.companyService = useService("company");
|
||||
this.currentCompany = this.companyService.currentCompany;
|
||||
|
||||
$(document).on('click', '.bookmark_section .dropdown-toggle', function(ev){self._getCurrentPageName(ev)});
|
||||
$(document).on('click', '.bookmark_section .add_bookmark', function(ev){self._saveBookmarkPage(ev)});
|
||||
$(document).on('contextmenu', '.bookmark_list .bookmark_tag', function(ev){self._showbookmarkoptions(ev)});
|
||||
$(document).on('click', '.magnifier_section .minus', function(ev){self._magnifierZoomOut(ev)});
|
||||
$(document).on('click', '.magnifier_section .plus', function(ev){self._magnifierZoomIn(ev)});
|
||||
$(document).on('click', '.magnifier_section .reset', function(ev){self._magnifierZoomReset(ev)});
|
||||
$(document).on('click', '.fullscreen_section > a.full_screen', function(ev){self._FullScreenMode(ev)});
|
||||
$(document).on("click", ".theme_selector a", function(ev){self._openConfigModal(ev)})
|
||||
$(document).on('click', '#dark_mod', function(ev){self._ChangeThemeModeCLicked(ev)});
|
||||
$(document).on('click', '.pin_sidebar', function(ev){self._ChangeSidebarBehaviour(ev)});
|
||||
$(document).on('click', '.bookmark_section .dropdown-toggle', function (ev) {
|
||||
self._getCurrentPageName(ev)
|
||||
});
|
||||
$(document).on('click', '.bookmark_section .add_bookmark', function (ev) {
|
||||
self._saveBookmarkPage(ev)
|
||||
});
|
||||
$(document).on('contextmenu', '.bookmark_list .bookmark_tag', function (ev) {
|
||||
self._showbookmarkoptions(ev)
|
||||
});
|
||||
$(document).on('click', '.magnifier_section .minus', function (ev) {
|
||||
self._magnifierZoomOut(ev)
|
||||
});
|
||||
$(document).on('click', '.magnifier_section .plus', function (ev) {
|
||||
self._magnifierZoomIn(ev)
|
||||
});
|
||||
$(document).on('click', '.magnifier_section .reset', function (ev) {
|
||||
self._magnifierZoomReset(ev)
|
||||
});
|
||||
$(document).on('click', '.fullscreen_section > a.full_screen', function (ev) {
|
||||
self._FullScreenMode(ev)
|
||||
});
|
||||
$(document).on("click", ".theme_selector a", function (ev) {
|
||||
self._openConfigModal(ev)
|
||||
})
|
||||
$(document).on('click', '#dark_mod', function (ev) {
|
||||
self._ChangeThemeModeCLicked(ev)
|
||||
});
|
||||
$(document).on('click', '.pin_sidebar', function (ev) {
|
||||
self._ChangeSidebarBehaviour(ev)
|
||||
});
|
||||
// $(document).on('click', '.lang_selector', function(ev){self._GetLanguages(ev)});
|
||||
|
||||
$(document).on('click', '.o_navbar_apps_menu .main_link', function(ev){self._ShowCurrentMenus(ev)});
|
||||
$(document).on('click', '.o_navbar_apps_menu .main_link', function (ev) {
|
||||
self._ShowCurrentMenus(ev)
|
||||
});
|
||||
|
||||
// SPIFFY MULTI TAB START
|
||||
$(document).on('click', '.o_navbar_apps_menu .child_menus', function(ev){self._childMenuClick(ev)});
|
||||
$(document).on('click', '.o_menu_sections .o_menu_entry_lvl_2, .o_menu_sections .o_nav_entry', function(ev){self._childMenuClick(ev)});
|
||||
$(document).on('click', '.multi_tab_section .multi_tab_div a', function(ev){self._TabClicked(ev)});
|
||||
$(document).on('click', '.multi_tab_section .remove_tab', function(ev){self._RemoveTab(ev)});
|
||||
$(document).on('click', '.o_navbar_apps_menu .child_menus', function (ev) {
|
||||
self._childMenuClick(ev)
|
||||
});
|
||||
$(document).on('click', '.o_menu_sections .o_menu_entry_lvl_2, .o_menu_sections .o_nav_entry', function (ev) {
|
||||
self._childMenuClick(ev)
|
||||
});
|
||||
$(document).on('click', '.multi_tab_section .multi_tab_div a', function (ev) {
|
||||
self._TabClicked(ev)
|
||||
});
|
||||
$(document).on('click', '.multi_tab_section .remove_tab', function (ev) {
|
||||
self._RemoveTab(ev)
|
||||
});
|
||||
// SPIFFY MULTI TAB END
|
||||
|
||||
$(document).on('click', '.search_bar, .close-search-bar', function(ev){self._showSearchbarModal(ev)});
|
||||
$(document).on('shown.bs.modal', '#search_bar_modal', function(ev){self._searchModalFocus(ev)});
|
||||
$(document).on('hidden.bs.modal', '#search_bar_modal', function(ev){self._searchModalReset(ev)});
|
||||
$(document).on('click', '.search_bar, .close-search-bar', function (ev) {
|
||||
self._showSearchbarModal(ev)
|
||||
});
|
||||
$(document).on('shown.bs.modal', '#search_bar_modal', function (ev) {
|
||||
self._searchModalFocus(ev)
|
||||
});
|
||||
$(document).on('hidden.bs.modal', '#search_bar_modal', function (ev) {
|
||||
self._searchModalReset(ev)
|
||||
});
|
||||
|
||||
$(document).on('keydown', '#searchPagesInput', function(ev){self._searchResultsNavigate(ev)});
|
||||
$(document).on('input', '#searchPagesInput', function(ev){self._searchMenuTimeout(ev)});
|
||||
$(document).on('click', '#searchPagesResults .autoComplete_highlighted', function(ev){self._searchResultChosen(ev)});
|
||||
$(document).on('keydown', '#searchPagesInput', function (ev) {
|
||||
self._searchResultsNavigate(ev)
|
||||
});
|
||||
$(document).on('input', '#searchPagesInput', function (ev) {
|
||||
self._searchMenuTimeout(ev)
|
||||
});
|
||||
$(document).on('click', '#searchPagesResults .autoComplete_highlighted', function (ev) {
|
||||
self._searchResultChosen(ev)
|
||||
});
|
||||
|
||||
$(document).on('click', '.o_app_drawer a', function(ev){self._OpenAppdrawer(ev)});
|
||||
$(document).on('click', '.mobile-header-toggle #mobileMenuToggleBtn', function(ev){self._mobileHeaderToggle(ev)});
|
||||
$(document).on('click', '.o_menu_sections #mobileMenuclose', function(ev){self._mobileHeaderClose(ev)});
|
||||
$(document).on('click', '.fav_app_drawer .fav_app_drawer_btn', function(ev){self._OpenFavAppdrawer(ev)});
|
||||
$(document).on('click', '.appdrawer_section .close_fav_app_btn', function(ev){self._CloseAppdrawer(ev)});
|
||||
$(document).on('click', '.o_app_drawer a', function (ev) {
|
||||
self._OpenAppdrawer(ev)
|
||||
});
|
||||
$(document).on('click', '.mobile-header-toggle #mobileMenuToggleBtn', function (ev) {
|
||||
self._mobileHeaderToggle(ev)
|
||||
});
|
||||
$(document).on('click', '.o_menu_sections #mobileMenuclose', function (ev) {
|
||||
self._mobileHeaderClose(ev)
|
||||
});
|
||||
$(document).on('click', '.fav_app_drawer .fav_app_drawer_btn', function (ev) {
|
||||
self._OpenFavAppdrawer(ev)
|
||||
});
|
||||
$(document).on('click', '.appdrawer_section .close_fav_app_btn', function (ev) {
|
||||
self._CloseAppdrawer(ev)
|
||||
});
|
||||
|
||||
$(document).on('click', '.debug_activator .activate_debug', function(ev){self._DebugToggler(ev)});
|
||||
$(document).on('click', '.debug_activator .activate_debug', function (ev) {
|
||||
self._DebugToggler(ev)
|
||||
});
|
||||
|
||||
$(document).on("click", ".header_to_do_list .to_do_list", function(ev){self._openToDoList(ev)});
|
||||
$(document).on("click", ".header_to_do_list .to_do_list", function (ev) {
|
||||
self._openToDoList(ev)
|
||||
});
|
||||
|
||||
this._searchableMenus = [];
|
||||
var menu = this.menuService.getApps()
|
||||
@@ -235,10 +293,54 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
},
|
||||
|
||||
_ShowCurrentMenus: function (ev) {
|
||||
console.log($(ev.target).parent().find('ul').hasClass('show'))
|
||||
// $(ev.target).parent().parent().find('ul').removeClass('show')
|
||||
// $(ev.target).parent().parent().find('a.main_link').removeClass('active')
|
||||
// if (last_class && ev.target != last_class) {
|
||||
// console.log(1111)
|
||||
// $(ev.target).parent().find('ul').addClass('show')
|
||||
// $(ev.target).addClass('active')
|
||||
// } else {
|
||||
//
|
||||
// var flag = $(ev.target).parent().find('ul').hasClass('show')
|
||||
// console.log(flag)
|
||||
// if (flag) {
|
||||
// $(ev.target).parent().parent().find('ul').removeClass('show')
|
||||
// $(ev.target).parent().parent().find('a.main_link').removeClass('active')
|
||||
// } else {
|
||||
// console.log(333)
|
||||
//
|
||||
// $(ev.target).parent().find('ul').addClass('show')
|
||||
// $(ev.target).addClass('active')
|
||||
// }
|
||||
// }
|
||||
if (last_class) {
|
||||
if (ev.target != last_class) {
|
||||
$(ev.target).parent().parent().find('ul').removeClass('show')
|
||||
$(ev.target).parent().parent().find('a.main_link').removeClass('active')
|
||||
$(ev.target).parent().find('ul').addClass('show')
|
||||
$(ev.target).addClass('active')
|
||||
} else {
|
||||
var flag = $(ev.target).parent().find('ul').hasClass('show')
|
||||
// console.log(flag)
|
||||
if (flag) {
|
||||
$(ev.target).parent().parent().find('ul').removeClass('show')
|
||||
$(ev.target).parent().parent().find('a.main_link').removeClass('active')
|
||||
} else {
|
||||
// console.log(333)
|
||||
$(ev.target).parent().parent().find('ul').removeClass('show')
|
||||
$(ev.target).parent().parent().find('a.main_link').removeClass('active')
|
||||
$(ev.target).parent().find('ul').addClass('show')
|
||||
$(ev.target).addClass('active')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$(ev.target).parent().find('ul').addClass('show')
|
||||
$(ev.target).addClass('active')
|
||||
}
|
||||
last_class = ev.target
|
||||
console.log(ev.target)
|
||||
|
||||
|
||||
// SPIFFY MULTI TAB START
|
||||
if (ev.shiftKey) {
|
||||
@@ -344,8 +446,7 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
|
||||
addmultitabtags: function (ev) {
|
||||
var self = this
|
||||
ajax.jsonRpc('/get/mutli/tab','call', {
|
||||
}).then(function(rec) {
|
||||
ajax.jsonRpc('/get/mutli/tab', 'call', {}).then(function (rec) {
|
||||
if (rec) {
|
||||
$('.multi_tab_section').empty()
|
||||
$.each(rec, function (key, value) {
|
||||
@@ -525,8 +626,7 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
})
|
||||
},
|
||||
addbookmarktags: function () {
|
||||
ajax.jsonRpc('/get/bookmark/link','call', {
|
||||
}).then(function(rec) {
|
||||
ajax.jsonRpc('/get/bookmark/link', 'call', {}).then(function (rec) {
|
||||
$('.bookmark_list').empty()
|
||||
$.each(rec, function (key, value) {
|
||||
var anchor_tag = '<div class="d-inline-block bookmark_div"><a href="' + value.url + '"' + ' class="bookmark_tag btn-light btn demo_btn" bookmark-id="' + value.id + '" bookmark-name="' + value.name + '" title="' + value.name + '">' + value.title + '</a></div>'
|
||||
@@ -822,8 +922,7 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
var app_light_bg_img = window.app_light_bg_image
|
||||
} else if ($("input[id='light_bg_image']").attr('value')) {
|
||||
var app_light_bg_img = $("input[id='light_bg_image']").attr('value')
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var app_light_bg_img = false
|
||||
}
|
||||
var light_body_bg_color = $("input[id='body_bg']").val()
|
||||
@@ -838,8 +937,7 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
var app_dark_bg_img = window.app_dark_bg_image
|
||||
} else if ($("input[id='dark_bg_image']").attr('value')) {
|
||||
var app_dark_bg_img = $("input[id='dark_bg_image']").attr('value')
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var app_dark_bg_img = false
|
||||
}
|
||||
var dark_body_bg_color = $("input[id='dark_body_bg']").val()
|
||||
@@ -942,8 +1040,7 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
$(':root').css('--biz-theme-body-color', 'var(--dark-theme-body-color)');
|
||||
$(':root').css('--biz-theme-body-text-color', 'var(--dark-theme-body-text-color)');
|
||||
$(':root').css('--biz-theme-primary-rgba', 'var(--primary-rgba)');
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
ajax.rpc('/active/dark/mode', {'dark_mode': 'off'})
|
||||
.then(function (data) {
|
||||
if (data) {
|
||||
@@ -1157,9 +1254,15 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
// TO DO LIST FUNCTIONS
|
||||
biz_TodoList_events: function () {
|
||||
var self = this;
|
||||
$('#close_to_do_sidebar').unbind().on('click', function(ev) {self._closeToDoSidebar(ev);})
|
||||
$('.note-options .note-delete a').unbind().on('click', function(ev) {self._deleteNote(ev);})
|
||||
$('.note-options .note-edit a').unbind().on('click', function(ev) {self._editNote(ev);})
|
||||
$('#close_to_do_sidebar').unbind().on('click', function (ev) {
|
||||
self._closeToDoSidebar(ev);
|
||||
})
|
||||
$('.note-options .note-delete a').unbind().on('click', function (ev) {
|
||||
self._deleteNote(ev);
|
||||
})
|
||||
$('.note-options .note-edit a').unbind().on('click', function (ev) {
|
||||
self._editNote(ev);
|
||||
})
|
||||
},
|
||||
|
||||
_closeToDoSidebar: function (ev) {
|
||||
@@ -1211,7 +1314,6 @@ odoo.define('spiffy_theme_backend.MenuJs', function (require) {
|
||||
},
|
||||
|
||||
|
||||
|
||||
_openToDoList: function () {
|
||||
var self = this
|
||||
self.showToDoSidebar();
|
||||
|
||||
@@ -62,16 +62,16 @@ function makeMenus(env, menusData, fetchLoadMenus) {
|
||||
return menusData[menuID];
|
||||
},
|
||||
getCurrentApp() {
|
||||
if (!currentAppId) {
|
||||
return;
|
||||
}
|
||||
var target_tag = '.o_navbar_apps_menu a.main_link[data-menu='+currentAppId+']'
|
||||
$(target_tag).addClass('active');
|
||||
if($(target_tag).hasClass('dropdown-btn')){
|
||||
var ultag = $(target_tag).parent().find('.header-sub-menus')
|
||||
$(ultag).addClass('show');
|
||||
}
|
||||
return this.getMenu(currentAppId);
|
||||
// if (!currentAppId) {
|
||||
// return;
|
||||
// }
|
||||
// var target_tag = '.o_navbar_apps_menu a.main_link[data-menu='+currentAppId+']'
|
||||
// $(target_tag).addClass('active');
|
||||
// if($(target_tag).hasClass('dropdown-btn')){
|
||||
// var ultag = $(target_tag).parent().find('.header-sub-menus')
|
||||
// $(ultag).addClass('show');
|
||||
// }
|
||||
// return this.getMenu(currentAppId);
|
||||
},
|
||||
getMenuAsTree(menuID) {
|
||||
const menu = this.getMenu(menuID);
|
||||
|
||||
Reference in New Issue
Block a user