Minor UI tweaks (#5980)

* Remove all CommitStatus when a repo is deleted

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* 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 <john.olheiser@gmail.com>

* 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 <john.olheiser@gmail.com>

* 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.
This commit is contained in:
John Olheiser 2019-02-19 17:09:47 -06:00 committed by techknowlogick
parent 2982413f8d
commit d26d249748
15 changed files with 115 additions and 53 deletions

View file

@ -18,9 +18,9 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch, titl
req := NewRequest(t, "GET", path.Join(user, repo)) req := NewRequest(t, "GET", path.Join(user, repo))
resp := session.MakeRequest(t, req, http.StatusOK) resp := session.MakeRequest(t, req, http.StatusOK)
// Click the little green button to create a pull // Click the PR button to create a pull
htmlDoc := NewHTMLParser(t, resp.Body) htmlDoc := NewHTMLParser(t, resp.Body)
link, exists := htmlDoc.doc.Find("button.ui.green.tiny.compact.button").Parent().Attr("href") link, exists := htmlDoc.doc.Find("#new-pull-request").Parent().Attr("href")
assert.True(t, exists, "The template has changed") assert.True(t, exists, "The template has changed")
if branch != "master" { if branch != "master" {
link = strings.Replace(link, ":master", ":"+branch, 1) link = strings.Replace(link, ":master", ":"+branch, 1)

View file

@ -121,6 +121,7 @@ func (ctx *Context) NotFound(title string, err error) {
} }
} }
ctx.Data["IsRepo"] = ctx.Repo.Repository != nil
ctx.Data["Title"] = "Page Not Found" ctx.Data["Title"] = "Page Not Found"
ctx.HTML(http.StatusNotFound, base.TplName("status/404")) ctx.HTML(http.StatusNotFound, base.TplName("status/404"))
} }

View file

