mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00

Change the data structure to support multiple branches. At the top level there is a set list of Branch objects, and then a LayerBranch object between each layer and the maintainers, dependencies, recipes and machines, so that the set of each can be different per branch. The branch is a session option, and can be selected via a drop-down that is shown for all pages. Additionally, with this change we avoid the need to run the update script within a build environment set up with oe-init-build-env - since we need a specific version of BitBake per branch we now use our own copy of BitBake which is fetched by the script itself. The update script will need to be called multiple times however - once per branch. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
270 lines
11 KiB
HTML
270 lines
11 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% comment %}
|
|
|
|
layerindex-web - layer editing form page template
|
|
|
|
Copyright (C) 2013 Intel Corporation
|
|
Licensed under the MIT license, see COPYING.MIT for details
|
|
|
|
{% endcomment %}
|
|
|
|
<!--
|
|
{% block title %}OpenEmbedded metadata index - edit layer{% endblock %}
|
|
-->
|
|
|
|
{% block submitlink %}
|
|
<!-- Remove submit link added by base.html, otherwise clicking it may lose changes -->
|
|
{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
{% autoescape on %}
|
|
|
|
<div class="container-fluid">
|
|
<div class="row-fluid">
|
|
{% block heading %}
|
|
<div class="page-header">
|
|
<h1>Edit layer</h1>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block formtop %}
|
|
{% if form.was_saved %}
|
|
<div class="alert alert-success">
|
|
Changes saved successfully.
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|
|
<form id="edit_layer_form" method="post">
|
|
{% csrf_token %}
|
|
{% for hidden in form.hidden_fields %}
|
|
{{ hidden }}
|
|
{% endfor %}
|
|
|
|
<div class="formfields">
|
|
{% for field in form.visible_fields %}
|
|
{% if field.name != 'captcha' %}
|
|
{% if field.errors %}
|
|
<div class="control-group alert alert-error">
|
|
{{ field.errors }}
|
|
{% else %}
|
|
<div class="control-group">
|
|
{% endif %}
|
|
<div class="control-label">
|
|
{{ field.label_tag }}
|
|
</div>
|
|
<div class="controls">
|
|
{% if field.name = 'deps' %}
|
|
<div class="scrolling">
|
|
<table><tbody>
|
|
{% for deplayer in deplistlayers %}
|
|
{% if deplayer.id in form.checked_deps %}
|
|
<tr>
|
|
<td><input type="checkbox" name="deps" value="{{ deplayer.id }}" id="id_deps_{{forloop.counter}}" checked="checked" /></td>
|
|
{% if deplayer.status = 'N' %}
|
|
<td><label class="muted" for="id_deps_{{forloop.counter}}">{{ deplayer.name }} (unpublished)</label></td>
|
|
{% else %}
|
|
<td><label for="id_deps_{{forloop.counter}}">{{ deplayer.name }}</label></td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% for deplayer in deplistlayers %}
|
|
{% if not deplayer.id in form.checked_deps %}
|
|
<tr>
|
|
<td><input type="checkbox" name="deps" value="{{ deplayer.id }}" id="id_deps_{{forloop.counter}}" /></td>
|
|
{% if deplayer.status = 'N' %}
|
|
<td><label class="muted" for="id_deps_{{forloop.counter}}">{{ deplayer.name }} (unpublished)</label></td>
|
|
{% else %}
|
|
<td><label for="id_deps_{{forloop.counter}}">{{ deplayer.name }}</label></td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</tbody></table>
|
|
</div>
|
|
{% else %}
|
|
{{ field }}
|
|
{% endif %}
|
|
<span class="help-inline custom-help">
|
|
{{ field.help_text }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
<h3 id="maintainers">Maintainers</h3>
|
|
{{ maintainerformset.non_form_errors }}
|
|
{{ maintainerformset.management_form }}
|
|
{% for maintainerform in maintainerformset %}
|
|
<div class="maintainerform" id="maintainerform-{{forloop.counter0}}">
|
|
<h4>Maintainer {{forloop.counter}}</h4>
|
|
<div class="maintainerformfields">
|
|
{% for hidden in maintainerform.hidden_fields %}
|
|
{{ hidden }}
|
|
{% endfor %}
|
|
|
|
{% for field in maintainerform.visible_fields %}
|
|
{% if field.errors %}
|
|
<div class="control-group alert alert-error">
|
|
{{ field.errors }}
|
|
{% else %}
|
|
<div class="control-group">
|
|
{% endif %}
|
|
<div class="control-label">
|
|
{{ field.label_tag }}
|
|
</div>
|
|
<div class="controls">
|
|
{{ field }}
|
|
<span class="help-inline custom-help">
|
|
{{ field.help_text }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
<p><a href="#" class="btn btn-small" id="addanothermaintainer"><i class="icon-plus"></i>Add maintainer</a><p>
|
|
|
|
|
|
{% if form.captcha %}
|
|
<div class="captchafield">
|
|
<h3>Verification</h3>
|
|
{% if form.captcha.errors %}
|
|
<div class="control-group alert alert-error">
|
|
{{ form.captcha.errors }}
|
|
{% else %}
|
|
<div class="control-group">
|
|
{% endif %}
|
|
<div class="controls">
|
|
{{ form.captcha }}
|
|
<span class="help-inline custom-help">
|
|
{{ form.captcha.help_text }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="submitbuttons">
|
|
{% block submitbuttons %}
|
|
<input type="submit" value="Save layer" class="btn btn-primary btn-large" />
|
|
{% endblock %}
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
{% endautoescape %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
if (typeof String.prototype.startsWith != 'function') {
|
|
String.prototype.startsWith = function (str){
|
|
return this.slice(0, str.length) == str;
|
|
};
|
|
}
|
|
|
|
auto_web_fields = function (e) {
|
|
repoval = $('#id_vcs_url').val()
|
|
if( repoval[repoval.length-1] == '/' )
|
|
repoval = repoval.slice(0, repoval.length-1)
|
|
|
|
if( repoval.startsWith('git://git.openembedded.org/') ) {
|
|
reponame = repoval.replace(/^.*\//, '')
|
|
$('#id_vcs_web_url').val('http://cgit.openembedded.org/cgit.cgi/' + reponame)
|
|
$('#id_vcs_web_tree_base_url').val('http://cgit.openembedded.org/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%')
|
|
$('#id_vcs_web_file_base_url').val('http://cgit.openembedded.org/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%')
|
|
}
|
|
else if( repoval.indexOf('git.yoctoproject.org/') > -1 ) {
|
|
reponame = repoval.replace(/^.*\//, '')
|
|
$('#id_vcs_web_url').val('http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame)
|
|
$('#id_vcs_web_tree_base_url').val('http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%')
|
|
$('#id_vcs_web_file_base_url').val('http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%')
|
|
}
|
|
else if( repoval.indexOf('github.com/') > -1 ) {
|
|
reponame = repoval.replace(/^.*github.com\//, '')
|
|
reponame = reponame.replace(/.git$/, '')
|
|
$('#id_vcs_web_url').val('http://github.com/' + reponame)
|
|
$('#id_vcs_web_tree_base_url').val('http://github.com/' + reponame + '/tree/%branch%/')
|
|
$('#id_vcs_web_file_base_url').val('http://github.com/' + reponame + '/blob/%branch%/')
|
|
}
|
|
else if( repoval.indexOf('gitorious.org/') > -1 ) {
|
|
reponame = repoval.replace(/^.*gitorious.org\//, '')
|
|
reponame = reponame.replace(/.git$/, '')
|
|
$('#id_vcs_web_url').val('http://gitorious.org/' + reponame)
|
|
$('#id_vcs_web_tree_base_url').val('http://gitorious.org/' + reponame + '/trees/%branch%/')
|
|
$('#id_vcs_web_file_base_url').val('http://gitorious.org/' + reponame + '/blobs/%branch%/')
|
|
}
|
|
else if( repoval.indexOf('bitbucket.org/') > -1 ) {
|
|
reponame = repoval.replace(/^.*bitbucket.org\//, '')
|
|
reponame = reponame.replace(/.git$/, '')
|
|
$('#id_vcs_web_url').val('http://bitbucket.org/' + reponame)
|
|
$('#id_vcs_web_tree_base_url').val('http://bitbucket.org/' + reponame + '/src/%branch%/%path%?at=%branch%')
|
|
$('#id_vcs_web_file_base_url').val('http://bitbucket.org/' + reponame + '/src/%branch%/%path%?at=%branch%')
|
|
}
|
|
};
|
|
|
|
split_email = function() {
|
|
// Split email name/email address pairs
|
|
name_input = $(this)
|
|
split_regex = /^"?([^"@$<>]+)"? *<([^<> ]+)>[ -]*(.*)?$/
|
|
matches = split_regex.exec(name_input.val())
|
|
if( matches ){
|
|
name_input.val($.trim(matches[1]))
|
|
email_id = name_input.attr('id').replace('-name', '-email')
|
|
$('#' + email_id).val($.trim(matches[2]))
|
|
resp_id = email_id.replace('-email', '-responsibility')
|
|
currval = $('#' + resp_id).val()
|
|
// Set the responsibility with the remainder of the value unless the user has entered a value for
|
|
// responsibility already
|
|
if( currval == window['last_' + resp_id] || currval == "" ) {
|
|
newval = $.trim(matches[3])
|
|
$('#' + resp_id).val(newval)
|
|
window['last_' + resp_id] = newval
|
|
}
|
|
}
|
|
}
|
|
|
|
expand_maintainer = function() {
|
|
for(i=0;i<{{ maintainerformset.total_form_count }};i++) {
|
|
maintbox = $('#maintainerform-' + i)
|
|
if( maintbox.is(':hidden') ) {
|
|
maintbox.slideToggle();
|
|
if( i == {{maintainerformset.total_form_count}} - 1 )
|
|
$('#addanothermaintainer').hide()
|
|
break
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
$('.maintainerform').hide()
|
|
|
|
for(i=0;i<{{ maintainerformset.total_form_count }};i++) {
|
|
name_input = $('#id_layermaintainer_set-' + i + '-name')
|
|
name_input.change(split_email)
|
|
resp_id = 'id_layermaintainer_set-' + i + '-responsibility'
|
|
window['last_' + resp_id] = ""
|
|
if( i==0 || name_input.val() )
|
|
$('#maintainerform-' + i).show()
|
|
}
|
|
$('#addanothermaintainer').click(expand_maintainer)
|
|
|
|
$('#id_vcs_url').change(auto_web_fields)
|
|
|
|
firstfield = $("#edit_layer_form input:text, #edit_layer_form textarea").first();
|
|
if( ! firstfield.val() )
|
|
firstfield.focus()
|
|
});
|
|
</script>
|
|
{% endblock %}
|