1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-22 17:34:03 +03:00

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))
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)
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")
if branch != "master" {
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.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["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()
if err != nil {
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 $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();
}
});
@ -417,23 +429,29 @@ 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')
);
if (!($(this).data('id') in labels)) {
labels[$(this).data('id')] = {
"update-url": $listMenu.data('update-url'),
"action": "detach",
"issue-id": $listMenu.data('issue-id'),
};
} else {
delete labels[$(this).data('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')
);
if (!($(this).data('id') in labels)) {
labels[$(this).data('id')] = {
"update-url": $listMenu.data('update-url'),
"action": "attach",
"issue-id": $listMenu.data('issue-id'),
};
} else {
delete labels[$(this).data('id')];
}
}
}
@ -2040,11 +2058,11 @@ $(document).ready(function () {
$('.issue-checkbox').click(function() {
var numChecked = $('.issue-checkbox').children('input:checked').length;
if (numChecked > 0) {
$('#issue-filters').hide();
$('#issue-actions').show();
$('#issue-filters').addClass("hide");
$('#issue-actions').removeClass("hide");
} else {
$('#issue-filters').show();
$('#issue-actions').hide();
$('#issue-filters').removeClass("hide");
$('#issue-actions').addClass("hide");
}
});

View File

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

View File

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

View File

@ -291,6 +291,13 @@ func Issues(ctx *context.Context) {
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)
}

View File

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

View File

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

View File

@ -29,7 +29,7 @@
</a>
</div>
{{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">
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
</a>
@ -58,8 +58,8 @@
{{end}}
{{if .Permission.CanRead $.UnitTypeExternalTracker}}
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues" target="_blank" rel="noopener noreferrer">
<i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} </span>
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
<i class="octicon octicon-link-external"></i> {{.i18n.Tr "repo.issues"}} </span>
</a>
{{end}}

View File

@ -57,17 +57,21 @@
{{end}}
{{template "repo/sub_menu" .}}
<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" .}}
{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
<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>
<!-- 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>
{{end}}
<div class="right fitted item" id="file-buttons">
<div class="ui tiny blue buttons">
{{if .Repository.CanEnableEditor}}

View File

@ -111,22 +111,33 @@
</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="ui 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>
<div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{.i18n.Tr "repo.issues.action_close"}}</div>
<div class="ui tiny basic status buttons">
<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}}">
<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>
{{/* Ten wide does not cope well and makes the columns stack.
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
this one correctly, but not the other one. */}}
<div class="nine wide right aligned right floated column">
<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 -->
<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">
{{.i18n.Tr "repo.issues.action_label"}}
<i class="dropdown icon"></i>
@ -182,9 +193,11 @@
<div class="issue list">
{{range .Issues}}
<li class="item">
{{if $.CanWriteIssuesOrPulls}}
<div class="ui checkbox issue-checkbox">
<input type="checkbox" data-issue-id={{.ID}}></input>
</div>
{{end}}
<div class="ui {{if .IsRead}}black{{else}}green{{end}} label">#{{.Index}}</div>
<a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a>

View File

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