mirror of https://github.com/gogits/gogs.git
Unknwon
9 years ago
20 changed files with 307 additions and 49 deletions
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,49 @@
|
||||
// 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 ( |
||||
"github.com/Unknwon/com" |
||||
|
||||
"github.com/gogits/gogs/models" |
||||
"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" |
||||
) |
||||
|
||||
func Wiki(ctx *middleware.Context) { |
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki") |
||||
ctx.Data["PageIsWiki"] = true |
||||
|
||||
wikiPath := models.WikiPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name) |
||||
if !com.IsDir(wikiPath) { |
||||
ctx.HTML(200, WIKI_START) |
||||
return |
||||
} |
||||
|
||||
ctx.HTML(200, WIKI_VIEW) |
||||
} |
||||
|
||||
func NewWiki(ctx *middleware.Context) { |
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") |
||||
ctx.Data["PageIsWiki"] = true |
||||
ctx.Data["RequireSimpleMDE"] = true |
||||
|
||||
wikiPath := models.WikiPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name) |
||||
if !com.IsDir(wikiPath) { |
||||
ctx.Data["title"] = "Home" |
||||
} |
||||
|
||||
ctx.HTML(200, WIKI_NEW) |
||||
} |
||||
|
||||
func EditWiki(ctx *middleware.Context) { |
||||
ctx.PlainText(200, []byte(ctx.Params(":page"))) |
||||
} |
@ -0,0 +1,27 @@
|
||||
{{template "base/head" .}} |
||||
<div class="repository wiki new"> |
||||
{{template "repo/header" .}} |
||||
<div class="ui container"> |
||||
{{template "repo/sidebar" .}} |
||||
<div class="ui header"> |
||||
{{.i18n.Tr "repo.wiki.new_page"}} |
||||
</div> |
||||
<form class="ui form" action="{{.Link}}" method="post"> |
||||
<div class="field"> |
||||
<input name="title" value="{{.title}}" autofocus> |
||||
</div> |
||||
<div class="field"> |
||||
<textarea id="edit-area" name="content" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.wiki.welcome"}}</textarea> |
||||
</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,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" .}} |
Loading…
Reference in new issue