Removed Github configuration from ProjectController / ProjectForm and added it to a new settings area.

This commit is contained in:
Dan Cryer 2013-10-11 21:51:23 +01:00
commit 2a47b08fec
10 changed files with 332 additions and 88 deletions

View file

@ -5,8 +5,6 @@
<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><a href="<?= PHPCI_URL ?>plugin"><i class="icon-user"></i> Manage Plugins</a></li>
</ul>
<?php if (count($projects)): ?>

View file

@ -175,6 +175,3 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="loading">Loading...</div>

View file

@ -0,0 +1,62 @@
<?php if (isset($_GET['saved'])): ?>
<p class="alert alert-success" style="margin-bottom: 20px;">
Your settings have been saved.
</p>
<?php endif; ?>
<?php if (isset($_GET['linked']) && $_GET['linked'] == 1): ?>
<p class="alert alert-success" style="margin-bottom: 20px;">
Your Github account has been linked.
</p>
<?php endif; ?>
<?php if (isset($_GET['linked']) && $_GET['linked'] == 2): ?>
<p class="alert alert-danger" style="margin-bottom: 20px;">
Your Github account could not be linked.
</p>
<?php endif; ?>
<div class="box">
<div class="row">
<div class="col-lg-12">
<h3 class="title">Github Application</h3>
<?php
$id = $settings['phpci']['github']['id'];
$returnTo = PHPCI_URL . 'settings/github-callback';
$githubUri = 'https://github.com/login/oauth/authorize?client_id='.$id.'&scope=repo&redirect_uri=' . $returnTo;
?>
<?php if (!empty($id) && empty($settings['phpci']['github']['token'])): ?>
<p class="alert alert-warning clearfix">
Before you can start using Github, you need to <a href="<?= $githubUri; ?>">sign in</a> and grant PHPCI access to your account.
</p>
<?php endif; ?>
<?php if (!empty($id) && !empty($settings['phpci']['github']['token'])): ?>
<p class="alert alert-success">
PHPCI is successfully linked to Github account
<strong>
<a href="<?= $githubUser['html_url']; ?>"><?= $githubUser['name']; ?></a>
</strong>
</p>
<?php endif; ?>
</div>
<div class="col-lg-8">
<?php print $github; ?>
</div>
<div class="col-lg-4">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Where to find these...</h3>
</div>
<div class="panel-body">
<p>If you own the application you would like to use, you can find this information within your
<a href="https://github.com/settings/applications">applications</a> settings area.</p>
</div>
</div>
</div>
</div>
</div>

View file

@ -6,7 +6,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='//fonts.googleapis.com/css?family=Roboto:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto:300,500&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="<?= PHPCI_URL ?>assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?= PHPCI_URL ?>assets/css/phpci.css">
@ -36,12 +36,25 @@
<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>
<li><p class="navbar-text"><strong><?php print $this->User()->getName(); ?></strong></p></li>
<li><a href="<?php print PHPCI_URL ?>session/logout">Log out</a></li>
<?php if ($this->User()->getIsAdmin()): ?>
<li>
<div class="btn-group">
<a class="btn btn-success navbar-btn" href="<?= PHPCI_URL ?>project/add">Add Project</a>
<?php if($this->User()->getIsAdmin()): ?>
<a class="btn btn-success navbar-btn pull-right" href="<?= PHPCI_URL ?>project/add">Add Project</a>
<?php endif; ?>
<button type="button" class="btn navbar-btn btn-default dropdown-toggle" data-toggle="dropdown">
Admin <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="/settings">Settings</a></li>
<li><a href="/plugin">Manage Plugins</a></li>
<li><a href="/user">Manage Users</a></li>
</ul>
</div>
</li>
<?php endif; ?>
</ul>
</div>
@ -52,5 +65,7 @@
<div id="content" class="container">
<?php print $content; ?>
</div>
<div id="loading">Loading...</div>
</body>
</html>