@ -337,6 +337,11 @@ func RepoAssignment() macaron.Handler {
ctx.Data["RepoLink"] = ctx.Repo.RepoLink ctx.Data["RepoLink"] = ctx.Repo.RepoLink
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
unit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalTracker)
if err == nil {
ctx.Data["RepoExternalIssuesLink"] = unit.ExternalTrackerConfig().ExternalTrackerURL
}
tags, err := ctx.Repo.GitRepo.GetTags() tags, err := ctx.Repo.GitRepo.GetTags()
if err != nil { if err != nil {
ctx.ServerError("GetTags", err) ctx.ServerError("GetTags", err)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -380,10 +380,22 @@ function initCommentForm() {
var $noSelect = $list.find('.no-select'); var $noSelect = $list.find('.no-select');
var $listMenu = $('.' + selector + ' .menu'); var $listMenu = $('.' + selector + ' .menu');
var hasLabelUpdateAction = $listMenu.data('action') == 'update'; var hasLabelUpdateAction = $listMenu.data('action') == 'update';
var labels = {};
$('.' + selector).dropdown('setting', 'onHide', function(){ $('.' + selector).dropdown('setting', 'onHide', function(){
hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var hasLabelUpdateAction = $listMenu.data('action') == 'update'; // Update the var
if (hasLabelUpdateAction) { 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(); location.reload();
} }
}); });
@ -417,23 +429,29 @@ function initCommentForm() {
$(this).removeClass('checked'); $(this).removeClass('checked');
$(this).find('.octicon').removeClass('octicon-check'); $(this).find('.octicon').removeClass('octicon-check');
if (hasLabelUpdateAction) { if (hasLabelUpdateAction) {
updateIssuesMeta( if (!($(this).data('id') in labels)) {
$listMenu.data('update-url'), labels[$(this).data('id')] = {
"detach", "update-url": $listMenu.data('update-url'),
$listMenu.data('issue-id'), "action": "detach",
$(this).data('id') "issue-id": $listMenu.data('issue-id'),
); };
} else {
delete labels[$(this).data('id')];
}
} }
} else { } else {
$(this).addClass('checked'); $(this).addClass('checked');
$(this).find('.octicon').addClass('octicon-check'); $(this).find('.octicon').addClass('octicon-check');
if (hasLabelUpdateAction) { if (hasLabelUpdateAction) {
updateIssuesMeta( if (!($(this).data('id') in labels)) {
$listMenu.data('update-url'), labels[$(this).data('id')] = {
"attach", "update-url": $listMenu.data('update-url'),
$listMenu.data('issue-id'), "action": "attach",
$(this).data('id') "issue-id": $listMenu.data('issue-id'),
); };
} else {
delete labels[$(this).data('id')];
}
} }
} }
@ -2040,11 +2058,11 @@ $(document).ready(function () {
$('.issue-checkbox').click(function() { $('.issue-checkbox').click(function() {
var numChecked = $('.issue-checkbox').children('input:checked').length; var numChecked = $('.issue-checkbox').children('input:checked').length;
if (numChecked > 0) { if (numChecked > 0) {
$('#issue-filters').hide(); $('#issue-filters').addClass("hide");
$('#issue-actions').show(); $('#issue-actions').removeClass("hide");
} else { } else {
$('#issue-filters').show(); $('#issue-filters').removeClass("hide");
$('#issue-actions').hide(); $('#issue-actions').addClass("hide");
} }
}); });

View file

@ -1580,10 +1580,18 @@
} }
} }
#issue-actions { #issue-filters.hide {
display: none; display: none;
} }
#issue-actions.hide {
display: none;
}
.ui.checkbox.issue-checkbox {
vertical-align: middle;
}
.issue.list { .issue.list {
list-style: none; list-style: none;
padding-top: 15px; padding-top: 15px;

View file

@ -230,7 +230,7 @@
} }
.ui.pagination.menu .active.item { .ui.pagination.menu .active.item {
color: #dbdbdb; color: #dbdbdb;
background-color: #609926; background-color: #87ab63;
} }
.repository .header-wrapper { .repository .header-wrapper {
background-color: #2a2e3a; background-color: #2a2e3a;
@ -259,10 +259,10 @@
background: #565454; background: #565454;
} }
.ui.blue.button, .ui.blue.buttons .button { .ui.blue.button, .ui.blue.buttons .button {
background-color: #609926; background-color: #87ab63;
} }
.ui.blue.button:hover, .ui.blue.buttons .button:hover { .ui.blue.button:hover, .ui.blue.buttons .button:hover {
background-color: #73ad36; background-color: #a0cc75;
} }
.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] { .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] {
background: #404552; background: #404552;
@ -277,10 +277,10 @@
border-right-color: #4b505f!important; border-right-color: #4b505f!important;
} }
.ui.green.button, .ui.green.buttons .button { .ui.green.button, .ui.green.buttons .button {
background-color: #609926; background-color: #87ab63;
} }
.ui.green.button:hover, .ui.green.buttons .button:hover { .ui.green.button:hover, .ui.green.buttons .button:hover {
background-color: #73ad36; background-color: #a0cc75;
} }
.ui.button { .ui.button {
background: #383c4a; background: #383c4a;
@ -476,7 +476,7 @@
border-top: 1px solid #4c505c; border-top: 1px solid #4c505c;
} }
.ui .text.blue { .ui .text.blue {
color: #609926 !important; color: #87ab63 !important;
} }
.ui.selection.active.dropdown, .ui.selection.active.dropdown .menu { .ui.selection.active.dropdown, .ui.selection.active.dropdown .menu {
border-color: #4e5361; border-color: #4e5361;
@ -517,7 +517,7 @@
background: #353945; background: #353945;
} }
.ui.secondary.pointing.menu .active.item { .ui.secondary.pointing.menu .active.item {
border-color: #609926; border-color: #87ab63;
color: #dbdbdb; color: #dbdbdb;
background: #404552; background: #404552;
} }
@ -693,15 +693,15 @@
color: #7c9b5e; color: #7c9b5e;
} }
.ui.blue.button:focus, .ui.blue.buttons .button:focus { .ui.blue.button:focus, .ui.blue.buttons .button:focus {
background-color: #609926; background-color: #87ab63;
} }
.ui.basic.blue.button:hover, .ui.basic.blue.buttons .button:hover { .ui.basic.blue.button:hover, .ui.basic.blue.buttons .button:hover {
box-shadow: 0 0 0 1px #609926 inset!important; box-shadow: 0 0 0 1px #87ab63 inset!important;
color: #609926!important; color: #87ab63!important;
} }
.ui.basic.blue.button:focus, .ui.basic.blue.buttons .button:focus { .ui.basic.blue.button:focus, .ui.basic.blue.buttons .button:focus {
box-shadow: 0 0 0 1px #609926 inset!important; box-shadow: 0 0 0 1px #87ab63 inset!important;
color: #609926!important; color: #87ab63!important;
} }
.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 { .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 {
background-color: #2a2e3a; background-color: #2a2e3a;
@ -771,8 +771,8 @@
background: #383c4a; background: #383c4a;
} }
.ui.basic.blue.button, .ui.basic.blue.buttons .button { .ui.basic.blue.button, .ui.basic.blue.buttons .button {
box-shadow: 0 0 0 1px #609926 inset!important; box-shadow: 0 0 0 1px #87ab63 inset!important;
color: #609926!important; color: #87ab63!important;
} }
.editor-toolbar { .editor-toolbar {
background-color: #404552; background-color: #404552;

View file

@ -291,6 +291,13 @@ func Issues(ctx *context.Context) {
return return
} }
perm, err := models.GetUserRepoPermission(ctx.Repo.Repository, ctx.User)
if err != nil {
ctx.ServerError("GetUserRepoPermission", err)
return
}
ctx.Data["CanWriteIssuesOrPulls"] = perm.CanWriteIssuesOrPulls(isPullList)
ctx.HTML(200, tplIssues) ctx.HTML(200, tplIssues)
} }

