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
Kazuhiko Shiozaki
slapos.toolbox
Commits
fd65c451
Commit
fd65c451
authored
Feb 11, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slaprunner: ace editor asks for unsaved changes before leaving page
parent
97a0b5be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
slapos/runner/static/js/scripts/softwareFolder.js
slapos/runner/static/js/scripts/softwareFolder.js
+16
-0
slapos/runner/templates/layout.html
slapos/runner/templates/layout.html
+1
-0
No files found.
slapos/runner/static/js/scripts/softwareFolder.js
View file @
fd65c451
...
@@ -23,6 +23,7 @@ $(document).ready(function () {
...
@@ -23,6 +23,7 @@ $(document).ready(function () {
edit_status
=
""
,
edit_status
=
""
,
current_file
=
null
,
current_file
=
null
,
favourite_list
=
new
Array
(),
favourite_list
=
new
Array
(),
beforeunload_warning_set
=
false
,
base_path
=
function
()
{
base_path
=
function
()
{
return
softwareDisplay
?
currentProject
:
'
runner_workdir/
'
;
return
softwareDisplay
?
currentProject
:
'
runner_workdir/
'
;
};
};
...
@@ -585,8 +586,11 @@ $(document).ready(function () {
...
@@ -585,8 +586,11 @@ $(document).ready(function () {
editor
=
ace
.
edit
(
"
editor
"
);
editor
=
ace
.
edit
(
"
editor
"
);
modelist
=
require
(
"
ace/ext/modelist
"
);
modelist
=
require
(
"
ace/ext/modelist
"
);
ace
.
require
(
"
ace/ext/language_tools
"
);
config
=
require
(
"
ace/config
"
);
config
=
require
(
"
ace/config
"
);
editor
.
setOptions
({
enableBasicAutocompletion
:
true
,
enableSnippets
:
true
});
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
editor
.
getSession
().
setMode
(
"
ace/mode/text
"
);
editor
.
getSession
().
setMode
(
"
ace/mode/text
"
);
editor
.
getSession
().
setTabSize
(
2
);
editor
.
getSession
().
setTabSize
(
2
);
...
@@ -603,6 +607,18 @@ $(document).ready(function () {
...
@@ -603,6 +607,18 @@ $(document).ready(function () {
$
(
"
#option
"
).
Tooltip
();
$
(
"
#option
"
).
Tooltip
();
$
(
"
#filelist
"
).
Tooltip
();
$
(
"
#filelist
"
).
Tooltip
();
editor
.
getSession
().
on
(
'
change
'
,
function
(){
$
(
"
#editor
"
).
val
(
editor
.
getSession
().
getValue
());
if
(
!
beforeunload_warning_set
)
{
window
.
onbeforeunload
=
function
()
{
return
"
You have unsaved changes
"
;
};
beforeunload_warning_set
=
true
;
}
});
$
(
'
input[value="Save Changes"]
'
).
click
(
function
()
{
window
.
onbeforeunload
=
function
()
{
return
;
};
});
editor
.
on
(
"
change
"
,
function
(
e
)
{
editor
.
on
(
"
change
"
,
function
(
e
)
{
if
(
edit_status
===
""
&&
edit
)
{
if
(
edit_status
===
""
&&
edit
)
{
$
(
"
span#edit_status
"
).
html
(
"
*
"
);
$
(
"
span#edit_status
"
).
html
(
"
*
"
);
...
...
slapos/runner/templates/layout.html
View file @
fd65c451
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
{% if request.path != '/login' %}
{% if request.path != '/login' %}
<script
src=
"{{ url_for('static', filename='js/ace/ace.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
src=
"{{ url_for('static', filename='js/ace/ace.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
src=
"{{ url_for('static', filename='js/ace/ext-modelist.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
src=
"{{ url_for('static', filename='js/ace/ext-modelist.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
src=
"{{ url_for('static', filename='js/ace/ext-language_tools.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
src=
"{{ url_for('static', filename='js/scripts/process.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
src=
"{{ url_for('static', filename='js/scripts/process.js') }}"
type=
"text/javascript"
charset=
"utf-8"
></script>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
...
...
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