Merge pull request #121 from Block8/feature/bootstrapv3

Merging switch to Bootstrap v3. Closes #99.
This commit is contained in:
Dan Cryer 2013-08-01 04:12:00 -07:00
commit 62071c6d86
18 changed files with 132 additions and 939 deletions

View file

@ -262,13 +262,15 @@ class ProjectController extends \PHPCI\Controller
$field->setPattern('^(github|bitbucket|remote|local)');
$field->setOptions($options);
$field->setLabel('Where is your project hosted?');
$field->setClass('span4');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$form->addField($field);
if (isset($_SESSION['github_token'])) {
$field = new Form\Element\Select('github');
$field->setLabel('Choose a Github repository:');
$field->setClass('span4');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$field->setOptions($this->getGithubRepositories());
$form->addField($field);
}
@ -302,24 +304,28 @@ class ProjectController extends \PHPCI\Controller
$field->setRequired(true);
$field->setValidator($referenceValidator);
$field->setLabel('Repository Name / URL (Remote) or Path (Local)');
$field->setClass('span4');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$form->addField($field);
$field = new Form\Element\Text('title');
$field->setRequired(true);
$field->setLabel('Project Title');
$field->setClass('span4');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$form->addField($field);
$field = new Form\Element\TextArea('key');
$field->setRequired(false);
$field->setLabel('Private key to use to access repository (leave blank for local and/or anonymous remotes)');
$field->setClass('span7');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$field->setRows(6);
$form->addField($field);
$field = new Form\Element\Submit();
$field->setValue('Save Project');
$field->setContainerClass('form-group');
$field->setClass('btn-success');
$form->addField($field);

View file

@ -47,13 +47,15 @@ class SessionController extends \PHPCI\Controller
$email = new b8\Form\Element\Email('email');
$email->setLabel('Email Address');
$email->setRequired(true);
$email->setClass('span3');
$email->setContainerClass('form-group');
$email->setClass('form-control');
$form->addField($email);
$pwd = new b8\Form\Element\Password('password');
$pwd->setLabel('Password');
$pwd->setRequired(true);
$pwd->setClass('span3');
$pwd->setContainerClass('form-group');
$pwd->setClass('form-control');
$form->addField($pwd);
$pwd = new b8\Form\Element\Submit();

View file

@ -135,25 +135,29 @@ class UserController extends \PHPCI\Controller
$field = new Form\Element\Email('email');
$field->setRequired(true);
$field->setLabel('Email Address');
$field->setClass('span4');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$form->addField($field);
$field = new Form\Element\Text('name');
$field->setRequired(true);
$field->setLabel('Name');
$field->setClass('span4');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$form->addField($field);
$field = new Form\Element\Password('password');
$field->setRequired(true);
$field->setLabel('Password' . ($type == 'edit' ? ' (leave blank to keep current password)' : ''));
$field->setClass('span4');
$field->setClass('form-control');
$field->setContainerClass('form-group');
$form->addField($field);
$field = new Form\Element\Checkbox('admin');
$field->setRequired(false);
$field->setCheckedValue(1);
$field->setLabel('Is this user an administrator?');
$field->setContainerClass('form-group');
$form->addField($field);
$field = new Form\Element\Submit();

24
PHPCI/Helper/Build.php Normal file
View file

@ -0,0 +1,24 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://www.phptesting.org/
*/
namespace PHPCI\Helper;
/**
* User Helper - Provides access to logged in user information in views.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Web
*/
class Build
{
public function formatPluginName($name)
{
return str_replace('Php', 'PHP', ucwords(str_replace('_', ' ', $name)));
}
}

View file

