diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-11-26 12:18:55 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-11-28 14:02:59 +0000 |
commit | 126bca43b72cc01bb71f6f449d1a3cc4254726d7 (patch) | |
tree | 4f69ea39a7905b662eb75001e410691ccb98d560 /bitbake/lib | |
parent | 5790337cec89f9c848e706e5c305ee83ac76496c (diff) | |
download | poky-126bca43b72cc01bb71f6f449d1a3cc4254726d7.tar.gz |
bitbake: toastergui: new project page
Patch that brings in to new project page according to specifications.
[YOCTO #6596]
(Bitbake rev: be357d147d525ac3d6b7bd33ca0aa594728ffedd)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/base.html | 2 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/newproject.html | 116 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 7 |
3 files changed, 92 insertions, 33 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html index 8170a3db88..594c495bd3 100644 --- a/bitbake/lib/toaster/toastergui/templates/base.html +++ b/bitbake/lib/toaster/toastergui/templates/base.html | |||
@@ -60,7 +60,7 @@ | |||
60 | </a> | 60 | </a> |
61 | {%if MANAGED %} | 61 | {%if MANAGED %} |
62 | <div class="btn-group pull-right"> | 62 | <div class="btn-group pull-right"> |
63 | <a class="btn" href="{% url 'newproject' %}">New project</a> | 63 | <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a> |
64 | </div> | 64 | </div> |
65 | <!-- New build popover --> | 65 | <!-- New build popover --> |
66 | <div class="btn-group pull-right" id="new-build-button"> | 66 | <div class="btn-group pull-right" id="new-build-button"> |
diff --git a/bitbake/lib/toaster/toastergui/templates/newproject.html b/bitbake/lib/toaster/toastergui/templates/newproject.html index 43c4e28bee..5a5e1e6dfe 100644 --- a/bitbake/lib/toaster/toastergui/templates/newproject.html +++ b/bitbake/lib/toaster/toastergui/templates/newproject.html | |||
@@ -3,35 +3,91 @@ | |||
3 | {% load humanize %} | 3 | {% load humanize %} |
4 | {% block pagecontent %} | 4 | {% block pagecontent %} |
5 | <div class="row-fluid"> | 5 | <div class="row-fluid"> |
6 | <div class="span6"> | 6 | <div class="page-header"> |
7 | <div class="page-header"> | 7 | <h1>Create a new project</h1> |
8 | <h1>Create a new project</h1> | 8 | </div> |
9 | </div> | 9 | <div class="container-fluid"> |
10 | <div class="container-fluid"> | 10 | {% if alert %} |
11 | {% if alert %} | 11 | <div class="alert alert-error row-fluid" role="alert">{{alert}}</div> |
12 | <div class="alert alert-error row-fluid" role="alert">{{alert}}</div> | 12 | {% endif %} |
13 | {% endif %} | 13 | </div> |
14 | </div> | 14 | {% if releases.count > 0 %} |
15 | <form method="POST">{% csrf_token %} | 15 | <form method="POST">{% csrf_token %} |
16 | <fieldset> | 16 | <fieldset> |
17 | <label>Project name <span class="muted">(required)</span></label> | 17 | <label>Project name <span class="muted">(required)</span></label> |
18 | <input type="text" class="input-xlarge" required name="projectname" value="{{projectname}}"> | 18 | <input type="text" class="input-xlarge" required id="new-project-name" name="projectname"> |
19 | <label class="project-form"> | 19 | {% if releases.count > 1 %} |
20 | Yocto Project version | 20 | <label class="project-form"> |
21 | <i class="icon-question-sign get-help" title="This sets the branch for the Yocto Project core layers (meta, meta-yocto and meta-yocto-bsp), and for the layers you use from the OpenEmbedded Metadata Index"></i> | 21 | Release version |
22 | </label> | 22 | <i class="icon-question-sign get-help" title="The version of the build system you want to use"></i> |
23 | <select name="projectversion" id="projectversion"> | 23 | </label> |
24 | {% for release in releases %} | 24 | <select name="projectversion" id="projectversion"> |
25 | <option value="{{release.id}}"{%if projectversion == release.id %} selected{%endif%}>{{release.name}} ({{release.description}})</option> | 25 | {% for release in releases %} |
26 | {% endfor %} | 26 | <option value="{{release.id}}"{%if projectversion == release.id %} selected{%endif%}>{{release.description}} ({{release.name}})</option> |
27 | </select> | 27 | {% endfor %} |
28 | </fieldset> | 28 | </select> |
29 | {% for release in releases %} | ||
30 | <div class="row-fluid helptext" id="description-{{release.id}}" style="display: none"> | ||
31 | <span class="help-block span5">{{release.helptext|safe}}</span> | ||
32 | </div> | ||
33 | {% endfor %} | ||
34 | {% else %} | ||
35 | <input type="hidden" name="projectversion" value="{{releases.0.id}}"/> | ||
36 | {% endif %} | ||
37 | </fieldset> | ||
29 | 38 | ||
30 | <div class="form-actions"> | 39 | <div class="form-actions"> |
31 | <input type="submit" class="btn btn-primary btn-large" value="Create project"/> | 40 | <input type="submit" class="btn btn-primary btn-large" value="Create project"></input> |
32 | </div> | 41 | <span class="help-inline" style="vertical-align:middle;">To create a project, you need to enter a project name</span> |
33 | </form> | 42 | </div> |
34 | </div> | 43 | </form> |
35 | </div> | 44 | {% else %} |
36 | </div> | 45 | <br/> |
46 | <div class="alert alert-warning row-fluid span6"> | ||
47 | <h3>No releases configured</h3> | ||
48 | <p> | ||
49 | It looks like Toaster releases have not been configured properly. Contact the person who set up Toaster, and tell them about it. | ||
50 | </p> | ||
51 | <p> | ||
52 | If you are the Toaster administrator, we are sorry: setting up Toaster is not easy. | ||
53 | <ul> | ||
54 | <li><a href="{% url 'admin:orm_release_changelist' %}">Log in to the Django administration interface</a> and check the "Releases" section.</li> | ||
55 | <li>Check out the <a href="https://wiki.yoctoproject.org/wiki/Setting_up_a_hosted_managed_mode_for_Toaster#Releases">documentation about configuring releases</a></li> | ||
56 | </ul> | ||
57 | </p> | ||
58 | </div> | ||
59 | {% endif %} | ||
60 | |||
61 | </div> | ||
62 | <script type="text/javascript"> | ||
63 | $(document).ready(function () { | ||
64 | // hide the new project button | ||
65 | $("#new-project-button").hide(); | ||
66 | $('.btn-primary').attr('disabled', 'disabled'); | ||
67 | |||
68 | // enable submit button when all required fields are populated | ||
69 | $("input#new-project-name").keyup(function() { | ||
70 | if ($("input#new-project-name").val().length > 0 ){ | ||
71 | $('.btn-primary').removeAttr('disabled'); | ||
72 | $(".help-inline").css('visibility','hidden'); | ||
73 | } | ||
74 | else { | ||
75 | $('.btn-primary').attr('disabled', 'disabled'); | ||
76 | $(".help-inline").css('visibility','visible'); | ||
77 | } | ||
78 | }); | ||
79 | |||
80 | // show relevant help text for the selected release | ||
81 | var selected_release = $('select').val(); | ||
82 | $("#description-" + selected_release).show(); | ||
83 | |||
84 | |||
85 | $('select').change(function(){ | ||
86 | var new_release = $('select').val(); | ||
87 | $(".helptext").hide(); | ||
88 | $('#description-' + new_release).fadeIn(); | ||
89 | }); | ||
90 | }) | ||
91 | </script> | ||
92 | </div> | ||
37 | {% endblock %} | 93 | {% endblock %} |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index b13f3e813a..49a7769cdb 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -1894,9 +1894,12 @@ if toastermain.settings.MANAGED: | |||
1894 | 'email': request.user.email if request.user.is_authenticated() else '', | 1894 | 'email': request.user.email if request.user.is_authenticated() else '', |
1895 | 'username': request.user.username if request.user.is_authenticated() else '', | 1895 | 'username': request.user.username if request.user.is_authenticated() else '', |
1896 | 'releases': Release.objects.order_by("id"), | 1896 | 'releases': Release.objects.order_by("id"), |
1897 | 'defaultbranch': ToasterSetting.objects.get(name = "DEFAULT_RELEASE").value, | ||
1898 | } | 1897 | } |
1899 | 1898 | ||
1899 | try: | ||
1900 | context['defaultbranch'] = ToasterSetting.objects.get(name = "DEFAULT_RELEASE").value | ||
1901 | except ToasterSetting.DoesNotExist: | ||
1902 | pass | ||
1900 | 1903 | ||
1901 | if request.method == "GET": | 1904 | if request.method == "GET": |
1902 | # render new project page | 1905 | # render new project page |
@@ -2156,7 +2159,7 @@ if toastermain.settings.MANAGED: | |||
2156 | 2159 | ||
2157 | 2160 | ||
2158 | def _lv_to_dict(x): | 2161 | def _lv_to_dict(x): |
2159 | return {"id": x.pk, "name": x.layer.name, | 2162 | return {"id": x.pk, "name": x.layer.name, |
2160 | "detail": "(" + x.layer.vcs_url + (")" if x.up_branch == None else " | "+x.up_branch.name+")"), | 2163 | "detail": "(" + x.layer.vcs_url + (")" if x.up_branch == None else " | "+x.up_branch.name+")"), |
2161 | "giturl": x.layer.vcs_url, "layerdetailurl" : reverse('layerdetails', args=(x.pk,))} | 2164 | "giturl": x.layer.vcs_url, "layerdetailurl" : reverse('layerdetails', args=(x.pk,))} |
2162 | 2165 | ||