phpci/PHPCI/View/ProjectForm.phtml

51 lines
1.5 KiB
PHTML

<div id="title">
<h1><?= $type == 'add' ? 'Add Project' : 'Edit Project' ?></h1>
</div>
<div class="row">
<div class="span4">
<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;"><?= $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="span8">
<?= $form; ?>
</div>
</div>
<script>
$(document).ready(function()
{
$('#element-reference').change(function()
{
var el = $(this);
var val = el.val();
var acceptable = {
'github_ssh': /git\@github\.com\:([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
'github_git': /git\:\/\/github.com\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
'github_http': /https\:\/\/github\.com\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)(\.git)?/,
'bb_ssh': /git\@bitbucket\.org\:([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
'bb_http': /https\:\/\/[a-zA-Z0-9_\-]+\@bitbucket.org\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
'bb_anon': /https\:\/\/bitbucket.org\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)(\.git)?/
};
for(var i in acceptable) {
if(val.match(acceptable[i])) {
el.val(val.replace(acceptable[i], '$1'));
}
}
});
});
</script>