@ -4,21 +4,20 @@
</div>
<div class="row">
<div class="span3">
<div class="well" style="padding: 8px 0">
<ul class="nav nav-list">
<div class="col-lg-3">
<ul class="nav nav-pills nav-stacked">
<li><a href="<?= PHPCI_URL ?>"><i class="icon-home"></i> Dashboard</a></li>
<li><a href="<?= PHPCI_URL ?>project/view/<?php print $build->getProject()->getId(); ?>"><i class="icon-folder-open"></i> <?php print $build->getProject()->getTitle(); ?></a></li>
<li class="divider"></li>
<li class="nav-header">Options</li>
</ul>
<h5>Options</h5>
<ul class="nav nav-pills nav-stacked">
<li><a href="<?= PHPCI_URL ?>build/rebuild/<?php print $build->getId(); ?>"><i class="icon-cog"></i> Rebuild</a></li>
<?php if($this->User()->getIsAdmin()): ?>
<li><a href="#" id="delete-build"><i class="icon-trash"></i> Delete Build</a></li>
<?php endif; ?>
</ul>
</div>
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered" style="margin-top: 20px">
<thead>
<tr>
<th colspan="2">Plugin Status</th>
@ -28,7 +27,7 @@
</tbody>
</table>
</div>
<div class="span9">
<div class="col-lg-9">
<div id="status"></div>
<table class="table table-striped table-bordered">

View file

@ -48,28 +48,20 @@ switch($build->getStatus())
$plugins = array();
}
if ( 0 === count($plugins) ) {
?>
<span class='label label-<?= $subcls ?>'>
<?= $status ?>
</span>
<?php
?> <span class='label label-<?= $subcls ?>'><?= $status ?></span> <?php
}
?>
<?php
foreach($plugins as $plugin => $pluginstatus):
$subcls = $pluginstatus?'label label-success':'label label-important';
?>
<span class='<?= $subcls ?>'>
<?= ucwords(str_replace('_', ' ', $plugin)) ?>
</span>
<?php endforeach; ?>
?> <span class='<?= $subcls ?>'><?php print $this->Build()->formatPluginName($plugin); ?></span> <?php endforeach; ?>
<br style='clear:both;' />
</td>
<td>
<div class="btn-group">
<a class="btn" href="<?= PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">View</a>
<a class="btn btn-default btn-small" href="<?= PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">View</a>
<?php if($this->User()->getIsAdmin()): ?>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">

View file

@ -2,14 +2,15 @@
<h1 style="display: inline-block">Dashboard</h1>
</div>
<div class="row">
<div class="span3">
<div class="well" style="padding: 8px 0">
<ul class="nav nav-list">
<li><a href="<?= PHPCI_URL ?>"><i class="icon-home"></i> Dashboard</a></li>
<div class="col-lg-3">
<ul class="nav nav-pills nav-stacked">
<li class="active"><a href="<?= PHPCI_URL ?>"><i class="icon-home"></i> Dashboard</a></li>
<li><a href="<?= PHPCI_URL ?>user"><i class="icon-user"></i> Users</a></li>
<li class="divider"></li>
<li class="nav-header">Projects</li>
</ul>
<?php if (count($projects)): ?>
<h5>Projects</h5>
<ul class="nav nav-pills nav-stacked">
<?php
foreach($projects as $project):
$status = 'icon-build-ok';
@ -37,9 +38,9 @@
<li><a href="<?= PHPCI_URL ?>project/view/<?php print $project->getId(); ?>"><i class="<?= $status; ?>"></i> <?php print $project->getTitle(); ?></a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="span9">
<?php endif; ?>
</div>
<div class="col-lg-9">
<h3>Project Overview</h3>
<table class="table table-striped table-bordered">
<thead>
@ -49,7 +50,7 @@
<th>Last Success</th>
<th>Last Failure</th>
<th>Success/Failures</th>
<th style="width: 1%"></th>
<th style="width: 100px"></th>
</tr>
</thead>
<tbody>
@ -66,7 +67,7 @@
<th>Commit</th>
<th>Branch</th>
<th>Status</th>
<th style="width: 1%"></th>
<th style="width: 100px"></th>
</tr>
</thead>
<tbody id="latest-builds">

View file

