xref: /openbmc/openbmc/poky/bitbake/lib/toaster/toastergui/templates/newproject_specific.html (revision 1a4b7ee28bf7413af6513fb45ad0d0736048f866)
1*1a4b7ee2SBrad Bishop{% extends "base.html" %}
2*1a4b7ee2SBrad Bishop{% load projecttags %}
3*1a4b7ee2SBrad Bishop{% load humanize %}
4*1a4b7ee2SBrad Bishop
5*1a4b7ee2SBrad Bishop{% block title %} Create a new project - Toaster {% endblock %}
6*1a4b7ee2SBrad Bishop
7*1a4b7ee2SBrad Bishop{% block pagecontent %}
8*1a4b7ee2SBrad Bishop<div class="row">
9*1a4b7ee2SBrad Bishop  <div class="col-md-12">
10*1a4b7ee2SBrad Bishop    <div class="page-header">
11*1a4b7ee2SBrad Bishop          <h1>Create a new project</h1>
12*1a4b7ee2SBrad Bishop        </div>
13*1a4b7ee2SBrad Bishop    {% if alert %}
14*1a4b7ee2SBrad Bishop      <div class="alert alert-danger" role="alert">{{alert}}</div>
15*1a4b7ee2SBrad Bishop    {% endif %}
16*1a4b7ee2SBrad Bishop
17*1a4b7ee2SBrad Bishop        <form method="POST"  action="{%url "newproject_specific" project_pk %}">{% csrf_token %}
18*1a4b7ee2SBrad Bishop          <div class="form-group" id="validate-project-name">
19*1a4b7ee2SBrad Bishop            <label class="control-label">Project name <span class="text-muted">(required)</span></label>
20*1a4b7ee2SBrad Bishop            <input type="text" class="form-control" required id="new-project-name" name="display_projectname" value="{{projectname}}" disabled>
21*1a4b7ee2SBrad Bishop          </div>
22*1a4b7ee2SBrad Bishop          <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>
23*1a4b7ee2SBrad Bishop        <input type="hidden" name="ptype" value="build" />
24*1a4b7ee2SBrad Bishop        <input type="hidden" name="projectname" value="{{projectname}}" />
25*1a4b7ee2SBrad Bishop
26*1a4b7ee2SBrad Bishop        {% if releases.count > 0 %}
27*1a4b7ee2SBrad Bishop				<div class="release form-group">
28*1a4b7ee2SBrad Bishop            {% if releases.count > 1 %}
29*1a4b7ee2SBrad Bishop              <label class="control-label">
30*1a4b7ee2SBrad Bishop                Release
31*1a4b7ee2SBrad Bishop                <span class="glyphicon glyphicon-question-sign get-help" title="The version of the build system you want to use"></span>
32*1a4b7ee2SBrad Bishop              </label>
33*1a4b7ee2SBrad Bishop              <select name="projectversion" id="projectversion" class="form-control">
34*1a4b7ee2SBrad Bishop                {% for release in releases %}
35*1a4b7ee2SBrad Bishop                    <option value="{{release.id}}"
36*1a4b7ee2SBrad Bishop                        {%if defaultbranch == release.name %}
37*1a4b7ee2SBrad Bishop                            selected
38*1a4b7ee2SBrad Bishop                        {%endif%}
39*1a4b7ee2SBrad Bishop                     >{{release.description}}</option>
40*1a4b7ee2SBrad Bishop                {% endfor %}
41*1a4b7ee2SBrad Bishop              </select>
42*1a4b7ee2SBrad Bishop              <div class="row">
43*1a4b7ee2SBrad Bishop                <div class="col-md-4">
44*1a4b7ee2SBrad Bishop                {% for release in releases %}
45*1a4b7ee2SBrad Bishop                  <div class="helptext" id="description-{{release.id}}" style="display: none">
46*1a4b7ee2SBrad Bishop                    <span class="help-block">{{release.helptext|safe}}</span>
47*1a4b7ee2SBrad Bishop                  </div>
48*1a4b7ee2SBrad Bishop                {% endfor %}
49*1a4b7ee2SBrad Bishop            {% else %}
50*1a4b7ee2SBrad Bishop              <input type="hidden" name="projectversion" value="{{releases.0.id}}"/>
51*1a4b7ee2SBrad Bishop            {% endif %}
52*1a4b7ee2SBrad Bishop                </div>
53*1a4b7ee2SBrad Bishop              </div>
54*1a4b7ee2SBrad Bishop            </fieldset>
55*1a4b7ee2SBrad Bishop        {% endif %}
56*1a4b7ee2SBrad Bishop            <div class="top-air">
57*1a4b7ee2SBrad Bishop              <input type="submit" id="create-project-button" class="btn btn-primary btn-lg" value="Create project"/>
58*1a4b7ee2SBrad Bishop              <span class="help-inline" style="vertical-align:middle;">To create a project, you need to specify the release</span>
59*1a4b7ee2SBrad Bishop            </div>
60*1a4b7ee2SBrad Bishop
61*1a4b7ee2SBrad Bishop        </form>
62*1a4b7ee2SBrad Bishop      </div>
63*1a4b7ee2SBrad Bishop    </div>
64*1a4b7ee2SBrad Bishop
65*1a4b7ee2SBrad Bishop    <script type="text/javascript">
66*1a4b7ee2SBrad Bishop        $(document).ready(function () {
67*1a4b7ee2SBrad Bishop            // hide the new project button, name is preset
68*1a4b7ee2SBrad Bishop            $("#new-project-button").hide();
69*1a4b7ee2SBrad Bishop
70*1a4b7ee2SBrad Bishop            // enable submit button when all required fields are populated
71*1a4b7ee2SBrad Bishop            $("input#new-project-name").on('input', function() {
72*1a4b7ee2SBrad Bishop                if ($("input#new-project-name").val().length > 0 ){
73*1a4b7ee2SBrad Bishop                    $('.btn-primary').removeAttr('disabled');
74*1a4b7ee2SBrad Bishop                    $(".help-inline").css('visibility','hidden');
75*1a4b7ee2SBrad Bishop                }
76*1a4b7ee2SBrad Bishop                else {
77*1a4b7ee2SBrad Bishop                    $('.btn-primary').attr('disabled', 'disabled');
78*1a4b7ee2SBrad Bishop                    $(".help-inline").css('visibility','visible');
79*1a4b7ee2SBrad Bishop                }
80*1a4b7ee2SBrad Bishop            });
81*1a4b7ee2SBrad Bishop
82*1a4b7ee2SBrad Bishop            // show relevant help text for the selected release
83*1a4b7ee2SBrad Bishop            var selected_release = $('select').val();
84*1a4b7ee2SBrad Bishop            $("#description-" + selected_release).show();
85*1a4b7ee2SBrad Bishop
86*1a4b7ee2SBrad Bishop            $('select').change(function(){
87*1a4b7ee2SBrad Bishop                var new_release = $('select').val();
88*1a4b7ee2SBrad Bishop                $(".helptext").hide();
89*1a4b7ee2SBrad Bishop                $('#description-' + new_release).fadeIn();
90*1a4b7ee2SBrad Bishop            });
91*1a4b7ee2SBrad Bishop
92*1a4b7ee2SBrad Bishop        });
93*1a4b7ee2SBrad Bishop    </script>
94*1a4b7ee2SBrad Bishop
95*1a4b7ee2SBrad Bishop{% endblock %}
96