@(issue: model.Issue, issueLabels: List[model.Label], labels: List[model.Label], hasWritePermission: Boolean, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) @import view.helpers._ <div style="margin-bottom: 8px;"> <span class="strong">Labels</span> @if(hasWritePermission){ <div class="pull-right"> @helper.html.dropdown(right = true) { @labels.map { label => <li> <a href="#" class="toggle-label" data-label-id="@label.labelId"> @helper.html.checkicon(issueLabels.exists(_.labelId == label.labelId)) <span class="label" style="background-color: #@label.color;"> </span> @label.labelName </a> </li> } } </div> } </div> <ul class="label-list nav nav-pills nav-stacked"> @labellist(issueLabels) </ul> <script> $(function(){ $('a.toggle-label').click(function(){ var path, icon; var i = $(this).children('i'); if(i.hasClass('icon-ok')){ path = 'delete'; icon = 'icon-white'; } else { path = 'new'; icon = 'icon-ok'; } $.post('@url(repository)/issues/@issue.issueId/label/' + path, { labelId : $(this).data('label-id') }, function(data){ i.removeClass().addClass(icon); $('ul.label-list').empty().html(data); }); return false; }); }); </script>