blob: acb614e9d3704f2b847ae56d2b39632752257486 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001{% extends "base.html" %}
2{% load projecttags %}
3{% load humanize %}
Patrick Williamsf1e5d692016-03-30 15:21:19 -05004
5{% block title %} Create a new project - Toaster {% endblock %}
6
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007{% block pagecontent %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -06008<div class="row">
9 <div class="col-md-12">
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010 <div class="page-header">
11 <h1>Create a new project</h1>
12 </div>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013 {% if alert %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060014 <div class="alert alert-danger" role="alert">{{alert}}</div>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015 {% endif %}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 <form method="POST">{% csrf_token %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060018 <div class="form-group" id="validate-project-name">
19 <label class="control-label">Project name <span class="text-muted">(required)</span></label>
20 <input type="text" class="form-control" required id="new-project-name" name="projectname">
21 </div>
22 <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>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023<!--
24 <fieldset>
25 <label class="project-form">Project type</label>
26 <label class="project-form radio"><input type="radio" name="ptype" value="analysis" checked/> Analysis Project</label>
27
28 {% if releases.count > 0 %}
29 <label class="project-form radio"><input type="radio" name="ptype" value="build" checked /> Build Project</label>
30 {% endif %}
31 </fieldset> -->
32 <input type="hidden" name="ptype" value="build" />
33
34 {% if releases.count > 0 %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060035 <div class="release form-group">
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036 {% if releases.count > 1 %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060037 <label class="control-label">
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 Release
Patrick Williamsc0f7c042017-02-23 20:41:17 -060039 <span class="glyphicon glyphicon-question-sign get-help" title="The version of the build system you want to use"></span>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040 </label>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060041 <select name="projectversion" id="projectversion" class="form-control">
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042 {% for release in releases %}
43 <option value="{{release.id}}"
44 {%if defaultbranch == release.name %}
45 selected
46 {%endif%}
47 >{{release.description}}</option>
48 {% endfor %}
49 </select>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050 <div class="row">
51 <div class="col-md-4">
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052 {% for release in releases %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053 <div class="helptext" id="description-{{release.id}}" style="display: none">
54 <span class="help-block">{{release.helptext|safe}}</span>
55 </div>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056 {% endfor %}
57 {% else %}
58 <input type="hidden" name="projectversion" value="{{releases.0.id}}"/>
59 {% endif %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060060 </div>
61 </div>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062 </fieldset>
63 {% endif %}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060064 <div class="top-air">
65 <input type="submit" id="create-project-button" class="btn btn-primary btn-lg" value="Create project"/>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066 <span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span>
67 </div>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060068
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069 </form>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070 <!--
Patrick Williamsc0f7c042017-02-23 20:41:17 -060071 <div class="col-md-5 well">
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072 <span class="help-block">
73 <h4>Toaster project types</h4>
74 <p>With a <strong>build project</strong> you configure and run your builds from Toaster.</p>
75 <p>With an <strong>analysis project</strong>, the builds are configured and run by another tool
76 (something like Buildbot or Jenkins), and the project only collects the information about the
77 builds (packages, recipes, dependencies, logs, etc). </p>
78 <p>You can read more on <a href="#">how to set up an analysis project</a>
79 in the Toaster manual.</p>
80 <h4>Release</h4>
81 <p>If you create a <strong>build project</strong>, you will need to select a <strong>release</strong>,
82 which is the version of the build system you want to use to run your builds.</p>
83 </div> -->
Patrick Williamsc0f7c042017-02-23 20:41:17 -060084 </div>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085 </div>
86
87 <script type="text/javascript">
88 $(document).ready(function () {
89 // hide the new project button
90 $("#new-project-button").hide();
91 $('.btn-primary').attr('disabled', 'disabled');
92
93 // enable submit button when all required fields are populated
94 $("input#new-project-name").on('input', function() {
95 if ($("input#new-project-name").val().length > 0 ){
96 $('.btn-primary').removeAttr('disabled');
97 $(".help-inline").css('visibility','hidden');
98 }
99 else {
100 $('.btn-primary').attr('disabled', 'disabled');
101 $(".help-inline").css('visibility','visible');
102 }
103 });
104
105 // show relevant help text for the selected release
106 var selected_release = $('select').val();
107 $("#description-" + selected_release).show();
108
109
110 $('select').change(function(){
111 var new_release = $('select').val();
112 $(".helptext").hide();
113 $('#description-' + new_release).fadeIn();
114 });
115
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600116 libtoaster.makeProjectNameValidation($("#new-project-name"),
117 $("#hint-error-project-name"), $("#validate-project-name"),
118 $(".btn-primary"));
119
120
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500121/* // Hide the project release when you select an analysis project
122 function projectType() {
123 if ($("input[type='radio']:checked").val() == 'build') {
124 $('.release').fadeIn();
125 }
126 else {
127 $('.release').fadeOut();
128 }
129 }
130 projectType();
131
132 $('input:radio').change(function(){
133 projectType();
134 }); */
135 });
136 </script>
137
138{% endblock %}