Improve - environment settings on project creation

This commit is contained in:
Stepan Strelets 2017-03-26 01:38:49 +03:00 committed by Dmitry Khomutov
parent 1cef8260e9
commit 657b98063d
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
2 changed files with 13 additions and 11 deletions

View file

@ -266,6 +266,7 @@ class ProjectController extends PHPCensor\Controller
'allow_public_status' => $this->getParam('allow_public_status', 0),
'branch' => $this->getParam('branch', null),
'group' => $this->getParam('group_id', null),
'environments' => $this->getParam('environments', null),
];
$project = $this->projectService->createProject($title, $type, $reference, $options);
@ -406,12 +407,10 @@ class ProjectController extends PHPCensor\Controller
$field->setClass('form-control')->setContainerClass('form-group')->setValue('master');
$form->addField($field);
if ($type != 'add') {
$field = Form\Element\TextArea::create('environments', Lang::get('environments_label'), false);
$field->setClass('form-control')->setContainerClass('form-group');
$field->setRows(6);
$form->addField($field);
}
$field = Form\Element\TextArea::create('environments', Lang::get('environments_label'), false);
$field->setClass('form-control')->setContainerClass('form-group');
$field->setRows(6);
$form->addField($field);
$field = Form\Element\Select::create('group_id', Lang::get('project_group'), true);
$field->setClass('form-control')->setContainerClass('form-group')->setValue(1);

View file

@ -84,15 +84,18 @@ class ProjectService
$project->setGroup($options['group']);
}
if (array_key_exists('environments', $options)) {
$project->setEnvironments($options['environments']);
}
// Allow certain project types to set access information:
$this->processAccessInformation($project);
// Save and return the project:
return $this->projectStore->save($project);
/** @var Project $project */
$project = $this->projectStore->save($project);
if (array_key_exists('environments', $options)) {
$project->setEnvironments($options['environments']);
}
return $project;
}
/**