php-censor/PHPCI/View/ProjectForm.phtml

40 lines
1.2 KiB
PHTML

<div id="title">
<h1><?php print $type == 'add' ? 'Add Project' : 'Edit Project' ?></h1>
</div>
<div class="row">
<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>
<textarea style="width: 90%; height: 150px;"><?php print $key ?></textarea>
<?php elseif($type == 'add'): ?>
<p>Fill in the form to the right to add your new project.</p>
<?php else: ?>
<p>Edit your project details using the form to the right.</p>
<?php endif; ?>
</div>
</div>
<div class="col-lg-8">
<?php print $form; ?>
</div>
</div>
<script>
window.return_url = <?php print json_encode((empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); ?>;
<?php
$gh = \b8\Config::getInstance()->get('phpci.github', null);
if($gh) {
print 'window.github_app_id = ' . json_encode($gh['id']) . ';' . PHP_EOL;
}
if(!empty($token)) {
print 'window.github_token = ' . json_encode($token) . ';' . PHP_EOL;
}
?>
$(document).ready(setupProjectForm);
</script>