Initial work to add support for angularjs

This commit is contained in:
Siteshwar Vashisht 2013-08-17 00:02:58 +05:30
parent 3b25795ee5
commit c018bfdb4d
10 changed files with 15488 additions and 841 deletions

14847
share/tools/web_config/angular.js vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,376 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<html ng-app="webconfig">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>fish shell configuration</title>
<style type="text/css">
body {
background-color: #292929;
font-family: Courier, "Courier New", monospace;
color: white;
}
#ancestor {
width: 800px;
margin-left: auto;
margin-right: auto;
margin-top: 25px;
}
#parent {
width: 100%;
min-height: 480px;
margin-top: 12px;
}
#tab_parent {
display: table;
width: 100%;
height: 50px;;
}
.tab {
display: table-cell;
border: 1px solid #111;
border-right: none;
padding-bottom: 15px;
padding-top: 15px;
font-size: 17pt;
text-align: center;
width: 20%;
background-color: #292929;
cursor: pointer;
}
#tab_parent :first-child {
border-top-left-radius: 8px;
}
#tab_parent :last-child {
border-right: 1px solid #111;
border-top-right-radius: 8px;
}
.tab_first {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.tab_last {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.selected_tab {
background-color: black;
border-color: black;
}
#tab_contents {
padding-top: 35px;
width: 100%;
background-color: black;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
margin-bottom: 20px;
}
.footer {
clear: both;
height: 30px;
}
#master_detail_table {
display: table;
margin-top: 10px;
margin-left: 12px;
margin-right: 12px;
}
#master {
display: table-cell;
text-align: right;
min-width: 200px;
font-size: 16pt;
padding-bottom: 20px;
padding-top: 35px;
vertical-align: top;
}
#detail {
display: table-cell;
border: 1px solid #555;
background-color: #181818;
padding-top: 30px;
padding-bottom: 20px;
padding-left: 30px;
padding-right: 30px;
border-radius: 5;
width: 100%;
}
#detail_function {
white-space: pre-wrap;
width: 100%;
font-size: 11pt;
color: #BBB;
}
.master_element {
padding-top: 6px;
padding-bottom: 11px;
padding-left: 5px;
padding-right: 22px;
font-size: 12pt;
/* Make our border overlap the detail, even if we're unselected (so it doesn't jump when selected) */
position: relative;
left: 1px;
border-bottom-style: solid;
border-bottom-width: 0px;
}
.selected_master_elem {
border: 1px solid #555;
border-right: none;
background-color: #181818;
border-top-left-radius: 5;
border-bottom-left-radius: 5;
/* Pad one less than .master_element, to accomodate our border. */
padding-top: 5px;
padding-bottom: 10px;
padding-left: 4px;
}
.master_element_text {
text-decoration: none;
padding-bottom: 1px;
border-bottom-style: inherit;
border-bottom-color: inherit;
border-bottom-width: 1px;
}
.master_element_description {
text-decoration: none;
padding-top: 15px;
font-size: 10pt;
border-bottom-style: inherit;
border-bottom-color: inherit;
border-bottom-width: 1px;
display: none;
}
.selected_master_elem > .master_element_description {
display: inline;
}
/* We have a newline between the label and description; hide it initially, but show it when it's selected */
.master_element > br { display: none; }
.selected_master_elem > br { display: inherit; }
/* Set this class to suppress the border bottom on master_element_texts with visible descriptions */
.master_element_no_border { border-bottom-width: 0 }
#colorpicker_term256 {
border: solid #444 1px;
}
.colorpicker_modifiers {
margin-top: 10px;
display:inline-block;
margin-left: auto;
margin-right: auto;
color: #AAA;
font-size: smaller;
}
.colorpicker_modifier_cell {
cursor: pointer;
display:inline-block;
text-align: center;
border: groove #333 2px;
padding: 5px;
margin-top: 5px;
margin-left: auto;
margin-right: auto;
}
.modifier_cell_selected {
color: #CCC;
border-color: #AAA;
background-color: #444;
}
#data_table {
table-layout:fixed;
color: #CCC;
width: 100%;
padding-left: 10px;
padding-right: 10px;
}
.data_table_row {
}
.data_table_cell {
padding-top: 5px;
padding-bottom: 5px;
vertical-align: top;
overflow:hidden;
border-bottom: #444 dotted 1px;
word-wrap: break-word;
}
/* The CSS we apply when a table row is filtered */
.data_table_row_filtered {
display: none;
}
.no_overflow {
text-overflow: ellipsis;
white-space: nowrap;
}
.colorpicker_target {
margin: 0 0 -50px 0;
position: relative;
bottom: 47px;
float: left; /* for some reason this makes the cells that it overlaps (before adjusting its bottom) clickable in Safari */
}
.colorpicker_target_tab {
cursor: pointer;
color: #555;
border: solid 1px #555;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 7px;
padding-right: 7px;
display: inline-block;
background-color: black;
margin-right: -2px;
min-width: 110px;
text-align: center;
}
.colorpicker_target_selected {
background-color: #181818; /* same as #detail */
color: white;
}
.colorpicker_term256_row {
}
.colorpicker_term256_cell {
width: 29;
height: 29;
}
.colorpicker_cell_selected {
border: dashed white 3px;
width: 23;
height: 23;
}
.error_msg {
color: red;
font-size: 12pt;
margin-left: 24pt;
margin-top: 5pt;
margin-bottom: 5pt;
}
img.delete_icon {
width: 20px;
height: 20px;
cursor: pointer;
text-decoration: none;
border: none;
}
#table_filter_container {
/* top right bottom left*/
padding: 0 10 10 30;
text-align: right;
position: relative;
bottom: 10px;
}
#table_filter_text_box {
}
.filter_text_box {
width: 250px;
padding: 5 10 5 10;
background-color: #888;
border: #222 solid 3px;
border-radius: 15px;
font-size: 12pt;
color: white;
font-weight: bold;
}
.text_box_transient {
color: #C8C8C8;
}
.prompt_demo {
/* This is the div that holds what the prompt looks like */
width: 100%;
background-color: black;
border-radius: 5px;
display: table;
}
.prompt_save_button {
border-radius: 5px;
border: solid #474747 1px;
text-shadow: 0px 1px #000;
padding: 5px 8px;
font-size: 12pt;
display: inline-block;
margin-top: 12px;
background-color: #282828;
color: #DDD;
cursor: pointer;
}
.prompt_save_button:hover {
background-color: #333;
border: solid #525252 1px;
color: #EEE;
}
.prompt_demo_text {
white-space: pre;
line-height: 170%;
padding: 4px 12px;
font-size: 14pt;
top: 0px;
bottom: 0px;
vertical-align: middle;
display: table-cell;
height: 72px; /* this is really the min height */
}
.prompt_function {
/* This is the div that holds the prompt function's definition */
width: 100%;
color: #BBB;
font-size: 10pt;
}
.prompt_function_text {
white-space: pre-wrap;
padding: 25px 3px;
}
</style>
<link rel="stylesheet" type="text/css" href="webconfig.css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript" src="webconfig.js"></script>
<script type="text/javascript">
function show_error(msg) {
@ -528,129 +165,6 @@ function set_prompt_demo_text(txt, font_size) {
prompt_demo_text.html(txt)
}
function switch_tab(new_tab) {
/* Switch selected tab */
$(".selected_tab").removeClass("selected_tab")
$('#' + new_tab).addClass("selected_tab")
/* Empty master element */
$('#master').empty()
/* Unselect some things */
$(".colorpicker_cell_selected").removeClass('colorpicker_cell_selected')
/* Hide some things */
$('#master_detail_table').hide()
$('#detail_colorpicker').hide()
$('#detail_prompt').hide()
$('#detail_function').hide()
$('#data_table').hide()
$('#table_filter_container').hide()
$('#data_table').empty()
/* Determine if we will want to show the data table (and associated filter box) */
var wants_data_table = false
/* Load something new */
if (new_tab == 'tab_colors') {
/* Keep track of whether this is the first element */
var first = true
run_get_request('/colors/', function(key_and_values){
/* Result is name, description, value */
var key = key_and_values[0]
var description = key_and_values[1]
var style = new Style(key_and_values[2])
style_map[key] = style
elem = create_master_element(key, description, style.color, '', select_color_master_element)
if (first) {
/* It's the first element, so select it, so something gets selected */
select_color_master_element(elem)
first = false
}
})
$('#detail_colorpicker').show()
$('#master_detail_table').show()
wants_data_table = false
} else if (new_tab == 'tab_prompt') {
/* Get rid of all sample prompts */
sample_prompts.length = 0
/* Color the first one blue */
var first = true;
run_get_request('/sample_prompts/', function(sample_prompt){
var name = sample_prompt['name']
sample_prompts[name] = sample_prompt
var color = first ? '66F' : 'AAA'
var func = first ? select_current_prompt_master_element : select_sample_prompt_master_element;
var elem = create_master_element(name, false/* description */, color, '13pt', func)
if (first) {
elem.children('.master_element_text').css('border-bottom-color', color)
select_current_prompt_master_element(elem)
}
first = false;
})
$('#detail_prompt').show()
$('#master_detail_table').show()
} else if (new_tab == 'tab_functions') {
/* Keep track of whether this is the first element */
var first = true
run_get_request('/functions/', function(contents){
var elem = create_master_element(contents, false/* description */, 'AAAAAA', '11pt', select_function_master_element)
if (first) {
/* It's the first element, so select it, so something gets selected */
select_function_master_element(elem)
first = false
}
})
$('#detail_function').show()
$('#master_detail_table').show()
wants_data_table = false
} else if (new_tab == 'tab_variables') {
run_get_request_with_bulk_handler('/variables/', function(json_contents){
var rows = new Array()
for (var i = 0; i < json_contents.length; i++) {
var contents = json_contents[i]
var name = contents[0]
var value = contents[1]
var flags = contents[2]
var row = create_data_table_element_text([name, value], false)
rows[i] = row
}
$('#data_table').append(rows.join(''))
})
wants_data_table = true
} else if (new_tab == 'tab_history') {
// Clear the history map
history_element_map.length = 0
run_get_request_with_bulk_handler('/history/', function(json_contents){
start = new Date().getTime()
var rows = new Array()
for (var i = 0; i < json_contents.length; i++) {
var history_text = json_contents[i]
rows[i] = create_data_table_element_text([history_text], true)
history_element_map[last_global_element_identifier] = history_text
}
$('#data_table').append(rows.join(''))
end = new Date().getTime()
//alert(rows.length + " rows in " + (end - start) + " msec")
})
wants_data_table = true
} else {
alert("Unknown tab");
}
/* Show or hide the data table and its search field */
if (wants_data_table) {
$('#data_table').show()
$('#table_filter_container').show()
} else {
$('#data_table').hide()
$('#table_filter_container').hide()
}
return false
}
function current_master_element_name() {
/* Get the name of the current color variable, like 'autosuggestion' */
var elems = $('.selected_master_elem')
@ -909,251 +423,7 @@ function Style(stuff) {
var style_map = new Array();
/* The first index here corresponds to value 16 */
term256_colors = [ //247
"ffd7d7",
"d7afaf",
"af8787",
"875f5f",
"5f0000",
"870000",
"af0000",
"d70000",
"ff0000",
"ff5f5f",
"d75f5f",
"d78787",
"ff8787",
"ffafaf",
"ffaf87",
"ffaf5f",
"ffaf00",
"ff875f",
"ff8700",
"ff5f00",
"d75f00",
"af5f5f",
"af5f00",
"d78700",
"d7875f",
"af875f",
"af8700",
"875f00",
"d7af87",
"ffd7af",
"ffd787",
"ffd75f",
"d7af00",
"d7af5f",
"ffd700",
"ffff5f",
"ffff00",
"ffff87",
"ffffaf",
"ffffd7",
"d7ff00",
"afd75f",
"d7d700",
"d7d787",
"d7d7af",
"afaf87",
"87875f",
"5f5f00",
"878700",
"afaf00",
"afaf5f",
"d7d75f",
"d7ff5f",
"d7ff87",
"87ff00",
"afff00",
"afff5f",
"afd700",
"87d700",
"87af00",
"5f8700",
"87af5f",
"5faf00",
"afd787",
"d7ffd7",
"d7ffaf",
"afffaf",
"afff87",
"5fff00",
"5fd700",
"87d75f",
"5fd75f",
"87ff5f",
"5fff5f",
"87ff87",
"afd7af",
"87d787",
"87d7af",
"87af87",
"5f875f",
"5faf5f",
"005f00",
"008700",
"00af00",
"00d700",
"00ff00",
"00ff5f",
"5fff87",
"00ff87",
"87ffaf",
"afffd7",
"5fd787",
"00d75f",
"5faf87",
"00af5f",
"5fffaf",
"00ffaf",
"5fd7af",
"00d787",
"00875f",
"00af87",
"00d7af",
"5fffd7",
"87ffd7",
"00ffd7",
"d7ffff",
"afd7d7",
"87afaf",
"5f8787",
"5fafaf",
"87d7d7",
"5fd7d7",
"5fffff",
"00ffff",
"87ffff",
"afffff",
"00d7d7",
"00d7ff",
"5fd7ff",
"5fafd7",
"00afd7",
"00afff",
"0087af",
"00afaf",
"008787",
"005f5f",
"005f87",
"0087d7",
"0087ff",
"5fafff",
"87afff",
"5f87d7",
"5f87ff",
"005fd7",
"005fff",
"005faf",
"5f87af",
"87afd7",
"afd7ff",
"87d7ff",
"d7d7ff",
"afafd7",
"8787af",
"afafff",
"8787d7",
"8787ff",
"5f5fff",
"5f5fd7",
"5f5faf",
"5f5f87",
"00005f",
"000087",
"0000af",
"0000d7",
"0000ff",
"5f00ff",
"5f00d7",
"5f00af",
"5f0087",
"8700af",
"8700d7",
"8700ff",
"af00ff",
"af00d7",
"d700ff",
"d75fff",
"d787ff",
"ffafd7",
"ffafff",
"ffd7ff",
"d7afff",
"d7afd7",
"af87af",
"af87d7",
"af87ff",
"875fd7",
"875faf",
"875fff",
"af5fff",
"af5fd7",
"af5faf",
"d75fd7",
"d787d7",
"ff87ff",
"ff5fff",
"ff5fd7",
"ff00ff",
"ff00af",
"ff00d7",
"d700af",
"d700d7",
"af00af",
"870087",
"5f005f",
"87005f",
"af005f",
"af0087",
"d70087",
"d7005f",
"ff0087",
"ff005f",
"ff5f87",
"d75f87",
"d75faf",
"ff5faf",
"ff87af",
"ff87d7",
"d787af",
"af5f87",
"875f87",
"000000",
"080808",
"121212",
"1c1c1c",
"262626",
"303030",
"3a3a3a",
"444444",
"4e4e4e",
"585858",
"5f5f5f",
"626262",
"6c6c6c",
"767676",
"808080",
"878787",
"8a8a8a",
"949494",
"9e9e9e",
"a8a8a8",
"afafaf",
"b2b2b2",
"bcbcbc",
"c6c6c6",
"d0d0d0",
"d7d7d7",
"dadada",
"e4e4e4",
"eeeeee",
"ffffff",
]
var items_per_row = 15
//var items_per_row = 15
var show_labels = 0
var COLOR_NORMAL = 'CCC'
@ -1262,36 +532,6 @@ function create_data_table_element_text(contents_list, show_delete_button) {
return result_str
}
/* Put stuff in colorpicker_term256 */
function populate_colorpicker_term256() {
$('#colorpicker_term256').empty()
var idx
for (idx = 0; idx < term256_colors.length; idx += items_per_row) {
var row = $('<tr>', {
class: 'colorpicker_term256_row'
})
for (var subidx = 0; subidx < items_per_row && idx + subidx < term256_colors.length; subidx++) {
cell_style = 'background-color: #' + term256_colors[idx + subidx]
var cell = $('<td>', {
class: 'colorpicker_term256_cell',
style: cell_style,
id: 'color_' + term256_colors[idx + subidx],
text: show_labels ? String(subidx + idx + 223) : '',
onClick: 'picked_color_cell(this)'
})
/* For reasons I don't understand, this makes the selected cell border appear in Firefox */
cell.append($('<div>', {
style: 'width: 100%; height: 100%'
}))
row.append(cell)
}
$('#colorpicker_term256').append(row)
}
}
/* Update the filter text box */
function update_table_filter_text_box(allow_transient_message) {
var box = $('#table_filter_text_box')
@ -1339,30 +579,6 @@ function update_table_filter_text_box(allow_transient_message) {
return true
}
$(document).ready(function() {
populate_colorpicker_term256()
var tab_name
switch (window.location.hash) {
case '#functions':
tab_name = 'tab_functions'
break
case '#variables':
tab_name = 'tab_variables'
break
case '#history':
tab_name = 'tab_history'
break
case '#prompt':
tab_name = 'tab_prompt'
break
case '#colors':
default:
tab_name = 'tab_colors'
break;
}
switch_tab(tab_name)
})
</script>
</head>
@ -1371,57 +587,16 @@ $(document).ready(function() {
<div id="ancestor">
<span style="font-size: 30pt">fish</span><p id="global_error" class="error_msg"></p>
<div id="parent">
<div id="tab_parent">
<div class="tab selected_tab" id="tab_colors" onClick="switch_tab('tab_colors')">colors</div>
<div class="tab" id="tab_prompt" onClick="switch_tab('tab_prompt')">prompt</div>
<div class="tab" id="tab_functions" onClick="switch_tab('tab_functions')">functions</div>
<div class="tab" id="tab_variables" onClick="switch_tab('tab_variables')">variables</div>
<div class="tab" id="tab_history" onClick="switch_tab('tab_history')">history</div>
<div id="tab_parent" ng-controller="main">
<div ng-class="tabCssClass('colors')" id="tab_colors" ng-click="changeView('colors')">colors</div>
<div ng-class="tabCssClass('prompt')" id="tab_prompt" ng-click="changeView('prompt')">prompt</div>
<div ng-class="tabCssClass('functions')" id="tab_functions" ng-click="changeView('functions')">functions</div>
<div ng-class="tabCssClass('variables')" id="tab_variables" ng-click="changeView('variables')">variables</div>
<div ng-class="tabCssClass('history')" id="tab_history" ng-click="changeView('history')">history</div>
</div>
<div id="tab_contents">
<div id="master_detail_table">
<div id="master"></div>
<div id="detail">
<div id="detail_colorpicker">
<div class="colorpicker_target">
<div class="colorpicker_target_tab tab_first colorpicker_target_selected" id="foreground" onClick="picked_colorpicker_target(this)">Text</div><div class="colorpicker_target_tab tab_last" id="background" onClick="picked_colorpicker_target(this)">Background</div>
</div>
<table id="colorpicker_term256"><tr><td></td></tr>
</table>
<div class="colorpicker_modifiers">
<div class="colorpicker_modifier_cell" id="modifier_underline" style="text-decoration: underline" onClick='picked_modifier(this)'>Underline</div>
</div>
</div>
<div id="detail_function"></div>
<div id="detail_prompt">
<div class="prompt_demo">
<div class="prompt_demo_text">
</div>
</div>
<div style="text-align: right">
<span class="prompt_save_button" onClick="save_current_prompt()">
use prompt
</span>
</div>
<div class="prompt_function">
<div class="prompt_function_text">
</div>
</div>
</div>
</div>
</div>
<table id="data_table">
<div id="table_filter_container">
<input type="text" id="table_filter_text_box" class="filter_text_box text_box_transient" value="Filter" onInput="update_table_filter_text_box(false)" onFocus="update_table_filter_text_box(false)" onBlur="update_table_filter_text_box(true)">
</div>
<tr><td>
</td></tr>
<tr><td></td></tr>
</table>
<div class="footer">
</div>
<ng-view></ng-view>
</div>
</div>
</div>
</body></html>

View file

@ -0,0 +1,39 @@
<div id="master_detail_table">
<div id="master">
<div ng-repeat="(name, attrs) in colorConfig">
<div ng-class="{'master_element':true, 'selected_master_elem':$index==selectedColorConfig}" style="color: {{ attrs.color }}" ng-click="configClicked($index)">
<span class="master_element_text">{{ attrs.name}}</span>
<span class="master_element_description" style="border-bottom-color: rgb(85, 85, 85);"> {{ attrs.description }}</span>
</div>
</div>
<tbody>
<tr class="data_table_row">
<td class="data_table_cell no_overflow" onclick:"toggle_overflow(this)"="" style="text-align: left; padding-right: 30px;"></td>
</tr>
</tbody>
</table>
</div>
<div id="detail">
<div id="detail_colorpicker">
<div class="colorpicker_target">
<div ng-class="{'colorpicker_target_tab': true, 'tab_first colorpicker_target_selected': target == 'text'}" id="foreground" ng-click="pickedColorPickerTarget('text')">Text</div><div ng-class="{'colorpicker_target_tab tab_last': true, 'tab_first colorpicker_target_selected': target == 'background'}" id="background" ng-click="pickedColorPickerTarget('background')">Background</div>
</div>
<table id="colorpicker_term256">
<tbody>
<tr ng-repeat="row in totalRows">
<td ng-repeat="item in itemsPerRow">
<div ng-class="{'colorpicker_term256_cell':true, 'colorpicker_cell_selected':(row*itemsPerRow.length)+item == selectedCell}" style="background-color: {{ term256Colors[(row*itemsPerRow.length)+item] }}" ng-click="pickedColorCell((row*itemsPerRow.length)+item)">
<div style="width: 100%; height: 100%"></div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="colorpicker_modifiers">
<div ng-class="{'colorpicker_modifier_cell': true, 'modifier_cell_selected': colorConfig[selectedColorConfig].underline}" id="modifier_underline" ng-style="{'text-decoration: underline': true}" onClick='picked_modifier(this)'>Underline</div>
</div>
</div>
</div>

View file

@ -0,0 +1,17 @@
<div id="tab_contents">
<div id="master_detail_table" style="display: table;">
<div id="master">
<div ng-repeat="func in functions">
<div id="master_{{func}}" ng-class="{'master_element': true, 'selected_master_elem': func == selectedFunction }" ng-style="'color: #aaaaaa'" ng-click="selectFunction(func)">
<span class="master_element_text" style="font-size: 11pt;">{{ func }}</span>
</div>
</div>
</div>
<div id="detail">
<div id="detail_function">
<div id="detail_function" style="display: block;">
{{ functionDefinition }}
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,13 @@
<table id="data_table" style="display: table;" >
<tbody>
<tr class="data_table_row" ng-repeat="item in historyItems">
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ item }}</td>
<td class="data_table_cell" style="text-align: right; width: 25px">
<a onclick="tell_fish_to_delete_element({{ $index }})">
<img class="delete_icon" src="delete.png">
</a>
</td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,25 @@
<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>
</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>
</div>
<div style="text-align: right">
<span class="prompt_save_button" onclick="save_current_prompt()" style="display: none;"> use prompt </span>
</div>
<div class="prompt_function">
<div class="prompt_function_text">
{{ selectedPrompt.function }}
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,9 @@
<table id="data_table" style="display: table;">
<tbody>
<tr class="data_table_row" ng-repeat="variable in variables">
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ variable.name }}</td>
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ variable.value }}</td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,364 @@
body {
background-color: #292929;
font-family: Courier, "Courier New", monospace;
color: white;
}
#ancestor {
width: 800px;
margin-left: auto;
margin-right: auto;
margin-top: 25px;
}
#parent {
width: 100%;
min-height: 480px;
margin-top: 12px;
}
#tab_parent {
display: table;
width: 100%;
height: 50px;;
}
.tab {
display: table-cell;
border: 1px solid #111;
border-right: none;
padding-bottom: 15px;
padding-top: 15px;
font-size: 17pt;
text-align: center;
width: 20%;
background-color: #292929;
cursor: pointer;
}
#tab_parent :first-child {
border-top-left-radius: 8px;
}
#tab_parent :last-child {
border-right: 1px solid #111;
border-top-right-radius: 8px;
}
.tab_first {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.tab_last {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.selected_tab {
background-color: black;
border-color: black;
}
#tab_contents {
padding-top: 35px;
width: 100%;
background-color: black;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
margin-bottom: 20px;
}
.footer {
clear: both;
height: 30px;
}
#master_detail_table {
display: table;
margin-top: 10px;
margin-left: 12px;
margin-right: 12px;
}
#master {
display: table-cell;
text-align: right;
min-width: 200px;
font-size: 16pt;
padding-bottom: 20px;
padding-top: 35px;
vertical-align: top;
}
#detail {
display: table-cell;
border: 1px solid #555;
background-color: #181818;
padding-top: 30px;
padding-bottom: 20px;
padding-left: 30px;
padding-right: 30px;
border-radius: 5;
width: 100%;
}
#detail_function {
white-space: pre-wrap;
width: 100%;
font-size: 11pt;
color: #BBB;
}
.master_element {
padding-top: 6px;
padding-bottom: 11px;
padding-left: 5px;
padding-right: 22px;
font-size: 12pt;
/* Make our border overlap the detail, even if we're unselected (so it doesn't jump when selected) */
position: relative;
left: 1px;
border-bottom-style: solid;
border-bottom-width: 0px;
}
.selected_master_elem {
border: 1px solid #555;
border-right: none;
background-color: #181818;
border-top-left-radius: 5;
border-bottom-left-radius: 5;
/* Pad one less than .master_element, to accomodate our border. */
padding-top: 5px;
padding-bottom: 10px;
padding-left: 4px;
}
.master_element_text {
text-decoration: none;
padding-bottom: 1px;
border-bottom-style: inherit;
border-bottom-color: inherit;
border-bottom-width: 1px;
}
.master_element_description {
text-decoration: none;
padding-top: 15px;
font-size: 10pt;
border-bottom-style: inherit;
border-bottom-color: inherit;
border-bottom-width: 1px;
display: none;
}
.selected_master_elem > .master_element_description {
display: inline;
}
/* We have a newline between the label and description; hide it initially, but show it when it's selected */
.master_element > br { display: none; }
.selected_master_elem > br { display: inherit; }
/* Set this class to suppress the border bottom on master_element_texts with visible descriptions */
.master_element_no_border { border-bottom-width: 0 }
#colorpicker_term256 {
border: solid #444 1px;
}
.colorpicker_modifiers {
margin-top: 10px;
display:inline-block;
margin-left: auto;
margin-right: auto;
color: #AAA;
font-size: smaller;
}
.colorpicker_modifier_cell {
cursor: pointer;
display:inline-block;
text-align: center;
border: groove #333 2px;
padding: 5px;
margin-top: 5px;
margin-left: auto;
margin-right: auto;
}
.modifier_cell_selected {
color: #CCC;
border-color: #AAA;
background-color: #444;
}
#data_table {
table-layout:fixed;
color: #CCC;
width: 100%;
padding-left: 10px;
padding-right: 10px;
}
.data_table_row {
}
.data_table_cell {
padding-top: 5px;
padding-bottom: 5px;
vertical-align: top;
overflow:hidden;
border-bottom: #444 dotted 1px;
word-wrap: break-word;
}
/* The CSS we apply when a table row is filtered */
.data_table_row_filtered {
display: none;
}
.no_overflow {
text-overflow: ellipsis;
white-space: nowrap;
}
.colorpicker_target {
margin: 0 0 -50px 0;
position: relative;
bottom: 47px;
float: left; /* for some reason this makes the cells that it overlaps (before adjusting its bottom) clickable in Safari */
}
.colorpicker_target_tab {
cursor: pointer;
color: #555;
border: solid 1px #555;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 7px;
padding-right: 7px;
display: inline-block;
background-color: black;
margin-right: -2px;
min-width: 110px;
text-align: center;
}
.colorpicker_target_selected {
background-color: #181818; /* same as #detail */
color: white;
}
.colorpicker_term256_row {
}
.colorpicker_term256_cell {
width: 29;
height: 29;
}
.colorpicker_cell_selected {
border: dashed white 3px;
width: 23;
height: 23;
}
.error_msg {
color: red;
font-size: 12pt;
margin-left: 24pt;
margin-top: 5pt;
margin-bottom: 5pt;
}
img.delete_icon {
width: 20px;
height: 20px;
cursor: pointer;
text-decoration: none;
border: none;
}
#table_filter_container {
/* top right bottom left*/
padding: 0 10 10 30;
text-align: right;
position: relative;
bottom: 10px;
}
#table_filter_text_box {
}
.filter_text_box {
width: 250px;
padding: 5 10 5 10;
background-color: #888;
border: #222 solid 3px;
border-radius: 15px;
font-size: 12pt;
color: white;
font-weight: bold;
}
.text_box_transient {
color: #C8C8C8;
}
.prompt_demo {
/* This is the div that holds what the prompt looks like */
width: 100%;
background-color: black;
border-radius: 5px;
display: table;
}
.prompt_save_button {
border-radius: 5px;
border: solid #474747 1px;
text-shadow: 0px 1px #000;
padding: 5px 8px;
font-size: 12pt;
display: inline-block;
margin-top: 12px;
background-color: #282828;
color: #DDD;
cursor: pointer;
}
.prompt_save_button:hover {
background-color: #333;
border: solid #525252 1px;
color: #EEE;
}
.prompt_demo_text {
white-space: pre;
line-height: 170%;
padding: 4px 12px;
font-size: 14pt;
top: 0px;
bottom: 0px;
vertical-align: middle;
display: table-cell;
height: 72px; /* this is really the min height */
}
.prompt_function {
/* This is the div that holds the prompt function's definition */
width: 100%;
color: #BBB;
font-size: 10pt;
}
.prompt_function_text {
white-space: pre-wrap;
padding: 25px 3px;
}

