commit
dcb391d341
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,178 @@ |
||||
// Copyright 2015 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models |
||||
|
||||
import ( |
||||
"fmt" |
||||
"io/ioutil" |
||||
"os" |
||||
"path" |
||||
"path/filepath" |
||||
"strings" |
||||
"sync" |
||||
|
||||
"github.com/Unknwon/com" |
||||
|
||||
"github.com/gogits/git-shell" |
||||
|
||||
"github.com/gogits/gogs/modules/setting" |
||||
) |
||||
|
||||
// workingPool represents a pool of working status which makes sure
|
||||
// that only one instance of same task is performing at a time.
|
||||
// However, different type of tasks can performing at the same time.
|
||||
type workingPool struct { |
||||
lock sync.Mutex |
||||
pool map[string]*sync.Mutex |
||||
count map[string]int |
||||
} |
||||
|
||||
// CheckIn checks in a task and waits if others are running.
|
||||
func (p *workingPool) CheckIn(name string) { |
||||
p.lock.Lock() |
||||
|
||||
lock, has := p.pool[name] |
||||
if !has { |
||||
lock = &sync.Mutex{} |
||||
p.pool[name] = lock |
||||
} |
||||
p.count[name]++ |
||||
|
||||
p.lock.Unlock() |
||||
lock.Lock() |
||||
} |
||||
|
||||
// CheckOut checks out a task to let other tasks run.
|
||||
func (p *workingPool) CheckOut(name string) { |
||||
p.lock.Lock() |
||||
defer p.lock.Unlock() |
||||
|
||||
p.pool[name].Unlock() |
||||
if p.count[name] == 1 { |
||||
delete(p.pool, name) |
||||
delete(p.count, name) |
||||
} else { |
||||
p.count[name]-- |
||||
} |
||||
} |
||||
|
||||
var wikiWorkingPool = &workingPool{ |
||||
pool: make(map[string]*sync.Mutex), |
||||
count: make(map[string]int), |
||||
} |
||||
|
||||
// ToWikiPageURL formats a string to corresponding wiki URL name.
|
||||
func ToWikiPageURL(name string) string { |
||||
return strings.Replace(name, " ", "-", -1) |
||||
} |
||||
|
||||
// ToWikiPageName formats a URL back to corresponding wiki page name.
|
||||
func ToWikiPageName(name string) string { |
||||
return strings.Replace(name, "-", " ", -1) |
||||
} |
||||
|
||||
// WikiCloneLink returns clone URLs of repository wiki.
|
||||
func (repo *Repository) WikiCloneLink() (cl *CloneLink) { |
||||
return repo.cloneLink(true) |
||||
} |
||||
|
||||
// WikiPath returns wiki data path by given user and repository name.
|
||||
func WikiPath(userName, repoName string) string { |
||||
return filepath.Join(UserPath(userName), strings.ToLower(repoName)+".wiki.git") |
||||
} |
||||
|
||||
func (repo *Repository) WikiPath() string { |
||||
return WikiPath(repo.MustOwner().Name, repo.Name) |
||||
} |
||||
|
||||
// HasWiki returns true if repository has wiki.
|
||||
func (repo *Repository) HasWiki() bool { |
||||
return com.IsDir(repo.WikiPath()) |
||||
} |
||||
|
||||
// InitWiki initializes a wiki for repository,
|
||||
// it does nothing when repository already has wiki.
|
||||
func (repo *Repository) InitWiki() error { |
||||
if repo.HasWiki() { |
||||
return nil |
||||
} |
||||
|
||||
if err := git.InitRepository(repo.WikiPath(), true); err != nil { |
||||
return fmt.Errorf("InitRepository: %v", err) |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
func (repo *Repository) LocalWikiPath() string { |
||||
return path.Join(setting.AppDataPath, "tmp/local-wiki", com.ToStr(repo.ID)) |
||||
} |
||||
|
||||
// UpdateLocalWiki makes sure the local copy of repository wiki is up-to-date.
|
||||
func (repo *Repository) UpdateLocalWiki() error { |
||||
return updateLocalCopy(repo.WikiPath(), repo.LocalWikiPath()) |
||||
} |
||||
|
||||
// updateWikiPage adds new page to repository wiki.
|
||||
func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, message string, isNew bool) (err error) { |
||||
wikiWorkingPool.CheckIn(com.ToStr(repo.ID)) |
||||
defer wikiWorkingPool.CheckOut(com.ToStr(repo.ID)) |
||||
|
||||
if err = repo.InitWiki(); err != nil { |
||||
return fmt.Errorf("InitWiki: %v", err) |
||||
} |
||||
|
||||
localPath := repo.LocalWikiPath() |
||||
|
||||
// Discard local commits make sure even to remote when local copy exists.
|
||||
if com.IsExist(localPath) { |
||||
// No need to check if nothing in the repository.
|
||||
if git.IsBranchExist(localPath, "master") { |
||||
if err = git.Reset(localPath, true, "origin/master"); err != nil { |
||||
return fmt.Errorf("Reset: %v", err) |
||||
} |
||||
} |
||||
} |
||||
|
||||
if err = repo.UpdateLocalWiki(); err != nil { |
||||
return fmt.Errorf("UpdateLocalWiki: %v", err) |
||||
} |
||||
|
||||
title = ToWikiPageName(strings.Replace(title, "/", " ", -1)) |
||||
filename := path.Join(localPath, title+".md") |
||||
|
||||
// If not a new file, show perform update not create.
|
||||
if isNew { |
||||
if com.IsExist(filename) { |
||||
return ErrWikiAlreadyExist{filename} |
||||
} |
||||
} else { |
||||
os.Remove(path.Join(localPath, oldTitle+".md")) |
||||
} |
||||
|
||||
if err = ioutil.WriteFile(filename, []byte(content), 0666); err != nil { |
||||
return fmt.Errorf("WriteFile: %v", err) |
||||
} |
||||
|
||||
if len(message) == 0 { |
||||
message = "Update page '" + title + "'" |
||||
} |
||||
if err = git.AddChanges(localPath, true); err != nil { |
||||
return fmt.Errorf("AddChanges: %v", err) |
||||
} else if err = git.CommitChanges(localPath, message, doer.NewGitSig()); err != nil { |
||||
return fmt.Errorf("CommitChanges: %v", err) |
||||
} else if err = git.Push(localPath, "origin", "master"); err != nil { |
||||
return fmt.Errorf("Push: %v", err) |
||||
} |
||||
|
||||
return nil |
||||
} |
||||
|
||||
func (repo *Repository) AddWikiPage(doer *User, title, content, message string) error { |
||||
return repo.updateWikiPage(doer, "", title, content, message, true) |
||||
} |
||||
|
||||
func (repo *Repository) EditWikiPage(doer *User, oldTitle, title, content, message string) error { |
||||
return repo.updateWikiPage(doer, oldTitle, title, content, message, false) |
||||
} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,245 @@ |
||||
// Copyright 2015 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package repo |
||||
|
||||
import ( |
||||
"io/ioutil" |
||||
"strings" |
||||
"time" |
||||
|
||||
"github.com/gogits/git-shell" |
||||
|
||||
"github.com/gogits/gogs/models" |
||||
"github.com/gogits/gogs/modules/auth" |
||||
"github.com/gogits/gogs/modules/base" |
||||
"github.com/gogits/gogs/modules/middleware" |
||||
) |
||||
|
||||
const ( |
||||
WIKI_START base.TplName = "repo/wiki/start" |
||||
WIKI_VIEW base.TplName = "repo/wiki/view" |
||||
WIKI_NEW base.TplName = "repo/wiki/new" |
||||
WIKI_PAGES base.TplName = "repo/wiki/pages" |
||||
) |
||||
|
||||
type PageMeta struct { |
||||
Name string |
||||
URL string |
||||
Updated time.Time |
||||
} |
||||
|
||||
func renderWikiPage(ctx *middleware.Context, isViewPage bool) (*git.Repository, string) { |
||||
wikiRepo, err := git.OpenRepository(ctx.Repo.Repository.WikiPath()) |
||||
if err != nil { |
||||
ctx.Handle(500, "OpenRepository", err) |
||||
return nil, "" |
||||
} |
||||
commit, err := wikiRepo.GetCommitOfBranch("master") |
||||
if err != nil { |
||||
ctx.Handle(500, "GetCommitOfBranch", err) |
||||
return nil, "" |
||||
} |
||||
|
||||
// Get page list.
|
||||
if isViewPage { |
||||
entries, err := commit.ListEntries() |
||||
if err != nil { |
||||
ctx.Handle(500, "ListEntries", err) |
||||
return nil, "" |
||||
} |
||||
pages := make([]PageMeta, 0, len(entries)) |
||||
for i := range entries { |
||||
if entries[i].Type == git.OBJECT_BLOB { |
||||
name := strings.TrimSuffix(entries[i].Name(), ".md") |
||||
pages = append(pages, PageMeta{ |
||||
Name: name, |
||||
URL: models.ToWikiPageURL(name), |
||||
}) |
||||
} |
||||
} |
||||
ctx.Data["Pages"] = pages |
||||
} |
||||
|
||||
pageURL := ctx.Params(":page") |
||||
if len(pageURL) == 0 { |
||||
pageURL = "Home" |
||||
} |
||||
ctx.Data["PageURL"] = pageURL |
||||
|
||||
pageName := models.ToWikiPageName(pageURL) |
||||
ctx.Data["old_title"] = pageName |
||||
ctx.Data["Title"] = pageName |
||||
ctx.Data["title"] = pageName |
||||
ctx.Data["RequireHighlightJS"] = true |
||||
|
||||
blob, err := commit.GetBlobByPath(pageName + ".md") |
||||
if err != nil { |
||||
if git.IsErrNotExist(err) { |
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/_pages") |
||||
} else { |
||||
ctx.Handle(500, "GetBlobByPath", err) |
||||
} |
||||
return nil, "" |
||||
} |
||||
r, err := blob.Data() |
||||
if err != nil { |
||||
ctx.Handle(500, "Data", err) |
||||
return nil, "" |
||||
} |
||||
data, err := ioutil.ReadAll(r) |
||||
if err != nil { |
||||
ctx.Handle(500, "ReadAll", err) |
||||
return nil, "" |
||||
} |
||||
if isViewPage { |
||||
ctx.Data["content"] = string(base.RenderMarkdown(data, ctx.Repo.RepoLink)) |
||||
} else { |
||||
ctx.Data["content"] = string(data) |
||||
} |
||||
|
||||
return wikiRepo, pageName |
||||
} |
||||
|
||||
func Wiki(ctx *middleware.Context) { |
||||
ctx.Data["PageIsWiki"] = true |
||||
|
||||
if !ctx.Repo.Repository.HasWiki() { |
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki") |
||||
ctx.HTML(200, WIKI_START) |
||||
return |
||||
} |
||||
|
||||
wikiRepo, pageName := renderWikiPage(ctx, true) |
||||
if ctx.Written() { |
||||
return |
||||
} |
||||
|
||||
// Get last change information.
|
||||
lastCommit, err := wikiRepo.GetCommitByPath(pageName + ".md") |
||||
if err != nil { |
||||
ctx.Handle(500, "GetCommitByPath", err) |
||||
return |
||||
} |
||||
ctx.Data["Author"] = lastCommit.Author |
||||
|
||||
ctx.HTML(200, WIKI_VIEW) |
||||
} |
||||
|
||||
func WikiPages(ctx *middleware.Context) { |
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.pages") |
||||
ctx.Data["PageIsWiki"] = true |
||||
|
||||
if !ctx.Repo.Repository.HasWiki() { |
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki") |
||||
return |
||||
} |
||||
|
||||
wikiRepo, err := git.OpenRepository(ctx.Repo.Repository.WikiPath()) |
||||
if err != nil { |
||||
ctx.Handle(500, "OpenRepository", err) |
||||
return |
||||
} |
||||
commit, err := wikiRepo.GetCommitOfBranch("master") |
||||
if err != nil { |
||||
ctx.Handle(500, "GetCommitOfBranch", err) |
||||
return |
||||
} |
||||
|
||||
entries, err := commit.ListEntries() |
||||
if err != nil { |
||||
ctx.Handle(500, "ListEntries", err) |
||||
return |
||||
} |
||||
pages := make([]PageMeta, 0, len(entries)) |
||||
for i := range entries { |
||||
if entries[i].Type == git.OBJECT_BLOB { |
||||
c, err := wikiRepo.GetCommitByPath(entries[i].Name()) |
||||
if err != nil { |
||||
ctx.Handle(500, "GetCommit", err) |
||||
return |
||||
} |
||||
name := strings.TrimSuffix(entries[i].Name(), ".md") |
||||
pages = append(pages, PageMeta{ |
||||
Name: name, |
||||
URL: models.ToWikiPageURL(name), |
||||
Updated: c.Author.When, |
||||
}) |
||||
} |
||||
} |
||||
ctx.Data["Pages"] = pages |
||||
|
||||
ctx.HTML(200, WIKI_PAGES) |
||||
} |
||||
|
||||
func NewWiki(ctx *middleware.Context) { |
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") |
||||
ctx.Data["PageIsWiki"] = true |
||||
ctx.Data["RequireSimpleMDE"] = true |
||||
|
||||
if !ctx.Repo.Repository.HasWiki() { |
||||
ctx.Data["title"] = "Home" |
||||
} |
||||
|
||||
ctx.HTML(200, WIKI_NEW) |
||||
} |
||||
|
||||
func NewWikiPost(ctx *middleware.Context, form auth.NewWikiForm) { |
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") |
||||
ctx.Data["PageIsWiki"] = true |
||||
ctx.Data["RequireSimpleMDE"] = true |
||||
|
||||
if ctx.HasError() { |
||||
ctx.HTML(200, WIKI_NEW) |
||||
return |
||||
} |
||||
|
||||
if err := ctx.Repo.Repository.AddWikiPage(ctx.User, form.Title, form.Content, form.Message); err != nil { |
||||
if models.IsErrWikiAlreadyExist(err) { |
||||
ctx.Data["Err_Title"] = true |
||||
ctx.RenderWithErr(ctx.Tr("repo.wiki.page_already_exists"), WIKI_NEW, &form) |
||||
} else { |
||||
ctx.Handle(500, "AddWikiPage", err) |
||||
} |
||||
return |
||||
} |
||||
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title)) |
||||
} |
||||
|
||||
func EditWiki(ctx *middleware.Context) { |
||||
ctx.Data["PageIsWiki"] = true |
||||
ctx.Data["PageIsWikiEdit"] = true |
||||
ctx.Data["RequireSimpleMDE"] = true |
||||
|
||||
if !ctx.Repo.Repository.HasWiki() { |
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki") |
||||
return |
||||
} |
||||
|
||||
renderWikiPage(ctx, false) |
||||
if ctx.Written() { |
||||
return |
||||
} |
||||
|
||||
ctx.HTML(200, WIKI_NEW) |
||||
} |
||||
|
||||
func EditWikiPost(ctx *middleware.Context, form auth.NewWikiForm) { |
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") |
||||
ctx.Data["PageIsWiki"] = true |
||||
ctx.Data["RequireSimpleMDE"] = true |
||||
|
||||
if ctx.HasError() { |
||||
ctx.HTML(200, WIKI_NEW) |
||||
return |
||||
} |
||||
|
||||
if err := ctx.Repo.Repository.EditWikiPage(ctx.User, form.OldTitle, form.Title, form.Content, form.Message); err != nil { |
||||
ctx.Handle(500, "EditWikiPage", err) |
||||
return |
||||
} |
||||
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title)) |
||||
} |
@ -1,5 +1,4 @@ |
||||
#!/bin/sh |
||||
echo "compiling LESS Files" |
||||
lessc ../public/ng/less/gogs.less ../public/ng/css/gogs.css |
||||
lessc ../public/ng/less/ui.less ../public/ng/css/ui.css |
||||
lessc ../public/less/gogs.less ../public/css/gogs.css |
||||
echo "done" |
||||
|
@ -1,67 +0,0 @@ |
||||
<div id="body-nav" class="repo-nav"> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="col-md-7"> |
||||
<h3 class="name"><i class="fa fa-book fa-lg"></i><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Repository.Name}}">{{.Repository.Name}}</a> {{if .Repository.IsPrivate}}<span class="label label-default">Private</span>{{else if .Repository.IsMirror}}<span class="label label-default">Mirror</span>{{end}}</h3> |
||||
<p class="desc">{{.Repository.DescriptionHtml}}{{if .Repository.Website}} <a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}</p> |
||||
</div> |
||||
<div class="col-md-5 actions text-right clone-group-btn"> |
||||
{{if not .IsBareRepo}} |
||||
<div class="btn-group" id="repo-clone"> |
||||
<a class="btn btn-default" href="{{.RepoLink}}/archive/{{.BranchName}}/{{.Repository.Name}}.zip"><i class="fa fa-download fa-lg fa-m"></i></a> |
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> |
||||
<span class="caret"></span> |
||||
</button> |
||||
<div class="dropdown-menu clone-group-btn dropdown-menu-right no-propagation"> |
||||
<div class="input-group"> |
||||
<span class="input-group-btn"> |
||||
<button class="btn btn-default" data-link="{{.CloneLink.SSH}}" type="button">SSH</button> |
||||
<button class="btn btn-default" data-link="{{.CloneLink.HTTPS}}" type="button">HTTPS</button> |
||||
</span> |
||||
<input type="text" class="form-control clone-group-url" value="" readonly id="repo-clone-ipt"/> |
||||
<span class="input-group-btn"> |
||||
<button class="btn btn-default" type="button" data-toggle="tooltip" title="copy to clipboard" data-placement="top" data-init="copy" data-copy-val="val" data-copy-from="#repo-clone-ipt"><i class="fa fa-copy"></i></button> |
||||
</span> |
||||
</div> |
||||
<p class="help-block text-center">Need help cloning? Visit <a target="_blank" href="https://help.github.com/articles/fork-a-repo">Help</a>!</p> |
||||
<hr/> |
||||
<div class="clone-zip text-center"> |
||||
<a class="btn btn-success btn-lg" href="{{.RepoLink}}/archive/{{.BranchName}}/{{.Repository.Name}}.zip" rel="nofollow"><i class="fa fa-suitcase"></i>Download ZIP</a> |
||||
<a class="btn btn-success btn-lg" href="{{.RepoLink}}/archive/{{.BranchName}}/{{.Repository.Name}}.tar.gz" rel="nofollow"><i class="fa fa-suitcase"></i>Download TAR.GZ</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{{if .IsSigned}} |
||||
<div class="btn-group {{if .IsRepositoryWatching}}watching{{else}}no-watching{{end}}" id="repo-watching" data-watch="{{AppSubUrl}}/{{.Owner.Name}}/{{.Repository.Name}}/action/watch" data-unwatch="{{AppSubUrl}}/{{.Owner.Name}}/{{.Repository.Name}}/action/unwatch"> |
||||
{{if .IsRepositoryWatching}} |
||||
<button type="button" class="btn btn-default"><i class="fa fa-eye fa-lg fa-m"></i></button> |
||||
{{else}} |
||||
<button type="button" class="btn btn-default"><i class="fa fa-eye-slash fa-lg fa-m"></i></button> |
||||
{{end}} |
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> |
||||
<span class="caret"></span> |
||||
</button> |
||||
<div class="dropdown-menu dropdown-menu-right"> |
||||
<div class="dropdown-item text-left to-unwatch"> |
||||
<h4 role="presentation" class="dropdown-header {{if not .IsRepositoryWatching}}text-primary{{end}}">Not Watching</h4> |
||||
<p class="description">You only receive notifications for conversations in which you participate or are @mentioned.</p> |
||||
<p class="divider"></p> |
||||
</div> |
||||
<div class="dropdown-item text-left to-watch"> |
||||
<h4 role="presentation" class="dropdown-header {{if .IsRepositoryWatching}}text-primary{{end}}">Watching</h4> |
||||
<p class="description">You receive notifications for all conversations in this repository.</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{{end}} |
||||
<!-- <div class="btn-group"> |
||||
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Star"><i class="fa fa-star"></i> {{.Repository.NumStars}}</button> |
||||
</div> --> |
||||
{{end}} |
||||
<!-- <div class="btn-group"> |
||||
<a type="button" {{if not .IsRepositoryOwner}}href="{{AppSubUrl}}/{{.Username}}/{{.Reponame}}/fork"{{end}} class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Fork"><i class="fa fa-code-fork fa-lg"></i> {{.Repository.NumForks}}</a> |
||||
</div> --> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,35 @@ |
||||
{{template "base/head" .}} |
||||
<div class="repository wiki new"> |
||||
{{template "repo/header" .}} |
||||
<div class="ui container"> |
||||
{{template "repo/sidebar" .}} |
||||
{{template "base/alert" .}} |
||||
<div class="ui header"> |
||||
{{.i18n.Tr "repo.wiki.new_page"}} |
||||
{{if .PageIsWikiEdit}} |
||||
<div class="ui right"> |
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a> |
||||
</div> |
||||
{{end}} |
||||
</div> |
||||
<form class="ui form" action="{{.Link}}" method="post"> |
||||
{{.CsrfTokenHtml}} |
||||
<input type="hidden" name="old_title" value="{{.old_title}}"> |
||||
<div class="field {{if .Err_Title}}error{{end}}"> |
||||
<input name="title" value="{{.title}}" autofocus required> |
||||
</div> |
||||
<div class="field"> |
||||
<textarea id="edit-area" name="content" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea required> |
||||
</div> |
||||
<div class="field"> |
||||
<input name="message" placeholder="{{.i18n.Tr "repo.wiki.default_commit_message"}}"> |
||||
</div> |
||||
<div class="text right"> |
||||
<button class="ui green button"> |
||||
{{.i18n.Tr "repo.wiki.save_page"}} |
||||
</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
{{template "base/footer" .}} |
@ -0,0 +1,28 @@ |
||||
{{template "base/head" .}} |
||||
<div class="repository wiki pages"> |
||||
{{template "repo/header" .}} |
||||
<div class="ui container"> |
||||
{{template "repo/sidebar" .}} |
||||
<div class="ui header"> |
||||
{{.i18n.Tr "repo.wiki.pages"}} |
||||
<div class="ui right"> |
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a> |
||||
</div> |
||||
</div> |
||||
<table class="ui table"> |
||||
<tbody> |
||||
{{range .Pages}} |
||||
<tr> |
||||
<td> |
||||
<i class="icon octicon octicon-file-text"></i> |
||||
<a href="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name}}</a> |
||||
</td> |
||||
{{$timeSince := TimeSince .Updated $.Lang}} |
||||
<td class="text right grey">{{$.i18n.Tr "repo.wiki.last_updated" $timeSince | Safe}}</td> |
||||
</tr> |
||||
{{end}} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
{{template "base/footer" .}} |
@ -0,0 +1,16 @@ |
||||
{{template "base/head" .}} |
||||
<div class="repository wiki start"> |
||||
{{template "repo/header" .}} |
||||
<div class="ui container"> |
||||
{{template "repo/sidebar" .}} |
||||
<div class="ui center segment"> |
||||
<span class="mega-octicon octicon-book"></span> |
||||
<h2>{{.i18n.Tr "repo.wiki.welcome"}}</h2> |
||||
<p>{{.i18n.Tr "repo.wiki.welcome_desc"}}</p> |
||||
{{if .IsSigned}} |
||||
<a class="ui green button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.create_first_page"}}</a> |
||||
{{end}} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{{template "base/footer" .}} |
@ -0,0 +1,73 @@ |
||||
{{template "base/head" .}} |
||||
<div class="repository wiki view"> |
||||
{{template "repo/header" .}} |
||||
<div class="ui container"> |
||||
{{template "repo/sidebar" .}} |
||||
<div class="ui grid"> |
||||
<div class="ui ten wide column"> |
||||
<div class="choose page"> |
||||
<div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}"> |
||||
<div class="ui basic small button"> |
||||
<span class="text"> |
||||
{{.i18n.Tr "repo.wiki.page"}}: |
||||
<strong>{{.title}}</strong> |
||||
</span> |
||||
<i class="dropdown icon"></i> |
||||
</div> |
||||
<div class="menu"> |
||||
<div class="ui icon search input"> |
||||
<i class="filter icon"></i> |
||||
<input name="search" placeholder="{{.i18n.Tr "repo.wiki.filter_page"}}..."> |
||||
</div> |
||||
<div class="scrolling menu" {{if .IsTag}}style="display: none"{{end}}> |
||||
{{range .Pages}} |
||||
<div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name}}</div> |
||||
{{end}} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="ui six wide column"> |
||||
<div class="ui action small input" id="clone-panel"> |
||||
{{if not $.DisableSSH}} |
||||
<button class="ui blue basic clone button" id="repo-clone-ssh" data-link="{{.WikiCloneLink.SSH}}"> |
||||
SSH |
||||
</button> |
||||
{{end}} |
||||
<button class="ui {{if $.DisableSSH}}blue{{end}} basic clone button" id="repo-clone-https" data-link="{{.WikiCloneLink.HTTPS}}"> |
||||
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} |
||||
</button> |
||||
<input id="repo-clone-url" value="{{if $.DisableSSH}}{{$.WikiCloneLink.HTTPS}}{{else}}{{$.WikiCloneLink.SSH}}{{end}}" readonly> |
||||
<button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> |
||||
<i class="octicon octicon-clippy"></i> |
||||
</button> |
||||
<div class="ui basic jump dropdown icon button"> |
||||
<i class="download icon"></i> |
||||
<div class="menu"> |
||||
<a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.zip"><i class="icon octicon octicon-file-zip"></i> ZIP</a> |
||||
<a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.tar.gz"><i class="icon octicon octicon-file-zip"></i> TAR.GZ</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="ui dividing header"> |
||||
{{.title}} |
||||
{{if .IsRepositoryPusher}} |
||||
<div class="ui right"> |
||||
<a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}/_edit">{{.i18n.Tr "repo.wiki.edit_page_button"}}</a> |
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a> |
||||
</div> |
||||
{{end}} |
||||
<div class="ui sub header"> |
||||
{{$timeSince := TimeSince .Author.When $.Lang}} |
||||
{{.i18n.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}} |
||||
</div> |
||||
</div> |
||||
<div class="ui segment markdown"> |
||||
{{.content | Str2html}} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{{template "base/footer" .}} |
@ -1,5 +0,0 @@ |
||||
{{template "base/head" .}} |
||||
<div class="ui container center"> |
||||
401 Unauthorized |
||||
</div> |
||||
{{template "base/footer" .}} |
@ -1,5 +0,0 @@ |
||||
{{template "base/head" .}} |
||||
<div class="ui container center"> |
||||
403 Forbidden |
||||
</div> |
||||
{{template "base/footer" .}} |
Loading…
Reference in new issue