View file

@ -1185,7 +1185,11 @@ func ResetPasswd(ctx *context.Context) {
return return
} }
ctx.Data["Code"] = code ctx.Data["Code"] = code
if u := models.VerifyUserActiveCode(code); u != nil {
ctx.Data["IsResetForm"] = true ctx.Data["IsResetForm"] = true
}
ctx.HTML(200, tplResetPassword) ctx.HTML(200, tplResetPassword)
} }

View file

@ -75,6 +75,7 @@
<input type="hidden" name="license" value="{{.license}}"> <input type="hidden" name="license" value="{{.license}}">
<div class="default text">{{.i18n.Tr "repo.license_helper"}}</div> <div class="default text">{{.i18n.Tr "repo.license_helper"}}</div>
<div class="menu"> <div class="menu">
<div class="item" data-value="">{{.i18n.Tr "repo.license_helper"}}</div>
{{range .Licenses}} {{range .Licenses}}
<div class="item" data-value="{{.}}">{{.}}</div> <div class="item" data-value="{{.}}">{{.}}</div>
{{end}} {{end}}

View file

@ -29,7 +29,7 @@
</a> </a>
</div> </div>
{{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}} {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
<div class="ui labeled button" tabindex="0"> <div class="ui labeled button {{if and (not $.CanSignedUserFork) ($.IsSigned)}}disabled{{end}}" tabindex="0">
<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"> <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">
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}} <i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
</a> </a>
@ -58,8 +58,8 @@
{{end}} {{end}}
{{if .Permission.CanRead $.UnitTypeExternalTracker}} {{if .Permission.CanRead $.UnitTypeExternalTracker}}
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues" target="_blank" rel="noopener noreferrer"> <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
<i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} </span> <i class="octicon octicon-link-external"></i> {{.i18n.Tr "repo.issues"}} </span>
</a> </a>
{{end}} {{end}}

