Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yPhil
Pétrolette
Commits
bf38ed68
Commit
bf38ed68
authored
Mar 13, 2022
by
yPhil
Browse files
killTab:
- if numberOfFeeds : dialog(), else kill() silently
parent
3996db45
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/js/PTL.dialog.js
View file @
bf38ed68
...
...
@@ -708,16 +708,12 @@ PTL.dialog = {
$dialog
.
dialog
(
'
open
'
);
});
},
killTab
:
function
(
$button
)
{
killTab
:
function
(
$button
,
tabName
,
$selectedTab
,
$selectedPanel
,
numberOfFeeds
)
{
$
(
'
div#ptlDialogs
'
).
load
(
'
/static/templates/dialogs.html #questionDialog
'
,
function
()
{
const
$dialog
=
$
(
this
),
$tabs
=
$
(
'
#tabs
'
),
$a
=
$button
.
prev
(
'
a.ui-tabs-anchor
'
),
tabId
=
$a
.
attr
(
'
href
'
),
$selectedTab
=
$a
.
parent
(),
$selectedPanel
=
$tabs
.
find
(
tabId
),
$icon
=
$dialog
.
find
(
'
div#icon > i
'
),
selectedTabIndex
=
$tabs
.
tabs
(
'
option
'
,
'
active
'
),
previousTabIndex
=
selectedTabIndex
===
0
?
0
:
selectedTabIndex
-
1
;
...
...
@@ -765,10 +761,9 @@ PTL.dialog = {
.
addClass
(
'
dangerous
'
)
.
text
(
PTL
.
tr
(
'
This action cannot be undone.
'
))
.
next
(
'
h2
'
).
text
(
PTL
.
tr
(
'
Name
'
))
.
next
(
'
p
'
).
text
(
$a
.
text
()
)
.
next
(
'
p
'
).
text
(
tabName
)
.
next
(
'
h2
'
).
text
(
PTL
.
tr
(
'
Number of feeds
'
))
.
next
(
'
p
'
).
text
(
$selectedPanel
.
find
(
'
li.feed
'
).
length
);
.
next
(
'
p
'
).
text
(
numberOfFeeds
);
}
});
...
...
public/js/PTL.tab.js
View file @
bf38ed68
...
...
@@ -34,7 +34,23 @@ PTL.tab = {
});
$tabs
.
on
(
"
click
"
,
"
i.tabCloser
"
,
function
()
{
PTL
.
dialog
.
killTab
(
$
(
this
));
const
$tabs
=
$
(
'
#tabs
'
),
$a
=
$
(
this
).
prev
(
'
a.ui-tabs-anchor
'
),
tabName
=
$a
.
text
(),
tabId
=
$a
.
attr
(
'
href
'
),
$selectedTab
=
$a
.
parent
(),
$selectedPanel
=
$tabs
.
find
(
tabId
),
numberOfFeeds
=
$selectedPanel
.
find
(
'
li.feed
'
).
length
;
if
(
numberOfFeeds
)
{
PTL
.
dialog
.
killTab
(
$
(
this
),
$a
.
text
(),
$selectedTab
,
$selectedPanel
,
numberOfFeeds
);
}
else
{
$selectedTab
.
remove
();
$selectedPanel
.
remove
();
PTL
.
tab
.
saveTabs
();
}
});
if
(
PTL
.
util
.
isMobile
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment