Skip to content

Commit d26d249

Browse files
jolheisertechknowlogick
authored andcommitted
Minor UI tweaks (#5980)
* Remove all CommitStatus when a repo is deleted Signed-off-by: jolheiser <[email protected]> * Minor UI tweaks (#5782) Added 'No License' option Added link and octicon change for external issue trackers Reset password now notifies right away if the code is invalid Signed-off-by: jolheiser <[email protected]> * More UI tweaks More info in PR * Generate stylesheet for arc-green * Make gofmt work * Change PR integration since the button is changed * Rebase * Generate stylesheet * UI updates Made the PR button a "basic" button Vertically centered the issue checkboxes Labels will update only once after modal is closed * Commit to reference related issues Resolves #5782 Resolves #5861 Addresses original question in #5993 * Change the comment wording since PR button is no longer little and green. * Revert changes that made Windows work * Regenerate stylesheet * Regenerate stylesheets * make generate-stylesheets * Update integration again, changed button style Signed-off-by: jolheiser <[email protected]> * Added ID to PR button Changed integration to use the ID to avoid breaking in the future * Added missing semi-colons * Added back distinction between issue actions and filters (overlooked it before) Moved action button over next to other action dropdowns * Remove extra tab formatting in list.tmpl * Remove more formatting from GoLand * Replace hardcoded "No License" with i18n license helper.
1 parent 2982413 commit d26d249

File tree

15 files changed

+115
-53
lines changed

15 files changed

+115
-53
lines changed

integrations/pull_create_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch, titl
1818
req := NewRequest(t, "GET", path.Join(user, repo))
1919
resp := session.MakeRequest(t, req, http.StatusOK)
2020

21-
// Click the little green button to create a pull
21+
// Click the PR button to create a pull
2222
htmlDoc := NewHTMLParser(t, resp.Body)
23-
link, exists := htmlDoc.doc.Find("button.ui.green.tiny.compact.button").Parent().Attr("href")
23+
link, exists := htmlDoc.doc.Find("#new-pull-request").Parent().Attr("href")
2424
assert.True(t, exists, "The template has changed")
2525
if branch != "master" {
2626
link = strings.Replace(link, ":master", ":"+branch, 1)

modules/context/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func (ctx *Context) NotFound(title string, err error) {
121121
}
122122
}
123123

124+
ctx.Data["IsRepo"] = ctx.Repo.Repository != nil
124125
ctx.Data["Title"] = "Page Not Found"
125126
ctx.HTML(http.StatusNotFound, base.TplName("status/404"))
126127
}

modules/context/repo.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ func RepoAssignment() macaron.Handler {
337337
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
338338
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
339339

340+
unit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalTracker)
341+
if err == nil {
342+
ctx.Data["RepoExternalIssuesLink"] = unit.ExternalTrackerConfig().ExternalTrackerURL
343+
}
344+
340345
tags, err := ctx.Repo.GitRepo.GetTags()
341346
if err != nil {
342347
ctx.ServerError("GetTags", err)

public/css/index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/css/theme-arc-green.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/index.js

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,22 @@ function initCommentForm() {
380380
var $noSelect = $list.find('.no-select');
381381
var $listMenu = $('.' + selector + ' .menu');
382382
var hasLabelUpdateAction = $listMenu.data('action') == 'update';
383+
var labels = {};
383384

384385
$('.' + selector).dropdown('setting', 'onHide', function(){
385386
hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var
386387
if (hasLabelUpdateAction) {
388+
for (var elementId in labels) {
389+
if (labels.hasOwnProperty(elementId)) {
390+
var label = labels[elementId];
391+
updateIssuesMeta(
392+
label["update-url"],
393+
label["action"],
394+
label["issue-id"],
395+
elementId
396+
);
397+
}
398+
}
387399
location.reload();
388400
}
389401
});
@@ -417,23 +429,29 @@ function initCommentForm() {
417429
$(this).removeClass('checked');
418430
$(this).find('.octicon').removeClass('octicon-check');
419431
if (hasLabelUpdateAction) {
420-
updateIssuesMeta(
421-
$listMenu.data('update-url'),
422-
"detach",
423-
$listMenu.data('issue-id'),
424-
$(this).data('id')
425-
);
432+
if (!($(this).data('id') in labels)) {
433+
labels[$(this).data('id')] = {
434+
"update-url": $listMenu.data('update-url'),
435+
"action": "detach",
436+
"issue-id": $listMenu.data('issue-id'),
437+
};
438+
} else {
439+
delete labels[$(this).data('id')];
440+
}
426441
}
427442
} else {
428443
$(this).addClass('checked');
429444
$(this).find('.octicon').addClass('octicon-check');
430445
if (hasLabelUpdateAction) {
431-
updateIssuesMeta(
432-
$listMenu.data('update-url'),
433-
"attach",
434-
$listMenu.data('issue-id'),
435-
$(this).data('id')
436-
);
446+
if (!($(this).data('id') in labels)) {
447+
labels[$(this).data('id')] = {
448+
"update-url": $listMenu.data('update-url'),
449+
"action": "attach",
450+
"issue-id": $listMenu.data('issue-id'),
451+
};
452+
} else {
453+
delete labels[$(this).data('id')];
454+
}
437455
}
438456
}
439457

@@ -2040,11 +2058,11 @@ $(document).ready(function () {
20402058
$('.issue-checkbox').click(function() {
20412059
var numChecked = $('.issue-checkbox').children('input:checked').length;
20422060
if (numChecked > 0) {
2043-
$('#issue-filters').hide();
2044-
$('#issue-actions').show();
2061+
$('#issue-filters').addClass("hide");
2062+
$('#issue-actions').removeClass("hide");
20452063
} else {
2046-
$('#issue-filters').show();
2047-
$('#issue-actions').hide();
2064+
$('#issue-filters').removeClass("hide");
2065+
$('#issue-actions').addClass("hide");
20482066
}
20492067
});
20502068

public/less/_repository.less

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,10 +1580,18 @@
15801580
}
15811581
}
15821582

1583-
#issue-actions {
1583+
#issue-filters.hide {
15841584
display: none;
15851585
}
15861586

1587+
#issue-actions.hide {
1588+
display: none;
1589+
}
1590+
1591+
.ui.checkbox.issue-checkbox {
1592+
vertical-align: middle;
1593+
}
1594+
15871595
.issue.list {
15881596
list-style: none;
15891597
padding-top: 15px;

public/less/themes/arc-green.less

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
}
231231
.ui.pagination.menu .active.item {
232232
color: #dbdbdb;
233-
background-color: #609926;
233+
background-color: #87ab63;
234234
}
235235
.repository .header-wrapper {
236236
background-color: #2a2e3a;
@@ -259,10 +259,10 @@
259259
background: #565454;
260260
}
261261
.ui.blue.button, .ui.blue.buttons .button {
262-
background-color: #609926;
262+
background-color: #87ab63;
263263
}
264264
.ui.blue.button:hover, .ui.blue.buttons .button:hover {
265-
background-color: #73ad36;
265+
background-color: #a0cc75;
266266
}
267267
.ui.form input:not([type]), .ui.form input[type=text], .ui.form input[type=email], .ui.form input[type=search], .ui.form input[type=password], .ui.form input[type=date], .ui.form input[type=datetime-local], .ui.form input[type=tel], .ui.form input[type=time], .ui.form input[type=url], .ui.form input[type=number] {
268268
background: #404552;
@@ -277,10 +277,10 @@
277277
border-right-color: #4b505f!important;
278278
}
279279
.ui.green.button, .ui.green.buttons .button {
280-
background-color: #609926;
280+
background-color: #87ab63;
281281
}
282282
.ui.green.button:hover, .ui.green.buttons .button:hover {
283-
background-color: #73ad36;
283+
background-color: #a0cc75;
284284
}
285285
.ui.button {
286286
background: #383c4a;
@@ -476,7 +476,7 @@
476476
border-top: 1px solid #4c505c;
477477
}
478478
.ui .text.blue {
479-
color: #609926 !important;
479+
color: #87ab63 !important;
480480
}
481481
.ui.selection.active.dropdown, .ui.selection.active.dropdown .menu {
482482
border-color: #4e5361;
@@ -517,7 +517,7 @@
517517
background: #353945;
518518
}
519519
.ui.secondary.pointing.menu .active.item {
520-
border-color: #609926;
520+
border-color: #87ab63;
521521
color: #dbdbdb;
522522
background: #404552;
523523
}
@@ -693,15 +693,15 @@
693693
color: #7c9b5e;
694694
}
695695
.ui.blue.button:focus, .ui.blue.buttons .button:focus {
696-
background-color: #609926;
696+
background-color: #87ab63;
697697
}
698698
.ui.basic.blue.button:hover, .ui.basic.blue.buttons .button:hover {
699-
box-shadow: 0 0 0 1px #609926 inset!important;
700-
color: #609926!important;
699+
box-shadow: 0 0 0 1px #87ab63 inset!important;
700+
color: #87ab63!important;
701701
}
702702
.ui.basic.blue.button:focus, .ui.basic.blue.buttons .button:focus {
703-
box-shadow: 0 0 0 1px #609926 inset!important;
704-
color: #609926!important;
703+
box-shadow: 0 0 0 1px #87ab63 inset!important;
704+
color: #87ab63!important;
705705
}
706706
.repository.file.list #file-content .code-view .lines-num pre, .repository.file.list #file-content .code-view .lines-code pre, .repository.file.list #file-content .code-view .lines-num ol, .repository.file.list #file-content .code-view .lines-code ol, .repository.file.list #file-content .code-view .lines-num .hljs, .repository.file.list #file-content .code-view .lines-code .hljs {
707707
background-color: #2a2e3a;
@@ -771,8 +771,8 @@
771771
background: #383c4a;
772772
}
773773
.ui.basic.blue.button, .ui.basic.blue.buttons .button {
774-
box-shadow: 0 0 0 1px #609926 inset!important;
775-
color: #609926!important;
774+
box-shadow: 0 0 0 1px #87ab63 inset!important;
775+
color: #87ab63!important;
776776
}
777777
.editor-toolbar {
778778
background-color: #404552;

routers/repo/issue.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ func Issues(ctx *context.Context) {
291291
return
292292
}
293293

294+
perm, err := models.GetUserRepoPermission(ctx.Repo.Repository, ctx.User)
295+
if err != nil {
296+
ctx.ServerError("GetUserRepoPermission", err)
297+
return
298+
}
299+
ctx.Data["CanWriteIssuesOrPulls"] = perm.CanWriteIssuesOrPulls(isPullList)
300+
294301
ctx.HTML(200, tplIssues)
295302
}
296303

