summaryrefslogtreecommitdiffstats
path: root/routers/repo/single.go
blob: 1d5e601aa30fb680dc735d5a6df93ac2b6a60dcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package repo

import (
	"github.com/codegangsta/martini"
	"github.com/martini-contrib/render"

	"github.com/gogits/gogs/models"
	"github.com/gogits/gogs/modules/base"
	"github.com/gogits/gogs/modules/log"
)

func Single(params martini.Params, r render.Render, data base.TmplData) {
	if !data["IsRepositoryValid"].(bool) {
		return
	}

	files, err := models.GetReposFiles(params["username"], params["reponame"], "HEAD", "/")
	if err != nil {
		data["ErrorMsg"] = err
		log.Error("repo.List: %v", err)
		r.HTML(200, "base/error", data)
		return
	}

	data["IsRepoToolbarSource"] = true
	data["Files"] = files

	r.HTML(200, "repo/single", data)
}

func Setting(r render.Render, data base.TmplData) {
	if !data["IsRepositoryValid"].(bool) {
		return
	}

	data["Title"] = data["Title"].(string) + " - settings"
	data["IsRepoToolbarSetting"] = true

	r.HTML(200, "repo/setting", data)
}