mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 10:31:14 -03:00
webconfig: Remove the abbreviations tab
Since the new expanded abbreviations in 3.6.0, abbr no longer accepts new universal variables. That means this tab is now non-functional (except that it could technically remove abbrs that were set in universal variables). Because making it work with the expanded abbreviations requires some awkwardness like a dedicated conf.d snippet (or writing into config.fish!), we simply remove it.
This commit is contained in:
@@ -34,10 +34,6 @@ fishconfig.config(
|
||||
controller: "bindingsController",
|
||||
templateUrl: "partials/bindings.html"
|
||||
})
|
||||
.when("/abbreviations", {
|
||||
controller: "abbreviationsController",
|
||||
templateUrl: "partials/abbreviations.html"
|
||||
})
|
||||
.otherwise({
|
||||
redirectTo: "/colors"
|
||||
})
|
||||
|
||||
@@ -395,49 +395,3 @@ controllers.controller("bindingsController", function($scope, $http) {
|
||||
|
||||
$scope.fetchBindings();
|
||||
});
|
||||
|
||||
controllers.controller("abbreviationsController", function($scope, $http) {
|
||||
$scope.abbreviations = [];
|
||||
$scope.addBlank = function() {
|
||||
// Add blank entry if it is missing
|
||||
var hasBlank = {hasBlank: false}
|
||||
angular.forEach($scope.abbreviations, function(value, key) {
|
||||
if (value.phrase === "" && value.word === "") {
|
||||
this.hasBlank = true;
|
||||
}
|
||||
}, hasBlank);
|
||||
if (!$scope.abbreviations) $scope.abbreviations = [];
|
||||
if (! hasBlank.hasBlank) {
|
||||
$scope.abbreviations.push({phrase: "", word: "", editable: true})
|
||||
}
|
||||
}
|
||||
$scope.fetchAbbreviations = function() {
|
||||
$http.get("abbreviations/").then(function(arg) {
|
||||
$scope.abbreviations = arg.data;
|
||||
$scope.addBlank();
|
||||
})};
|
||||
|
||||
$scope.editAbbreviation = function(abbreviation) {
|
||||
abbreviation.editable = true;
|
||||
}
|
||||
|
||||
$scope.saveAbbreviation = function(abbreviation) {
|
||||
if (abbreviation.word && abbreviation.phrase) {
|
||||
$http.post("save_abbreviation/", abbreviation).then(function(arg) {
|
||||
abbreviation.editable = false;
|
||||
$scope.addBlank();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.removeAbbreviation = function(abbreviation) {
|
||||
if (abbreviation.word) {
|
||||
$http.post("remove_abbreviation/", abbreviation).then(function(arg) {
|
||||
$scope.abbreviations.splice($scope.abbreviations.indexOf(abbreviation), 1);
|
||||
$scope.addBlank();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.fetchAbbreviations();
|
||||
});
|
||||
|
||||
@@ -41,20 +41,3 @@ filters.filter("filterBinding", function() {
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
filters.filter("filterAbbreviations", function() {
|
||||
return function(abbreviations, query) {
|
||||
var result = []
|
||||
if (abbreviations == undefined) return result;
|
||||
if (query == null) { return abbreviations};
|
||||
|
||||
for(var i=0; i<abbreviations.length; ++i) {
|
||||
var abbr = abbreviations[i];
|
||||
if (abbr.word.toLowerCase().indexOf(query) != -1 || abbr.phrase.toLowerCase().indexOf(query.toLowerCase()) != -1) {
|
||||
result.push(abbr);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user