Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame^] | 1 | {% extends "base.html" %} |
| 2 | {% load projecttags %} |
| 3 | {% load humanize %} |
| 4 | {% block pagecontent %} |
| 5 | <div class="row-fluid"> |
| 6 | <div class="page-header"> |
| 7 | <h1>Create a new project</h1> |
| 8 | </div> |
| 9 | <div class="container-fluid"> |
| 10 | {% if alert %} |
| 11 | <div class="alert alert-error row-fluid" role="alert">{{alert}}</div> |
| 12 | {% endif %} |
| 13 | </div> |
| 14 | |
| 15 | <div class="row-fluid"> |
| 16 | <div class="span6"> |
| 17 | <form method="POST">{% csrf_token %} |
| 18 | |
| 19 | <fieldset> |
| 20 | <label>Project name <span class="muted">(required)</span></label> |
| 21 | <input type="text" class="input-xlarge" required id="new-project-name" name="projectname"> |
| 22 | </fieldset> |
| 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 %} |
| 35 | <fieldset class="release"> |
| 36 | {% if releases.count > 1 %} |
| 37 | <label class="project-form"> |
| 38 | Release |
| 39 | <i class="icon-question-sign get-help" title="The version of the build system you want to use"></i> |
| 40 | </label> |
| 41 | <select name="projectversion" id="projectversion"> |
| 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> |
| 50 | {% for release in releases %} |
| 51 | <div class="row-fluid helptext" id="description-{{release.id}}" style="display: none"> |
| 52 | <span class="help-block span5">{{release.helptext|safe}}</span> |
| 53 | </div> |
| 54 | {% endfor %} |
| 55 | {% else %} |
| 56 | <input type="hidden" name="projectversion" value="{{releases.0.id}}"/> |
| 57 | {% endif %} |
| 58 | </fieldset> |
| 59 | {% endif %} |
| 60 | |
| 61 | <div class="form-actions"> |
| 62 | <input type="submit" id="create-project-button" class="btn btn-primary btn-large" value="Create project"/> |
| 63 | <span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span> |
| 64 | </div> |
| 65 | </form> |
| 66 | </div> |
| 67 | <!-- |
| 68 | <div class="span5 well"> |
| 69 | <span class="help-block"> |
| 70 | <h4>Toaster project types</h4> |
| 71 | <p>With a <strong>build project</strong> you configure and run your builds from Toaster.</p> |
| 72 | <p>With an <strong>analysis project</strong>, the builds are configured and run by another tool |
| 73 | (something like Buildbot or Jenkins), and the project only collects the information about the |
| 74 | builds (packages, recipes, dependencies, logs, etc). </p> |
| 75 | <p>You can read more on <a href="#">how to set up an analysis project</a> |
| 76 | in the Toaster manual.</p> |
| 77 | <h4>Release</h4> |
| 78 | <p>If you create a <strong>build project</strong>, you will need to select a <strong>release</strong>, |
| 79 | which is the version of the build system you want to use to run your builds.</p> |
| 80 | </div> --> |
| 81 | </div> |
| 82 | </div> |
| 83 | |
| 84 | <script type="text/javascript"> |
| 85 | $(document).ready(function () { |
| 86 | // hide the new project button |
| 87 | $("#new-project-button").hide(); |
| 88 | $('.btn-primary').attr('disabled', 'disabled'); |
| 89 | |
| 90 | // enable submit button when all required fields are populated |
| 91 | $("input#new-project-name").on('input', function() { |
| 92 | if ($("input#new-project-name").val().length > 0 ){ |
| 93 | $('.btn-primary').removeAttr('disabled'); |
| 94 | $(".help-inline").css('visibility','hidden'); |
| 95 | } |
| 96 | else { |
| 97 | $('.btn-primary').attr('disabled', 'disabled'); |
| 98 | $(".help-inline").css('visibility','visible'); |
| 99 | } |
| 100 | }); |
| 101 | |
| 102 | // show relevant help text for the selected release |
| 103 | var selected_release = $('select').val(); |
| 104 | $("#description-" + selected_release).show(); |
| 105 | |
| 106 | |
| 107 | $('select').change(function(){ |
| 108 | var new_release = $('select').val(); |
| 109 | $(".helptext").hide(); |
| 110 | $('#description-' + new_release).fadeIn(); |
| 111 | }); |
| 112 | |
| 113 | /* // Hide the project release when you select an analysis project |
| 114 | function projectType() { |
| 115 | if ($("input[type='radio']:checked").val() == 'build') { |
| 116 | $('.release').fadeIn(); |
| 117 | } |
| 118 | else { |
| 119 | $('.release').fadeOut(); |
| 120 | } |
| 121 | } |
| 122 | projectType(); |
| 123 | |
| 124 | $('input:radio').change(function(){ |
| 125 | projectType(); |
| 126 | }); */ |
| 127 | }); |
| 128 | </script> |
| 129 | |
| 130 | {% endblock %} |