routers/user/auth.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,11 @@ func ResetPasswd(ctx *context.Context) {
11851185
return
11861186
}
11871187
ctx.Data["Code"] = code
1188-
ctx.Data["IsResetForm"] = true
1188+
1189+
if u := models.VerifyUserActiveCode(code); u != nil {
1190+
ctx.Data["IsResetForm"] = true
1191+
}
1192+
11891193
ctx.HTML(200, tplResetPassword)
11901194
}
11911195

templates/repo/create.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<input type="hidden" name="license" value="{{.license}}">
7676
<div class="default text">{{.i18n.Tr "repo.license_helper"}}</div>
7777
<div class="menu">
78+
<div class="item" data-value="">{{.i18n.Tr "repo.license_helper"}}</div>
7879
{{range .Licenses}}
7980
<div class="item" data-value="{{.}}">{{.}}</div>
8081
{{end}}

templates/repo/header.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</a>
3030
</div>
3131
{{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
32-
<div class="ui labeled button" tabindex="0">
32+
<div class="ui labeled button {{if and (not $.CanSignedUserFork) ($.IsSigned)}}disabled{{end}}" tabindex="0">
3333
<a class="ui compact basic button {{if or (not $.IsSigned) (not $.CanSignedUserFork)}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else if $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{ else }} data-content="{{$.i18n.Tr "repo.fork_guest_user" }}" href="{{AppSubUrl}}/user/login?redirect_to={{AppSubUrl}}/repo/fork/{{.ID}}" {{end}} data-position="top center" data-variation="tiny">
3434
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
3535
</a>
@@ -58,8 +58,8 @@
5858
{{end}}
5959

6060
{{if .Permission.CanRead $.UnitTypeExternalTracker}}
61-
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues" target="_blank" rel="noopener noreferrer">
62-
<i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} </span>
61+
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
62+
<i class="octicon octicon-link-external"></i> {{.i18n.Tr "repo.issues"}} </span>
6363
</a>
6464
{{end}}
6565

templates/repo/home.tmpl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,21 @@
5757
{{end}}
5858
{{template "repo/sub_menu" .}}
5959
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
60-
{{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}}
61-
<div class="fitted item">
62-
<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.BranchName | EscapePound}}">
63-
<button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
64-
</a>
65-
</div>
66-
{{end}}
6760
{{template "repo/branch_dropdown" .}}
6861
{{ $n := len .TreeNames}}
6962
{{ $l := Subtract $n 1}}
70-
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div>
63+
<!-- If home page, show new PR. If not, show breadcrumb -->
64+
{{if eq $n 0}}
65+
{{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}}
66+
<div class="fitted item">
67+
<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.BranchName | EscapePound}}">
68+
<button id="new-pull-request" class="ui compact basic button">{{.i18n.Tr "repo.pulls.compare_changes"}}</button>
69+
</a>
70+
</div>
71+
{{end}}
72+
{{else}}
73+
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div>
74+
{{end}}
7175
<div class="right fitted item" id="file-buttons">
7276
<div class="ui tiny blue buttons">
7377
{{if .Repository.CanEnableEditor}}

