Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.toolbox
Commits
299dbfed
Commit
299dbfed
authored
Mar 18, 2014
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent conflits while opening tabs
parent
6e7664a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
slapos/runner/static/js/scripts/softwareFolder.js
slapos/runner/static/js/scripts/softwareFolder.js
+18
-16
No files found.
slapos/runner/static/js/scripts/softwareFolder.js
View file @
299dbfed
...
...
@@ -71,13 +71,16 @@ $(document).ready(function () {
editorlist
[
hash
].
busy
=
false
;
status
=
true
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
$
(
"
#tabControl div.active span.bt_close
"
).
click
();
$
(
"
#error
"
).
Popup
(
"
Unable to open file:
"
+
file
+
"
<br/>
"
+
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
//Close current tab
$
(
"
#tabControl div[rel='
"
+
hash
+
"
'] span.bt_close
"
).
click
();
}
})
.
fail
(
function
(
jqXHR
,
exception
)
{
alertStatus
(
jqXHR
);
$
(
"
#tabControl div.active span.bt_close
"
).
click
();
//Close current tab
$
(
"
#tabControl div[rel='
"
+
hash
+
"
'] span.bt_close
"
).
click
();
})
.
always
(
function
()
{
// always
...
...
@@ -189,8 +192,8 @@ $(document).ready(function () {
if
(
editorlist
.
hasOwnProperty
(
hash
))
{
//this file already exist in editor. Select file and exit!
$
(
"
#tabControl div.item
"
).
each
(
function
()
{
var
rel
=
$
(
this
).
attr
(
'
rel
'
)
.
split
(
'
#
'
)
;
if
(
(
rel
.
length
===
2
)
&&
(
rel
[
1
]
===
hash
)
)
{
var
rel
=
$
(
this
).
attr
(
'
rel
'
);
if
(
rel
&&
(
rel
===
hash
)
)
{
$
(
this
).
click
();
return
""
;
}
...
...
@@ -198,7 +201,7 @@ $(document).ready(function () {
return
""
;
}
var
width
=
resizeTabItems
(
true
);
var
tab
=
'
<div class="item" rel="
'
+
path
+
'
#
'
+
hash
var
tab
=
'
<div class="item" rel="
'
+
hash
+
'
"><span style="width:
'
+
width
+
'
px"
'
+
'
title="
'
+
path
+
'
">
'
+
title
+
'
</span>
'
+
'
<span class="bt_close" title="Close this tab">×</span></div>
'
;
...
...
@@ -215,7 +218,7 @@ $(document).ready(function () {
if
(
$
(
this
).
hasClass
(
'
active
'
)
)
{
return
false
;
}
var
rel
=
$
(
this
).
attr
(
'
rel
'
)
.
split
(
'
#
'
)
,
var
rel
=
$
(
this
).
attr
(
'
rel
'
),
current
=
$
(
"
#tabContent pre.active
"
).
attr
(
'
rel
'
);
if
(
current
&&
current
!==
undefined
)
{
editorlist
[
current
].
isOpened
=
false
;
...
...
@@ -223,25 +226,25 @@ $(document).ready(function () {
$
(
"
#tabControl div.active
"
).
removeClass
(
'
active
'
);
$
(
"
#tabContent pre.active
"
).
removeClass
(
'
active
'
);
$
(
this
).
addClass
(
'
active
'
);
$
(
"
#tabContent pre[rel='
"
+
rel
[
1
]
+
"
']
"
).
addClass
(
'
active
'
);
editorlist
[
rel
[
1
]
].
isOpened
=
true
;
editorlist
[
rel
[
1
]
].
editor
.
resize
();
$
(
"
#tabContent pre[rel='
"
+
rel
+
"
']
"
).
addClass
(
'
active
'
);
editorlist
[
rel
].
isOpened
=
true
;
editorlist
[
rel
].
editor
.
resize
();
return
false
;
});
/*Close Selected Tab*/
$
(
"
#tabControl div.item:last span.bt_close
"
).
click
(
function
()
{
var
$tab
=
$
(
this
).
parent
(),
position
=
0
;
var
rel
=
$tab
.
attr
(
'
rel
'
)
.
split
(
'
#
'
)
;
var
rel
=
$tab
.
attr
(
'
rel
'
);
//Remove tab
if
(
$tab
.
hasClass
(
'
active
'
)
&&
$
(
"
#tabControl div.item
"
).
length
>
0
)
{
position
=
(
$tab
.
index
()
==
0
)
?
1
:
$tab
.
index
();
$
(
"
#tabControl div.item:nth-child(
"
+
position
+
"
)
"
).
click
();
}
editorlist
[
rel
[
1
]
].
editor
.
destroy
();
delete
editorlist
[
rel
[
1
]
];
editorlist
[
rel
].
editor
.
destroy
();
delete
editorlist
[
rel
];
$tab
.
remove
();
$
(
"
#tabContent pre[rel='
"
+
rel
[
1
]
+
"
']
"
).
remove
();
$
(
"
#tabContent pre[rel='
"
+
rel
+
"
']
"
).
remove
();
resizeTabItems
();
saveTabList
();
return
false
;
...
...
@@ -309,8 +312,7 @@ $(document).ready(function () {
function
getActiveTabTitleSelector
(
hash
)
{
var
rel
=
(
hash
)
?
hash
:
$
(
"
#tabContent pre.active
"
).
attr
(
'
rel
'
);
if
(
editorlist
.
hasOwnProperty
(
rel
)
)
{
return
"
#tabControl div[rel='
"
+
editorlist
[
rel
].
path
+
"
#
"
+
rel
+
"
'] span:nth-child(1)
"
;
return
"
#tabControl div[rel='
"
+
rel
+
"
'] span:nth-child(1)
"
;
}
else
{
return
""
;
}
}
...
...
Write
Preview
Markdown
is supported
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