mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Reorganized javascript code across app, filters and controllers
Moved all javascript files under js folder Removed jquery.js from repository
This commit is contained in:
parent
877a14c0b8
commit
eb9e712f91
5 changed files with 79 additions and 80 deletions
|
@ -4,9 +4,10 @@
|
||||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||||
<title>fish shell configuration</title>
|
<title>fish shell configuration</title>
|
||||||
<link rel="stylesheet" type="text/css" href="fishconfig.css"/>
|
<link rel="stylesheet" type="text/css" href="fishconfig.css"/>
|
||||||
<script type="text/javascript" src="jquery.js"></script>
|
|
||||||
<script type="text/javascript" src="angular.js"></script>
|
<script type="text/javascript" src="angular.js"></script>
|
||||||
<script type="text/javascript" src="fishconfig.js"></script>
|
<script type="text/javascript" src="js/filters.js"></script>
|
||||||
|
<script type="text/javascript" src="js/controllers.js"></script>
|
||||||
|
<script type="text/javascript" src="js/app.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
4
share/tools/web_config/jquery.js
vendored
4
share/tools/web_config/jquery.js
vendored
File diff suppressed because one or more lines are too long
33
share/tools/web_config/js/app.js
Normal file
33
share/tools/web_config/js/app.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
fishconfig = angular.module("fishconfig", ["filters", "controllers"]);
|
||||||
|
|
||||||
|
fishconfig.config(
|
||||||
|
["$routeProvider", function($routeProvider) {
|
||||||
|
$routeProvider
|
||||||
|
.when("/colors", {
|
||||||
|
controller: "colorsController",
|
||||||
|
templateUrl: "partials/colors.html"
|
||||||
|
})
|
||||||
|
.when("/prompt", {
|
||||||
|
controller: "promptController",
|
||||||
|
templateUrl: "partials/prompt.html"
|
||||||
|
})
|
||||||
|
.when("/functions", {
|
||||||
|
controller: "functionsController",
|
||||||
|
templateUrl: "partials/functions.html"
|
||||||
|
})
|
||||||
|
.when("/variables", {
|
||||||
|
controller: "variablesController",
|
||||||
|
templateUrl: "partials/variables.html"
|
||||||
|
})
|
||||||
|
.when("/history", {
|
||||||
|
controller: "historyController",
|
||||||
|
templateUrl: "partials/history.html"
|
||||||
|
})
|
||||||
|
.when("/bindings", {
|
||||||
|
controller: "bindingsController",
|
||||||
|
templateUrl: "partials/bindings.html"
|
||||||
|
})
|
||||||
|
.otherwise({
|
||||||
|
redirectTo: "/colors"
|
||||||
|
})
|
||||||
|
}]);
|
|
@ -1,72 +1,6 @@
|
||||||
fishconfig = angular.module("fishconfig", []);
|
controllers = angular.module("controllers", []);
|
||||||
|
|
||||||
fishconfig.filter("filterVariable", function() {
|
controllers.controller("main", function($scope, $location) {
|
||||||
return function(variables, query) {
|
|
||||||
var result = []
|
|
||||||
if (variables == undefined) return result;
|
|
||||||
if (query == null) { return variables };
|
|
||||||
|
|
||||||
for(i=0; i<variables.length; ++i) {
|
|
||||||
variable = variables[i];
|
|
||||||
if (variable.name.indexOf(query) != -1 || variable.value.indexOf(query) != -1) {
|
|
||||||
result.push(variable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fishconfig.filter("filterBinding", function() {
|
|
||||||
return function(bindings, query) {
|
|
||||||
var result = []
|
|
||||||
if (bindings == undefined) return result;
|
|
||||||
if (query == null) { return bindings};
|
|
||||||
|
|
||||||
for(i=0; i<bindings.length; ++i) {
|
|
||||||
binding = bindings[i];
|
|
||||||
if (binding.command.indexOf(query) != -1) {
|
|
||||||
result.push(binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fishconfig.config(
|
|
||||||
["$routeProvider", function($routeProvider) {
|
|
||||||
$routeProvider
|
|
||||||
.when("/colors", {
|
|
||||||
controller: "colorsController",
|
|
||||||
templateUrl: "partials/colors.html"
|
|
||||||
})
|
|
||||||
.when("/prompt", {
|
|
||||||
controller: "promptController",
|
|
||||||
templateUrl: "partials/prompt.html"
|
|
||||||
})
|
|
||||||
.when("/functions", {
|
|
||||||
controller: "functionsController",
|
|
||||||
templateUrl: "partials/functions.html"
|
|
||||||
})
|
|
||||||
.when("/variables", {
|
|
||||||
controller: "variablesController",
|
|
||||||
templateUrl: "partials/variables.html"
|
|
||||||
})
|
|
||||||
.when("/history", {
|
|
||||||
controller: "historyController",
|
|
||||||
templateUrl: "partials/history.html"
|
|
||||||
})
|
|
||||||
.when("/bindings", {
|
|
||||||
controller: "bindingsController",
|
|
||||||
templateUrl: "partials/bindings.html"
|
|
||||||
})
|
|
||||||
.otherwise({
|
|
||||||
redirectTo: "/colors"
|
|
||||||
})
|
|
||||||
}]);
|
|
||||||
|
|
||||||
fishconfig.controller("main", function($scope, $location) {
|
|
||||||
$scope.currentTab = "colors";
|
$scope.currentTab = "colors";
|
||||||
|
|
||||||
$scope.changeView = function(view) {
|
$scope.changeView = function(view) {
|
||||||
|
@ -84,7 +18,7 @@ fishconfig.controller("main", function($scope, $location) {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
fishconfig.controller("colorsController", function($scope, $http) {
|
controllers.controller("colorsController", function($scope, $http) {
|
||||||
$scope.term256Colors = [ //247
|
$scope.term256Colors = [ //247
|
||||||
"ffd7d7",
|
"ffd7d7",
|
||||||
"d7afaf",
|
"d7afaf",
|
||||||
|
@ -686,7 +620,7 @@ fishconfig.controller("colorsController", function($scope, $http) {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
fishconfig.controller("promptController", function($scope, $http) {
|
controllers.controller("promptController", function($scope, $http) {
|
||||||
$scope.selectedPrompt = null;
|
$scope.selectedPrompt = null;
|
||||||
|
|
||||||
$scope.fetchCurrentPrompt = function(currenttPrompt) {
|
$scope.fetchCurrentPrompt = function(currenttPrompt) {
|
||||||
|
@ -728,7 +662,7 @@ fishconfig.controller("promptController", function($scope, $http) {
|
||||||
$scope.fetchSamplePrompts();
|
$scope.fetchSamplePrompts();
|
||||||
});
|
});
|
||||||
|
|
||||||
fishconfig.controller("functionsController", function($scope, $http) {
|
controllers.controller("functionsController", function($scope, $http) {
|
||||||
$scope.selectedFunction = null;
|
$scope.selectedFunction = null;
|
||||||
$scope.functionDefinition = "";
|
$scope.functionDefinition = "";
|
||||||
|
|
||||||
|
@ -769,7 +703,7 @@ fishconfig.controller("functionsController", function($scope, $http) {
|
||||||
$scope.fetchFunctions();
|
$scope.fetchFunctions();
|
||||||
});
|
});
|
||||||
|
|
||||||
fishconfig.controller("variablesController", function($scope, $http) {
|
controllers.controller("variablesController", function($scope, $http) {
|
||||||
$scope.query = null;
|
$scope.query = null;
|
||||||
|
|
||||||
$scope.fetchVariables= function() {
|
$scope.fetchVariables= function() {
|
||||||
|
@ -780,7 +714,7 @@ fishconfig.controller("variablesController", function($scope, $http) {
|
||||||
$scope.fetchVariables();
|
$scope.fetchVariables();
|
||||||
});
|
});
|
||||||
|
|
||||||
fishconfig.controller("historyController", function($scope, $http, $timeout) {
|
controllers.controller("historyController", function($scope, $http, $timeout) {
|
||||||
$scope.historyItems = [];
|
$scope.historyItems = [];
|
||||||
$scope.historySize = 0;
|
$scope.historySize = 0;
|
||||||
// Stores items which are yet to be added in history items
|
// Stores items which are yet to be added in history items
|
||||||
|
@ -819,7 +753,7 @@ fishconfig.controller("historyController", function($scope, $http, $timeout) {
|
||||||
$scope.fetchHistory();
|
$scope.fetchHistory();
|
||||||
});
|
});
|
||||||
|
|
||||||
fishconfig.controller("bindingsController", function($scope, $http) {
|
controllers.controller("bindingsController", function($scope, $http) {
|
||||||
$scope.bindings = [];
|
$scope.bindings = [];
|
||||||
$scope.fetchBindings = function() {
|
$scope.fetchBindings = function() {
|
||||||
$http.get("/bindings/").success(function(data, status, headers, config) {
|
$http.get("/bindings/").success(function(data, status, headers, config) {
|
35
share/tools/web_config/js/filters.js
Normal file
35
share/tools/web_config/js/filters.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
filters = angular.module("filters", []);
|
||||||
|
|
||||||
|
filters.filter("filterVariable", function() {
|
||||||
|
return function(variables, query) {
|
||||||
|
var result = []
|
||||||
|
if (variables == undefined) return result;
|
||||||
|
if (query == null) { return variables };
|
||||||
|
|
||||||
|
for(i=0; i<variables.length; ++i) {
|
||||||
|
variable = variables[i];
|
||||||
|
if (variable.name.indexOf(query) != -1 || variable.value.indexOf(query) != -1) {
|
||||||
|
result.push(variable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
filters.filter("filterBinding", function() {
|
||||||
|
return function(bindings, query) {
|
||||||
|
var result = []
|
||||||
|
if (bindings == undefined) return result;
|
||||||
|
if (query == null) { return bindings};
|
||||||
|
|
||||||
|
for(i=0; i<bindings.length; ++i) {
|
||||||
|
binding = bindings[i];
|
||||||
|
if (binding.command.indexOf(query) != -1) {
|
||||||
|
result.push(binding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in a new issue