templates/repo/issue/list.tmpl

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,33 @@
111111
</div>
112112
</div>
113113
</div>
114-
<div id="issue-actions" class="ui stackable grid">
114+
<div id="issue-actions" class="ui stackable grid hide">
115115
<div class="six wide column">
116-
<div class="ui basic status buttons">
117-
<div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status">{{.i18n.Tr "repo.issues.action_open"}}</div>
118-
<div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{.i18n.Tr "repo.issues.action_close"}}</div>
116+
<div class="ui tiny basic status buttons">
117+
<a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
118+
<i class="octicon octicon-issue-opened"></i>
119+
{{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}}
120+
</a>
121+
<a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
122+
<i class="octicon octicon-issue-closed"></i>
123+
{{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}}
124+
</a>
119125
</div>
120126
</div>
121-
122127
{{/* Ten wide does not cope well and makes the columns stack.
123128
This seems to be related to jQuery's hide/show: in fact, switching
124129
issue-actions and issue-filters and having this ten wide will show
125130
this one correctly, but not the other one. */}}
126131
<div class="nine wide right aligned right floated column">
127132
<div class="ui secondary filter stackable menu">
133+
<!-- Action Button -->
134+
{{if .IsShowClosed}}
135+
<div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.i18n.Tr "repo.issues.action_open"}}</div>
136+
{{else}}
137+
<div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.i18n.Tr "repo.issues.action_close"}}</div>
138+
{{end}}
128139
<!-- Labels -->
129-
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item" style="margin-left: auto">
140+
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item">
130141
<span class="text">
131142
{{.i18n.Tr "repo.issues.action_label"}}
132143
<i class="dropdown icon"></i>
@@ -182,9 +193,11 @@
182193
<div class="issue list">
183194
{{range .Issues}}
184195
<li class="item">
196+
{{if $.CanWriteIssuesOrPulls}}
185197
<div class="ui checkbox issue-checkbox">
186198
<input type="checkbox" data-issue-id={{.ID}}></input>
187199
</div>
200+
{{end}}
188201
<div class="ui {{if .IsRead}}black{{else}}green{{end}} label">#{{.Index}}</div>
189202
<a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a>
190203

templates/status/404.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{template "base/head" .}}
2+
{{if .IsRepo}}<div class="repository">{{template "repo/header" .}}</div>{{end}}
23
<div class="ui container center">
34
<p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/404.png" alt="404"/></p>
45
<div class="ui divider"></div>

0 commit comments

Comments
 (0)