mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-26 07:41:15 -03:00
Fixed code for changing prompt
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
<div id="master_detail_table" style="display: table;">
|
||||
<div id="master">
|
||||
<div ng-repeat="prompt in samplePrompts">
|
||||
<div id="master_{{prompt.name}}" ng-class="{'master_element': true, 'selected_master_elem': selectedPrompt == prompt}" ng-style="selectedPrompt == prompt && {color: '#6666ff'} || {color: '#aaaaaa' }" ng-click="selectPrompt(prompt)">
|
||||
<span ng-class="{master_element_text: selectedPrompt == prompt}" ng-style="selectedPrompt == prompt && {'font-size': '13pt', 'border-bottom-color': rgb(0, 6, 111)} || {'font-size': '13pt'}">{{ prompt.name }}</span>
|
||||
<div id="master_{{prompt.name}}" ng-class="{'master_element': true, 'selected_master_elem': selectedPrompt == prompt}" ng-style="prompt.name=='Current' && {color: '#6666ff'} || {color: '#aaaaaa' }" ng-click="selectPrompt(prompt)">
|
||||
<span ng-class="{master_element_text: selectedPrompt == prompt}" ng-style="prompt.name=='Current' && {'font-size': '13pt', 'border-bottom-color': rgb(0, 6, 111) } || {'font-size': '13pt'}">{{ prompt.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail">
|
||||
<div id="detail_prompt" style="display: block;">
|
||||
<div class="prompt_demo">
|
||||
<div class="prompt_demo_text" style="font-size: 15pt;">
|
||||
<div class="prompt_demo_text" style="font-size: {{ demoTextFontSize }};" ng-bind-html-unsafe="demoText">
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: right">
|
||||
<span class="prompt_save_button" onclick="save_current_prompt()" style="display: none;"> use prompt </span>
|
||||
<div style="text-align: right" ng-show="selectedPrompt.name != 'Current'">
|
||||
<span class="prompt_save_button" ng-click="setNewPrompt(selectedPrompt)"> use prompt </span>
|
||||
</div>
|
||||
<div class="prompt_function">
|
||||
<div class="prompt_function_text">
|
||||
|
||||
@@ -94,9 +94,9 @@ webconfig.controller("colorsController", function($scope, $http) {
|
||||
|
||||
webconfig.controller("promptController", function($scope, $http) {
|
||||
$scope.selectedPrompt = null;
|
||||
$scope.fetchCurrentPrompt = function(currentPrompt) {
|
||||
$scope.fetchCurrentPrompt = function(currenttPrompt) {
|
||||
$http.get("/current_prompt/").success(function(data, status, headers, config) {
|
||||
currentPrompt.function = data.function;
|
||||
currenttPrompt.function = data.function;
|
||||
})};
|
||||
|
||||
$scope.fetchSamplePrompts= function() {
|
||||
@@ -106,14 +106,28 @@ webconfig.controller("promptController", function($scope, $http) {
|
||||
$scope.selectPrompt($scope.samplePrompts[0]);
|
||||
}
|
||||
})};
|
||||
$scope.fetchSamplePrompt = function(selectedPrompt) {
|
||||
console.log("Fetcing sample prompt");
|
||||
$http.post("/get_sample_prompt/","what=" + encodeURIComponent(selectedPrompt.function), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
|
||||
console.log("Data is " + JSON.stringify(data[0]));
|
||||
$scope.demoText= data[0].demo;
|
||||
$scope.demoTextFontSize = data[0].font_size;
|
||||
console.log("Demo text is " + $scope.demoText);
|
||||
})};
|
||||
|
||||
$scope.selectPrompt = function(promptt) {
|
||||
$scope.selectedPrompt= promptt;
|
||||
if ($scope.selectedPrompt.name == "Current") {
|
||||
$scope.fetchCurrentPrompt($scope.selectedPrompt);
|
||||
}
|
||||
$scope.fetchSamplePrompt($scope.selectedPrompt);
|
||||
}
|
||||
|
||||
$scope.setNewPrompt = function(selectedPrompt) {
|
||||
console.log("Set new prompt" + selectedPrompt);
|
||||
$http.post("/set_prompt/","what=" + encodeURIComponent(selectedPrompt.function), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config){
|
||||
console.log("Data is " + JSON.stringify(data));
|
||||
})};
|
||||
$scope.fetchSamplePrompts();
|
||||
});
|
||||
|
||||
@@ -154,5 +168,11 @@ webconfig.controller("historyController", function($scope, $http) {
|
||||
$scope.historyItems = data;
|
||||
})};
|
||||
|
||||
$scope.deleteHistoryItem = function(item) {
|
||||
index = $scope.historyItems.indexOf(item);
|
||||
$http.post("/delete_history_item/","what=" + encodeURIComponent(item), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
|
||||
$scope.historyItems.splice(index, 1);
|
||||
})};
|
||||
|
||||
$scope.fetchHistory();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user