mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-03 20:15:59 +01:00
- Replace urls with helpers.url and helpers.assets - Move google-code-prettify to main.scala.html - Move some CSS styles to gitbucket.css
51 lines
2.3 KiB
HTML
51 lines
2.3 KiB
HTML
@(label: Option[model.Label], repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
|
@import context._
|
|
@import view.helpers._
|
|
@defining((if(label.isEmpty) ("new", 190, 4) else ("edit", 180, 8))){ case (mode, width, margin) =>
|
|
<div id="@(mode)LabelArea">
|
|
<form method="POST" id="edit-label-form"
|
|
action="@url(repository)/issues/label/@{if(mode == "new") "new" else label.get.labelId + "/edit"}"
|
|
validate="true" @if(mode == "edit"){ style="margin-bottom: 8px;"}>
|
|
<span id="error-@(mode)LabelName" class="error"></span>
|
|
<input type="text" name="@(mode)LabelName" id="@(mode)LabelName" style="width: @(width)px; margin-left: @(margin)px; margin-bottom: 0px;" value="@label.map(_.labelName)"@if(mode == "new"){ placeholder="New label name"}/>
|
|
<span id="error-@(mode)Color" class="error"></span>
|
|
<div class="input-append color bscp" data-color="#@label.map(_.color).getOrElse("888888")" data-color-format="hex" id="@(mode)Color" style="width: @(width)px; margin-bottom: 0px;">
|
|
<input type="text" class="span3" name="@(mode)Color" value="#@label.map(_.color)" readonly style="width: @(width - 12)px; margin-left: @(margin)px;">
|
|
<span class="add-on"><i style="background-color: #@label.map(_.color).getOrElse("888888");"></i></span>
|
|
</div>
|
|
<input type="submit" class="btn" style="margin-left: @(margin)px; margin-bottom: 0px;" value="@if(mode == "new"){Create} else {Save}"/>
|
|
@if(mode == "edit"){
|
|
<input type="hidden" name="editLabelId" value="@label.map(_.labelId)"/>
|
|
}
|
|
</form>
|
|
<script>
|
|
$(function(){
|
|
@if(mode == "new"){
|
|
$('#newColor').colorpicker();
|
|
} else {
|
|
$('#editColor').colorpicker();
|
|
|
|
$('#edit-label-form').submit(function(e){
|
|
var form = $(e.target);
|
|
$.post(form.attr('action') + '/validate', $(form).serialize(), function(data){
|
|
// clear all error messages
|
|
$('.error').text('');
|
|
|
|
if($.isEmptyObject(data)){
|
|
$.post(form.attr('action'), $(form).serialize(), function(data){
|
|
$('#label-edit').parent().empty().html(data);
|
|
});
|
|
} else {
|
|
$.each(data, function(key, value){
|
|
$('#error-' + key).text(value);
|
|
});
|
|
}
|
|
}, 'json');
|
|
return false;
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
}
|