diff --git a/.gitignore b/.gitignore
old mode 100755
new mode 100644
diff --git a/LICENSE.txt b/LICENSE.txt
old mode 100755
new mode 100644
diff --git a/angular-seed/app/css/app.css b/angular-seed/app/css/app.css
old mode 100755
new mode 100644
index 7a015a0..6bc3642
--- a/angular-seed/app/css/app.css
+++ b/angular-seed/app/css/app.css
@@ -61,8 +61,7 @@
.params .CodeMirror {
height: auto;
- max-height: 300px;
- overflow-y: auto;
+ min-height: 50px;
}
.source .CodeMirror {
@@ -76,9 +75,12 @@
}
.template_error {
- background-color: #F2DEDE;
- color: #B94A48;
- border-color: #EED3D7;
+ background-color: #000;
+ color: #F04441;
+ border-color: #000;
+}
+#RESULT_PANEL code, #RESULT_PANEL pre {
+ font-family: "Source Code Pro Semibold","Envy Code R",Consolas, Monaco, Menlo, 'Courier New', monospace;
}
.file_active {
diff --git a/angular-seed/app/embed.html b/angular-seed/app/embed.html
old mode 100755
new mode 100644
index 4da1760..bbc889d
--- a/angular-seed/app/embed.html
+++ b/angular-seed/app/embed.html
@@ -36,7 +36,7 @@
.embedded .nav.nav-tabs li a {border: none;border-radius: 0;background: transparent;}
.embedded .nav.nav-tabs li:not(.active) a:hover {text-decoration: underline;}
.embedded form {margin-bottom: 1px;}
- .embedded form .toolbar {margin-top: 5px;}
+ .embedded form .toolbar {margin-top: 5px;position: absolute;right:0;}
.embedded .edit_panel input {border-radius: 0;}
.embedded .btn {border-radius: 0;background-image: none;}
.embedded .slight-buttons .btn {background: transparent;border-color: #fff;border-image: none;margin-bottom: -2px;opacity: .5;}
@@ -136,7 +136,7 @@
var $_ = $(this).find('.tag.lbl');
$_.html($_.data('label')).animate({opacity: 0.7}, 400);
}
- }, '.source .CodeMirror, .params .CodeMirror, #RESULT_PANEL div.result')
+ }, '.source .CodeMirror, .params .CodeMirror, #RESULT_PANEL div.result');
});
setInterval(function(){
if ($('.source .CodeMirror .tag.lbl').size() > 0) return;
diff --git a/angular-seed/app/index-async.html b/angular-seed/app/index-async.html
old mode 100755
new mode 100644
diff --git a/angular-seed/app/index.html b/angular-seed/app/index.html
old mode 100755
new mode 100644
index d78be66..11b7f0c
--- a/angular-seed/app/index.html
+++ b/angular-seed/app/index.html
@@ -52,10 +52,14 @@
About
-
- Logged in as {{current}}
- Admin Login
-
+
@@ -113,7 +117,12 @@
}, '.source .CodeMirror, .params .CodeMirror, #RESULT_PANEL div.result')
var wh = $(window).height();
setInterval(function(){
- $('.source .CodeMirror').animate({'height': (wh - 220) + 'px'});
+ var h = wh - 220;
+ $('.source .CodeMirror').animate({'height': h + 'px'});
+ var ph = $('.params .CodeMirror').height();
+ if (ph > h / 2) {
+ $('.params .CodeMirror').animate({height: (h / 2) + 'px'});
+ }
}, 1000);
});
setInterval(function(){
diff --git a/angular-seed/app/js/controllers.js b/angular-seed/app/js/controllers.js
old mode 100755
new mode 100644
index 2f7f977..41c91ab
--- a/angular-seed/app/js/controllers.js
+++ b/angular-seed/app/js/controllers.js
@@ -59,16 +59,43 @@ function EditorCtrl($scope, $http, $routeParams, $dialog, $location, $timeout) {
$scope.switchFile = switchFile;
$scope.removeFile = removeFile;
$scope.setMain = setMain;
- $scope.editFileName = editFileName;
- $scope.cancelEditFileName = cancelEditFileName;
+ $scope.renameFile = renameFile;
+ $scope.cancelRenameFile = cancelRenameFile;
$scope.getActiveFile = getActiveFile;
$scope.getMainFile = getMainFile;
$scope.keyEventHandlerForCodeMirror = keyEventHandlerForCodeMirror;
+ $scope.ta = {
+ $source: function() {return $('.source textarea');},
+ $params: function() {return $('.params textarea');}
+ };
+ $scope.$focus = false;
+ $scope.storeCurFocus = function(){
+ $scope.$focus = $scope.ta.$source;
+ var $p = $scope.ta.$params();
+ if ($p.is(":focus")) {
+ $scope.$focus = $scope.ta.$params;
+ }
+ };
+ $scope.restoreFocus = function() {
+ setTimeout(function(){
+ if ($scope.$focus) {
+ $scope.$focus().focus();
+ } else {
+ $('.source textarea').focus();
+ }
+ },1);
+ }
function keyEventHandlerForCodeMirror($event) {
var keyCode = $event.keyCode;
if (keyCode === 10 || keyCode == 13 && $event.ctrlKey) {
run();
+ } else if (keyCode == 84 && $event.ctrlKey && $event.altKey) /*ctrl-al-t*/ {
+// var $t = $scope.ta.$source(), $p = $scope.ta.$params();
+// if ($t.is(':focus')) $p.focus();
+// else $t.focus();
+ } else if (keyCode == 113 /*F2*/) {
+ renameFile();
}
}
@@ -108,6 +135,7 @@ function EditorCtrl($scope, $http, $routeParams, $dialog, $location, $timeout) {
}
function setMain(file) {
+ if (!file) file = getActiveFile();
_.each($scope.currentCode.files, function (file) {
file.isMain = false;
});
@@ -122,6 +150,7 @@ function EditorCtrl($scope, $http, $routeParams, $dialog, $location, $timeout) {
}
function removeFile(file, noAlert) {
+ if (!file) file = getActiveFile();
if ($scope.currentCode.files.length > 1) {
if (noAlert || confirm('Delete this template?')) {
$scope.currentCode.files = _.without($scope.currentCode.files, file);
@@ -140,6 +169,8 @@ function EditorCtrl($scope, $http, $routeParams, $dialog, $location, $timeout) {
// 1. not null
// 2. unique
function saveFileName(file) {
+ if (!file) file = getActiveFile();
+ if (!file) return;
var editName = file.editName;
if (!editName) {
alert('filename should not be empty');
@@ -156,20 +187,25 @@ function EditorCtrl($scope, $http, $routeParams, $dialog, $location, $timeout) {
file.filename = editName;
file.editing = false;
}
+ $scope.restoreFocus();
}
- function editFileName(file) {
+ function renameFile(file) {
+ $scope.storeCurFocus();
+ if (!file) file = getActiveFile();
file.editName = file.filename;
file.editing = !file.editing;
}
- function cancelEditFileName(file) {
+ function cancelRenameFile(file) {
+ if (!file) file = getActiveFile();
if (!file.filename) {
removeFile(file, true);
return;
}
file.editName = null;
file.editing = false;
+ $scope.restoreFocus();
}
function removeCurrentCode() {
@@ -209,7 +245,7 @@ function EditorCtrl($scope, $http, $routeParams, $dialog, $location, $timeout) {
}
function run() {
- if ($scope.currentCode.files.length > 0) {
+ if ($scope.currentCode.files.length > 0) {
if ($scope.running) return;
$scope.running = true;
$scope.resultPageActive = true;
@@ -246,7 +282,6 @@ function EditorCtrl($scope, $http, $routeParams, $dialog, $location, $timeout) {
newOne.isMain = true;
}
}
-
}
EditorCtrl.$inject = ['$scope', '$http', '$routeParams', '$dialog', '$location', '$timeout'];
@@ -262,10 +297,12 @@ function SaveDialogCtrl($scope, dialog, code, $http, saveAsNew) {
}
$http.post('/api/Application/save', code).success(function (code) {
dialog.close(code);
+ //TODO: $scope.run();
}).error(function (data) {
- alert(data);
- });
+ alert(data);
+ });
}
+
}
SaveDialogCtrl.$inject = ['$scope', 'dialog', 'code', '$http', 'saveAsNew'];
diff --git a/angular-seed/app/js/filters.js b/angular-seed/app/js/filters.js
old mode 100755
new mode 100644
index 927bc40..36fa19a
--- a/angular-seed/app/js/filters.js
+++ b/angular-seed/app/js/filters.js
@@ -23,7 +23,7 @@ angular.module('myApp.filters', []).
}
function safe_tags_replace(str) {
- return str.replace(/[&<>]/g, replaceTag);
+ return str ? str.replace(/[&<>]/g, replaceTag) : "";
}
return safe_tags_replace(str);
diff --git a/angular-seed/app/partials/about.html b/angular-seed/app/partials/about.html
old mode 100755
new mode 100644
index cd21fce..4efb33c
--- a/angular-seed/app/partials/about.html
+++ b/angular-seed/app/partials/about.html
@@ -3,12 +3,24 @@
Rythm Fiddle
-
Rythm Fiddle is created by Freewind
+
Rythm Fiddle is brought to you by Freewind
and Green
Fork me: https://github.com/freewind/rythmfiddle
-
License: Apache 2
+
License: Apache License, Version 2
+
+
Use "messages.xx" or "msg.xx" or "m.xx" to name resource files if you need i18n
+
+
Shortcut keys
+
+ - Ctrl-Enter: Run the fiddle (Only in editors)
+ - F2: Rename current source file (Global)
+ - Escape: Cancel source file rename (Only in rename input text element)
+ - Ctrl-Alt-T: Toggle focus between source editor and param editor (Only in editors)
+ - Ctrl-Alt-T: Focus source editor (focus is not in editors
+ - Alt-1 ~ 9: Select the nth template source file
+