Initial work on upgrading to Bootstrap v3

This commit is contained in:
Dan Cryer 2013-08-01 11:55:10 +01:00
parent c935c5c7ee
commit 8b5abc1f98
14 changed files with 110 additions and 903 deletions

View file

@ -262,13 +262,13 @@ 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('col-lg-4 form-control');
$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('col-lg-4 form-control');
$field->setOptions($this->getGithubRepositories());
$form->addField($field);
}
@ -302,24 +302,25 @@ 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('col-lg-4 form-control');
$form->addField($field);
$field = new Form\Element\Text('title');
$field->setRequired(true);
$field->setLabel('Project Title');
$field->setClass('span4');
$field->setClass('col-lg-4 form-control');
$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('col-lg-7 form-control');
$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,13 @@ 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');
$form->addField($email);
$pwd = new b8\Form\Element\Password('password');
$pwd->setLabel('Password');
$pwd->setRequired(true);
$pwd->setClass('span3');
$pwd->setContainerClass('form-group');
$form->addField($pwd);
$pwd = new b8\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,8 +16,8 @@
<?php endif; ?>
</div>
</div>
<div class="span8">
<?php print $form; ?>
<div class="col-lg-8">
<?php print str_replace(array('span7', 'control-group'), array('col-lg-7', 'form-group'), $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

@ -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>

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

File diff suppressed because one or more lines are too long

9
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();