authentication screen is complete
This commit is contained in:
169
setup.js
169
setup.js
@ -1,40 +1,174 @@
|
|||||||
var blessed = require('blessed')
|
var blessed = require('blessed')
|
||||||
var screen = blessed.screen({
|
var screen = blessed.screen({
|
||||||
|
autoPadding: true
|
||||||
});
|
});
|
||||||
|
|
||||||
var list = blessed.list({
|
var home = blessed.list({
|
||||||
parent: screen,
|
parent: screen,
|
||||||
padding: { top: 2 },
|
padding: { top: 2 },
|
||||||
mouse: true,
|
mouse: true,
|
||||||
keys: true,
|
keys: true,
|
||||||
vi: true,
|
|
||||||
fg: 'white',
|
fg: 'white',
|
||||||
bg: 'blue',
|
bg: 'blue',
|
||||||
selectedFg: 'blue',
|
selectedFg: 'blue',
|
||||||
selectedBg: 'white',
|
selectedBg: 'white',
|
||||||
items: [
|
items: [
|
||||||
'» Add/Remove Authentication',
|
'» Authentication',
|
||||||
'» Change Email Service',
|
'» Email Service',
|
||||||
'» Enable Socket.IO',
|
'» Socket.IO',
|
||||||
'» Enable Node.js Cluster',
|
'» Node.js Cluster',
|
||||||
'» Exit'
|
'» Exit'
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
list.append(blessed.Text({
|
var authentication = blessed.form({
|
||||||
|
mouse: true,
|
||||||
|
keys: true,
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'blue',
|
||||||
|
padding: { left: 1, right: 1 }
|
||||||
|
});
|
||||||
|
|
||||||
|
var authText = blessed.text({
|
||||||
|
parent: authentication,
|
||||||
|
content: 'Selecting a checkbox adds an authentication provider. Unselecting a checkbox removes it. If authentication provider is already present, no action will be taken.',
|
||||||
|
padding: 1,
|
||||||
|
bg: 'magenta',
|
||||||
|
fg: 'white'
|
||||||
|
});
|
||||||
|
|
||||||
|
var facebookCheckbox = blessed.checkbox({
|
||||||
|
parent: authentication,
|
||||||
|
top: 6,
|
||||||
|
checked: true,
|
||||||
|
mouse: true,
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'blue',
|
||||||
|
content: 'Facebook'
|
||||||
|
});
|
||||||
|
|
||||||
|
var githubCheckbox = blessed.checkbox({
|
||||||
|
parent: authentication,
|
||||||
|
top: 7,
|
||||||
|
checked: true,
|
||||||
|
mouse: true,
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'blue',
|
||||||
|
content: 'GitHub'
|
||||||
|
});
|
||||||
|
|
||||||
|
var googleCheckbox = blessed.checkbox({
|
||||||
|
parent: authentication,
|
||||||
|
top: 8,
|
||||||
|
checked: true,
|
||||||
|
mouse: true,
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'blue',
|
||||||
|
content: 'Google'
|
||||||
|
});
|
||||||
|
|
||||||
|
var twitterCheckbox = blessed.checkbox({
|
||||||
|
parent: authentication,
|
||||||
|
top: 9,
|
||||||
|
checked: true,
|
||||||
|
mouse: true,
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'blue',
|
||||||
|
content: 'Twitter'
|
||||||
|
});
|
||||||
|
|
||||||
|
var linkedinCheckbox = blessed.checkbox({
|
||||||
|
parent: authentication,
|
||||||
|
top: 10,
|
||||||
|
checked: true,
|
||||||
|
mouse: true,
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'blue',
|
||||||
|
content: 'LinkedIn'
|
||||||
|
});
|
||||||
|
|
||||||
|
var instagramCheckbox = blessed.checkbox({
|
||||||
|
parent: authentication,
|
||||||
|
top: 11,
|
||||||
|
checked: true,
|
||||||
|
mouse: true,
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'blue',
|
||||||
|
content: 'Instagram'
|
||||||
|
});
|
||||||
|
|
||||||
|
var authOk = blessed.button({
|
||||||
|
parent: authentication,
|
||||||
|
top: 13,
|
||||||
|
mouse: true,
|
||||||
|
shrink: true,
|
||||||
|
name: 'ok',
|
||||||
|
content: ' SUBMIT ',
|
||||||
|
style: {
|
||||||
|
fg: 'blue',
|
||||||
|
bg: 'white',
|
||||||
|
focus: {
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'red'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var authCancel = blessed.button({
|
||||||
|
parent: authentication,
|
||||||
|
top: 13,
|
||||||
|
left: 9,
|
||||||
|
mouse: true,
|
||||||
|
shrink: true,
|
||||||
|
name: 'cancel',
|
||||||
|
content: ' CANCEL ',
|
||||||
|
style: {
|
||||||
|
fg: 'blue',
|
||||||
|
bg: 'white',
|
||||||
|
focus: {
|
||||||
|
fg: 'white',
|
||||||
|
bg: 'red'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var title = blessed.text({
|
||||||
|
parent: screen,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fg: 'blue',
|
fg: 'blue',
|
||||||
bg: 'white',
|
bg: 'white',
|
||||||
content: 'Hackathon Starter (c) 2014'
|
content: 'Hackathon Starter (c) 2014'
|
||||||
}));
|
});
|
||||||
|
|
||||||
|
var footer = blessed.text({
|
||||||
list.append(blessed.Text({
|
parent: screen,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
fg: 'white',
|
fg: 'white',
|
||||||
bg: 'blue',
|
bg: 'blue',
|
||||||
content: '<Up/Down> moves; <Enter> selects'
|
content: ' <Up/Down> moves | <Enter> selects | <q> exits'
|
||||||
}));
|
});
|
||||||
|
|
||||||
|
home.on('select', function(child, index) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
home.append(authentication);
|
||||||
|
authentication.focus();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
console.log('doh');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
console.log('doh');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
|
||||||
|
console.log('doh');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -42,16 +176,5 @@ screen.key('q', function() {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
//var check = blessed.checkbox({
|
|
||||||
// parent: form,
|
|
||||||
// keys: true,
|
|
||||||
// left: 0,
|
|
||||||
// top: 0,
|
|
||||||
// width: 30,
|
|
||||||
// height: 4,
|
|
||||||
// bg: 'blue',
|
|
||||||
// content: ' » Hello or cancel?'
|
|
||||||
//});
|
|
||||||
|
|
||||||
screen.render();
|
screen.render();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user