blob: e83b2bea61d5511785d22fb3073c37bfad22d008 [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 %}
8<div class="row-fluid">
9 <div class="page-header">
10 <h1>Create a new project</h1>
11 </div>
12 <div class="container-fluid">
13 {% if alert %}
14 <div class="alert alert-error row-fluid" role="alert">{{alert}}</div>
15 {% endif %}
16 </div>
17
18 <div class="row-fluid">
19 <div class="span6">
20 <form method="POST">{% csrf_token %}
21
22 <fieldset>
23 <label>Project name <span class="muted">(required)</span></label>
24 <input type="text" class="input-xlarge" required id="new-project-name" name="projectname">
25 </fieldset>
26<!--
27 <fieldset>
28 <label class="project-form">Project type</label>
29 <label class="project-form radio"><input type="radio" name="ptype" value="analysis" checked/> Analysis Project</label>
30
31 {% if releases.count > 0 %}
32 <label class="project-form radio"><input type="radio" name="ptype" value="build" checked /> Build Project</label>
33 {% endif %}
34 </fieldset> -->
35 <input type="hidden" name="ptype" value="build" />
36
37 {% if releases.count > 0 %}
38 <fieldset class="release">
39 {% if releases.count > 1 %}
40 <label class="project-form">
41 Release
42 <i class="icon-question-sign get-help" title="The version of the build system you want to use"></i>
43 </label>
44 <select name="projectversion" id="projectversion">
45 {% for release in releases %}
46 <option value="{{release.id}}"
47 {%if defaultbranch == release.name %}
48 selected
49 {%endif%}
50 >{{release.description}}</option>
51 {% endfor %}
52 </select>
53 {% for release in releases %}
54 <div class="row-fluid helptext" id="description-{{release.id}}" style="display: none">
55 <span class="help-block span5">{{release.helptext|safe}}</span>
56 </div>
57 {% endfor %}
58 {% else %}
59 <input type="hidden" name="projectversion" value="{{releases.0.id}}"/>
60 {% endif %}
61 </fieldset>
62 {% endif %}
63
64 <div class="form-actions">
65 <input type="submit" id="create-project-button" class="btn btn-primary btn-large" value="Create project"/>
66 <span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span>
67 </div>
68 </form>
69 </div>
70 <!--
71 <div class="span5 well">
72 <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> -->
84 </div>
85 </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
116/* // Hide the project release when you select an analysis project
117 function projectType() {
118 if ($("input[type='radio']:checked").val() == 'build') {
119 $('.release').fadeIn();
120 }
121 else {
122 $('.release').fadeOut();
123 }
124 }
125 projectType();
126
127 $('input:radio').change(function(){
128 projectType();
129 }); */
130 });
131 </script>
132
133{% endblock %}