Permalink
Browse files

fixes #20

1 parent 96eb68a commit 60bbc0e5c4bb8ff0022a8611fe92bfe0c5e76856 @pizzapanther committed Oct 19, 2011
View
701 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -211,7 +211,7 @@ ul.jqueryFileTree {
background-image: url(/static/ide/img/new.png);
}
-.right_menu ul li a.cancel {
+.right_menu ul li a.cancel, #main_menu ul li a.cancel {
background-image: url(/static/ide/img/cancel.png);
}
@@ -230,3 +230,7 @@ ul.jqueryFileTree {
.right_menu ul li a.rename {
background-image: url(/static/ide/img/rename.png);
}
+
+#main_menu ul li a.about {
+ background-image: url(/static/ide/img/about.png);
+}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -220,7 +220,7 @@ $(document).ready(function () {
});
window.onbeforeunload = function() {
- return 'Are you sure you wish to leave this page?';
+ return 'Leaving so soon!';
}
var canon = require('pilot/canon');
@@ -233,5 +233,7 @@ canon.addCommand({
sender: 'editor'
},
exec: function(env, args, request) { SaveCurrentTab(); }
-})
+});
+
+
@@ -1,6 +1,23 @@
function about () {
- alert('Neutron IDE v11.11 by Paul M Bailey - paul.m.bailey@gmail.com\n\nneutronide.com\n\nLicense: GPLv3');
+ alert('Neutron IDE v11.11 by Paul M Bailey - paul.m.bailey@gmail.com\n\nneutronide.com\n\nLicense: BSD');
+ hide_menu();
+}
+
+function show_menu () {
+ var offset = $("#menu_button").offset();
+ $("#main_menu").css('display', 'block');
+ $("#main_menu").offset({top: offset.top + 7, left: offset.left + 7});
+}
+
+function hide_menu () {
+ $("#main_menu").css('display', 'none');
+}
+
+function CloseAll () {
+ if (confirm('Are you sure you wish to close all tabs?')) {
+ $('#tabs span.ui-icon-close').click();
+ }
}
function SaveAll () {
@@ -36,4 +53,14 @@ function SaveAll () {
error: function (jqXHR, textStatus, errorThrown) { alert('Error Saving: ' + dp); $("#status").html(''); },
});
}
-}
+}
+
+canon.addCommand({
+ name: 'SaveFile',
+ bindKey: {
+ win: 'Ctrl-shift-S',
+ mac: 'Command-shift-S',
+ sender: 'editor'
+ },
+ exec: function(env, args, request) { SaveAll(); }
+});
@@ -18,13 +18,8 @@
<span id="logo" class="logo">Neutron IDE V11.11</span>
<input type="button" value="Save" onclick="SaveCurrentTab()"/>
<input type="button" value="Save All" onclick="SaveAll()"/>
- <input type="button" value="Close All" onclick="alert('narf')"/>
+ <input type="button" value="Close All" onclick="CloseAll()"/>
<button id="menu_button" onclick="show_menu()"><img src="{{ STATIC_URL }}ide/img/menu.png" alt="Menu" title="Menu"/></button>
- <div id="main_menu">
- <ul>
- <li><a href="javascript: void(0)" onclick="about()">About</a></li>
- </ul>
- </div>
<div id="current_edit">Welcome to Neutron IDE</div>
<div id="status"></div>
</div>
@@ -40,5 +35,10 @@
{% include "ide/right_menu_dir.html" %}
{% endblock %}
{% block footer %}
-<div id="saveall"></div>
+<div id="main_menu">
+ <ul>
+ <li><a href="javascript: void(0)" onclick="about()" class="about">About</a></li>
+ <li class="btop"><a href="javascript: void(0)" onclick="hide_menu()" class="cancel">Cancel</a>
+ </ul>
+</div>
{% endblock %}
@@ -25,4 +25,5 @@
<input type="hidden" name="create_new_did" id="create_new_did" value=""/>
<input type="hidden" name="temp_file" id="temp_file" value=""/>
</form>
-</div>
+</div>
+<div id="saveall"></div>
@@ -16,6 +16,26 @@ textarea {
float: right;
}
+img {
+ border: 0;
+}
+
+button img {
+ display: inline-block;
+}
+
+.ui-layout-north {
+
+}
+
+#main_menu {
+ border: solid 1px #bbb;
+ background-color: #DDD;
+ position: absolute;
+ z-index: 1000;
+ display: none;
+}
+
#current_edit {
font-size: 0.8em;
overflow: hidden;
@@ -104,9 +124,10 @@ ul.jqueryFileTree {
}
.ui-layout-north.ui-layout-pane {
- padding: 2px 5px 0 5px;
+ padding: 2px 5px;
background: #DDD;
border: 0;
+ overflow: hidden;
}
.ui-layout-resizer.ui-layout-resizer-north {
@@ -125,6 +146,15 @@ ul.jqueryFileTree {
padding-left: 40px;
}
+#saveall {
+ display: none;
+}
+
+#saveall p {
+ padding: 0;
+ margin: 2px 0;
+}
+
.right_menu {
border: solid 1px #bbb;
background-color: #DDD;
@@ -135,29 +165,29 @@ ul.jqueryFileTree {
z-index: 1000;
}
-.right_menu a {
+.right_menu a, #main_menu a {
color: #333;
font-size: 11px;
line-height: 18px;
text-decoration: none;
}
-.right_menu a:hover {
+.right_menu a:hover, #main_menu a:hover {
background-color: #BDF;
}
-.right_menu ul {
+.right_menu ul, #main_menu ul {
margin: 0;
padding: 0;
list-style-type: none;
}
-.right_menu ul li {
+.right_menu ul li, #main_menu ul li {
padding: 2px;
margin: 0;
}
-.right_menu ul li.btop {
+.right_menu ul li.btop, #main_menu ul li.btop {
border-top: solid 1px #bbb;
}
@@ -166,13 +196,13 @@ ul.jqueryFileTree {
text-align: center;
}
-.right_menu ul li a {
+.right_menu ul li a, #main_menu ul li a {
display: block;
width: 120px;
padding: 3px 0 0 23px;
}
-.right_menu ul li a {
+.right_menu ul li a, #main_menu ul li a {
background-repeat: no-repeat;
background-position: 0px 3px;
}
@@ -181,7 +211,7 @@ ul.jqueryFileTree {
background-image: url(/static/ide/img/new.png);
}
-.right_menu ul li a.cancel {
+.right_menu ul li a.cancel, #main_menu ul li a.cancel {
background-image: url(/static/ide/img/cancel.png);
}
@@ -200,3 +230,7 @@ ul.jqueryFileTree {
.right_menu ul li a.rename {
background-image: url(/static/ide/img/rename.png);
}
+
+#main_menu ul li a.about {
+ background-image: url(/static/ide/img/about.png);
+}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -95,7 +95,7 @@ function create_tab (data) {
editor.resize();
editor.getSession().setValue(data.data);
- tab_paths[data.path] = {tab: tab_counter, editor: editor, filename: data.filename}
+ tab_paths[data.path] = {tab: tab_counter, editor: editor, filename: data.filename, uid: data.uid}
tab_counts[tab_counter] = data.path
tab_counter++;
@@ -127,7 +127,7 @@ function resize_editor () {
var cnt = split_href(href);
var h = $("#tabs").height();
- $("#editor_" + cnt).height(h - 29);
+ $("#editor_" + cnt).height(h - 27);
try {
tab_paths[dp].editor.resize();
}
@@ -220,7 +220,7 @@ $(document).ready(function () {
});
window.onbeforeunload = function() {
- return 'Are you sure you wish to leave this page?';
+ return 'Leaving so soon!';
}
var canon = require('pilot/canon');
@@ -233,5 +233,7 @@ canon.addCommand({
sender: 'editor'
},
exec: function(env, args, request) { SaveCurrentTab(); }
-})
+});
+
+
@@ -1,4 +1,66 @@
function about () {
- alert('Neutron IDE v11.10 by Paul M Bailey - paul.m.bailey@gmail.com\n\nneutronide.com\n\nLicense: GPLv3');
+ alert('Neutron IDE v11.11 by Paul M Bailey - paul.m.bailey@gmail.com\n\nneutronide.com\n\nLicense: BSD');
+ hide_menu();
}
+
+function show_menu () {
+ var offset = $("#menu_button").offset();
+ $("#main_menu").css('display', 'block');
+ $("#main_menu").offset({top: offset.top + 7, left: offset.left + 7});
+}
+
+function hide_menu () {
+ $("#main_menu").css('display', 'none');
+}
+
+function CloseAll () {
+ if (confirm('Are you sure you wish to close all tabs?')) {
+ $('#tabs span.ui-icon-close').click();
+ }
+}
+
+function SaveAll () {
+ $( "#saveall" ).dialog({
+ title: 'Save All',
+ modal: true,
+ closeOnEscape: false,
+ open: function(event, ui) {
+ $(this).parent().children().children('.ui-dialog-titlebar-close').hide();
+ },
+ });
+
+ for (dp in tab_paths) {
+ var contents = tab_paths[dp].editor.getSession().getValue();
+
+ $("#saveall").empty();
+ $("#saveall").append('<p id="saveall_' + tab_paths[dp].uid + '">Saving ' + tab_paths[dp].filename + ' ...</p>');
+
+ $.ajax({
+ type: 'POST',
+ url: '/filesave/',
+ data: {'path': dp, 'contents': contents},
+ success: function (data, textStatus, jqXHR) {
+ $("#saveall_" + data.uid).remove();
+ if (data.result == 'bad') {
+ alert(data.error);
+ }
+
+ if ($('#saveall').children().size() == 0) {
+ $("#saveall").dialog('close');
+ }
+ },
+ error: function (jqXHR, textStatus, errorThrown) { alert('Error Saving: ' + dp); $("#status").html(''); },
+ });
+ }
+}
+
+canon.addCommand({
+ name: 'SaveFile',
+ bindKey: {
+ win: 'Ctrl-shift-S',
+ mac: 'Command-shift-S',
+ sender: 'editor'
+ },
+ exec: function(env, args, request) { SaveAll(); }
+});

0 comments on commit 60bbc0e

Please sign in to comment.