Aufgrund einer Wartung wird GitLab am 18.01. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 18.01. between 8:00 and 9:00 am.

Commit af72a530 authored by ThorbenQuast's avatar ThorbenQuast
Browse files

editor: update information dialog

parent 1cab71ed
......@@ -302,6 +302,10 @@ class FSAjaxController(AbstractController):
self.release_session()
fs = self.get('fs')
self.release_database()
logger.debug("\n\n\n\n\n")
logger.debug(self.get('window_id'))
logger.debug(self.get('view_id'))
logger.debug("\n\n\n\n\n")
return fs.get_file(path, utf8=utf8,
window_id=self.get('window_id'),
view_id=self.get('view_id'),
......
......@@ -22,6 +22,7 @@ class CodeEditorExtension(AbstractExtension):
self.add_js("js/preview.js")
self.add_js("js/prefs.js")
self.add_js("js/commandline.js")
self.add_js("js/updateInfo.js")
self.add_css("css/styles.css")
......
<div class="codeeditor">
<div class="codeeditor-left">
<div class="codeeditor-ace"></div>
</div>
......@@ -63,7 +62,7 @@
<button class="btn btn-default select-button" type="button">
<i class="glyphicon glyphicon-folder-close"></i>
</button>
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" title="Thumbnail sizes">
<button class="btn btn-default dropdown-toggle" id="preview-resize-btn" type="button" data-toggle="dropdown" title="Thumbnail sizes">
<i class="glyphicon glyphicon-eye-open"></i>
</button>
<ul id="zoom" class="dropdown-menu" role="menu">
......@@ -92,5 +91,4 @@
<div class="well"></div>
</div>
</div>
</div>
<div id="main">
<span id="header" style="font-size: 18px; font-weight: bold; left:30%;"></span>
<br></br>
<span id="textfield" style="font-size: 16px; font-weight: normal"></span>
<br></br>
<br></br>
<span id="pagecounter" style="left: 45%; position: absolute;"></span>
<br></br>
<button class="btn btn-sm btn-default" id="continue" type="button">
<i class="glyphicon glyphicon-play-circle"></i>
<span style="font-weight:bold">Continue</span>
</button>
<button class="btn btn-sm btn-default" id="quit" type="button">
<i class="glyphicon glyphicon-remove"></i>
<span style="font-weight:bold">Quit</span>
</button>
<div class="checkbox">
<label>
<input type="checkbox"> Do not show again
</label>
</div>
</div>
\ No newline at end of file
......@@ -45,6 +45,7 @@ var CodeEditor = Emitter.extend({
this.addOwnScrollBar();
this.view.onSocket("watch", function(data) {
console.log(data);
if (data.watch_id != "code") {
return;
}
......@@ -131,8 +132,7 @@ var CodeEditor = Emitter.extend({
//new: check for auto save tmp file
this.view.POST(vispa.url.dynamic("/ajax/fs/get_file"), {
path: self.giveAutoSavePath(),
utf8: true,
watch_id: "code_auto"
utf8: true
}).done(function(res) {
if (res.success) { //an autosave file exists
self.view.confirm("An autosave file exists. Do you want to load its content?",
......@@ -181,8 +181,7 @@ var CodeEditor = Emitter.extend({
self.view.POST(vispa.url.dynamic("/ajax/fs/save_file"), {
path: self.giveAutoSavePath(),
content: self.getContent(),
utf8: true,
watch_id: "code_auto"
utf8: true
}).done(function(res) {
self.savingProcessing = false;
self.mtime = res.mtime;
......
......@@ -89,6 +89,13 @@ var CodeEditorView = vispa.ExtensionView.Center.extend({
iconClass: "glyphicon glyphicon-asterisk",
buttonClass: "btn-default",
children: getHighlightModeEntries()
}).addMenuEntry("updateInfo", {
label: "1.1 Update",
iconClass: "glyphicon glyphicon-info-sign",
buttonClass: "btn-primary",
callback: function() {
self.updateInfo.start();
}
});
this.editor = new CodeEditor(this, path, writable);
......@@ -96,7 +103,7 @@ var CodeEditorView = vispa.ExtensionView.Center.extend({
this.preview = new CodeEditorPreview(this);
this.ui = new CodeEditorUI(this, showOutput);
this.commandLine = new CommandLine(this);
this.updateInfo = new UpdateInfo(this);
this.forceClose = false;
},
......@@ -132,6 +139,7 @@ var CodeEditorView = vispa.ExtensionView.Center.extend({
self._applyShortcuts();
self.setLoading(false);
self.updateInfo.setup(node);
setTimeout(self.editor.checkModifications.bind(self.editor), 0);
});
return this;
......
var UpdateInfo = Emitter.extend({
init: function(view) {
this.view = view;
this.mainNode = null;
this.headerNode = null;
this.textNode = null;
this.pageCounterNode = null;
this.checkBoxNode = null;
this.totalPages = content.length;
this.pageCounter = null;
this.highlightedElement = null;
this.cookieName = "updateInfo";
},
setup: function(node) {
this.mainNode = node;
if (!this.checkCookie())
this.start();
},
start: function() {
var self = this;
this.view.getTemplate("html/updateInfo.html", function(err, tmpl) {
var body = $(tmpl);
self.headerNode = $(body).find("#header");
self.textNode = $(body).find("#textfield");
self.pageCounterNode = $(body).find("#pagecounter");
self.checkBoxNode = $(body).find("input");
//make the page
self.checkBoxNode.prop("checked", self.checkCookie());
self.makePage(1);
//setup buttons
$(body).find("#continue").click(function() {
self.makePage(self.pageCounter + 1);
});
$(body).find("#quit").click(function() {
self.setCookie(self.checkBoxNode.prop("checked"));
self.highlightElement();
dialog.close();
});
var dialog = Dialog.dialog({
header: "<i class='glyphicon glyphicon-info-sign'></i>" +
" 1.1 Update",
body: body,
show: false
//TODO: BEFORECLOSE!
});
dialog.show();
});
},
makePage: function(page) {
if (page === undefined)
return this;
this.pageCounter = page > this.totalPages ? this.totalPages : page;
this.pageCounterNode.html(String(this.pageCounter + "/" + String(this.totalPages)));
var header = content[this.pageCounter - 1].header;
var text = content[this.pageCounter - 1].text;
var selector = content[this.pageCounter - 1].selector;
this.headerNode.html(header);
this.textNode.html(text);
this.highlightElement(selector);
return this;
},
highlightElement: function(selector) {
if (this.highlightedElement)
this.highlightedElement.css("background-color", "");
if (selector === undefined)
return this;
this.highlightedElement = this.mainNode.find(selector);
this.highlightedElement.css("background-color", "red");
},
checkCookie: function() {
var cookie = $.cookie(this.cookieName);
return cookie ? JSON.parse(cookie) : false;
},
setCookie: function(value) {
if (value === undefined)
value = true;
$.cookie(this.cookieName, JSON.stringify(value), {
expires: 3650
}); //basically no expiry
}
});
var content = [{
header: "Welcome to the VISPA Code Editor 1.1",
text: "VISPA 1.1 introduces many new features for the code editor as well as" +
" some crucial bug fixes. </br> This tour will give you a short impression of" +
" the changes. </br></br> Press 'Continue' to proceed or 'Quit' at any point to stop" +
" the tour.",
selector: null
}, {
header: "Section Resizing",
text: "Resizing of the individual sections is now possible by simple mouse drag.",
selector: ".codeeditor-x-dragbar, .codeeditor-y-dragbar"
}, {
header: "Quick Job Submission",
text: "If the jobmanagement extension is installed on your VISPA setup, an interface" +
" for e.g. a quick job submission is now provided.",
selector: "#submit"
}, {
header: "Commands",
text: "Place your command with which the opened file should be executed.",
selector: "#command-line"
}, {
header: "Memorizing Commands",
text: "A user defined number of commands is temporarily saved. </br> The last indicated command" +
" at the last save may also be memorized long term if cookies are enabled (see preferences).",
selector: "#history-btn"
}, {
header: "Preview Thumbnail Resizing",
text: "The preview thumbnails are now resizable either via the highlighted button" +
" or through the preference system.",
selector: "#preview-resize-btn"
}, {
header: "Filewatch, text to be written ('ttbw')",
text: "removal and renaming of open files is recognized (not really yet)",
selector: null
}, {
header: "Autosave, ttbw",
text: "files are being autosaved at a time interval as indicated in the preferences",
selector: null
}, {
header: "Bugfixes, ttbw",
text: "- overwriting existing files </br>- no more preview artefacts </br>" +
"- job init failure </br>- improved editor closure </br>- saving of output",
selector: null
}, {
header: "A Word of Caution, ttbw",
text: "Do not produce output lines at high frequencies! When producing more than ~1000 lines" +
" the interval between two consecutive ones should not be smaller than 10ms. </br>" +
" Otherwise, your web browser might crash and the page must be reloaded.",
selector: "#execute"
}, {
header: "Preference System",
text: "Although this is nothing new, we would like to remind you of VISPA's preference system." +
"</br>Open it by clicking on the arrow next to your user name on the top right-hand corner" +
" to personalize and enhance your experience with VISPA.",
selector: null
}, {
header: "Report Issues",
text: "In case you encounter any difficulties, discover a bug or have any suggestions for" +
" further improval, do not hesitate to contact us! </br></br> Please use the feedback" +
" button or send an e-mail to vispa@lists.rwth-aachen.de.",
selector: null
}, {
header: "Thank You",
text: "Thank you for your time and enjoy the improved code editor.</br></br>" +
"Do not forget to check the box below if this window shall not appear again. </br>" +
"'Quit' will close this dialog.",
selector: null
}];
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment