Skip to content

Commit

Permalink
UI updates
Browse files Browse the repository at this point in the history
Made the PR button a "basic" button
Vertically centered the issue checkboxes
Labels will update only once after modal is closed
  • Loading branch information
jolheiser committed Feb 10, 2019
1 parent c6e708f commit 477d07b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion public/css/index.css

Large diffs are not rendered by default.

34 changes: 22 additions & 12 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,22 @@ function initCommentForm() {
var $noSelect = $list.find('.no-select');
var $listMenu = $('.' + selector + ' .menu');
var hasLabelUpdateAction = $listMenu.data('action') == 'update';
var labels = {};

$('.' + selector).dropdown('setting', 'onHide', function(){
hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var
if (hasLabelUpdateAction) {
for (var elementId in labels) {
if (labels.hasOwnProperty(elementId)) {
var label = labels[elementId];
updateIssuesMeta(
label["update-url"],
label["action"],
label["issue-id"],
elementId
);
}
}
location.reload();
}
});
Expand Down Expand Up @@ -308,23 +320,21 @@ function initCommentForm() {
$(this).removeClass('checked');
$(this).find('.octicon').removeClass('octicon-check');
if (hasLabelUpdateAction) {
updateIssuesMeta(
$listMenu.data('update-url'),
"detach",
$listMenu.data('issue-id'),
$(this).data('id')
);
labels[$(this).data('id')] = {
"update-url": $listMenu.data('update-url'),
"action": "detach",
"issue-id": $listMenu.data('issue-id'),
};
}
} else {
$(this).addClass('checked');
$(this).find('.octicon').addClass('octicon-check');
if (hasLabelUpdateAction) {
updateIssuesMeta(
$listMenu.data('update-url'),
"attach",
$listMenu.data('issue-id'),
$(this).data('id')
);
labels[$(this).data('id')] = {
"update-url": $listMenu.data('update-url'),
"action": "attach",
"issue-id": $listMenu.data('issue-id'),
};
}
}

Expand Down
4 changes: 4 additions & 0 deletions public/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,10 @@
display: none;
}

.ui.checkbox.issue-checkbox {
vertical-align: middle;
}

.issue.list {
list-style: none;
padding-top: 15px;
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
{{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}}
<div class="fitted item">
<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.BranchName | EscapePound}}">
<button class="ui small compact button">{{.i18n.Tr "repo.pulls.compare_changes"}}</button>
<button class="ui small compact basic button">{{.i18n.Tr "repo.pulls.compare_changes"}}</button>
</a>
</div>
{{end}}
Expand Down

0 comments on commit 477d07b

Please sign in to comment.