Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | {% extends "base.html" %} |
| 2 | {% load projecttags %} |
| 3 | {% load humanize %} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 4 | |
| 5 | {% block title %} Create a new project - Toaster {% endblock %} |
| 6 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | {% block pagecontent %} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 8 | <div class="row"> |
| 9 | <div class="col-md-12"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 10 | <div class="page-header"> |
| 11 | <h1>Create a new project</h1> |
| 12 | </div> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 13 | {% if alert %} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 14 | <div class="alert alert-danger" role="alert">{{alert}}</div> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 15 | {% endif %} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 17 | <form method="POST">{% csrf_token %} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 18 | <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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | <!-- |
| 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 Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 35 | <div class="release form-group"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | {% if releases.count > 1 %} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 37 | <label class="control-label"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | Release |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 39 | <span class="glyphicon glyphicon-question-sign get-help" title="The version of the build system you want to use"></span> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | </label> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 41 | <select name="projectversion" id="projectversion" class="form-control"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | {% 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 Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 50 | <div class="row"> |
| 51 | <div class="col-md-4"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | {% for release in releases %} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 53 | <div class="helptext" id="description-{{release.id}}" style="display: none"> |
| 54 | <span class="help-block">{{release.helptext|safe}}</span> |
| 55 | </div> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | {% endfor %} |
Brad Bishop | 5dd7cbb | 2018-09-05 22:26:40 -0700 | [diff] [blame] | 57 | </div> |
| 58 | </div> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | {% else %} |
| 60 | <input type="hidden" name="projectversion" value="{{releases.0.id}}"/> |
| 61 | {% endif %} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 62 | </div> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 63 | {% endif %} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 64 | <div class="top-air"> |
| 65 | <input type="submit" id="create-project-button" class="btn btn-primary btn-lg" value="Create project"/> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 66 | <span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span> |
| 67 | </div> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 68 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 69 | </form> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 70 | <!-- |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 71 | <div class="col-md-5 well"> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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> --> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 84 | </div> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 116 | libtoaster.makeProjectNameValidation($("#new-project-name"), |
| 117 | $("#hint-error-project-name"), $("#validate-project-name"), |
| 118 | $(".btn-primary")); |
| 119 | |
| 120 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 121 | /* // 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 %} |