139 lines
5.6 KiB
HTML
139 lines
5.6 KiB
HTML
{% extends "base.html" %}
|
|
{% load projecttags %}
|
|
{% load humanize %}
|
|
|
|
{% block title %} Create a new project - Toaster {% endblock %}
|
|
|
|
{% block pagecontent %}
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="page-header">
|
|
<h1>Create a new project</h1>
|
|
</div>
|
|
{% if alert %}
|
|
<div class="alert alert-danger" role="alert">{{alert}}</div>
|
|
{% endif %}
|
|
|
|
<form method="POST">{% csrf_token %}
|
|
<div class="form-group" id="validate-project-name">
|
|
<label class="control-label">Project name <span class="text-muted">(required)</span></label>
|
|
<input type="text" class="form-control" required id="new-project-name" name="projectname">
|
|
</div>
|
|
<p class="help-block text-danger" style="display: none;" id="hint-error-project-name">A project with this name exists. Project names must be unique.</p>
|
|
<!--
|
|
<fieldset>
|
|
<label class="project-form">Project type</label>
|
|
<label class="project-form radio"><input type="radio" name="ptype" value="analysis" checked/> Analysis Project</label>
|
|
|
|
{% if releases.count > 0 %}
|
|
<label class="project-form radio"><input type="radio" name="ptype" value="build" checked /> Build Project</label>
|
|
{% endif %}
|
|
</fieldset> -->
|
|
<input type="hidden" name="ptype" value="build" />
|
|
|
|
{% if releases.count > 0 %}
|
|
<div class="release form-group">
|
|
{% if releases.count > 1 %}
|
|
<label class="control-label">
|
|
Release
|
|
<span class="glyphicon glyphicon-question-sign get-help" title="The version of the build system you want to use"></span>
|
|
</label>
|
|
<select name="projectversion" id="projectversion" class="form-control">
|
|
{% for release in releases %}
|
|
<option value="{{release.id}}"
|
|
{%if defaultbranch == release.name %}
|
|
selected
|
|
{%endif%}
|
|
>{{release.description}}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
{% for release in releases %}
|
|
<div class="helptext" id="description-{{release.id}}" style="display: none">
|
|
<span class="help-block">{{release.helptext|safe}}</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<input type="hidden" name="projectversion" value="{{releases.0.id}}"/>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
{% endif %}
|
|
<div class="top-air">
|
|
<input type="submit" id="create-project-button" class="btn btn-primary btn-lg" value="Create project"/>
|
|
<span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span>
|
|
</div>
|
|
|
|
</form>
|
|
<!--
|
|
<div class="col-md-5 well">
|
|
<span class="help-block">
|
|
<h4>Toaster project types</h4>
|
|
<p>With a <strong>build project</strong> you configure and run your builds from Toaster.</p>
|
|
<p>With an <strong>analysis project</strong>, the builds are configured and run by another tool
|
|
(something like Buildbot or Jenkins), and the project only collects the information about the
|
|
builds (packages, recipes, dependencies, logs, etc). </p>
|
|
<p>You can read more on <a href="#">how to set up an analysis project</a>
|
|
in the Toaster manual.</p>
|
|
<h4>Release</h4>
|
|
<p>If you create a <strong>build project</strong>, you will need to select a <strong>release</strong>,
|
|
which is the version of the build system you want to use to run your builds.</p>
|
|
</div> -->
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function () {
|
|
// hide the new project button
|
|
$("#new-project-button").hide();
|
|
$('.btn-primary').attr('disabled', 'disabled');
|
|
|
|
// enable submit button when all required fields are populated
|
|
$("input#new-project-name").on('input', function() {
|
|
if ($("input#new-project-name").val().length > 0 ){
|
|
$('.btn-primary').removeAttr('disabled');
|
|
$(".help-inline").css('visibility','hidden');
|
|
}
|
|
else {
|
|
$('.btn-primary').attr('disabled', 'disabled');
|
|
$(".help-inline").css('visibility','visible');
|
|
}
|
|
});
|
|
|
|
// show relevant help text for the selected release
|
|
var selected_release = $('select').val();
|
|
$("#description-" + selected_release).show();
|
|
|
|
|
|
$('select').change(function(){
|
|
var new_release = $('select').val();
|
|
$(".helptext").hide();
|
|
$('#description-' + new_release).fadeIn();
|
|
});
|
|
|
|
libtoaster.makeProjectNameValidation($("#new-project-name"),
|
|
$("#hint-error-project-name"), $("#validate-project-name"),
|
|
$(".btn-primary"));
|
|
|
|
|
|
/* // Hide the project release when you select an analysis project
|
|
function projectType() {
|
|
if ($("input[type='radio']:checked").val() == 'build') {
|
|
$('.release').fadeIn();
|
|
}
|
|
else {
|
|
$('.release').fadeOut();
|
|
}
|
|
}
|
|
projectType();
|
|
|
|
$('input:radio').change(function(){
|
|
projectType();
|
|
}); */
|
|
});
|
|
</script>
|
|
|
|
{% endblock %}
|