mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-17 00:01:00 -04:00
Compare commits
No commits in common. "7018659a1d7ef2ec1303ae26a8925fff92898327" and "b937adc54d35b00a9a888052c173b59b7ded8a0f" have entirely different histories.
7018659a1d
...
b937adc54d
@ -208,8 +208,8 @@ func serveInstalled(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
// Set up Chi routes
|
||||
webRoutes := routers.NormalRoutes()
|
||||
err := listen(webRoutes, true)
|
||||
c := routers.NormalRoutes()
|
||||
err := listen(c, true)
|
||||
<-graceful.GetManager().Done()
|
||||
log.Info("PID: %d Gitea Web Finished", os.Getpid())
|
||||
log.GetManager().Close()
|
||||
|
@ -20,8 +20,6 @@ menu:
|
||||
- [Paid Commercial Support](https://about.gitea.com/)
|
||||
- [Discord](https://discord.gg/Gitea)
|
||||
- [Discourse Forum](https://discourse.gitea.io/)
|
||||
- [Matrix](https://matrix.to/#/#gitea-space:matrix.org)
|
||||
- NOTE: Most of the Matrix channels are bridged with their counterpart in Discord and may experience some degree of flakiness with the bridge process.
|
||||
|
||||
**NOTE:** When asking for support, it may be a good idea to have the following available so that the person helping has all the info they need:
|
||||
|
||||
|
@ -198,7 +198,6 @@ type SearchOptions struct {
|
||||
IsClosed util.OptionalBool
|
||||
OrderBy db.SearchOrderBy
|
||||
Type Type
|
||||
Title string
|
||||
}
|
||||
|
||||
func (opts *SearchOptions) toConds() builder.Cond {
|
||||
@ -219,10 +218,6 @@ func (opts *SearchOptions) toConds() builder.Cond {
|
||||
if opts.OwnerID > 0 {
|
||||
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
|
||||
}
|
||||
|
||||
if len(opts.Title) != 0 {
|
||||
cond = cond.And(db.BuildCaseInsensitiveLike("title", opts.Title))
|
||||
}
|
||||
return cond
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,6 @@ func RepoRefForAPI(next http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
ctx.Repo.Commit = commit
|
||||
ctx.Repo.CommitID = ctx.Repo.Commit.ID.String()
|
||||
ctx.Repo.TreePath = ctx.Params("*")
|
||||
next.ServeHTTP(w, req)
|
||||
return
|
||||
|
@ -5,14 +5,11 @@ package git
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
)
|
||||
|
||||
// BlamePart represents block of blame - continuous lines with one sha
|
||||
@ -118,19 +115,15 @@ func CreateBlameReader(ctx context.Context, repoPath, commitID, file string) (*B
|
||||
done := make(chan error, 1)
|
||||
|
||||
go func(cmd *Command, dir string, stdout io.WriteCloser, done chan error) {
|
||||
stderr := bytes.Buffer{}
|
||||
// TODO: it doesn't work for directories (the directories shouldn't be "blamed"), and the "err" should be returned by "Read" but not by "Close"
|
||||
err := cmd.Run(&RunOpts{
|
||||
if err := cmd.Run(&RunOpts{
|
||||
UseContextTimeout: true,
|
||||
Dir: dir,
|
||||
Stdout: stdout,
|
||||
Stderr: &stderr,
|
||||
})
|
||||
done <- err
|
||||
_ = stdout.Close()
|
||||
if err != nil {
|
||||
log.Error("Error running git blame (dir: %v): %v, stderr: %v", repoPath, err, stderr.String())
|
||||
Stderr: os.Stderr,
|
||||
}); err == nil {
|
||||
stdout.Close()
|
||||
}
|
||||
done <- err
|
||||
}(cmd, repoPath, stdout, done)
|
||||
|
||||
bufferedReader := bufio.NewReader(reader)
|
||||
|
@ -4,7 +4,6 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@ -132,11 +131,6 @@ func EnvironmentToConfig(cfg ConfigProvider, envs []string) (changed bool) {
|
||||
log.Error("Error reading file for %s : %v", envKey, envValue, err)
|
||||
continue
|
||||
}
|
||||
if bytes.HasSuffix(fileContent, []byte("\r\n")) {
|
||||
fileContent = fileContent[:len(fileContent)-2]
|
||||
} else if bytes.HasSuffix(fileContent, []byte("\n")) {
|
||||
fileContent = fileContent[:len(fileContent)-1]
|
||||
}
|
||||
keyValue = string(fileContent)
|
||||
}
|
||||
|
||||
|
@ -99,19 +99,4 @@ key = old
|
||||
changed = EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
|
||||
assert.True(t, changed)
|
||||
assert.Equal(t, "value-from-file", cfg.Section("sec").Key("key").String())
|
||||
|
||||
cfg, _ = NewConfigProviderFromData("")
|
||||
_ = os.WriteFile(tmpFile, []byte("value-from-file\n"), 0o644)
|
||||
EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
|
||||
assert.Equal(t, "value-from-file", cfg.Section("sec").Key("key").String())
|
||||
|
||||
cfg, _ = NewConfigProviderFromData("")
|
||||
_ = os.WriteFile(tmpFile, []byte("value-from-file\r\n"), 0o644)
|
||||
EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
|
||||
assert.Equal(t, "value-from-file", cfg.Section("sec").Key("key").String())
|
||||
|
||||
cfg, _ = NewConfigProviderFromData("")
|
||||
_ = os.WriteFile(tmpFile, []byte("value-from-file\n\n"), 0o644)
|
||||
EnvironmentToConfig(cfg, []string{"GITEA__sec__key__FILE=" + tmpFile})
|
||||
assert.Equal(t, "value-from-file\n", cfg.Section("sec").Key("key").String())
|
||||
}
|
||||
|
@ -90,16 +90,12 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
|
||||
return nil, convertMinioErr(err)
|
||||
}
|
||||
|
||||
// Check to see if we already own this bucket
|
||||
exists, errBucketExists := minioClient.BucketExists(ctx, config.Bucket)
|
||||
if errBucketExists != nil {
|
||||
return nil, convertMinioErr(err)
|
||||
}
|
||||
|
||||
if !exists {
|
||||
if err := minioClient.MakeBucket(ctx, config.Bucket, minio.MakeBucketOptions{
|
||||
Region: config.Location,
|
||||
}); err != nil {
|
||||
if err := minioClient.MakeBucket(ctx, config.Bucket, minio.MakeBucketOptions{
|
||||
Region: config.Location,
|
||||
}); err != nil {
|
||||
// Check to see if we already own this bucket (which happens if you run this twice)
|
||||
exists, errBucketExists := minioClient.BucketExists(ctx, config.Bucket)
|
||||
if !exists || errBucketExists != nil {
|
||||
return nil, convertMinioErr(err)
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ func Projects(ctx *context.Context) {
|
||||
sortType := ctx.FormTrim("sort")
|
||||
|
||||
isShowClosed := strings.ToLower(ctx.FormTrim("state")) == "closed"
|
||||
keyword := ctx.FormTrim("q")
|
||||
page := ctx.FormInt("page")
|
||||
if page <= 1 {
|
||||
page = 1
|
||||
@ -65,7 +64,6 @@ func Projects(ctx *context.Context) {
|
||||
IsClosed: util.OptionalBoolOf(isShowClosed),
|
||||
OrderBy: project_model.GetSearchOrderByBySortType(sortType),
|
||||
Type: projectType,
|
||||
Title: keyword,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("FindProjects", err)
|
||||
@ -397,7 +395,7 @@ func ViewProject(ctx *context.Context) {
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
ctx.Data["Project"] = project
|
||||
ctx.Data["IssuesMap"] = issuesMap
|
||||
ctx.Data["Columns"] = boards // TODO: rename boards to columns in backend
|
||||
ctx.Data["Boards"] = boards
|
||||
shared_user.RenderUserHeader(ctx)
|
||||
|
||||
err = shared_user.LoadHeaderCount(ctx)
|
||||
|
@ -86,7 +86,18 @@ func TeamsAction(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
}
|
||||
checkIsOrgMemberAndRedirect(ctx, ctx.Org.OrgLink+"/teams/")
|
||||
|
||||
redirect := ctx.Org.OrgLink + "/teams/"
|
||||
if isOrgMember, err := org_model.IsOrganizationMember(ctx, ctx.Org.Organization.ID, ctx.Doer.ID); err != nil {
|
||||
ctx.ServerError("IsOrganizationMember", err)
|
||||
return
|
||||
} else if !isOrgMember {
|
||||
redirect = setting.AppSubURL + "/"
|
||||
}
|
||||
ctx.JSON(http.StatusOK,
|
||||
map[string]any{
|
||||
"redirect": redirect,
|
||||
})
|
||||
return
|
||||
case "remove":
|
||||
if !ctx.Org.IsOwner {
|
||||
@ -113,7 +124,10 @@ func TeamsAction(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
}
|
||||
checkIsOrgMemberAndRedirect(ctx, ctx.Org.OrgLink+"/teams/"+url.PathEscape(ctx.Org.Team.LowerName))
|
||||
ctx.JSON(http.StatusOK,
|
||||
map[string]any{
|
||||
"redirect": ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName),
|
||||
})
|
||||
return
|
||||
case "add":
|
||||
if !ctx.Org.IsOwner {
|
||||
@ -203,20 +217,6 @@ func TeamsAction(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func checkIsOrgMemberAndRedirect(ctx *context.Context, defaultRedirect string) {
|
||||
if isOrgMember, err := org_model.IsOrganizationMember(ctx, ctx.Org.Organization.ID, ctx.Doer.ID); err != nil {
|
||||
ctx.ServerError("IsOrganizationMember", err)
|
||||
return
|
||||
} else if !isOrgMember {
|
||||
if ctx.Org.Organization.Visibility.IsPrivate() {
|
||||
defaultRedirect = setting.AppSubURL + "/"
|
||||
} else {
|
||||
defaultRedirect = ctx.Org.Organization.HomeLink()
|
||||
}
|
||||
}
|
||||
ctx.JSONRedirect(defaultRedirect)
|
||||
}
|
||||
|
||||
// TeamsRepoAction operate team's repository
|
||||
func TeamsRepoAction(ctx *context.Context) {
|
||||
if !ctx.Org.IsOwner {
|
||||
|
@ -54,7 +54,6 @@ func Projects(ctx *context.Context) {
|
||||
sortType := ctx.FormTrim("sort")
|
||||
|
||||
isShowClosed := strings.ToLower(ctx.FormTrim("state")) == "closed"
|
||||
keyword := ctx.FormTrim("q")
|
||||
repo := ctx.Repo.Repository
|
||||
page := ctx.FormInt("page")
|
||||
if page <= 1 {
|
||||
@ -77,7 +76,6 @@ func Projects(ctx *context.Context) {
|
||||
IsClosed: util.OptionalBoolOf(isShowClosed),
|
||||
OrderBy: project_model.GetSearchOrderByBySortType(sortType),
|
||||
Type: project_model.TypeRepository,
|
||||
Title: keyword,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetProjects", err)
|
||||
@ -366,7 +364,7 @@ func ViewProject(ctx *context.Context) {
|
||||
ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(unit.TypeProjects)
|
||||
ctx.Data["Project"] = project
|
||||
ctx.Data["IssuesMap"] = issuesMap
|
||||
ctx.Data["Columns"] = boards // TODO: rename boards to columns in backend
|
||||
ctx.Data["Boards"] = boards
|
||||
|
||||
ctx.HTML(http.StatusOK, tplProjectsView)
|
||||
}
|
||||
|
@ -1,36 +1,25 @@
|
||||
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
|
||||
<div class="gt-df gt-sb gt-mb-4">
|
||||
<div class="small-menu-items ui compact tiny menu list-header-toggle">
|
||||
<a class="item{{if not .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=open&q={{$.Keyword}}">
|
||||
{{svg "octicon-project-symlink" 16 "gt-mr-3"}}
|
||||
{{.locale.PrettyNumber .OpenCount}} {{.locale.Tr "repo.issues.open_title"}}
|
||||
</a>
|
||||
<a class="item{{if .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=closed&q={{$.Keyword}}">
|
||||
{{svg "octicon-check" 16 "gt-mr-3"}}
|
||||
{{.locale.PrettyNumber .ClosedCount}} {{.locale.Tr "repo.issues.closed_title"}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="gt-text-right">
|
||||
<a class="ui small green button" href="{{$.Link}}/new">{{.locale.Tr "repo.projects.new"}}</a>
|
||||
</div>
|
||||
<div class="gt-text-right">
|
||||
<a class="ui small green button" href="{{$.Link}}/new">{{.locale.Tr "repo.projects.new"}}</a>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
{{end}}
|
||||
|
||||
{{template "base/alert" .}}
|
||||
<div class="small-menu-items ui compact tiny menu">
|
||||
<a class="item{{if not .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=open">
|
||||
{{svg "octicon-project-symlink" 16 "gt-mr-3"}}
|
||||
{{.locale.PrettyNumber .OpenCount}} {{.locale.Tr "repo.issues.open_title"}}
|
||||
</a>
|
||||
<a class="item{{if .IsShowClosed}} active{{end}}" href="{{$.Link}}?state=closed">
|
||||
{{svg "octicon-check" 16 "gt-mr-3"}}
|
||||
{{.locale.PrettyNumber .ClosedCount}} {{.locale.Tr "repo.issues.closed_title"}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="list-header">
|
||||
<!-- Search -->
|
||||
<form class="list-header-search ui form ignore-dirty">
|
||||
<div class="ui small search fluid action input">
|
||||
<input type="hidden" name="state" value="{{$.State}}">
|
||||
{{template "shared/searchinput" dict "locale" .locale "Value" .Keyword}}
|
||||
<button class="ui small icon button" type="submit" aria-label="{{.locale.Tr "explore.search"}}">
|
||||
{{svg "octicon-search"}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="ui right floated secondary filter menu">
|
||||
<!-- Sort -->
|
||||
<div class="list-header-sort ui small dropdown type jump item">
|
||||
<div class="ui dropdown type jump item">
|
||||
<span class="text">
|
||||
{{.locale.Tr "repo.issues.filter_sort"}}
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
@ -42,7 +31,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="milestone-list">
|
||||
{{range .Projects}}
|
||||
<li class="milestone-card">
|
||||
|
@ -1,10 +1,10 @@
|
||||
<h2 class="ui dividing header">
|
||||
{{if .PageIsEditProjects}}
|
||||
{{ctx.Locale.Tr "repo.projects.edit"}}
|
||||
<div class="sub header">{{ctx.Locale.Tr "repo.projects.edit_subheader"}}</div>
|
||||
{{.locale.Tr "repo.projects.edit"}}
|
||||
<div class="sub header">{{.locale.Tr "repo.projects.edit_subheader"}}</div>
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "repo.projects.new"}}
|
||||
<div class="sub header">{{ctx.Locale.Tr "repo.projects.new_subheader"}}</div>
|
||||
{{.locale.Tr "repo.projects.new"}}
|
||||
<div class="sub header">{{.locale.Tr "repo.projects.new_subheader"}}</div>
|
||||
{{end}}
|
||||
</h2>
|
||||
{{template "base/alert" .}}
|
||||
@ -13,23 +13,23 @@
|
||||
<div>
|
||||
<input type="hidden" id="redirect" name="redirect" value="{{.redirect}}">
|
||||
<div class="field {{if .Err_Title}}error{{end}}">
|
||||
<label>{{ctx.Locale.Tr "repo.projects.title"}}</label>
|
||||
<input name="title" placeholder="{{ctx.Locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
|
||||
<label>{{.locale.Tr "repo.projects.title"}}</label>
|
||||
<input name="title" placeholder="{{.locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{ctx.Locale.Tr "repo.projects.description"}}</label>
|
||||
<textarea name="content" placeholder="{{ctx.Locale.Tr "repo.projects.description_placeholder"}}">{{.content}}</textarea>
|
||||
<label>{{.locale.Tr "repo.projects.description"}}</label>
|
||||
<textarea name="content" placeholder="{{.locale.Tr "repo.projects.description_placeholder"}}">{{.content}}</textarea>
|
||||
</div>
|
||||
|
||||
{{if not .PageIsEditProjects}}
|
||||
<div class="field">
|
||||
<label>{{ctx.Locale.Tr "repo.projects.template.desc"}}</label>
|
||||
<label>{{.locale.Tr "repo.projects.template.desc"}}</label>
|
||||
<div class="ui selection dropdown">
|
||||
<input type="hidden" name="board_type" value="{{.type}}">
|
||||
<div class="default text">{{ctx.Locale.Tr "repo.projects.template.desc_helper"}}</div>
|
||||
<div class="default text">{{.locale.Tr "repo.projects.template.desc_helper"}}</div>
|
||||
<div class="menu">
|
||||
{{range $element := .BoardTypes}}
|
||||
<div class="item" data-id="{{$element.BoardType}}" data-value="{{$element.BoardType}}">{{ctx.Locale.Tr $element.Translation}}</div>
|
||||
<div class="item" data-id="{{$element.BoardType}}" data-value="{{$element.BoardType}}">{{$.locale.Tr $element.Translation}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
@ -37,18 +37,18 @@
|
||||
{{end}}
|
||||
|
||||
<div class="field">
|
||||
<label>{{ctx.Locale.Tr "repo.projects.card_type.desc"}}</label>
|
||||
<label>{{.locale.Tr "repo.projects.card_type.desc"}}</label>
|
||||
<div class="ui selection dropdown">
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
{{range $element := .CardTypes}}
|
||||
{{if or (eq $.card_type $element.CardType) (and (not $.PageIsEditProjects) (eq $element.CardType 1))}}
|
||||
<input type="hidden" name="card_type" value="{{$element.CardType}}">
|
||||
<div class="default text">{{ctx.Locale.Tr $element.Translation}}</div>
|
||||
<div class="default text">{{$.locale.Tr $element.Translation}}</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<div class="menu">
|
||||
{{range $element := .CardTypes}}
|
||||
<div class="item" data-id="{{$element.CardType}}" data-value="{{$element.CardType}}">{{ctx.Locale.Tr $element.Translation}}</div>
|
||||
<div class="item" data-id="{{$element.CardType}}" data-value="{{$element.CardType}}">{{$.locale.Tr $element.Translation}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
@ -57,10 +57,10 @@
|
||||
<div class="divider"></div>
|
||||
<div class="gt-text-right">
|
||||
<a class="ui cancel button" href="{{$.CancelLink}}">
|
||||
{{ctx.Locale.Tr "repo.milestones.cancel"}}
|
||||
{{.locale.Tr "repo.milestones.cancel"}}
|
||||
</a>
|
||||
<button class="ui primary button">
|
||||
{{if .PageIsEditProjects}}{{ctx.Locale.Tr "repo.projects.modify"}}{{else}}{{ctx.Locale.Tr "repo.projects.create"}}{{end}}
|
||||
{{if .PageIsEditProjects}}{{.locale.Tr "repo.projects.modify"}}{{else}}{{.locale.Tr "repo.projects.create"}}{{end}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -1,48 +1,25 @@
|
||||
{{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}
|
||||
|
||||
<div class="gt-df gt-sb gt-ac gt-mb-4">
|
||||
<h2 class="gt-mb-0">{{.Project.Title}}</h2>
|
||||
{{if $canWriteProject}}
|
||||
<div class="ui compact mini menu">
|
||||
<a class="item" href="{{.Link}}/edit?redirect=project">
|
||||
{{svg "octicon-pencil"}}
|
||||
{{ctx.Locale.Tr "repo.issues.label_edit"}}
|
||||
</a>
|
||||
{{if .Project.IsClosed}}
|
||||
<button class="item btn link-action" data-url="{{.Link}}/open">
|
||||
{{svg "octicon-check"}}
|
||||
{{ctx.Locale.Tr "repo.projects.open"}}
|
||||
</button>
|
||||
{{else}}
|
||||
<button class="item btn link-action" data-url="{{.Link}}/close">
|
||||
{{svg "octicon-skip"}}
|
||||
{{ctx.Locale.Tr "repo.projects.close"}}
|
||||
</button>
|
||||
{{end}}
|
||||
<button class="item btn delete-button" data-url="{{.Link}}/delete" data-id="{{.Project.ID}}">
|
||||
{{svg "octicon-trash"}}
|
||||
{{ctx.Locale.Tr "repo.issues.label_delete"}}
|
||||
</button>
|
||||
<button class="item btn show-modal" data-modal="#new-project-column-item">
|
||||
{{svg "octicon-plus"}}
|
||||
{{ctx.Locale.Tr "new_project_column"}}
|
||||
</button>
|
||||
</div>
|
||||
<div class="ui small modal new-project-column-modal" id="new-project-column-item">
|
||||
<div class="ui two column stackable grid">
|
||||
<div class="column">
|
||||
</div>
|
||||
<div class="column right aligned">
|
||||
{{if .CanWriteProjects}}
|
||||
<a class="ui small green button show-modal item" data-modal="#new-board-item">{{.locale.Tr "new_project_column"}}</a>
|
||||
{{end}}
|
||||
<div class="ui small modal new-board-modal" id="new-board-item">
|
||||
<div class="header">
|
||||
{{ctx.Locale.Tr "repo.projects.column.new"}}
|
||||
{{$.locale.Tr "repo.projects.column.new"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="required field">
|
||||
<label for="new_project_column">{{ctx.Locale.Tr "repo.projects.column.new_title"}}</label>
|
||||
<input class="new-project-column" id="new_project_column" name="title" required>
|
||||
<label for="new_board">{{$.locale.Tr "repo.projects.column.new_title"}}</label>
|
||||
<input class="new-board" id="new_board" name="title" required>
|
||||
</div>
|
||||
|
||||
<div class="field color-field">
|
||||
<label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
|
||||
<label for="new_board_color">{{$.locale.Tr "repo.projects.column.color"}}</label>
|
||||
<div class="color picker column">
|
||||
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color_picker" name="color">
|
||||
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_board_color_picker" name="color">
|
||||
<div class="column precolors">
|
||||
{{template "repo/issue/label_precolors"}}
|
||||
</div>
|
||||
@ -50,143 +27,237 @@
|
||||
</div>
|
||||
|
||||
<div class="text right actions">
|
||||
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
|
||||
<button data-url="{{$.Link}}" class="ui primary button" id="new_project_column_submit">{{ctx.Locale.Tr "repo.projects.column.new_submit"}}</button>
|
||||
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
|
||||
<button data-url="{{$.Link}}" class="ui primary button" id="new_board_submit">{{$.locale.Tr "repo.projects.column.new_submit"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
<div class="ui two column stackable grid">
|
||||
<div class="column">
|
||||
<h2 class="project-title">{{$.Project.Title}}</h2>
|
||||
<div class="content project-description">{{$.Project.RenderedContent|Str2html}}</div>
|
||||
</div>
|
||||
{{if $.CanWriteProjects}}
|
||||
<div class="column right aligned">
|
||||
<div class="ui compact right mini menu">
|
||||
<a class="item" href="{{$.Link}}/edit?redirect=project">
|
||||
{{svg "octicon-pencil"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
|
||||
</a>
|
||||
{{if .Project.IsClosed}}
|
||||
<a class="item link-action" href data-url="{{$.Link}}/open">
|
||||
{{svg "octicon-check"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.projects.open"}}</span>
|
||||
</a>
|
||||
{{else}}
|
||||
<a class="item link-action" href data-url="{{$.Link}}/close">
|
||||
{{svg "octicon-skip"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.projects.close"}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="item delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.Project.ID}}">
|
||||
{{svg "octicon-trash"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_delete"}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="content">{{$.Project.RenderedContent|Str2html}}</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div id="project-board">
|
||||
<div class="board {{if .CanWriteProjects}}sortable{{end}}">
|
||||
{{range .Columns}}
|
||||
<div class="ui segment project-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
|
||||
<div class="project-column-header">
|
||||
<div class="ui large label project-column-title gt-py-2">
|
||||
<div class="ui small circular grey label project-column-issue-count">
|
||||
{{.NumIssues}}
|
||||
</div>
|
||||
{{.Title}}
|
||||
{{range $board := .Boards}}
|
||||
<div class="ui segment board-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
|
||||
<div class="board-column-header gt-df gt-ac gt-sb">
|
||||
<div class="ui large label board-label gt-py-2">
|
||||
<div class="ui small circular grey label board-card-cnt">
|
||||
{{.NumIssues}}
|
||||
</div>
|
||||
{{if and $canWriteProject (ne .ID 0)}}
|
||||
<div class="ui dropdown jump item">
|
||||
<div class="gt-px-3" tabindex="-1">
|
||||
{{svg "octicon-kebab-horizontal"}}
|
||||
</div>
|
||||
<div class="menu user-menu" tabindex="-1">
|
||||
<a class="item show-modal button" data-modal="#edit-project-column-modal-{{.ID}}">
|
||||
{{svg "octicon-pencil"}}
|
||||
{{ctx.Locale.Tr "repo.projects.column.edit"}}
|
||||
{{.Title}}
|
||||
</div>
|
||||
{{if and $.CanWriteProjects (ne .ID 0)}}
|
||||
<div class="ui dropdown jump item">
|
||||
<div class="not-mobile gt-px-3" tabindex="-1">
|
||||
{{svg "octicon-kebab-horizontal"}}
|
||||
</div>
|
||||
<div class="menu user-menu" tabindex="-1">
|
||||
<a class="item show-modal button" data-modal="#edit-project-board-modal-{{.ID}}">
|
||||
{{svg "octicon-pencil"}}
|
||||
{{$.locale.Tr "repo.projects.column.edit"}}
|
||||
</a>
|
||||
{{if not .Default}}
|
||||
<a class="item show-modal button default-project-board-show"
|
||||
data-modal="#default-project-board-modal-{{.ID}}"
|
||||
data-modal-default-project-board-header="{{$.locale.Tr "repo.projects.column.set_default"}}"
|
||||
data-modal-default-project-board-content="{{$.locale.Tr "repo.projects.column.set_default_desc"}}"
|
||||
data-url="{{$.Link}}/{{.ID}}/default">
|
||||
{{svg "octicon-pin"}}
|
||||
{{$.locale.Tr "repo.projects.column.set_default"}}
|
||||
</a>
|
||||
{{if not .Default}}
|
||||
<a class="item show-modal button default-project-column-show"
|
||||
data-modal="#default-project-column-modal-{{.ID}}"
|
||||
data-modal-default-project-column-header="{{ctx.Locale.Tr "repo.projects.column.set_default"}}"
|
||||
data-modal-default-project-column-content="{{ctx.Locale.Tr "repo.projects.column.set_default_desc"}}"
|
||||
data-url="{{$.Link}}/{{.ID}}/default">
|
||||
{{svg "octicon-pin"}}
|
||||
{{ctx.Locale.Tr "repo.projects.column.set_default"}}
|
||||
</a>
|
||||
{{else}}
|
||||
<a class="item show-modal button default-project-column-show"
|
||||
data-modal="#default-project-column-modal-{{.ID}}"
|
||||
data-modal-default-project-column-header="{{ctx.Locale.Tr "repo.projects.column.unset_default"}}"
|
||||
data-modal-default-project-column-content="{{ctx.Locale.Tr "repo.projects.column.unset_default_desc"}}"
|
||||
data-url="{{$.Link}}/{{.ID}}/unsetdefault">
|
||||
{{svg "octicon-pin-slash"}}
|
||||
{{ctx.Locale.Tr "repo.projects.column.unset_default"}}
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="item show-modal button show-delete-project-column-modal"
|
||||
data-modal="#delete-project-column-modal-{{.ID}}"
|
||||
data-url="{{$.Link}}/{{.ID}}">
|
||||
{{svg "octicon-trash"}}
|
||||
{{ctx.Locale.Tr "repo.projects.column.delete"}}
|
||||
{{else}}
|
||||
<a class="item show-modal button default-project-board-show"
|
||||
data-modal="#default-project-board-modal-{{.ID}}"
|
||||
data-modal-default-project-board-header="{{$.locale.Tr "repo.projects.column.unset_default"}}"
|
||||
data-modal-default-project-board-content="{{$.locale.Tr "repo.projects.column.unset_default_desc"}}"
|
||||
data-url="{{$.Link}}/{{.ID}}/unsetdefault">
|
||||
{{svg "octicon-pin-slash"}}
|
||||
{{$.locale.Tr "repo.projects.column.unset_default"}}
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="item show-modal button show-delete-column-modal"
|
||||
data-modal="#delete-board-modal-{{.ID}}"
|
||||
data-url="{{$.Link}}/{{.ID}}"
|
||||
>
|
||||
{{svg "octicon-trash"}}
|
||||
{{$.locale.Tr "repo.projects.column.delete"}}
|
||||
</a>
|
||||
|
||||
<div class="ui small modal edit-project-column-modal" id="edit-project-column-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
{{ctx.Locale.Tr "repo.projects.column.edit"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="required field">
|
||||
<label for="new_project_column_title">{{ctx.Locale.Tr "repo.projects.column.edit_title"}}</label>
|
||||
<input class="project-column-title-input" id="new_project_column_title" name="title" value="{{.Title}}" required>
|
||||
</div>
|
||||
<div class="ui small modal edit-project-board" id="edit-project-board-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
{{$.locale.Tr "repo.projects.column.edit"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="required field">
|
||||
<label for="new_board_title">{{$.locale.Tr "repo.projects.column.edit_title"}}</label>
|
||||
<input class="project-board-title" id="new_board_title" name="title" value="{{.Title}}" required>
|
||||
</div>
|
||||
|
||||
<div class="field color-field">
|
||||
<label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
|
||||
<div class="color picker column">
|
||||
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color" name="color" value="{{.Color}}">
|
||||
<div class="column precolors">
|
||||
{{template "repo/issue/label_precolors"}}
|
||||
</div>
|
||||
<div class="field color-field">
|
||||
<label for="new_board_color">{{$.locale.Tr "repo.projects.column.color"}}</label>
|
||||
<div class="color picker column">
|
||||
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_board_color" name="color" value="{{.Color}}">
|
||||
<div class="column precolors">
|
||||
{{template "repo/issue/label_precolors"}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text right actions">
|
||||
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
|
||||
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-project-column-button">{{ctx.Locale.Tr "repo.projects.column.edit"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui g-modal-confirm modal default-project-column-modal" id="default-project-column-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
<span id="default-project-column-header"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<label id="default-project-column-content"></label>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" (dict "locale" ctx.Locale "ModalButtonTypes" "confirm")}}
|
||||
</div>
|
||||
|
||||
<div class="ui g-modal-confirm modal" id="delete-project-column-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
{{ctx.Locale.Tr "repo.projects.column.delete"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<label>
|
||||
{{ctx.Locale.Tr "repo.projects.column.deletion_desc"}}
|
||||
</label>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" (dict "locale" ctx.Locale "ModalButtonTypes" "confirm")}}
|
||||
<div class="text right actions">
|
||||
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
|
||||
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-column-button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
<div class="ui g-modal-confirm modal default-project-board-modal" id="default-project-board-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
<span id="default-project-board-header"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<label id="default-project-board-content"></label>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
|
||||
</div>
|
||||
|
||||
<div class="ui cards {{if $.CanWriteProjects}}gt-cursor-grab{{end}}" data-url="{{$.Link}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}">
|
||||
{{range (index $.IssuesMap .ID)}}
|
||||
<div class="issue-card gt-word-break" data-issue="{{.ID}}">
|
||||
{{template "repo/issue/card" (dict "Issue" . "Page" $)}}
|
||||
<div class="ui g-modal-confirm modal" id="delete-board-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
{{$.locale.Tr "repo.projects.column.delete"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<label>
|
||||
{{$.locale.Tr "repo.projects.column.deletion_desc"}}
|
||||
</label>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="ui cards board" data-url="{{$.Link}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}">
|
||||
|
||||
{{range (index $.IssuesMap .ID)}}
|
||||
|
||||
<!-- start issue card -->
|
||||
<div class="card board-card" data-issue="{{.ID}}">
|
||||
{{if eq $.Project.CardType 1}}{{/* Images and Text*/}}
|
||||
<div class="card-attachment-images">
|
||||
{{range (index $.issuesAttachmentMap .ID)}}
|
||||
<img src="{{.DownloadURL}}" alt="{{.Name}}" />
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="content gt-p-0">
|
||||
<div class="header">
|
||||
<span class="gt-dif gt-ac gt-vm">
|
||||
{{template "shared/issueicon" .}}
|
||||
</span>
|
||||
<a class="project-board-title gt-vm" href="{{.Link}}">
|
||||
{{.Title}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="meta gt-my-2">
|
||||
<span class="text light grey">
|
||||
{{.Repo.FullName}}#{{.Index}}
|
||||
{{$timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale}}
|
||||
{{if .OriginalAuthor}}
|
||||
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}}
|
||||
{{else if gt .Poster.ID 0}}
|
||||
{{$.locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{else}}
|
||||
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
{{- if .MilestoneID}}
|
||||
<div class="meta gt-my-2">
|
||||
<a class="milestone" href="{{$.RepoLink}}/milestone/{{.MilestoneID}}">
|
||||
{{svg "octicon-milestone" 16 "gt-mr-2 gt-vm"}}
|
||||
<span class="gt-vm">{{.Milestone.Name}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{- end}}
|
||||
{{- range index $.LinkedPRs .ID}}
|
||||
<div class="meta gt-my-2">
|
||||
<a href="{{$.RepoLink}}/pulls/{{.Index}}">
|
||||
<span class="gt-m-0 text {{if .PullRequest.HasMerged}}purple{{else if .IsClosed}}red{{else}}green{{end}}">{{svg "octicon-git-merge" 16 "gt-mr-2 gt-vm"}}</span>
|
||||
<span class="gt-vm">{{.Title}} <span class="text light grey">#{{.Index}}</span></span>
|
||||
</a>
|
||||
</div>
|
||||
{{- end}}
|
||||
</div>
|
||||
|
||||
{{if or .Labels .Assignees}}
|
||||
<div class="extra content labels-list gt-p-0 gt-pt-2">
|
||||
{{range .Labels}}
|
||||
<a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel $.Context .}}</a>
|
||||
{{end}}
|
||||
<div class="right floated">
|
||||
{{range .Assignees}}
|
||||
<a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<!-- stop issue card -->
|
||||
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{if .CanWriteProjects}}
|
||||
<div class="ui g-modal-confirm delete modal">
|
||||
<div class="header">
|
||||
{{svg "octicon-trash"}}
|
||||
{{ctx.Locale.Tr "repo.projects.deletion"}}
|
||||
{{.locale.Tr "repo.projects.deletion"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{ctx.Locale.Tr "repo.projects.deletion_desc"}}</p>
|
||||
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" .}}
|
||||
</div>
|
||||
|
@ -1,66 +0,0 @@
|
||||
{{with .Issue}}
|
||||
{{if eq $.Page.Project.CardType 1}}{{/* Images and Text*/}}
|
||||
<div class="card-attachment-images">
|
||||
{{range (index $.Page.issuesAttachmentMap .ID)}}
|
||||
<img src="{{.DownloadURL}}" alt="{{.Name}}" />
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="content gt-p-0 gt-w-100">
|
||||
<div class="gt-df gt-items-start">
|
||||
<div class="issue-card-icon">
|
||||
{{template "shared/issueicon" .}}
|
||||
</div>
|
||||
<a class="issue-card-title muted issue-title" href="{{.Link}}">{{.Title | RenderEmoji ctx | RenderCodeBlock}}</a>
|
||||
{{if and $.isPinnedIssueCard $.Page.IsRepoAdmin}}
|
||||
<a role="button" class="issue-card-unpin muted gt-df gt-ac" data-tooltip-content={{ctx.Locale.Tr "repo.issues.unpin_issue"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Page.Link}}/unpin/{{.Index}}">
|
||||
{{svg "octicon-x" 16}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="meta gt-my-2">
|
||||
<span class="text light grey muted-links">
|
||||
{{if not $.Page.Repository}}{{.Repo.FullName}}{{end}}#{{.Index}}
|
||||
{{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}}
|
||||
{{if .OriginalAuthor}}
|
||||
{{ctx.Locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}}
|
||||
{{else if gt .Poster.ID 0}}
|
||||
{{ctx.Locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
{{if .MilestoneID}}
|
||||
<div class="meta gt-my-2">
|
||||
<a class="milestone" href="{{$.Page.RepoLink}}/milestone/{{.MilestoneID}}">
|
||||
{{svg "octicon-milestone" 16 "gt-mr-2 gt-vm"}}
|
||||
<span class="gt-vm">{{.Milestone.Name}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if $.Page.LinkedPRs}}
|
||||
{{range index $.Page.LinkedPRs .ID}}
|
||||
<div class="meta gt-my-2">
|
||||
<a href="{{$.Page.RepoLink}}/pulls/{{.Index}}">
|
||||
<span class="gt-m-0 text {{if .PullRequest.HasMerged}}purple{{else if .IsClosed}}red{{else}}green{{end}}">{{svg "octicon-git-merge" 16 "gt-mr-2 gt-vm"}}</span>
|
||||
<span class="gt-vm">{{.Title}} <span class="text light grey">#{{.Index}}</span></span>
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{if or .Labels .Assignees}}
|
||||
<div class="extra content labels-list gt-p-0 gt-pt-2">
|
||||
{{range .Labels}}
|
||||
<a target="_blank" href="{{$.Page.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel ctx .}}</a>
|
||||
{{end}}
|
||||
<div class="right floated">
|
||||
{{range .Assignees}}
|
||||
<a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{ctx.Locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
@ -6,8 +6,61 @@
|
||||
{{if .PinnedIssues}}
|
||||
<div id="issue-pins" {{if .IsRepoAdmin}}data-is-repo-admin{{end}}>
|
||||
{{range .PinnedIssues}}
|
||||
<div class="issue-card gt-word-break {{if $.IsRepoAdmin}}gt-cursor-grab{{end}}" data-move-url="{{$.Link}}/move_pin" data-issue-id="{{.ID}}">
|
||||
{{template "repo/issue/card" (dict "Issue" . "Page" $ "isPinnedIssueCard" true)}}
|
||||
<div class="pinned-issue-card gt-word-break" data-move-url="{{$.Link}}/move_pin" data-issue-id="{{.ID}}">
|
||||
{{if eq $.Project.CardType 1}}
|
||||
<div class="card-attachment-images">
|
||||
{{range (index $.issuesAttachmentMap .ID)}}
|
||||
<img src="{{.DownloadURL}}" alt="{{.Name}}">
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="content gt-p-0">
|
||||
<div class="header gt-df gt-items-start">
|
||||
<div class="pinned-issue-icon">
|
||||
{{template "shared/issueicon" .}}
|
||||
</div>
|
||||
<a class="pinned-issue-title muted issue-title" href="{{.Link}}">{{.Title | RenderEmoji $.Context | RenderCodeBlock}}</a>
|
||||
{{if $.IsRepoAdmin}}
|
||||
<a role="button" class="pinned-issue-unpin muted gt-df gt-ac" data-tooltip-content={{$.locale.Tr "repo.issues.unpin_issue"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Link}}/unpin/{{.Index}}">
|
||||
{{svg "octicon-x" 16}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="meta gt-my-2">
|
||||
<span class="text light grey muted-links">
|
||||
#{{.Index}}
|
||||
{{$timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale}}
|
||||
{{if .OriginalAuthor}}
|
||||
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}}
|
||||
{{else if gt .Poster.ID 0}}
|
||||
{{$.locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{else}}
|
||||
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
{{- if .MilestoneID}}
|
||||
<div class="meta gt-my-2">
|
||||
<a class="milestone" href="{{$.RepoLink}}/milestone/{{.MilestoneID}}">
|
||||
{{svg "octicon-milestone" 16 "gt-mr-2 gt-vm"}}
|
||||
<span class="gt-vm">{{.Milestone.Name}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{- end}}
|
||||
</div>
|
||||
|
||||
{{if or .Labels .Assignees}}
|
||||
<div class="extra content labels-list gt-p-0 gt-pt-2">
|
||||
{{range .Labels}}
|
||||
<a href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel $.Context .}}</a>
|
||||
{{end}}
|
||||
<div class="right floated">
|
||||
{{range .Assignees}}
|
||||
<a href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
@ -1,13 +1,277 @@
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{.Title}}" class="page-content repository projects view-project">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container padded">
|
||||
<div class="gt-df gt-sb gt-ac gt-mb-4">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
<a class="ui right small green button item" href="{{.RepoLink}}/issues/new/choose?project={{.Project.ID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a>
|
||||
<div class="ui container">
|
||||
<div class="ui two column stackable grid">
|
||||
<div class="column">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
</div>
|
||||
<div class="column right aligned">
|
||||
{{if and .CanWriteProjects (not .Repository.IsArchived)}}
|
||||
<a class="ui small green button item" href="{{$.RepoLink}}/issues/new/choose?project={{$.Project.ID}}">{{.locale.Tr "repo.issues.new"}}</a>
|
||||
<a class="ui small green button show-modal item" data-modal="#new-board-item">{{.locale.Tr "new_project_column"}}</a>
|
||||
{{end}}
|
||||
<div class="ui small modal new-board-modal" id="new-board-item">
|
||||
<div class="header">
|
||||
{{$.locale.Tr "repo.projects.column.new"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="required field">
|
||||
<label for="new_board">{{$.locale.Tr "repo.projects.column.new_title"}}</label>
|
||||
<input class="new-board" id="new_board" name="title" required>
|
||||
</div>
|
||||
|
||||
<div class="field color-field">
|
||||
<label for="new_board_color">{{$.locale.Tr "repo.projects.column.color"}}</label>
|
||||
<div class="color picker column">
|
||||
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_board_color_picker" name="color">
|
||||
<div class="column precolors">
|
||||
{{template "repo/issue/label_precolors"}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text right actions">
|
||||
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
|
||||
<button data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}" class="ui primary button disabled" id="new_board_submit">{{$.locale.Tr "repo.projects.column.new_submit"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "projects/view" .}}
|
||||
<div class="divider"></div>
|
||||
<div class="ui two column stackable grid">
|
||||
<div class="column">
|
||||
<h2 class="project-title">{{$.Project.Title}}</h2>
|
||||
<div class="content project-description">{{$.Project.RenderedContent|Str2html}}</div>
|
||||
</div>
|
||||
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
|
||||
<div class="column right aligned">
|
||||
<div class="ui compact right mini menu">
|
||||
<a class="item" href="{{$.RepoLink}}/projects/{{.Project.ID}}/edit?redirect=project">
|
||||
{{svg "octicon-pencil"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_edit"}}</span>
|
||||
</a>
|
||||
{{if .Project.IsClosed}}
|
||||
<a class="item link-action" href data-url="{{$.RepoLink}}/projects/{{.Project.ID}}/open">
|
||||
{{svg "octicon-check"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.projects.open"}}</span>
|
||||
</a>
|
||||
{{else}}
|
||||
<a class="item link-action" href data-url="{{$.RepoLink}}/projects/{{.Project.ID}}/close">
|
||||
{{svg "octicon-skip"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.projects.close"}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="item delete-button" href="#" data-url="{{$.RepoLink}}/projects/{{.Project.ID}}/delete" data-id="{{.Project.ID}}">
|
||||
{{svg "octicon-trash"}}
|
||||
<span class="gt-mx-3">{{$.locale.Tr "repo.issues.label_delete"}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<div class="ui container fluid padded" id="project-board">
|
||||
|
||||
<div class="board {{if .CanWriteProjects}}sortable{{end}}">
|
||||
{{range $board := .Boards}}
|
||||
|
||||
<div class="ui segment board-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}">
|
||||
<div class="board-column-header gt-df gt-ac gt-sb">
|
||||
<div class="ui large label board-label gt-py-2">
|
||||
<div class="ui small circular grey label board-card-cnt">
|
||||
{{.NumIssues}}
|
||||
</div>
|
||||
{{.Title}}
|
||||
</div>
|
||||
{{if and $.CanWriteProjects (not $.Repository.IsArchived) (ne .ID 0)}}
|
||||
<div class="ui dropdown jump item">
|
||||
<div class="not-mobile gt-px-3" tabindex="-1">
|
||||
{{svg "octicon-kebab-horizontal"}}
|
||||
</div>
|
||||
<div class="menu user-menu" tabindex="-1">
|
||||
<a class="item show-modal button" data-modal="#edit-project-board-modal-{{.ID}}">
|
||||
{{svg "octicon-pencil"}}
|
||||
{{$.locale.Tr "repo.projects.column.edit"}}
|
||||
</a>
|
||||
{{if not .Default}}
|
||||
<a class="item show-modal button default-project-board-show"
|
||||
data-modal="#default-project-board-modal-{{.ID}}"
|
||||
data-modal-default-project-board-header="{{$.locale.Tr "repo.projects.column.set_default"}}"
|
||||
data-modal-default-project-board-content="{{$.locale.Tr "repo.projects.column.set_default_desc"}}"
|
||||
data-type="set_default"
|
||||
data-url="{{$.Link}}/{{.ID}}/default">
|
||||
{{svg "octicon-pin"}}
|
||||
{{$.locale.Tr "repo.projects.column.set_default"}}
|
||||
</a>
|
||||
{{else}}
|
||||
<a class="item show-modal button default-project-board-show"
|
||||
data-modal="#default-project-board-modal-{{.ID}}"
|
||||
data-modal-default-project-board-header="{{$.locale.Tr "repo.projects.column.unset_default"}}"
|
||||
data-modal-default-project-board-content="{{$.locale.Tr "repo.projects.column.unset_default_desc"}}"
|
||||
data-type="unset_default"
|
||||
data-url="{{$.Link}}/{{.ID}}/unsetdefault">
|
||||
{{svg "octicon-pin-slash"}}
|
||||
{{$.locale.Tr "repo.projects.column.unset_default"}}
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="item show-modal button show-delete-column-modal"
|
||||
data-modal="#delete-board-modal-{{.ID}}"
|
||||
data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}"
|
||||
>
|
||||
{{svg "octicon-trash"}}
|
||||
{{$.locale.Tr "repo.projects.column.delete"}}
|
||||
</a>
|
||||
|
||||
<div class="ui small modal edit-project-board" id="edit-project-board-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
{{$.locale.Tr "repo.projects.column.edit"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<form class="ui form">
|
||||
<div class="required field">
|
||||
<label for="new_board_title">{{$.locale.Tr "repo.projects.column.edit_title"}}</label>
|
||||
<input class="project-board-title" id="new_board_title" name="title" value="{{.Title}}" required>
|
||||
</div>
|
||||
|
||||
<div class="field color-field">
|
||||
<label for="new_board_color">{{$.locale.Tr "repo.projects.column.color"}}</label>
|
||||
<div class="color picker column">
|
||||
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_board_color" name="color" value="{{.Color}}">
|
||||
<div class="column precolors">
|
||||
{{template "repo/issue/label_precolors"}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text right actions">
|
||||
<button class="ui cancel button">{{$.locale.Tr "settings.cancel"}}</button>
|
||||
<button data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}" class="ui primary button edit-column-button">{{$.locale.Tr "repo.projects.column.edit"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui g-modal-confirm modal default-project-board-modal" id="default-project-board-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
<span id="default-project-board-header"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<label id="default-project-board-content"></label>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
|
||||
</div>
|
||||
|
||||
<div class="ui g-modal-confirm modal" id="delete-board-modal-{{.ID}}">
|
||||
<div class="header">
|
||||
{{$.locale.Tr "repo.projects.column.delete"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<label>
|
||||
{{$.locale.Tr "repo.projects.column.deletion_desc"}}
|
||||
</label>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="ui cards board" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}">
|
||||
|
||||
{{range (index $.IssuesMap .ID)}}
|
||||
|
||||
<!-- start issue card -->
|
||||
<div class="card board-card" data-issue="{{.ID}}">
|
||||
{{if eq $.Project.CardType 1}}{{/* Images and Text*/}}
|
||||
<div class="card-attachment-images">
|
||||
{{range (index $.issuesAttachmentMap .ID)}}
|
||||
<img src="{{.DownloadURL}}" alt="{{.Name}}">
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="content gt-p-0">
|
||||
<div class="header">
|
||||
<span class="gt-dif gt-ac gt-vm">
|
||||
{{template "shared/issueicon" .}}
|
||||
</span>
|
||||
<a class="project-board-title gt-vm" href="{{.Link}}">
|
||||
{{.Title}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="meta gt-my-2">
|
||||
<span class="text light grey">
|
||||
#{{.Index}}
|
||||
{{$timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale}}
|
||||
{{if .OriginalAuthor}}
|
||||
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}}
|
||||
{{else if gt .Poster.ID 0}}
|
||||
{{$.locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{else}}
|
||||
{{$.locale.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
{{- if .MilestoneID}}
|
||||
<div class="meta gt-my-2">
|
||||
<a class="milestone" href="{{$.RepoLink}}/milestone/{{.MilestoneID}}">
|
||||
{{svg "octicon-milestone" 16 "gt-mr-2 gt-vm"}}
|
||||
<span class="gt-vm">{{.Milestone.Name}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{- end}}
|
||||
{{- range index $.LinkedPRs .ID}}
|
||||
<div class="meta gt-my-2">
|
||||
<a href="{{$.RepoLink}}/pulls/{{.Index}}">
|
||||
<span class="gt-m-0 text {{if .PullRequest.HasMerged}}purple{{else if .IsClosed}}red{{else}}green{{end}}">{{svg "octicon-git-merge" 16 "gt-mr-2 gt-vm"}}</span>
|
||||
<span class="gt-vm">{{.Title}} <span class="text light grey">#{{.Index}}</span></span>
|
||||
</a>
|
||||
</div>
|
||||
{{- end}}
|
||||
</div>
|
||||
|
||||
{{if or .Labels .Assignees}}
|
||||
<div class="extra content labels-list gt-p-0 gt-pt-2">
|
||||
{{range .Labels}}
|
||||
<a target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{RenderLabel $.Context .}}</a>
|
||||
{{end}}
|
||||
<div class="right floated">
|
||||
{{range .Assignees}}
|
||||
<a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<!-- stop issue card -->
|
||||
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{if .CanWriteProjects}}
|
||||
<div class="ui g-modal-confirm delete modal">
|
||||
<div class="header">
|
||||
{{svg "octicon-trash"}}
|
||||
{{.locale.Tr "repo.projects.deletion"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{template "base/footer" .}}
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
"code.gitea.io/gitea/tests"
|
||||
)
|
||||
|
||||
var testE2eWebRoutes *web.Route
|
||||
var c *web.Route
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
defer log.GetManager().Close()
|
||||
@ -38,7 +38,7 @@ func TestMain(m *testing.M) {
|
||||
defer cancel()
|
||||
|
||||
tests.InitTest(false)
|
||||
testE2eWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
|
||||
os.Unsetenv("GIT_AUTHOR_NAME")
|
||||
os.Unsetenv("GIT_AUTHOR_EMAIL")
|
||||
|
@ -22,7 +22,7 @@ func onGiteaRunTB(t testing.TB, callback func(testing.TB, *url.URL), prepare ...
|
||||
defer tests.PrepareTestEnv(t, 1)()
|
||||
}
|
||||
s := http.Server{
|
||||
Handler: testE2eWebRoutes,
|
||||
Handler: c,
|
||||
}
|
||||
|
||||
u, err := url.Parse(setting.AppURL)
|
||||
|
@ -22,10 +22,10 @@ import (
|
||||
|
||||
func TestActivityPubPerson(t *testing.T) {
|
||||
setting.Federation.Enabled = true
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
defer func() {
|
||||
setting.Federation.Enabled = false
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
}()
|
||||
|
||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||
@ -60,10 +60,10 @@ func TestActivityPubPerson(t *testing.T) {
|
||||
|
||||
func TestActivityPubMissingPerson(t *testing.T) {
|
||||
setting.Federation.Enabled = true
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
defer func() {
|
||||
setting.Federation.Enabled = false
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
}()
|
||||
|
||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||
@ -75,13 +75,13 @@ func TestActivityPubMissingPerson(t *testing.T) {
|
||||
|
||||
func TestActivityPubPersonInbox(t *testing.T) {
|
||||
setting.Federation.Enabled = true
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
defer func() {
|
||||
setting.Federation.Enabled = false
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
}()
|
||||
|
||||
srv := httptest.NewServer(testWebRoutes)
|
||||
srv := httptest.NewServer(c)
|
||||
defer srv.Close()
|
||||
|
||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||
|
@ -17,10 +17,10 @@ import (
|
||||
|
||||
func TestNodeinfo(t *testing.T) {
|
||||
setting.Federation.Enabled = true
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
defer func() {
|
||||
setting.Federation.Enabled = false
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
}()
|
||||
|
||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||
|
@ -110,14 +110,14 @@ func getExpectedFileResponseForCreate(repoFullName, commitID, treePath, latestCo
|
||||
}
|
||||
|
||||
func BenchmarkAPICreateFileSmall(b *testing.B) {
|
||||
onGiteaRun(b, func(b *testing.B, u *url.URL) {
|
||||
user2 := unittest.AssertExistsAndLoadBean(b, &user_model.User{ID: 2}) // owner of the repo1 & repo16
|
||||
repo1 := unittest.AssertExistsAndLoadBean(b, &repo_model.Repository{ID: 1}) // public repo
|
||||
onGiteaRunTB(b, func(t testing.TB, u *url.URL) {
|
||||
b := t.(*testing.B)
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) // owner of the repo1 & repo16
|
||||
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) // public repo
|
||||
|
||||
b.ResetTimer()
|
||||
for n := 0; n < b.N; n++ {
|
||||
treePath := fmt.Sprintf("update/file%d.txt", n)
|
||||
_, _ = createFileInBranch(user2, repo1, treePath, repo1.DefaultBranch, treePath)
|
||||
createFileInBranch(user2, repo1, treePath, repo1.DefaultBranch, treePath)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -125,15 +125,16 @@ func BenchmarkAPICreateFileSmall(b *testing.B) {
|
||||
func BenchmarkAPICreateFileMedium(b *testing.B) {
|
||||
data := make([]byte, 10*1024*1024)
|
||||
|
||||
onGiteaRun(b, func(b *testing.B, u *url.URL) {
|
||||
user2 := unittest.AssertExistsAndLoadBean(b, &user_model.User{ID: 2}) // owner of the repo1 & repo16
|
||||
repo1 := unittest.AssertExistsAndLoadBean(b, &repo_model.Repository{ID: 1}) // public repo
|
||||
onGiteaRunTB(b, func(t testing.TB, u *url.URL) {
|
||||
b := t.(*testing.B)
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) // owner of the repo1 & repo16
|
||||
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) // public repo
|
||||
|
||||
b.ResetTimer()
|
||||
for n := 0; n < b.N; n++ {
|
||||
treePath := fmt.Sprintf("update/file%d.txt", n)
|
||||
copy(data, treePath)
|
||||
_, _ = createFileInBranch(user2, repo1, treePath, repo1.DefaultBranch, treePath)
|
||||
createFileInBranch(user2, repo1, treePath, repo1.DefaultBranch, treePath)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -24,7 +24,9 @@ func StringWithCharset(length int, charset string) string {
|
||||
}
|
||||
|
||||
func BenchmarkRepoBranchCommit(b *testing.B) {
|
||||
onGiteaRun(b, func(b *testing.B, u *url.URL) {
|
||||
onGiteaRunTB(b, func(t testing.TB, u *url.URL) {
|
||||
b := t.(*testing.B)
|
||||
|
||||
samples := []int64{1, 2, 3}
|
||||
b.ResetTimer()
|
||||
|
||||
|
@ -56,7 +56,7 @@ func TestSessionFileCreation(t *testing.T) {
|
||||
oldSessionConfig := setting.SessionConfig.ProviderConfig
|
||||
defer func() {
|
||||
setting.SessionConfig.ProviderConfig = oldSessionConfig
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
}()
|
||||
|
||||
var config session.Options
|
||||
@ -75,7 +75,7 @@ func TestSessionFileCreation(t *testing.T) {
|
||||
|
||||
setting.SessionConfig.ProviderConfig = string(newConfigBytes)
|
||||
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
|
||||
t.Run("NoSessionOnViewIssue", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
@ -57,10 +57,12 @@ func createSSHUrl(gitPath string, u *url.URL) *url.URL {
|
||||
return &u2
|
||||
}
|
||||
|
||||
func onGiteaRun[T testing.TB](t T, callback func(T, *url.URL)) {
|
||||
defer tests.PrepareTestEnv(t, 1)()
|
||||
func onGiteaRunTB(t testing.TB, callback func(testing.TB, *url.URL), prepare ...bool) {
|
||||
if len(prepare) == 0 || prepare[0] {
|
||||
defer tests.PrepareTestEnv(t, 1)()
|
||||
}
|
||||
s := http.Server{
|
||||
Handler: testWebRoutes,
|
||||
Handler: c,
|
||||
}
|
||||
|
||||
u, err := url.Parse(setting.AppURL)
|
||||
@ -87,6 +89,12 @@ func onGiteaRun[T testing.TB](t T, callback func(T, *url.URL)) {
|
||||
callback(t, u)
|
||||
}
|
||||
|
||||
func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bool) {
|
||||
onGiteaRunTB(t, func(t testing.TB, u *url.URL) {
|
||||
callback(t.(*testing.T), u)
|
||||
}, prepare...)
|
||||
}
|
||||
|
||||
func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
assert.NoError(t, git.CloneWithArgs(context.Background(), git.AllowLFSFiltersArgs(), u.String(), dstLocalPath, git.CloneRepoOptions{}))
|
||||
|
@ -16,7 +16,6 @@ import (
|
||||
"code.gitea.io/gitea/modules/process"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -25,7 +24,12 @@ import (
|
||||
)
|
||||
|
||||
func TestGPGGit(t *testing.T) {
|
||||
tmpDir := t.TempDir() // use a temp dir to avoid messing with the user's GPG keyring
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
username := "user2"
|
||||
|
||||
// OK Set a new GPG home
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
err := os.Chmod(tmpDir, 0o700)
|
||||
assert.NoError(t, err)
|
||||
|
||||
@ -36,20 +40,31 @@ func TestGPGGit(t *testing.T) {
|
||||
|
||||
// Need to create a root key
|
||||
rootKeyPair, err := importTestingKey(tmpDir, "gitea", "gitea@fake.local")
|
||||
if !assert.NoError(t, err, "importTestingKey") {
|
||||
return
|
||||
assert.NoError(t, err)
|
||||
if err != nil {
|
||||
assert.FailNow(t, "Unable to import rootKeyPair")
|
||||
}
|
||||
|
||||
defer test.MockVariableValue(&setting.Repository.Signing.SigningKey, rootKeyPair.PrimaryKey.KeyIdShortString())()
|
||||
defer test.MockVariableValue(&setting.Repository.Signing.SigningName, "gitea")()
|
||||
defer test.MockVariableValue(&setting.Repository.Signing.SigningEmail, "gitea@fake.local")()
|
||||
defer test.MockVariableValue(&setting.Repository.Signing.InitialCommit, []string{"never"})()
|
||||
defer test.MockVariableValue(&setting.Repository.Signing.CRUDActions, []string{"never"})()
|
||||
rootKeyID := rootKeyPair.PrimaryKey.KeyIdShortString()
|
||||
|
||||
username := "user2"
|
||||
oldKeyID := setting.Repository.Signing.SigningKey
|
||||
oldName := setting.Repository.Signing.SigningName
|
||||
oldEmail := setting.Repository.Signing.SigningEmail
|
||||
defer func() {
|
||||
setting.Repository.Signing.SigningKey = oldKeyID
|
||||
setting.Repository.Signing.SigningName = oldName
|
||||
setting.Repository.Signing.SigningEmail = oldEmail
|
||||
}()
|
||||
|
||||
setting.Repository.Signing.SigningKey = rootKeyID
|
||||
setting.Repository.Signing.SigningName = "gitea"
|
||||
setting.Repository.Signing.SigningEmail = "gitea@fake.local"
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: username})
|
||||
baseAPITestContext := NewAPITestContext(t, username, "repo1")
|
||||
|
||||
setting.Repository.Signing.InitialCommit = []string{"never"}
|
||||
setting.Repository.Signing.CRUDActions = []string{"never"}
|
||||
|
||||
baseAPITestContext := NewAPITestContext(t, username, "repo1")
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
@ -72,8 +87,11 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.False(t, response.Verification.Verified)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.CRUDActions = []string{"parentsigned"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.CRUDActions = []string{"parentsigned"}
|
||||
t.Run("Unsigned-Initial-CRUD-ParentSigned", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -86,8 +104,11 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.False(t, response.Verification.Verified)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.CRUDActions = []string{"never"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.CRUDActions = []string{"never"}
|
||||
t.Run("Unsigned-Initial-CRUD-Never", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -96,8 +117,11 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.False(t, response.Verification.Verified)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.CRUDActions = []string{"always"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.CRUDActions = []string{"always"}
|
||||
t.Run("Unsigned-Initial-CRUD-Always", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -130,8 +154,11 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.Equal(t, "gitea@fake.local", response.Verification.Signer.Email)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.CRUDActions = []string{"parentsigned"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.CRUDActions = []string{"parentsigned"}
|
||||
t.Run("Unsigned-Initial-CRUD-ParentSigned", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -150,8 +177,11 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.Equal(t, "gitea@fake.local", response.Verification.Signer.Email)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.InitialCommit = []string{"always"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.InitialCommit = []string{"always"}
|
||||
t.Run("AlwaysSign-Initial", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-always", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -175,8 +205,11 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.Equal(t, "gitea@fake.local", branch.Commit.Verification.Signer.Email)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.CRUDActions = []string{"never"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.CRUDActions = []string{"never"}
|
||||
t.Run("AlwaysSign-Initial-CRUD-Never", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-always-never", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -186,8 +219,10 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.False(t, response.Verification.Verified)
|
||||
}))
|
||||
})
|
||||
|
||||
setting.Repository.Signing.CRUDActions = []string{"parentsigned"}
|
||||
}, false)
|
||||
setting.Repository.Signing.CRUDActions = []string{"parentsigned"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
t.Run("AlwaysSign-Initial-CRUD-ParentSigned-On-Always", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-always-parent", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -202,8 +237,11 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.Equal(t, "gitea@fake.local", response.Verification.Signer.Email)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.CRUDActions = []string{"always"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.CRUDActions = []string{"always"}
|
||||
t.Run("AlwaysSign-Initial-CRUD-Always", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-always-always", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
@ -218,16 +256,21 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.Equal(t, "gitea@fake.local", response.Verification.Signer.Email)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
var pr api.PullRequest
|
||||
setting.Repository.Signing.Merges = []string{"commitssigned"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.Merges = []string{"commitssigned"}
|
||||
t.Run("UnsignedMerging", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
var err error
|
||||
t.Run("CreatePullRequest", func(t *testing.T) {
|
||||
pr, err := doAPICreatePullRequest(testCtx, testCtx.Username, testCtx.Reponame, "master", "never2")(t)
|
||||
pr, err = doAPICreatePullRequest(testCtx, testCtx.Username, testCtx.Reponame, "master", "never2")(t)
|
||||
assert.NoError(t, err)
|
||||
t.Run("MergePR", doAPIMergePullRequest(testCtx, testCtx.Username, testCtx.Reponame, pr.Index))
|
||||
})
|
||||
t.Run("MergePR", doAPIMergePullRequest(testCtx, testCtx.Username, testCtx.Reponame, pr.Index))
|
||||
t.Run("CheckMasterBranchUnsigned", doAPIGetBranch(testCtx, "master", func(t *testing.T, branch api.Branch) {
|
||||
assert.NotNil(t, branch.Commit)
|
||||
assert.NotNil(t, branch.Commit.Verification)
|
||||
@ -235,16 +278,20 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.Empty(t, branch.Commit.Verification.Signature)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.Merges = []string{"basesigned"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.Merges = []string{"basesigned"}
|
||||
t.Run("BaseSignedMerging", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
var err error
|
||||
t.Run("CreatePullRequest", func(t *testing.T) {
|
||||
pr, err := doAPICreatePullRequest(testCtx, testCtx.Username, testCtx.Reponame, "master", "parentsigned2")(t)
|
||||
pr, err = doAPICreatePullRequest(testCtx, testCtx.Username, testCtx.Reponame, "master", "parentsigned2")(t)
|
||||
assert.NoError(t, err)
|
||||
t.Run("MergePR", doAPIMergePullRequest(testCtx, testCtx.Username, testCtx.Reponame, pr.Index))
|
||||
})
|
||||
t.Run("MergePR", doAPIMergePullRequest(testCtx, testCtx.Username, testCtx.Reponame, pr.Index))
|
||||
t.Run("CheckMasterBranchUnsigned", doAPIGetBranch(testCtx, "master", func(t *testing.T, branch api.Branch) {
|
||||
assert.NotNil(t, branch.Commit)
|
||||
assert.NotNil(t, branch.Commit.Verification)
|
||||
@ -252,23 +299,27 @@ func TestGPGGit(t *testing.T) {
|
||||
assert.Empty(t, branch.Commit.Verification.Signature)
|
||||
}))
|
||||
})
|
||||
}, false)
|
||||
setting.Repository.Signing.Merges = []string{"commitssigned"}
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
setting.Repository.Signing.Merges = []string{"commitssigned"}
|
||||
t.Run("CommitsSignedMerging", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||
var err error
|
||||
t.Run("CreatePullRequest", func(t *testing.T) {
|
||||
pr, err := doAPICreatePullRequest(testCtx, testCtx.Username, testCtx.Reponame, "master", "always-parentsigned")(t)
|
||||
pr, err = doAPICreatePullRequest(testCtx, testCtx.Username, testCtx.Reponame, "master", "always-parentsigned")(t)
|
||||
assert.NoError(t, err)
|
||||
t.Run("MergePR", doAPIMergePullRequest(testCtx, testCtx.Username, testCtx.Reponame, pr.Index))
|
||||
})
|
||||
t.Run("MergePR", doAPIMergePullRequest(testCtx, testCtx.Username, testCtx.Reponame, pr.Index))
|
||||
t.Run("CheckMasterBranchUnsigned", doAPIGetBranch(testCtx, "master", func(t *testing.T, branch api.Branch) {
|
||||
assert.NotNil(t, branch.Commit)
|
||||
assert.NotNil(t, branch.Commit.Verification)
|
||||
assert.True(t, branch.Commit.Verification.Verified)
|
||||
}))
|
||||
})
|
||||
})
|
||||
}, false)
|
||||
}
|
||||
|
||||
func crudActionCreateFile(t *testing.T, ctx APITestContext, user *user_model.User, from, to, path string, callback ...func(*testing.T, api.FileResponse)) func(*testing.T) {
|
||||
|
@ -40,7 +40,7 @@ import (
|
||||
"github.com/xeipuuv/gojsonschema"
|
||||
)
|
||||
|
||||
var testWebRoutes *web.Route
|
||||
var c *web.Route
|
||||
|
||||
type NilResponseRecorder struct {
|
||||
httptest.ResponseRecorder
|
||||
@ -87,7 +87,7 @@ func TestMain(m *testing.M) {
|
||||
defer cancel()
|
||||
|
||||
tests.InitTest(true)
|
||||
testWebRoutes = routers.NormalRoutes()
|
||||
c = routers.NormalRoutes()
|
||||
|
||||
// integration test settings...
|
||||
if setting.CfgProvider != nil {
|
||||
@ -374,7 +374,7 @@ func MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.
|
||||
if req.RemoteAddr == "" {
|
||||
req.RemoteAddr = "test-mock:12345"
|
||||
}
|
||||
testWebRoutes.ServeHTTP(recorder, req)
|
||||
c.ServeHTTP(recorder, req)
|
||||
if expectedStatus != NoExpectedStatus {
|
||||
if !assert.EqualValues(t, expectedStatus, recorder.Code, "Request: %s %s", req.Method, req.URL.String()) {
|
||||
logUnexpectedResponse(t, recorder)
|
||||
@ -386,7 +386,7 @@ func MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.
|
||||
func MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseRecorder {
|
||||
t.Helper()
|
||||
recorder := NewNilResponseRecorder()
|
||||
testWebRoutes.ServeHTTP(recorder, req)
|
||||
c.ServeHTTP(recorder, req)
|
||||
if expectedStatus != NoExpectedStatus {
|
||||
if !assert.EqualValues(t, expectedStatus, recorder.Code,
|
||||
"Request: %s %s", req.Method, req.URL.String()) {
|
||||
@ -399,7 +399,7 @@ func MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedSta
|
||||
func MakeRequestNilResponseHashSumRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseHashSumRecorder {
|
||||
t.Helper()
|
||||
recorder := NewNilResponseHashSumRecorder()
|
||||
testWebRoutes.ServeHTTP(recorder, req)
|
||||
c.ServeHTTP(recorder, req)
|
||||
if expectedStatus != NoExpectedStatus {
|
||||
if !assert.EqualValues(t, expectedStatus, recorder.Code,
|
||||
"Request: %s %s", req.Method, req.URL.String()) {
|
||||
|
@ -181,7 +181,7 @@ func InitTest(requireGitea bool) {
|
||||
|
||||
func PrepareTestEnv(t testing.TB, skip ...int) func() {
|
||||
t.Helper()
|
||||
ourSkip := 1
|
||||
ourSkip := 2
|
||||
if len(skip) > 0 {
|
||||
ourSkip += skip[0]
|
||||
}
|
||||
|
@ -6,7 +6,11 @@
|
||||
margin: 0 0.5em;
|
||||
}
|
||||
|
||||
.project-column {
|
||||
.board.sortable .board-card {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.board-column {
|
||||
background-color: var(--color-project-board-bg) !important;
|
||||
border: 1px solid var(--color-secondary) !important;
|
||||
margin: 0 0.5rem !important;
|
||||
@ -21,34 +25,33 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.project-column-header {
|
||||
.board-column-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.project-column-header.dark-label {
|
||||
.board-column-header.dark-label {
|
||||
color: var(--color-project-board-dark-label) !important;
|
||||
}
|
||||
|
||||
.project-column-header.dark-label .project-column-title {
|
||||
.board-column-header.dark-label .board-label {
|
||||
color: var(--color-project-board-dark-label) !important;
|
||||
}
|
||||
|
||||
.project-column-header.light-label {
|
||||
.board-column-header.light-label {
|
||||
color: var(--color-project-board-light-label) !important;
|
||||
}
|
||||
|
||||
.project-column-header.light-label .project-column-title {
|
||||
.board-column-header.light-label .board-label {
|
||||
color: var(--color-project-board-light-label) !important;
|
||||
}
|
||||
|
||||
.project-column-title {
|
||||
.board-label {
|
||||
background: none !important;
|
||||
line-height: 1.25 !important;
|
||||
}
|
||||
|
||||
.project-column > .cards {
|
||||
.board-column > .cards {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-content: baseline;
|
||||
@ -56,37 +59,60 @@
|
||||
padding: 0 !important;
|
||||
flex-wrap: nowrap !important;
|
||||
flex-direction: column;
|
||||
overflow-x: auto;
|
||||
gap: .25rem;
|
||||
}
|
||||
|
||||
.project-column > .divider {
|
||||
.project-board-title {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.board-column > .divider {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.project-column:first-child {
|
||||
.board-column:first-child {
|
||||
margin-left: auto !important;
|
||||
}
|
||||
|
||||
.project-column:last-child {
|
||||
.board-column:last-child {
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
.card-attachment-images {
|
||||
.board-column .ui.cards > .card > .content {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.board-card {
|
||||
margin: 4px 2px !important;
|
||||
border-radius: 5px !important;
|
||||
width: calc(100% - 4px) !important;
|
||||
padding: 0.5rem !important;
|
||||
min-height: auto !important;
|
||||
}
|
||||
|
||||
.board-card .meta * {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.board-card .header {
|
||||
margin-top: 0 !important;
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.board-card .card-attachment-images {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card-attachment-images img {
|
||||
.board-card .card-attachment-images img {
|
||||
display: inline-block;
|
||||
max-height: 50px;
|
||||
border-radius: var(--border-radius);
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.card-attachment-images img:only-child {
|
||||
.board-card .card-attachment-images img:only-child {
|
||||
max-height: 90px;
|
||||
margin: auto;
|
||||
}
|
||||
@ -113,12 +139,12 @@
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.edit-project-column-modal .color.picker.column,
|
||||
.new-project-column-modal .color.picker.column {
|
||||
.edit-project-board .color.picker.column,
|
||||
.new-board-modal .color.picker.column {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.edit-project-column-modal .color.picker.column .minicolors,
|
||||
.new-project-column-modal .color.picker.column .minicolors {
|
||||
.edit-project-board .color.picker.column .minicolors,
|
||||
.new-board-modal .color.picker.column .minicolors {
|
||||
flex: 1;
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ Gitea's private styles use `g-` prefix.
|
||||
.gt-content-center { align-content: center !important; }
|
||||
.gt-cursor-default { cursor: default !important; }
|
||||
.gt-cursor-pointer { cursor: pointer !important; }
|
||||
.gt-cursor-grab { cursor: grab !important; }
|
||||
.gt-invisible { visibility: hidden !important; }
|
||||
.gt-items-start { align-items: flex-start !important; }
|
||||
.gt-pointer-events-none { pointer-events: none !important; }
|
||||
|
@ -45,7 +45,6 @@
|
||||
|
||||
@import "./repo.css";
|
||||
@import "./repo/release-tag.css";
|
||||
@import "./repo/issue-card.css";
|
||||
@import "./repo/issue-label.css";
|
||||
@import "./repo/issue-list.css";
|
||||
@import "./repo/list-header.css";
|
||||
|
@ -3302,6 +3302,25 @@ tbody.commit-list {
|
||||
}
|
||||
}
|
||||
|
||||
.pinned-issue-card {
|
||||
border-radius: var(--border-radius);
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--color-secondary);
|
||||
background: var(--color-card);
|
||||
}
|
||||
|
||||
.pinned-issue-icon,
|
||||
.pinned-issue-unpin {
|
||||
margin-top: 1px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.pinned-issue-title {
|
||||
flex: 1;
|
||||
font-size: 18px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
#cherry-pick-modal .scrolling.menu {
|
||||
max-height: 200px;
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
.issue-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--color-secondary);
|
||||
background: var(--color-card);
|
||||
}
|
||||
|
||||
.issue-card-icon,
|
||||
.issue-card-unpin {
|
||||
margin-top: 1px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.issue-card-title {
|
||||
flex: 1;
|
||||
font-size: 18px;
|
||||
margin-left: 4px;
|
||||
}
|
@ -74,23 +74,23 @@
|
||||
<SvgIcon name="octicon-gear" :size="18"/>
|
||||
</button>
|
||||
<div class="menu transition action-job-menu" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
|
||||
<a class="item" @click="toggleTimeDisplay('seconds')">
|
||||
<i class="icon"><SvgIcon :name="timeVisible['log-time-seconds'] ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
|
||||
{{ locale.showLogSeconds }}
|
||||
</a>
|
||||
<a class="item" @click="toggleTimeDisplay('stamp')">
|
||||
<i class="icon"><SvgIcon :name="timeVisible['log-time-stamp'] ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
|
||||
{{ locale.showTimeStamps }}
|
||||
</a>
|
||||
<a class="item" @click="toggleFullScreen()">
|
||||
<i class="icon"><SvgIcon :name="isFullScreen ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
|
||||
{{ locale.showFullScreen }}
|
||||
</a>
|
||||
<div class="divider"/>
|
||||
<a :class="['item', currentJob.steps.length === 0 ? 'disabled' : '']" :href="run.link+'/jobs/'+jobIndex+'/logs'" target="_blank">
|
||||
<i class="icon"><SvgIcon name="octicon-download"/></i>
|
||||
{{ locale.downloadLogs }}
|
||||
</a>
|
||||
<a class="item" @click="toggleTimeDisplay('seconds')">
|
||||
<i class="icon"><SvgIcon v-show="timeVisible['log-time-seconds']" name="octicon-check"/></i>
|
||||
{{ locale.showLogSeconds }}
|
||||
</a>
|
||||
<a class="item" @click="toggleTimeDisplay('stamp')">
|
||||
<i class="icon"><SvgIcon v-show="timeVisible['log-time-stamp']" name="octicon-check"/></i>
|
||||
{{ locale.showTimeStamps }}
|
||||
</a>
|
||||
<div class="divider"/>
|
||||
<a class="item" @click="toggleFullScreen()">
|
||||
<i class="icon"><SvgIcon v-show="isFullScreen" name="octicon-check"/></i>
|
||||
{{ locale.showFullScreen }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -401,10 +401,20 @@ const sfc = {
|
||||
if (this.menuVisible) this.menuVisible = false;
|
||||
},
|
||||
|
||||
// show at most one of log seconds and timestamp (can be both invisible)
|
||||
toggleTimeDisplay(type) {
|
||||
const toToggleTypes = [];
|
||||
const other = type === 'seconds' ? 'stamp' : 'seconds';
|
||||
this.timeVisible[`log-time-${type}`] = !this.timeVisible[`log-time-${type}`];
|
||||
for (const el of this.$refs.steps.querySelectorAll(`.log-time-${type}`)) {
|
||||
toggleElem(el, this.timeVisible[`log-time-${type}`]);
|
||||
toToggleTypes.push(type);
|
||||
if (this.timeVisible[`log-time-${type}`] && this.timeVisible[`log-time-${other}`]) {
|
||||
this.timeVisible[`log-time-${other}`] = false;
|
||||
toToggleTypes.push(other);
|
||||
}
|
||||
for (const toToggle of toToggleTypes) {
|
||||
for (const el of this.$refs.steps.querySelectorAll(`.log-time-${toToggle}`)) {
|
||||
toggleElem(el, this.timeVisible[`log-time-${toToggle}`]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -140,7 +140,7 @@ function initRepoIssueListAuthorDropdown() {
|
||||
}
|
||||
|
||||
function initPinRemoveButton() {
|
||||
for (const button of document.getElementsByClassName('issue-card-unpin')) {
|
||||
for (const button of document.getElementsByClassName('pinned-issue-unpin')) {
|
||||
button.addEventListener('click', async (event) => {
|
||||
const el = event.currentTarget;
|
||||
const id = Number(el.getAttribute('data-issue-id'));
|
||||
@ -157,7 +157,7 @@ function initPinRemoveButton() {
|
||||
// Delete the tooltip
|
||||
el._tippy.destroy();
|
||||
// Remove the Card
|
||||
el.closest(`div.issue-card[data-issue-id="${id}"]`).remove();
|
||||
el.closest(`div.pinned-issue-card[data-issue-id="${id}"]`).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -7,27 +7,27 @@ const {csrfToken} = window.config;
|
||||
|
||||
function updateIssueCount(cards) {
|
||||
const parent = cards.parentElement;
|
||||
const cnt = parent.getElementsByClassName('issue-card').length;
|
||||
parent.getElementsByClassName('project-column-issue-count')[0].textContent = cnt;
|
||||
const cnt = parent.getElementsByClassName('board-card').length;
|
||||
parent.getElementsByClassName('board-card-cnt')[0].textContent = cnt;
|
||||
}
|
||||
|
||||
function createNewColumn(url, columnTitle, projectColorInput) {
|
||||
function createNewBoard(url, boardTitle, projectColorInput) {
|
||||
$.ajax({
|
||||
url,
|
||||
data: JSON.stringify({title: columnTitle.val(), color: projectColorInput.val()}),
|
||||
data: JSON.stringify({title: boardTitle.val(), color: projectColorInput.val()}),
|
||||
headers: {
|
||||
'X-Csrf-Token': csrfToken,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
method: 'POST',
|
||||
}).done(() => {
|
||||
columnTitle.closest('form').removeClass('dirty');
|
||||
boardTitle.closest('form').removeClass('dirty');
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function moveIssue({item, from, to, oldIndex}) {
|
||||
const columnCards = to.getElementsByClassName('issue-card');
|
||||
const columnCards = to.getElementsByClassName('board-card');
|
||||
updateIssueCount(from);
|
||||
updateIssueCount(to);
|
||||
|
||||
@ -56,19 +56,19 @@ async function initRepoProjectSortable() {
|
||||
const els = document.querySelectorAll('#project-board > .board.sortable');
|
||||
if (!els.length) return;
|
||||
|
||||
// the HTML layout is: #project-board > .board > .project-column .cards > .issue-card
|
||||
// the HTML layout is: #project-board > .board > .board-column .board.cards > .board-card.card .content
|
||||
const mainBoard = els[0];
|
||||
let boardColumns = mainBoard.getElementsByClassName('project-column');
|
||||
let boardColumns = mainBoard.getElementsByClassName('board-column');
|
||||
createSortable(mainBoard, {
|
||||
group: 'project-column',
|
||||
draggable: '.project-column',
|
||||
group: 'board-column',
|
||||
draggable: '.board-column',
|
||||
filter: '[data-id="0"]',
|
||||
animation: 150,
|
||||
ghostClass: 'card-ghost',
|
||||
delayOnTouchOnly: true,
|
||||
delay: 500,
|
||||
onSort: () => {
|
||||
boardColumns = mainBoard.getElementsByClassName('project-column');
|
||||
boardColumns = mainBoard.getElementsByClassName('board-column');
|
||||
for (let i = 0; i < boardColumns.length; i++) {
|
||||
const column = boardColumns[i];
|
||||
if (parseInt($(column).data('sorting')) !== i) {
|
||||
@ -87,7 +87,7 @@ async function initRepoProjectSortable() {
|
||||
});
|
||||
|
||||
for (const boardColumn of boardColumns) {
|
||||
const boardCardList = boardColumn.getElementsByClassName('cards')[0];
|
||||
const boardCardList = boardColumn.getElementsByClassName('board')[0];
|
||||
createSortable(boardCardList, {
|
||||
group: 'shared',
|
||||
animation: 150,
|
||||
@ -107,18 +107,18 @@ export function initRepoProject() {
|
||||
|
||||
const _promise = initRepoProjectSortable();
|
||||
|
||||
$('.edit-project-column-modal').each(function () {
|
||||
const projectHeader = $(this).closest('.project-column-header');
|
||||
const projectTitleLabel = projectHeader.find('.project-column-title');
|
||||
const projectTitleInput = $(this).find('.project-column-title-input');
|
||||
const projectColorInput = $(this).find('#new_project_column_color');
|
||||
const boardColumn = $(this).closest('.project-column');
|
||||
$('.edit-project-board').each(function () {
|
||||
const projectHeader = $(this).closest('.board-column-header');
|
||||
const projectTitleLabel = projectHeader.find('.board-label');
|
||||
const projectTitleInput = $(this).find('.project-board-title');
|
||||
const projectColorInput = $(this).find('#new_board_color');
|
||||
const boardColumn = $(this).closest('.board-column');
|
||||
|
||||
if (boardColumn.css('backgroundColor')) {
|
||||
setLabelColor(projectHeader, rgbToHex(boardColumn.css('backgroundColor')));
|
||||
}
|
||||
|
||||
$(this).find('.edit-project-column-button').on('click', function (e) {
|
||||
$(this).find('.edit-column-button').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
@ -141,9 +141,9 @@ export function initRepoProject() {
|
||||
});
|
||||
});
|
||||
|
||||
$('.default-project-column-modal').each(function () {
|
||||
const boardColumn = $(this).closest('.project-column');
|
||||
const showButton = $(boardColumn).find('.default-project-column-show');
|
||||
$('.default-project-board-modal').each(function () {
|
||||
const boardColumn = $(this).closest('.board-column');
|
||||
const showButton = $(boardColumn).find('.default-project-board-show');
|
||||
const commitButton = $(this).find('.actions > .ok.button');
|
||||
|
||||
$(commitButton).on('click', (e) => {
|
||||
@ -162,7 +162,7 @@ export function initRepoProject() {
|
||||
});
|
||||
});
|
||||
|
||||
$('.show-delete-project-column-modal').each(function () {
|
||||
$('.show-delete-column-modal').each(function () {
|
||||
const deleteColumnModal = $(`${$(this).attr('data-modal')}`);
|
||||
const deleteColumnButton = deleteColumnModal.find('.actions > .ok.button');
|
||||
const deleteUrl = $(this).attr('data-url');
|
||||
@ -183,28 +183,28 @@ export function initRepoProject() {
|
||||
});
|
||||
});
|
||||
|
||||
$('#new_project_column_submit').on('click', (e) => {
|
||||
$('#new_board_submit').on('click', (e) => {
|
||||
e.preventDefault();
|
||||
const columnTitle = $('#new_project_column');
|
||||
const projectColorInput = $('#new_project_column_color_picker');
|
||||
if (!columnTitle.val()) {
|
||||
const boardTitle = $('#new_board');
|
||||
const projectColorInput = $('#new_board_color_picker');
|
||||
if (!boardTitle.val()) {
|
||||
return;
|
||||
}
|
||||
const url = $(this).data('url');
|
||||
createNewColumn(url, columnTitle, projectColorInput);
|
||||
createNewBoard(url, boardTitle, projectColorInput);
|
||||
});
|
||||
|
||||
$('.new-project-column').on('input keyup', (e) => {
|
||||
const columnTitle = $('#new_project_column');
|
||||
const projectColorInput = $('#new_project_column_color_picker');
|
||||
if (!columnTitle.val()) {
|
||||
$('#new_project_column_submit').addClass('disabled');
|
||||
$('.new-board').on('input keyup', (e) => {
|
||||
const boardTitle = $('#new_board');
|
||||
const projectColorInput = $('#new_board_color_picker');
|
||||
if (!boardTitle.val()) {
|
||||
$('#new_board_submit').addClass('disabled');
|
||||
return;
|
||||
}
|
||||
$('#new_project_column_submit').removeClass('disabled');
|
||||
$('#new_board_submit').removeClass('disabled');
|
||||
if (e.key === 'Enter') {
|
||||
const url = $(this).data('url');
|
||||
createNewColumn(url, columnTitle, projectColorInput);
|
||||
createNewBoard(url, boardTitle, projectColorInput);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ function makeCollections({mentions, emoji}) {
|
||||
|
||||
if (mentions) {
|
||||
collections.push({
|
||||
values: window.config.mentionValues ?? [],
|
||||
values: window.config.mentionValues,
|
||||
requireLeadingSpace: true,
|
||||
menuItemTemplate: (item) => {
|
||||
return `
|
||||
|
@ -32,7 +32,7 @@ export function matchMention(queryText) {
|
||||
|
||||
// results is a map of weights, lower is better
|
||||
const results = new Map();
|
||||
for (const obj of window.config.mentionValues ?? []) {
|
||||
for (const obj of window.config.mentionValues) {
|
||||
const index = obj.key.toLowerCase().indexOf(query);
|
||||
if (index === -1) continue;
|
||||
const existing = results.get(obj);
|
||||
|
Loading…
x
Reference in New Issue
Block a user