Browse Source

adding #4

release/0.1
Björn 4 years ago
parent
commit
2f2996dc0f
2 changed files with 16 additions and 3 deletions
  1. +4
    -1
      app/Commands/NginxVhostsCommand.php
  2. +12
    -2
      app/Factories/NginxVhostFactory.php

+ 4
- 1
app/Commands/NginxVhostsCommand.php View File

@ -219,7 +219,10 @@ class NginxVhostsCommand extends Command
// add Submenu for select templates
->addSubMenu('add', $submenuSelectTemplate)
->addLineBreak('-');
->addLineBreak('-')
->modifySelectableStyle(function (SelectableStyle $style) {
$style->setItemExtra('[ enabled ]');
});
$mainmenu->addLineBreak('-');


+ 12
- 2
app/Factories/NginxVhostFactory.php View File

@ -10,8 +10,9 @@ use PhpSchool\CliMenu\MenuItem\MenuMenuItem;
class NginxVhostFactory
{
/**
* adding Vhosts behind index
*
* @param [type] $mainmenu
* @param [type] $mainmenu
* @param [type] $vhosts
* @param [type] $vhostIndex
*/
@ -31,7 +32,7 @@ class NginxVhostFactory
}
}
// check for linebreak
// check for linebreak-object
foreach($items as $index => $item) {
if ($index > $vhostIndex && get_class($item) === 'PhpSchool\CliMenu\MenuItem\LineBreakItem') {
$startIndex = $index;
@ -57,6 +58,7 @@ class NginxVhostFactory
}
/**
*
*
* @param [type] $vhost
* @param [type] $mainmenu
@ -77,6 +79,7 @@ class NginxVhostFactory
$builder
->setTitle('Nginx > '.$vhost['domain'])
->setGoBackButtonText('Back')
->addLineBreak('')
->addItem('edit', function(CliMenu $menu) use ($vhost) {
system('nano /etc/nginx/sites-available/'.$vhost['file'].' > `tty`');
})
@ -101,6 +104,7 @@ class NginxVhostFactory
->addLineBreak('-');
$submenu = $builder->build();
$submenu->setParent($mainmenu);
$submenu->setStyle($mainmenu->getStyle());
@ -110,6 +114,12 @@ class NginxVhostFactory
$builder->isMenuDisabled()
);
// show item extra if domain is enabled
$item->getStyle()->setItemExtra('[ enabled ]');
if ($vhost['enabled']) {
$item->showItemExtra();
}
return $item;
}


Loading…
Cancel
Save