@ -3,13 +3,13 @@
</div>
<div class="row">
<div class="span3">
<div class="well" style="padding: 8px 0">
<ul class="nav nav-list">
<div class="col-lg-3">
<ul class="nav nav-pills nav-stacked">
<li><a href="<?= PHPCI_URL ?>"><i class="icon-home"></i> Dashboard</a></li>
<li><a href="<?= PHPCI_URL ?>project/view/<?php print $project->getId(); ?>"><i class="icon-folder-open"></i> <?php print $project->getTitle(); ?></a></li>
<li class="divider"></li>
<li class="nav-header">Options</li>
</ul>
<h5>Options</h5>
<ul class="nav nav-pills nav-stacked">
<li><a href="<?= PHPCI_URL ?>project/build/<?php print $project->getId(); ?>"><i class="icon-cog"></i> Build Now</a></li>
<?php if($this->User()->getIsAdmin()): ?>
@ -17,7 +17,6 @@
<li><a href="#" id="delete-project"><i class="icon-trash"></i> Delete Project</a></li>
<?php endif; ?>
</ul>
</div>
<?php if (in_array($project->getType(), array('github', 'bitbucket'))): ?>
<br>
@ -40,7 +39,7 @@
?>
</p>
</div>
<div class="span9">
<div class="col-lg-9">
<table class="table table-striped table-bordered">
<thead>
<tr>
@ -49,7 +48,7 @@
<th>Commit</th>
<th>Branch</th>
<th>Status</th>
<th style="width: 1%"></th>
<th style="width: 100px"></th>
</tr>
</thead>
<tbody id="latest-builds">
@ -59,7 +58,7 @@
<?php
print '<div class="pagination"><ul>';
print '<div><ul class="pagination">';
$pages = ceil($total / 10);
$pages = $pages == 0 ? 1 : $pages;

View file

@ -3,7 +3,7 @@
</div>
<div class="row">
<div class="span4">
<div class="col-lg-4">
<div class="well" style="">
<?php if(!is_null($key)): ?>
<p>To make it easier to get started, we've generated a public / private key pair for you to use for this project. To use it, just add the following public key to the "deploy keys" section of your repository settings on Github / Bitbucket.</p>
@ -16,7 +16,7 @@
<?php endif; ?>
</div>
</div>
<div class="span8">
<div class="col-lg-8">
<?php print $form; ?>
</div>
</div>

View file

@ -109,6 +109,6 @@ foreach($projects as $projectId => $project):
<?php } ?>
</td>
<td><?= $project['successes'] ?>/<?= $project['failures'] ?></td>
<td><a class="btn" href='<?= PHPCI_URL ?>project/build/<?= $projectId ?>'>build</a></td>
<td><a class="btn btn-default btn-small" href='<?= PHPCI_URL ?>project/build/<?= $projectId ?>'>build now &raquo;</a></td>
</tr>
<?php endforeach; ?>

View file

@ -3,25 +3,23 @@
</div>
<div class="row">
<div class="span3">
<div class="well" style="padding: 8px 0">
<ul class="nav nav-list">
<div class="col-lg-3">
<ul class="nav nav-pills nav-stacked">
<li><a href="<?= PHPCI_URL ?>"><i class="icon-home"></i> Dashboard</a></li>
<li><a href="<?= PHPCI_URL ?>user"><i class="icon-user"></i> Users</a></li>
<li class="active"><a href="<?= PHPCI_URL ?>user"><i class="icon-user"></i> Users</a></li>
<?php if($this->User()->getIsAdmin()): ?>
<li><a href="<?= PHPCI_URL ?>user/add"><i class="icon-plus-sign"></i> Add User</a></li>
<?php endif; ?>
</ul>
</div>
</div>
<div class="span9">
<div class="col-lg-9">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Email Address</th>
<th>Name</th>
<th>Administrator</th>
<th style="width: 1%"></th>
<th style="width: 100px"></th>
</tr>
</thead>
<tbody>
@ -47,8 +45,8 @@
<td>
<?php if($this->User()->getIsAdmin()): ?>
<div class="btn-group">
<a class="btn" href="<?= PHPCI_URL ?>user/edit/<?php print $user->getId(); ?>">Edit</a>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<a class="btn btn-default btn-small" href="<?= PHPCI_URL ?>user/edit/<?php print $user->getId(); ?>">Edit</a>
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">