View file

@ -0,0 +1,156 @@
webconfig = angular.module("webconfig", []);
webconfig.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"
})
.otherwise({
redirectTo: "/colors"
})
}]);
webconfig.controller("main", function($scope, $location) {
$scope.currentTab = "colors";
$scope.changeView = function(view) {
$location.path(view);
$scope.currentTab = view;
}
$scope.tabCssClass = function(view) {
var cls = "tab";
if ($scope.currentTab == view) {
cls += " selected_tab";
}
return cls;
}
})
webconfig.controller("colorsController", function($scope, $http) {
$scope.term256Colors = [ "ffd7d7", "d7afaf", "af8787", "875f5f", "5f0000", "870000", "af0000", "d70000", "ff0000", "ff5f5f", "d75f5f", "d78787", "ff8787", "ffafaf", "ffaf87", "ffaf5f", "ffaf00", "ff875f", "ff8700", "ff5f00", "d75f00", "af5f5f", "af5f00", "d78700", "d7875f", "af875f", "af8700", "875f00", "d7af87", "ffd7af", "ffd787", "ffd75f", "d7af00", "d7af5f", "ffd700", "ffff5f", "ffff00", "ffff87", "ffffaf", "ffffd7", "d7ff00", "afd75f", "d7d700", "d7d787", "d7d7af", "afaf87", "87875f", "5f5f00", "878700", "afaf00", "afaf5f", "d7d75f", "d7ff5f", "d7ff87", "87ff00", "afff00", "afff5f", "afd700", "87d700", "87af00", "5f8700", "87af5f", "5faf00", "afd787", "d7ffd7", "d7ffaf", "afffaf", "afff87", "5fff00", "5fd700", "87d75f", "5fd75f", "87ff5f", "5fff5f", "87ff87", "afd7af", "87d787", "87d7af", "87af87", "5f875f", "5faf5f", "005f00", "008700", "00af00", "00d700", "00ff00", "00ff5f", "5fff87", "00ff87", "87ffaf", "afffd7", "5fd787", "00d75f", "5faf87", "00af5f", "5fffaf", "00ffaf", "5fd7af", "00d787", "00875f", "00af87", "00d7af", "5fffd7", "87ffd7", "00ffd7", "d7ffff", "afd7d7", "87afaf", "5f8787", "5fafaf", "87d7d7", "5fd7d7", "5fffff", "00ffff", "87ffff", "afffff", "00d7d7", "00d7ff", "5fd7ff", "5fafd7", "00afd7", "00afff", "0087af", "00afaf", "008787", "005f5f", "005f87", "0087d7", "0087ff", "5fafff", "87afff", "5f87d7", "5f87ff", "005fd7", "005fff", "005faf", "5f87af", "87afd7", "afd7ff", "87d7ff", "d7d7ff", "afafd7", "8787af", "afafff", "8787d7", "8787ff", "5f5fff", "5f5fd7", "5f5faf", "5f5f87", "00005f", "000087", "0000af", "0000d7", "0000ff", "5f00ff", "5f00d7", "5f00af", "5f0087", "8700af", "8700d7", "8700ff", "af00ff", "af00d7", "d700ff", "d75fff", "d787ff", "ffafd7", "ffafff", "ffd7ff", "d7afff", "d7afd7", "af87af", "af87d7", "af87ff", "875fd7", "875faf", "875fff", "af5fff", "af5fd7", "af5faf", "d75fd7", "d787d7", "ff87ff", "ff5fff", "ff5fd7", "ff00ff", "ff00af", "ff00d7", "d700af", "d700d7", "af00af", "870087", "5f005f", "87005f", "af005f", "af0087", "d70087", "d7005f", "ff0087", "ff005f", "ff5f87", "d75f87", "d75faf", "ff5faf", "ff87af", "ff87d7", "d787af", "af5f87", "875f87", "000000", "080808", "121212", "1c1c1c", "262626", "303030", "3a3a3a", "444444", "4e4e4e", "585858", "5f5f5f", "626262", "6c6c6c", "767676", "808080", "878787", "8a8a8a", "949494", "9e9e9e", "a8a8a8", "afafaf", "b2b2b2", "bcbcbc", "c6c6c6", "d0d0d0", "d7d7d7", "dadada", "e4e4e4", "eeeeee", "ffffff", ];
range = function(start, end) {
var result = [];
for (var i = start; i <= end; i++) {
result.push(i);
}
return result;
};
$scope.selectedColorConfig = 0;
$scope.itemsPerRow = range(0, 15);
$scope.totalRows = range(0, $scope.term256Colors.length/$scope.itemsPerRow.length);
$scope.selectedCell = -1;
$scope.target = "text";
$scope.configClicked = function(index) {
$scope.selectedColorConfig = index;
//console.log("Color :" + $scope.colorConfig[$scope.selectedColorConfig].color.toLowerCase() + $scope.term256Colors.indexOf($scope.colorConfig[$scope.selectedColorConfig].color.toLowerCase()));
if ($scope.target == "background") {
$scope.selectedCell = $scope.term256Colors.indexOf($scope.colorConfig[$scope.selectedColorConfig].background.toLowerCase());
}
else {
$scope.selectedCell = $scope.term256Colors.indexOf($scope.colorConfig[$scope.selectedColorConfig].color.toLowerCase());
}
}
$scope.pickedColorCell = function(index) {
console.log("color picked" + index + " " + $scope.term256Colors[index]);
$scope.selectedCell = index;
}
$scope.pickedColorPickerTarget = function(target) {
console.log("Picked " + target);
$scope.target = target;
$scope.configClicked($scope.selectedColorConfig);
}
$scope.fetchColors = function() {
$http.get("/colors/").success(function(data, status, headers, config) {
$scope.colorConfig= data;
$scope.selectedCell = $scope.term256Colors.indexOf($scope.colorConfig[$scope.selectedColorConfig].color);
})};
$scope.fetchColors();
});
webconfig.controller("promptController", function($scope, $http) {
$scope.selectedPrompt = null;
$scope.fetchCurrentPrompt = function(currentPrompt) {
$http.get("/current_prompt/").success(function(data, status, headers, config) {
currentPrompt.function = data.function;
})};
$scope.fetchSamplePrompts= function() {
$http.get("/sample_prompts/").success(function(data, status, headers, config) {
$scope.samplePrompts = data;
if ($scope.selectedPrompt == null) {
$scope.selectPrompt($scope.samplePrompts[0]);
}
})};
$scope.selectPrompt = function(promptt) {
$scope.selectedPrompt= promptt;
if ($scope.selectedPrompt.name == "Current") {
$scope.fetchCurrentPrompt($scope.selectedPrompt);
}
}
$scope.fetchSamplePrompts();
});
webconfig.controller("functionsController", function($scope, $http) {
$scope.selectedFunction = null;
$scope.functionDefinition = "";
$scope.selectFunction = function(fun) {
$scope.selectedFunction = fun;
$scope.fetchFunctionDefinition($scope.selectedFunction);
}
$scope.fetchFunctions= function() {
$http.get("/functions/").success(function(data, status, headers, config) {
$scope.functions = data;
$scope.selectFunction($scope.functions[0]);
})};
$scope.fetchFunctionDefinition = function(name) {
$http.post("/get_function/","what=" + name, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
$scope.functionDefinition = data[0];
})};
$scope.fetchFunctions();
});
webconfig.controller("variablesController", function($scope, $http) {
$scope.fetchVariables= function() {
$http.get("/variables/").success(function(data, status, headers, config) {
$scope.variables = data;
})};
$scope.fetchVariables();
});
webconfig.controller("historyController", function($scope, $http) {
$scope.fetchHistory = function() {
$http.get("/history/").success(function(data, status, headers, config) {
$scope.historyItems = data;
})};
$scope.fetchHistory();
});

View file

@ -95,7 +95,7 @@ def parse_color(color_str):
# Regular color
color = better_color(color, parse_one_color(comp))
return [color, background_color, bold, underline]
return {"color": color, "background": background_color, "bold": bold, "underline": underline}
def parse_bool(val):
val = val.lower()
@ -248,7 +248,7 @@ class FishVar:
flags = []
if self.universal: flags.append('universal')
if self.exported: flags.append('exported')
return [self.name, self.value, ', '.join(flags)]
return {"name": self.name, "value": self.value, "Flags": ', '.join(flags)}
class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
@ -308,7 +308,9 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
for match in re.finditer(r"^fish_color_(\S+) ?(.*)", line):
color_name, color_value = [x.strip() for x in match.group(1, 2)]
color_desc = descriptions.get(color_name, '')
result.append([color_name, color_desc, parse_color(color_value)])
data = { "name": color_name, "description" : color_desc }
data.update(parse_color(color_value))
result.append(data)
remaining.discard(color_name)
# Ensure that we have all the color names we know about, so that if the