Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | {% extends "base.html" %} |
| 2 | {% load projecttags %} |
| 3 | {% load humanize %} |
| 4 | {% load static %} |
| 5 | {% block pagecontent %} |
| 6 | |
| 7 | {% include "projecttopbar.html" %} |
| 8 | |
| 9 | |
| 10 | {% if project and project.release %} |
| 11 | <script src="{% static 'js/layerDepsModal.js' %}"></script> |
| 12 | <script src="{% static 'js/importlayer.js' %}"></script> |
| 13 | <script> |
| 14 | $(document).ready(function (){ |
| 15 | var ctx = { |
| 16 | xhrImportLayerUrl : "{% url 'xhr_importlayer' %}", |
| 17 | }; |
| 18 | |
| 19 | try { |
| 20 | importLayerPageInit(ctx); |
| 21 | } catch (e) { |
| 22 | document.write("Sorry, An error has occurred loading this page"); |
| 23 | console.warn(e); |
| 24 | } |
| 25 | }); |
| 26 | </script> |
| 27 | |
| 28 | <form class="span11"> |
| 29 | <fieldset> |
| 30 | <legend>Layer repository information</legend> |
| 31 | <span class="help-block">The layer you are importing must be compatible with <strong>{{project.release.description}}</strong>, which is the release you are using in this project.</span> |
| 32 | <div class="alert alert-error" id="import-error" style="display:none"> |
| 33 | <button type="button" class="close" data-dismiss="alert">×</button> |
| 34 | <h3> </h3> |
| 35 | <p></p> |
| 36 | <ul></ul> |
| 37 | </div> |
| 38 | |
| 39 | <div class="control-group" id="layer-name-ctrl"> |
| 40 | <label class="control-label air" for="import-layer-name"> |
| 41 | Layer name |
| 42 | <span class="icon-question-sign get-help" title="Something like 'meta-mylayer'. Your layer name must be unique and can only include letters, numbers and dashes"></span> |
| 43 | </label> |
| 44 | <div class="controls"> |
| 45 | <input id="import-layer-name" type="text" required autofocus data-autocomplete="off" data-provide="typeahead"> |
| 46 | <span class="help-inline" style="display: none;" id="invalid-layer-name-hint">A valid layer name can only include letters, numbers and dashes</span> |
| 47 | <span class="help-inline" style="display: none;" id="duplicated-layer-name-hint"></span> |
| 48 | </div> |
| 49 | |
| 50 | </div> |
| 51 | <div id="duplicate-layer-info" style="display:none"> |
| 52 | <div class="alert warning"> |
| 53 | <h3>A layer called <a href="" class="dup-layer-link"><span class="dup-layer-name"></span></a> already exists</h3> |
| 54 | <p>Layer names must be unqiue. Please use a different layer name.</p> |
| 55 | </div> |
| 56 | <dl> |
| 57 | <dt> |
| 58 | The <span class="dup-layer-name"></span> repository url is |
| 59 | </dt> |
| 60 | <dd> |
| 61 | <span id="dup-layer-vcs-url"></span> |
| 62 | </dd> |
| 63 | |
| 64 | <dt> |
| 65 | The <span class="dup-layer-name"></span> revision is |
| 66 | </dt> |
| 67 | <dd> |
| 68 | <span id="dup-layer-revision"></span> |
| 69 | </dd> |
| 70 | </dl> |
| 71 | |
| 72 | <p><a href="" class="dup-layer-link">View the <span class="dup-layer-name"></span> layer information</a></p> |
| 73 | |
| 74 | </div> |
| 75 | |
| 76 | <div class="fields-apart-from-layer-name"> |
| 77 | <label for="layer-git-repo-url" class="project-form"> |
| 78 | Git repository URL |
| 79 | <span class="icon-question-sign get-help" title="Fetch/clone URL of the repository. Currently, Toaster only supports Git repositories." ></span> |
| 80 | </label> |
| 81 | |
| 82 | <input type="text" id="layer-git-repo-url" class="input-xxlarge" required> |
| 83 | <label class="project-form" for="layer-subdir"> |
| 84 | Repository subdirectory |
| 85 | <span class="muted">(optional)</span> |
| 86 | <span class="icon-question-sign get-help" title="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)"></span> |
| 87 | </label> |
| 88 | <input type="text" id="layer-subdir"> |
| 89 | |
| 90 | <div class="control-group" id="layer-revision-ctrl"> |
| 91 | <label class="control-label project-form" for="layer-git-ref">Revision |
| 92 | <span class="icon-question-sign get-help" title="You can provide a Git branch, a tag or a commit SHA as the revision"></span> |
| 93 | </label> |
| 94 | <div class="controls"> |
| 95 | <input type="text" class="span3" id="layer-git-ref" required> |
| 96 | <span class="help-inline" style="diaply:none;" id="invalid-layer-revision-hint"></span> |
| 97 | </div> |
| 98 | </div> |
| 99 | </div> |
| 100 | |
| 101 | </fieldset> |
| 102 | |
| 103 | <div class="fields-apart-from-layer-name"> |
| 104 | <fieldset class="air"> |
| 105 | <legend> |
| 106 | Layer dependencies |
| 107 | <span class="muted">(optional)</span> |
| 108 | <span class="icon-question-sign get-help heading-help" title="Other layers this layer depends upon"></span> |
| 109 | </legend> |
| 110 | <ul class="unstyled configuration-list" id="layer-deps-list"> |
| 111 | </ul> |
| 112 | <div class="input-append"> |
| 113 | <input type="text" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" placeholder="Type a layer name" id="layer-dependency" class="input-xlarge"> |
| 114 | <a class="btn" id="add-layer-dependency-btn"> |
| 115 | Add layer |
| 116 | </a> |
| 117 | </div> |
| 118 | <span class="help-inline">You can only add layers Toaster knows about</span> |
| 119 | </fieldset> |
| 120 | <div class="air" id="form-actions"> |
| 121 | <button class="btn btn-primary btn-large" data-toggle="modal" id="import-and-add-btn" data-target="#dependencies-message" disabled>Import and add to project</button> |
| 122 | <span class="help-inline" id="import-and-add-hint" style="vertical-align: middle;">To import a layer you need to enter a layer name, a Git repository URL and a revision (branch, tag or commit)</span> |
| 123 | </div> |
| 124 | </div> |
| 125 | </form> |
| 126 | |
| 127 | {% else %} {#project and project release#} |
| 128 | <div class="page-header"> |
| 129 | <h1>Import layer</h1> |
| 130 | </div> |
| 131 | <div class="alert alert-info" id="import-error" > |
| 132 | <h3>Unsupported project type</h3> |
| 133 | <p>This project does not support importing layers.</p> |
| 134 | <ul></ul> |
| 135 | </div> |
| 136 | |
| 137 | {% endif %} |
| 138 | {% endblock %} |