View file

@ -3,7 +3,7 @@
</div>
<div class="row">
<div class="span4">
<div class="col-lg-4">
<div class="well" style="">
<?php if($type == 'add'): ?>
<p>Fill in the form to the right to add a new user.</p>
@ -12,7 +12,7 @@
<?php endif; ?>
</div>
</div>
<div class="span8">
<div class="col-lg-8">
<?php print $form; ?>
</div>
</div>

View file

@ -15,19 +15,27 @@
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="<?= PHPCI_URL ?>">PHPCI <span class="badge badge-important" style="position: relative; top: -3px; margin-left: 10px">1.0.0 Beta</span></a>
<div class="container">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?= PHPCI_URL ?>">PHPCI <span class="label label-danger" style="position: relative; top: -3px; margin-left: 10px">1.0 Beta</span></a>
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav pull-right">
<li><a href="<?= PHPCI_URL ?>session/logout">Log out</a></li>
</ul>
<?php if($this->User()->getIsAdmin()): ?>
<a class="btn btn-success navbar-btn pull-right" href="<?= PHPCI_URL ?>project/add">Add Project</a>
<?php endif; ?>
</div>
<ul class="nav pull-right">
<li><a href="<?= PHPCI_URL ?>session/logout">Log out</a></li>
</ul>
<?php if($this->User()->getIsAdmin()): ?>
<a class="pull-right btn" href="<?= PHPCI_URL ?>project/add">Add Project</a>
<?php endif; ?>
</div>
</div>
</div>

View file

@ -43,29 +43,6 @@ $conf['b8']['view']['path'] = dirname(__FILE__) . '/PHPCI/View/';
$config = new b8\Config($conf);
if (file_exists(APPLICATION_PATH . 'config.php')) {
require(APPLICATION_PATH . 'config.php');
$conf = $config->get(null);
unset($conf['b8']['app']);
unset($conf['b8']['view']);
$conf['phpci']['url'] = $conf['install_url'];
if (isset($conf['github_app'])) {
$conf['phpci']['github'] = $conf['github_app'];
}
unset($conf['install_url']);
unset($conf['github_app']);
$dumper = new Symfony\Component\Yaml\Dumper();
$yaml = $dumper->dump($conf);
file_put_contents(APPLICATION_PATH . 'PHPCI/config.yml', $yaml);
unlink(APPLICATION_PATH . 'config.php');
}
if (file_exists(APPLICATION_PATH . 'PHPCI/config.yml')) {
$config->loadYaml(APPLICATION_PATH . 'PHPCI/config.yml');

840
public/assets/css/bootstrap.min.css vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

9
public/assets/js/bootstrap.min.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

View file

@ -82,7 +82,7 @@ function updateBuildView(data)
for(var plugin in data.plugins)
{
var row = $('<tr>').addClass(data.plugins[plugin] ? 'success' : 'error');
var name = $('<td>').html('<strong>' + plugin + '</strong>');
var name = $('<td>').html('<strong>' + formatPluginName(plugin) + '</strong>');
var status = $('<td>').text(data.plugins[plugin] ? 'OK' : 'Failed');
row.append(name);
@ -168,4 +168,19 @@ function setupProjectForm()
$('#element-token').val('');
}
});
}
function formatPluginName (name) {
name = name.replace(new RegExp('_', 'g'), ' ');
name = ucwords(name);
name = name.replace(new RegExp('Php', 'g'), 'PHP');
return name;
}
function ucwords (str) {
return (str + '').replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function ($1) {
return $1.toUpperCase();
});
}

View file

@ -16,3 +16,4 @@ require_once('../bootstrap.php');
$fc = new PHPCI\Application($config, new b8\Http\Request());
print $fc->handleRequest();