View file

@ -57,17 +57,21 @@
{{end}} {{end}}
{{template "repo/sub_menu" .}} {{template "repo/sub_menu" .}}
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins"> <div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
{{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 green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
</a>
</div>
{{end}}
{{template "repo/branch_dropdown" .}} {{template "repo/branch_dropdown" .}}
{{ $n := len .TreeNames}} {{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}} {{ $l := Subtract $n 1}}
<!-- If home page, show new PR. If not, show breadcrumb -->
{{if eq $n 0}}
{{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 id="new-pull-request" class="ui compact basic button">{{.i18n.Tr "repo.pulls.compare_changes"}}</button>
</a>
</div>
{{end}}
{{else}}
<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> <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>
{{end}}
<div class="right fitted item" id="file-buttons"> <div class="right fitted item" id="file-buttons">
<div class="ui tiny blue buttons"> <div class="ui tiny blue buttons">
{{if .Repository.CanEnableEditor}} {{if .Repository.CanEnableEditor}}

View file

@ -111,22 +111,33 @@
</div> </div>
</div> </div>
</div> </div>
<div id="issue-actions" class="ui stackable grid"> <div id="issue-actions" class="ui stackable grid hide">
<div class="six wide column"> <div class="six wide column">
<div class="ui basic status buttons"> <div class="ui tiny basic status buttons">
<div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status">{{.i18n.Tr "repo.issues.action_open"}}</div> <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}}">
<div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{.i18n.Tr "repo.issues.action_close"}}</div> <i class="octicon octicon-issue-opened"></i>
{{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}}
</a>
<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}}">
<i class="octicon octicon-issue-closed"></i>
{{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}}
</a>
</div> </div>
</div> </div>
{{/* Ten wide does not cope well and makes the columns stack. {{/* Ten wide does not cope well and makes the columns stack.
This seems to be related to jQuery's hide/show: in fact, switching This seems to be related to jQuery's hide/show: in fact, switching
issue-actions and issue-filters and having this ten wide will show issue-actions and issue-filters and having this ten wide will show
this one correctly, but not the other one. */}} this one correctly, but not the other one. */}}
<div class="nine wide right aligned right floated column"> <div class="nine wide right aligned right floated column">
<div class="ui secondary filter stackable menu"> <div class="ui secondary filter stackable menu">
<!-- Action Button -->
{{if .IsShowClosed}}
<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>
{{else}}
<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>
{{end}}
<!-- Labels --> <!-- Labels -->
<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item" style="margin-left: auto"> <div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item">
<span class="text"> <span class="text">
{{.i18n.Tr "repo.issues.action_label"}} {{.i18n.Tr "repo.issues.action_label"}}
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
@ -182,9 +193,11 @@
<div class="issue list"> <div class="issue list">
{{range .Issues}} {{range .Issues}}
<li class="item"> <li class="item">
{{if $.CanWriteIssuesOrPulls}}
<div class="ui checkbox issue-checkbox"> <div class="ui checkbox issue-checkbox">
<input type="checkbox" data-issue-id={{.ID}}></input> <input type="checkbox" data-issue-id={{.ID}}></input>
</div> </div>
{{end}}
<div class="ui {{if .IsRead}}black{{else}}green{{end}} label">#{{.Index}}</div> <div class="ui {{if .IsRead}}black{{else}}green{{end}} label">#{{.Index}}</div>
<a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a> <a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a>

View file

@ -1,4 +1,5 @@
{{template "base/head" .}} {{template "base/head" .}}
{{if .IsRepo}}<div class="repository">{{template "repo/header" .}}</div>{{end}}
<div class="ui container center"> <div class="ui container center">
<p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/404.png" alt="404"/></p> <p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/404.png" alt="404"/></p>
<div class="ui divider"></div> <div class="ui divider"></div>