Improved status action (shield.io image) and docs
This commit is contained in:
parent
9cb1fc7ccc
commit
e724504610
2 changed files with 30 additions and 4 deletions
|
|
@ -127,12 +127,20 @@ class BuildStatusController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the appropriate build status image in SVG format for a given project.
|
||||
*/
|
||||
* Returns the appropriate build status image in SVG format for a given project.
|
||||
*/
|
||||
public function image($projectId)
|
||||
{
|
||||
$style = $this->getParam('style', 'plastic');
|
||||
$label = $this->getParam('label', 'build');
|
||||
// plastic|flat|flat-squared|social
|
||||
$style = $this->getParam('style', 'flat');
|
||||
$label = $this->getParam('label', 'build');
|
||||
|
||||
$optionalParams = [
|
||||
'logo' => $this->getParam('logo'),
|
||||
'logoWidth' => $this->getParam('logoWidth'),
|
||||
'link' => $this->getParam('link'),
|
||||
'maxAge' => $this->getParam('maxAge'),
|
||||
];
|
||||
|
||||
$status = $this->getStatus($projectId);
|
||||
|
||||
|
|
@ -150,6 +158,12 @@ class BuildStatusController extends Controller
|
|||
$color,
|
||||
$style
|
||||
));
|
||||
|
||||
foreach ($optionalParams as $paramName => $param) {
|
||||
if ($param) {
|
||||
$image .= '&' . $paramName . '=' . $param;
|
||||
}
|
||||
}
|
||||
|
||||
$this->response->disableLayout();
|
||||
$this->response->setHeader('Content-Type', 'image/svg+xml');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue