last few changes

- fix sidebar menu item name (remove badge text)
- add removeActiveTab and event listener
pull/3069/head
REJack 2020-09-20 11:18:05 +02:00
parent 1058af118a
commit fd07c05d2d
1 changed files with 15 additions and 0 deletions

View File

@ -17,6 +17,7 @@ const DATA_KEY = 'lte.iframe'
const JQUERY_NO_CONFLICT = $.fn[NAME] const JQUERY_NO_CONFLICT = $.fn[NAME]
const SELECTOR_DATA_TOGGLE = '[data-widget="iframe"]' const SELECTOR_DATA_TOGGLE = '[data-widget="iframe"]'
const SELECTOR_DATA_TOGGLE_CLOSE = '[data-widget="iframe-close"]'
const SELECTOR_CONTENT_WRAPPER = '.content-wrapper' const SELECTOR_CONTENT_WRAPPER = '.content-wrapper'
const SELECTOR_CONTENT_IFRAME = `${SELECTOR_CONTENT_WRAPPER} iframe` const SELECTOR_CONTENT_IFRAME = `${SELECTOR_CONTENT_WRAPPER} iframe`
const SELECTOR_TAB_NAV = `${SELECTOR_DATA_TOGGLE}.iframe-mode .nav` const SELECTOR_TAB_NAV = `${SELECTOR_DATA_TOGGLE}.iframe-mode .nav`
@ -97,6 +98,7 @@ class IFrame {
$item = $(item).parent('a').clone() $item = $(item).parent('a').clone()
} }
$item.find('.right').remove()
let title = $item.find('p').text() let title = $item.find('p').text()
if (title === '') { if (title === '') {
title = $item.text() title = $item.text()
@ -160,6 +162,15 @@ class IFrame {
}) })
} }
removeActiveTab() {
$(`${SELECTOR_TAB_NAVBAR_NAV_ITEM}.active`).parent().remove()
$('.tab-pane.active').remove()
if ($(SELECTOR_TAB_CONTENT).children().length == $(`${SELECTOR_TAB_EMPTY}, ${SELECTOR_TAB_LOADING}`).length) {
$(SELECTOR_TAB_EMPTY).show()
}
}
// Private // Private
_init() { _init() {
@ -187,6 +198,10 @@ class IFrame {
this.tabClick(e.target) this.tabClick(e.target)
this.switchTab(e.target) this.switchTab(e.target)
}) })
$(document).on('click', SELECTOR_DATA_TOGGLE_CLOSE, e => {
e.preventDefault()
this.removeActiveTab()
})
} }
_fixHeight(tabEmpty = false) { _fixHeight(tabEmpty = false) {