Browse Source

Finish new home page of organization

pull/357/head
Unknwon 11 years ago
parent
commit
5fbf8531e6
  1. 4
      cmd/web.go
  2. 14
      conf/locale/locale_en-US.ini
  3. 14
      conf/locale/locale_zh-CN.ini
  4. 2
      gogs.go
  5. 5
      models/models.go
  6. 1
      models/org.go
  7. 62
      models/repo.go
  8. 2
      modules/middleware/auth.go
  9. 8
      modules/middleware/repo.go
  10. 105
      public/ng/css/gogs.css
  11. 4
      public/ng/css/ui.css
  12. 1
      public/ng/less/gogs.less
  13. 8
      public/ng/less/gogs/base.less
  14. 96
      public/ng/less/gogs/organization.less
  15. 1
      public/ng/less/gogs/repository.less
  16. 7
      public/ng/less/ui/form.less
  17. 15
      routers/org/org.go
  18. 66
      routers/repo/repo.go
  19. 4
      routers/user/home.go
  20. 2
      scripts/start.sh
  21. 2
      templates/.VERSION
  22. 101
      templates/org/home.tmpl
  23. 2
      templates/org/teams.tmpl
  24. 2
      templates/repo/create.tmpl
  25. 15
      templates/repo/header.tmpl
  26. 4
      templates/repo/home.tmpl
  27. 2
      templates/user/dashboard/dashboard.tmpl

4
cmd/web.go

@ -235,7 +235,7 @@ func runWeb(*cli.Context) {
r.Post("/:org/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost) r.Post("/:org/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
r.Get("/:org/teams/:team/edit", org.EditTeam) r.Get("/:org/teams/:team/edit", org.EditTeam)
r.Get("/:org/team/:team", org.SingleTeam) r.Get("/:org/teams/:team", org.SingleTeam)
r.Get("/:org/settings", org.Settings) r.Get("/:org/settings", org.Settings)
r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost) r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost)
@ -264,7 +264,7 @@ func runWeb(*cli.Context) {
}, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner) }, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
m.Group("/:username/:reponame", func(r *macaron.Router) { m.Group("/:username/:reponame", func(r *macaron.Router) {
// r.Get("/action/:action", repo.Action) r.Get("/action/:action", repo.Action)
m.Group("/issues", func(r *macaron.Router) { m.Group("/issues", func(r *macaron.Router) {
r.Get("/new", repo.CreateIssue) r.Get("/new", repo.CreateIssue)

14
conf/locale/locale_en-US.ini

@ -179,6 +179,13 @@ migrate_type = Migration Type
migrate_type_helper = This repository will be a <span class="label label-blue label-radius">Mirror</span> migrate_type_helper = This repository will be a <span class="label label-blue label-radius">Mirror</span>
migrate_repo = Migrate Repository migrate_repo = Migrate Repository
clone_helper = Need help cloning? Visit <a target="_blank" href="http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository">Help</a>!
unwatch = Unwatch
watch = Watch
unstar = Unstar
star = Star
fork = Fork
settings = Settings settings = Settings
settings.options = Options settings.options = Options
settings.collaboration = Collaboration settings.collaboration = Collaboration
@ -221,6 +228,13 @@ org_name_holder = Organization Name
org_name_helper = Great organization names are short and memorable. org_name_helper = Great organization names are short and memorable.
org_email_helper = Organization's Email receives all notifications and confirmations. org_email_helper = Organization's Email receives all notifications and confirmations.
create_org = Create Organization create_org = Create Organization
repo_updated = Updated
people = People
invite_someone = Invite Someone
teams = Teams
lower_members = members
lower_repositories = repositories
create_new_team = Create New Team
[action] [action]
create_repo = created repository <a href="/%s">%s</a> create_repo = created repository <a href="/%s">%s</a>

14
conf/locale/locale_zh-CN.ini

@ -179,6 +179,13 @@ migrate_type = 迁移类型
migrate_type_helper = 本仓库将是 <span class="label label-blue label-radius">镜像</span> migrate_type_helper = 本仓库将是 <span class="label label-blue label-radius">镜像</span>
migrate_repo = 迁移仓库 migrate_repo = 迁移仓库
clone_helper = 不知道如何操作?访问 <a target="_blank" href="http://git-scm.com/book/zh/Git-基础-取得项目的-Git-仓库">此处</a> 查看帮助!
unwatch = 取消关注
watch = 关注
unstar = 取消点赞
star = 点赞
fork = 派生
settings = 仓库设置 settings = 仓库设置
settings.options = 基本设置 settings.options = 基本设置
settings.collaboration = 管理协作者 settings.collaboration = 管理协作者
@ -221,6 +228,13 @@ org_name_holder = 组织名称
org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。 org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。
org_email_helper = 组织的邮箱用于接收所有通知和确认邮件。 org_email_helper = 组织的邮箱用于接收所有通知和确认邮件。
create_org = 创建组织 create_org = 创建组织
repo_updated = 最后更新于
people = 组织成员
invite_someone = 邀请他人加入
teams = 组织团队
lower_members = 名成员
lower_repositories = 个仓库
create_new_team = 创建新的团队
[action] [action]
create_repo = 创建了仓库 <a href="/%s">%s</a> create_repo = 创建了仓库 <a href="/%s">%s</a>

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.4.7.0809 Alpha" const APP_VER = "0.4.7.0810 Alpha"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

5
models/models.go

@ -32,8 +32,9 @@ var (
) )
func init() { func init() {
tables = append(tables, new(User), new(PublicKey), new(Repository), new(Watch), tables = append(tables, new(User), new(PublicKey),
new(Action), new(Access), new(Issue), new(Comment), new(Oauth2), new(Follow), new(Repository), new(Watch), new(Star), new(Action), new(Access),
new(Issue), new(Comment), new(Oauth2), new(Follow),
new(Mirror), new(Release), new(LoginSource), new(Webhook), new(IssueUser), new(Mirror), new(Release), new(LoginSource), new(Webhook), new(IssueUser),
new(Milestone), new(Label), new(HookTask), new(Team), new(OrgUser), new(TeamUser), new(Milestone), new(Label), new(HookTask), new(Team), new(OrgUser), new(TeamUser),
new(UpdateTask), new(Attachment)) new(UpdateTask), new(Attachment))

1
models/org.go

@ -106,6 +106,7 @@ func CreateOrganization(org, owner *User) (*User, error) {
// Create default owner team. // Create default owner team.
t := &Team{ t := &Team{
OrgId: org.Id, OrgId: org.Id,
LowerName: strings.ToLower(OWNER_TEAM),
Name: OWNER_TEAM, Name: OWNER_TEAM,
Authorize: ORG_ADMIN, Authorize: ORG_ADMIN,
NumMembers: 1, NumMembers: 1,

62
models/repo.go

@ -137,6 +137,7 @@ type Repository struct {
NumTags int `xorm:"-"` NumTags int `xorm:"-"`
IsPrivate bool IsPrivate bool
IsMirror bool IsMirror bool
*Mirror `xorm:"-"`
IsFork bool `xorm:"NOT NULL DEFAULT false"` IsFork bool `xorm:"NOT NULL DEFAULT false"`
IsBare bool IsBare bool
IsGoget bool IsGoget bool
@ -150,6 +151,11 @@ func (repo *Repository) GetOwner() (err error) {
return err return err
} }
func (repo *Repository) GetMirror() (err error) {
repo.Mirror, err = GetMirror(repo.Id)
return err
}
// DescriptionHtml does special handles to description and return HTML string. // DescriptionHtml does special handles to description and return HTML string.
func (repo *Repository) DescriptionHtml() template.HTML { func (repo *Repository) DescriptionHtml() template.HTML {
sanitize := func(s string) string { sanitize := func(s string) string {
@ -953,21 +959,33 @@ type Watch struct {
} }
// Watch or unwatch repository. // Watch or unwatch repository.
func WatchRepo(uid, rid int64, watch bool) (err error) { func WatchRepo(uid, repoId int64, watch bool) (err error) {
if watch { if watch {
if _, err = x.Insert(&Watch{RepoId: rid, UserId: uid}); err != nil { if IsWatching(uid, repoId) {
return nil
}
if _, err = x.Insert(&Watch{RepoId: repoId, UserId: uid}); err != nil {
return err return err
} }
_, err = x.Exec("UPDATE `repository` SET num_watches = num_watches + 1 WHERE id = ?", rid) _, err = x.Exec("UPDATE `repository` SET num_watches = num_watches + 1 WHERE id = ?", repoId)
} else { } else {
if _, err = x.Delete(&Watch{0, uid, rid}); err != nil { if !IsWatching(uid, repoId) {
return nil
}
if _, err = x.Delete(&Watch{0, uid, repoId}); err != nil {
return err return err
} }
_, err = x.Exec("UPDATE `repository` SET num_watches = num_watches - 1 WHERE id = ?", rid) _, err = x.Exec("UPDATE `repository` SET num_watches = num_watches - 1 WHERE id = ?", repoId)
} }
return err return err
} }
// IsWatching checks if user has watched given repository.
func IsWatching(uid, rid int64) bool {
has, _ := x.Get(&Watch{0, uid, rid})
return has
}
// GetWatchers returns all watchers of given repository. // GetWatchers returns all watchers of given repository.
func GetWatchers(rid int64) ([]*Watch, error) { func GetWatchers(rid int64) ([]*Watch, error) {
watches := make([]*Watch, 0, 10) watches := make([]*Watch, 0, 10)
@ -1003,9 +1021,37 @@ func NotifyWatchers(act *Action) error {
return nil return nil
} }
// IsWatching checks if user has watched given repository. type Star struct {
func IsWatching(uid, rid int64) bool { Id int64
has, _ := x.Get(&Watch{0, uid, rid}) Uid int64 `xorm:"UNIQUE(s)"`
RepoId int64 `xorm:"UNIQUE(s)"`
}
// Star or unstar repository.
func StarRepo(uid, repoId int64, star bool) (err error) {
if star {
if IsStaring(uid, repoId) {
return nil
}
if _, err = x.Insert(&Star{Uid: uid, RepoId: repoId}); err != nil {
return err
}
_, err = x.Exec("UPDATE `repository` SET num_stars = num_stars + 1 WHERE id = ?", repoId)
} else {
if !IsStaring(uid, repoId) {
return nil
}
if _, err = x.Delete(&Star{0, uid, repoId}); err != nil {
return err
}
_, err = x.Exec("UPDATE `repository` SET num_stars = num_stars - 1 WHERE id = ?", repoId)
}
return err
}
// IsStaring checks if user has starred given repository.
func IsStaring(uid, repoId int64) bool {
has, _ := x.Get(&Star{0, uid, repoId})
return has return has
} }

2
modules/middleware/auth.go

@ -5,7 +5,6 @@
package middleware package middleware
import ( import (
"fmt"
"net/url" "net/url"
"strings" "strings"
@ -44,7 +43,6 @@ func Toggle(options *ToggleOptions) macaron.Handler {
} }
if options.SignInRequire { if options.SignInRequire {
fmt.Println(ctx.User.IsActive, setting.Service.RegisterEmailConfirm)
if !ctx.IsSigned { if !ctx.IsSigned {
// Ignore watch repository operation. // Ignore watch repository operation.
if strings.HasSuffix(ctx.Req.RequestURI, "watch") { if strings.HasSuffix(ctx.Req.RequestURI, "watch") {

8
modules/middleware/repo.go

@ -246,17 +246,17 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
} }
// repo is bare and display enable // repo is bare and display enable
if displayBare && ctx.Repo.Repository.IsBare { if ctx.Repo.Repository.IsBare {
log.Debug("Bare repository: %s", ctx.Repo.RepoLink) log.Debug("Bare repository: %s", ctx.Repo.RepoLink)
if displayBare {
ctx.HTML(200, "repo/bare") ctx.HTML(200, "repo/bare")
}
return return
} }
if ctx.IsSigned { if ctx.IsSigned {
ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.Id, repo.Id) ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.Id, repo.Id)
} ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.Id, repo.Id)
if ctx.Repo.Repository.IsBare {
return
} }
ctx.Data["TagName"] = ctx.Repo.TagName ctx.Data["TagName"] = ctx.Repo.TagName

105
public/ng/css/gogs.css

@ -40,6 +40,11 @@ img.avatar-48 {
height: 48px; height: 48px;
vertical-align: middle; vertical-align: middle;
} }
img.avatar-100 {
width: 100px;
height: 100px;
vertical-align: middle;
}
#wrapper { #wrapper {
padding: 0; padding: 0;
margin: 0 0 -55px 0; margin: 0 0 -55px 0;
@ -226,6 +231,9 @@ img.avatar-48 {
.text-grey { .text-grey {
color: #999999; color: #999999;
} }
.text-black {
color: #444444;
}
.markdown { .markdown {
background-color: white; background-color: white;
font-size: 16px; font-size: 16px;
@ -974,6 +982,7 @@ The register and sign-in page style
border-left: none; border-left: none;
} }
#repo-clone-help { #repo-clone-help {
clear: both;
line-height: 48px; line-height: 48px;
} }
#repo-clone-zip { #repo-clone-zip {
@ -1665,3 +1674,99 @@ textarea#issue-add-content {
box-sizing: border-box; box-sizing: border-box;
height: 120px; height: 120px;
} }
.org-header {
padding: 16px 0;
background-color: #FFF;
border-bottom: 1px solid #DDD;
}
.org-header img {
padding-right: 10px;
}
#org-home-header {
min-height: 100px;
}
#org-home-header-info {
padding-top: 10px;
}
#org-home-header-info h2 {
font-size: 30px;
}
#org-home-header-info ul {
list-style: none;
}
#org-home-header-info ul li {
float: left;
padding-right: 5px;
}
#org-home-repo-list {
padding: 10px 0;
}
#org-repo-list {
padding: 10px 0;
}
#org-repo-list .org-repo-item {
border-top: 1px solid #eee;
padding: 30px 20px;
}
#org-repo-list .org-repo-item .org-repo-status {
list-style: none;
color: #888;
}
#org-repo-list .org-repo-item .org-repo-status li {
float: left;
margin-right: 6px;
}
#org-repo-list .org-repo-item h2 {
margin-bottom: 5px;
}
#org-repo-list .org-repo-item .org-repo-description {
margin: 0;
font-size: 14px;
color: #666;
}
#org-repo-list .org-repo-item .org-repo-updated {
font-size: 12px;
display: block;
margin: 5px 0 0;
color: #808080;
}
.org-sidebar {
margin: -80px 0 0 20px;
}
.org-sidebar .panel-footer {
padding: .8em 1.2em;
}
#org-member-avatar-group {
padding: 15px;
}
#org-member-avatar-group img {
width: 59px;
height: 59px;
border-radius: 3px;
}
#org-home-team-list {
padding: 0 15px;
}
#org-home-team-list ul {
list-style: none;
padding-top: 10px;
}
#org-home-team-list ul li {
padding: 10px 0;
border-bottom: 1px solid #eee;
}
#org-home-team-list ul li:last-child {
border-bottom: 0;
}
.team-name {
display: block;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.team-meta {
margin-top: 0;
margin-bottom: 0;
color: #777;
}

4
public/ng/css/ui.css

@ -372,6 +372,10 @@ dt {
font-size: 10.8px; font-size: 10.8px;
padding: .4em .9em; padding: .4em .9em;
} }
.btn-medium {
font-size: 12px;
padding: .4em .9em;
}
.btn-large { .btn-large {
font-size: 14.4px; font-size: 14.4px;
} }

1
public/ng/less/gogs.less

@ -6,3 +6,4 @@
@import "gogs/repository"; @import "gogs/repository";
@import "gogs/settings"; @import "gogs/settings";
@import "gogs/issue"; @import "gogs/issue";
@import "gogs/organization";

8
public/ng/less/gogs/base.less

@ -50,6 +50,11 @@ img.avatar-48{
height: 48px; height: 48px;
vertical-align: middle; vertical-align: middle;
} }
img.avatar-100{
width: 100px;
height: 100px;
vertical-align: middle;
}
#wrapper { #wrapper {
padding: 0; padding: 0;
margin: 0 0 -55px 0; margin: 0 0 -55px 0;
@ -243,3 +248,6 @@ clear: both;
.text-grey { .text-grey {
color: #999999; color: #999999;
} }
.text-black {
color: #444444;
}

96
public/ng/less/gogs/organization.less

@ -0,0 +1,96 @@
.org-header {
padding: 16px 0;
background-color: #FFF;
border-bottom: 1px solid #DDD;
img {
padding-right: 10px;
}
}
#org-home-header {
min-height: 100px;
}
#org-home-header-info {
padding-top: 10px;
h2 {
font-size: 30px;
}
ul {
list-style: none;
li {
float: left;
padding-right: 5px;
}
}
}
#org-home-repo-list {
padding: 10px 0;
}
#org-repo-list {
padding: 10px 0;
.org-repo-item {
border-top: 1px solid #eee;
padding: 30px 20px;
.org-repo-status {
list-style: none;
color: #888;
li {
float: left;
margin-right: 6px;
}
}
h2 {
margin-bottom: 5px;
}
.org-repo-description {
margin: 0;
font-size: 14px;
color: #666;
}
.org-repo-updated {
font-size: 12px;
display: block;
margin: 5px 0 0;
color: #808080;
}
}
}
.org-sidebar {
margin: -80px 0 0 20px;
.panel-footer {
padding: .8em 1.2em;
}
}
#org-member-avatar-group {
padding: 15px;
img {
width: 59px;
height: 59px;
border-radius: 3px;
}
}
#org-home-team-list {
padding: 0 15px;
ul {
list-style: none;
padding-top: 10px;
li {
padding: 10px 0;
border-bottom: 1px solid #eee;
&:last-child {
border-bottom: 0;
}
}
}
}
.team-name {
display: block;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.team-meta {
margin-top: 0;
margin-bottom: 0;
color: #777;
}

1
public/ng/less/gogs/repository.less

@ -97,6 +97,7 @@ border-top-right-radius: .25em;
border-left: none; border-left: none;
} }
#repo-clone-help { #repo-clone-help {
clear: both;
line-height: 48px; line-height: 48px;
} }
#repo-clone-zip { #repo-clone-zip {

7
public/ng/less/ui/form.less

@ -5,12 +5,14 @@
&:hover { &:hover {
} }
} }
.btn-small { .btn-small {
font-size: 0.9*@baseFontSize; font-size: 0.9*@baseFontSize;
padding: .4em .9em; padding: .4em .9em;
} }
.btn-medium {
font-size: @baseFontSize;
padding: .4em .9em;
}
.btn-large { .btn-large {
font-size: 1.2*@baseFontSize; font-size: 1.2*@baseFontSize;
} }
@ -23,7 +25,6 @@
color: #FFF; color: #FFF;
} }
} }
.btn-blue { .btn-blue {
background-color: @btnBlueColor; background-color: @btnBlueColor;
border: 1px solid @btnBlueColor; border: 1px solid @btnBlueColor;

15
routers/org/org.go

@ -19,34 +19,33 @@ const (
) )
func Home(ctx *middleware.Context) { func Home(ctx *middleware.Context) {
ctx.Data["Title"] = "Organization " + ctx.Params(":org") ctx.Data["Title"] = ctx.Params(":org")
org, err := models.GetUserByName(ctx.Params(":org")) org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil { if err != nil {
if err == models.ErrUserNotExist { if err == models.ErrUserNotExist {
ctx.Handle(404, "org.Home(GetUserByName)", err) ctx.Handle(404, "GetUserByName", err)
} else { } else {
ctx.Handle(500, "org.Home(GetUserByName)", err) ctx.Handle(500, "GetUserByName", err)
} }
return return
} }
ctx.Data["Org"] = org ctx.Data["Org"] = org
ctx.Data["Repos"], err = models.GetRepositories(org.Id, ctx.Data["Repos"], err = models.GetRepositories(org.Id, ctx.IsSigned && org.IsOrgMember(ctx.User.Id))
ctx.IsSigned && org.IsOrgMember(ctx.User.Id))
if err != nil { if err != nil {
ctx.Handle(500, "org.Home(GetRepositories)", err) ctx.Handle(500, "GetRepositories", err)
return return
} }
if err = org.GetMembers(); err != nil { if err = org.GetMembers(); err != nil {
ctx.Handle(500, "org.Home(GetMembers)", err) ctx.Handle(500, "GetMembers", err)
return return
} }
ctx.Data["Members"] = org.Members ctx.Data["Members"] = org.Members
if err = org.GetTeams(); err != nil { if err = org.GetTeams(); err != nil {
ctx.Handle(500, "org.Home(GetTeams)", err) ctx.Handle(500, "GetTeams", err)
return return
} }
ctx.Data["Teams"] = org.Teams ctx.Data["Teams"] = org.Teams

66
routers/repo/repo.go

@ -204,36 +204,42 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
ctx.Handle(500, "MigratePost", err) ctx.Handle(500, "MigratePost", err)
} }
// func Action(ctx *middleware.Context, params martini.Params) { func Action(ctx *middleware.Context) {
// var err error var err error
// switch params["action"] { switch ctx.Params(":action") {
// case "watch": case "watch":
// err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, true) err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
// case "unwatch": case "unwatch":
// err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, false) err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
// case "desc": case "star":
// if !ctx.Repo.IsOwner { err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
// ctx.Error(404) case "unstar":
// return err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
// } case "desc":
if !ctx.Repo.IsOwner {
// ctx.Repo.Repository.Description = ctx.Query("desc") ctx.Error(404)
// ctx.Repo.Repository.Website = ctx.Query("site") return
// err = models.UpdateRepository(ctx.Repo.Repository) }
// }
ctx.Repo.Repository.Description = ctx.Query("desc")
// if err != nil { ctx.Repo.Repository.Website = ctx.Query("site")
// log.Error("repo.Action(%s): %v", params["action"], err) err = models.UpdateRepository(ctx.Repo.Repository)
// ctx.JSON(200, map[string]interface{}{ }
// "ok": false,
// "err": err.Error(), if err != nil {
// }) log.Error(4, "repo.Action(%s): %v", ctx.Params(":action"), err)
// return ctx.JSON(200, map[string]interface{}{
// } "ok": false,
// ctx.JSON(200, map[string]interface{}{ "err": err.Error(),
// "ok": true, })
// }) return
// } }
ctx.Redirect(ctx.Repo.RepoLink)
return
ctx.JSON(200, map[string]interface{}{
"ok": true,
})
}
func Download(ctx *middleware.Context) { func Download(ctx *middleware.Context) {
ext := "." + ctx.Params(":ext") ext := "." + ctx.Params(":ext")

4
routers/user/home.go

@ -73,6 +73,10 @@ func Dashboard(ctx *middleware.Context) {
mirrors := make([]*models.Repository, 0, len(repos)/2) mirrors := make([]*models.Repository, 0, len(repos)/2)
for _, repo := range repos { for _, repo := range repos {
if repo.IsMirror { if repo.IsMirror {
if err = repo.GetMirror(); err != nil {
ctx.Handle(500, "GetMirror: "+repo.Name, err)
return
}
mirrors = append(mirrors, repo) mirrors = append(mirrors, repo)
} }
} }

2
scripts/start.sh

@ -12,4 +12,4 @@ USER=$(whoami)
HOME=$(grep "^$USER:" /etc/passwd | cut -d: -f6) HOME=$(grep "^$USER:" /etc/passwd | cut -d: -f6)
export USER HOME PATH export USER HOME PATH
cd "$(dirname $0)" && exec ./gogs web cd "$(pwd)" && exec ./gogs web

2
templates/.VERSION

@ -1 +1 @@
0.4.7.0809 Alpha 0.4.7.0810 Alpha

101
templates/org/home.tmpl

@ -1,70 +1,75 @@
{{template "base/head" .}} {{template "ng/base/head" .}}
{{template "base/navbar" .}} {{template "ng/base/header" .}}
<div id="body-nav" class="org-nav"> <div class="org-header" id="org-home-header">
<div class="container clearfix"> <div class="container clear">
<div class="col-md-8" id="org-nav-wrapper"> <img class="avatar-100 left" src="{{.Org.AvatarLink}}?s=140"/>
<img class="pull-left org-logo" src="{{.Org.AvatarLink}}?s=140" alt="" width="100"/> <div id="org-home-header-info">
<div id="org-nav-info"> <h2>{{.Org.FullName}} <a class="text-grey" href="/org/{{.Org.LowerName}}/settings"><span class="octicon octicon-gear"></span></a></h2>
<h2 class="org-name">{{.Org.FullName}}</h2> {{if .Org.Description}}<p>{{.Org.Description}}</p>{{end}}
{{if .Org.Description}}<p class="org-description">{{.Org.Description}}</p>{{end}} <ul class="text-grey">
<ul class="org-meta list-inline"> {{if .Org.Location}}<li><span class="octicon octicon-location"></span> <span>{{.Org.Location}}</span></li>{{end}}
{{if .Org.Website}}<li><i class="fa fa-link"></i><a target="_blank" href="{{.Org.Website}}">{{.Org.Website}}</a></li>{{end}} {{if .Org.Website}}<li><span class="octicon octicon-link"></span> <a target="_blank" href="{{.Org.Website}}">{{.Org.Website}}</a></li>{{end}}
<li><i class="fa fa-envelope"></i><a href="mailto:{{.Org.Email}}">{{.Org.Email}}</a></li> {{if .Org.Email}}<li><span class="octicon octicon-mail"></span> <a href="mailto:{{.Org.Email}}">{{.Org.Email}}</a></li>{{end}}
</ul> </ul>
</div> </div>
</div> </div>
</div>
</div> </div>
<div id="body" class="container"> <div class="container">
<div id="org"> <div id="org-home-repo-list" class="left grid-2-3">
<div class="org-main col-md-8"> <div class="clear">
<div class="org-toolbar clearfix"> <a class="btn btn-green btn-large btn-link btn-radius right" href="/repo/create?org={{.Org.Id}}"><i class="octicon octicon-repo-create"></i> {{.i18n.Tr "new_repo"}}</a>
<a class="btn pull-right btn-success" href="/repo/create?org={{.Org.Id}}"><i class="fa fa-plus"></i> New Repository</a> </div>
</div> <div id="org-repo-list">
<hr style="width: 100%;border-color: #DDD"/>
<div class="org-repo-list" id="org-repo-list">
{{range .Repos}} {{range .Repos}}
<div class="org-repo-item"> <div class="org-repo-item">
<div class="org-repo-status pull-right"> <ul class="org-repo-status right">
<!-- <ul class="list-inline"> <li><i class="octicon octicon-star"></i> {{.NumStars}}</li>
<li><strong>Go</strong></li> <li><i class="octicon octicon-git-branch"></i> {{.NumForks}}</li>
<li><i class="i fa fa-star"></i><strong>6</strong></li> </ul>
<li><i class="fa fa-code-fork"></i><strong>2</strong></li> <h2><a href="/{{$.Org.Name}}/{{.Name}}">{{.Name}}</a></h2>
</ul> -->
</div>
<h3 class="org-repo-name"><a href="/{{$.Org.Name}}/{{.Name}}">{{.Name}}</a></h3>
<p class="org-repo-description">{{.Description}}</p> <p class="org-repo-description">{{.Description}}</p>
<p class="org-repo-update">Updated {{TimeSince .Updated $.Lang}}</p> <p class="org-repo-updated">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
</div> </div>
{{end}} {{end}}
</div> </div>
</div> </div>
<div class="grid-1-3 right">
<div class="org-sidebar col-md-4"> <div class="org-sidebar">
<div class="org-panel panel panel-default" id="org-sidebar-members"> <div class="panel panel-radius">
<div class="panel-heading"><strong><a href="/org/{{$.Org.Name}}/members">Members</a></strong></div> <div class="panel-header">
<div class="panel-body"> <a class="text-grey right" href="/org/{{.Org.LowerName}}/members"><strong>{{.Org.NumMembers}}</strong><span class="octicon octicon-chevron-right"></span></a>
<strong>{{.i18n.Tr "org.people"}}</strong>
</div>
<div class="panel-body" id="org-member-avatar-group">
{{range .Members}} {{range .Members}}
<a class="org-member" href="/user/{{.Name}}" data-toggle="tooltip" title="{{.Name}}" data-placement="bottom"><img src="{{.AvatarLink}}?s=140" alt=""/></a> <a href="/{{.Name}}"><img src="{{.AvatarLink}}"></a>
{{end}} {{end}}
</div> </div>
<div class="panel-footer">
<a class="btn btn-medium btn-blue btn-link btn-radius" href="">{{.i18n.Tr "org.invite_someone"}}</a>
</div> </div>
<div class="org-panel panel panel-default" id="org-sidebar-teams">
<div class="panel-heading"><strong><a href="/org/{{$.Org.Name}}/teams">Teams</a></strong></div>
<div class="panel-body">
{{range .Teams}}
<div class="org-team">
<a href="/org/{{$.Org.Name}}/teams/{{.LowerName}}">
<p class="org-team-name"><strong>{{.Name}}</strong></p>
<p class="org-team-meta">
{{.NumMembers}} members · {{.NumRepos}} repositories
</p>
</a>
</div> </div>
<br>
<div class="panel panel-radius">
<div class="panel-header">
<a class="text-grey right" href="/org/{{.Org.LowerName}}/teams"><strong>{{.Org.NumTeams}}</strong><span class="octicon octicon-chevron-right"></span></a>
<strong>{{.i18n.Tr "org.teams"}}</strong>
</div>
<div class="panel-body" id="org-home-team-list">
<ul>
{{range .Teams}}
<li>
<a class="text-black" href="/org/{{$.Org.LowerName}}/teams/{{.LowerName}}"><strong class="team-name">{{.Name}}</strong></a>
<p class="team-meta">{{.NumMembers}} {{$.i18n.Tr "org.lower_members"}} · {{.NumRepos}} {{$.i18n.Tr "org.lower_repositories"}}</p>
</li>
{{end}} {{end}}
</ul>
</div>
<div class="panel-footer">
<a class="btn btn-medium btn-blue btn-link btn-radius" href="/org/{{$.Org.LowerName}}/teams/new">{{.i18n.Tr "org.create_new_team"}}</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "ng/base/footer" .}}

2
templates/org/teams.tmpl

@ -43,7 +43,7 @@
</p> </p>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
{{if .IsMember $.SignedUserId}} {{if .IsMember $.SignedUser.Id}}
<a class="pull-right btn btn-danger" href="/org/{{$.Org.Name}}/teams/{{.LowerName}}?action=leave">Leave</a> <a class="pull-right btn btn-danger" href="/org/{{$.Org.Name}}/teams/{{.LowerName}}?action=leave">Leave</a>
{{else}} {{else}}
<a class="pull-right btn btn-default" href="/org/{{$.Org.Name}}/teams/{{.LowerName}}?action=join">Join</a> <a class="pull-right btn btn-default" href="/org/{{$.Org.Name}}/teams/{{.LowerName}}?action=join">Join</a>

2
templates/repo/create.tmpl

@ -10,7 +10,7 @@
<label for="owner" class="req">{{.i18n.Tr "repo.owner"}}</label> <label for="owner" class="req">{{.i18n.Tr "repo.owner"}}</label>
<input id="repo-owner-id" type="hidden" name="uid" value="{{.ContextUser.Id}}" /> <input id="repo-owner-id" type="hidden" name="uid" value="{{.ContextUser.Id}}" />
<div class="inline-block drop"> <div class="inline-block drop">
<a href="#" class="drop-bottom"> <a class="drop-bottom">
<img class="avatar" src="{{.ContextUser.AvatarLink}}" id="repo-owner-avatar" alt="user-avatar"> <img class="avatar" src="{{.ContextUser.AvatarLink}}" id="repo-owner-avatar" alt="user-avatar">
<strong id="repo-owner-name">{{.ContextUser.Name}}</strong> <strong id="repo-owner-name">{{.ContextUser.Name}}</strong>
</a> </a>

15
templates/repo/header.tmpl

@ -20,7 +20,7 @@
<button id="repo-clone-https" class="btn btn-gray left">HTTPS</button> <button id="repo-clone-https" class="btn btn-gray left">HTTPS</button>
<input id="repo-clone-url" type="text" class="ipt ipt-disabled left" value="{{.CloneLink.SSH}}" /> <input id="repo-clone-url" type="text" class="ipt ipt-disabled left" value="{{.CloneLink.SSH}}" />
<button id="repo-clone-copy" class="btn btn-black left btn-right-radius">Copy</button> <button id="repo-clone-copy" class="btn btn-black left btn-right-radius">Copy</button>
<p class="text-center" id="repo-clone-help">Need help cloning? Visit <a target="_blank" href="http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository">Help</a>!</p> <p class="text-center" id="repo-clone-help">{{.i18n.Tr "repo.clone_helper" | Str2html}}</p>
<hr/> <hr/>
<div class="text-center" id="repo-clone-zip"> <div class="text-center" id="repo-clone-zip">
<a class="btn btn-green btn-radius" href="{{.RepoLink}}/archive/{{.BranchName}}.zip"><i class="octicon octicon-file-zip"></i>ZIP</a> <a class="btn btn-green btn-radius" href="{{.RepoLink}}/archive/{{.BranchName}}.zip"><i class="octicon octicon-file-zip"></i>ZIP</a>
@ -30,25 +30,24 @@
</div> </div>
</li> </li>
<li id="repo-header-watch"> <li id="repo-header-watch">
<a id="repo-header-watch-btn" href="#"> <a id="repo-header-watch-btn" href="{{.RepoLink}}/action/{{if .IsWatchingRepo}}un{{end}}watch">
<button class="btn btn-gray text-bold btn-radius"> <button class="btn btn-gray text-bold btn-radius">
<i class="octicon octicon-eye-watch"></i>{{if .IsWatchingRepo}}Unwatch{{else}}Watch{{end}} <i class="octicon octicon-eye-watch"></i>{{if .IsWatchingRepo}}{{.i18n.Tr "repo.unwatch"}}{{else}}{{.i18n.Tr "repo.watch"}}{{end}}<span class="num">{{.Repository.NumWatches}}</span>
<span class="num">{{.Repository.NumWatches}}</span>
</button> </button>
</a> </a>
</li> </li>
<li id="repo-header-star"> <li id="repo-header-star">
<a id="repo-header-star-btn" href="#"> <a id="repo-header-star-btn" href="{{.RepoLink}}/action/{{if .IsStaringRepo}}un{{end}}star">
<button class="btn btn-gray text-bold btn-radius"> <button class="btn btn-gray text-bold btn-radius">
<i class="octicon octicon-star"></i>Star <i class="octicon octicon-star"></i>{{if .IsStaringRepo}}{{.i18n.Tr "repo.unstar"}}{{else}}{{.i18n.Tr "repo.star"}}{{end}}
<span class="num">{{.Repository.NumStars}}</span> <span class="num">{{.Repository.NumStars}}</span>
</button> </button>
</a> </a>
</li> </li>
<li id="repo-header-fork"> <li id="repo-header-fork">
<a id="repo-header-fork-btn" href="#"> <a id="repo-header-fork-btn" href="{{.RepoLink}}/action/fork">
<button class="btn btn-gray text-bold btn-radius"> <button class="btn btn-gray text-bold btn-radius">
<i class="octicon octicon-repo-forked"></i>Fork <i class="octicon octicon-repo-forked"></i>{{.i18n.Tr "repo.fork"}}
<span class="num">{{.Repository.NumForks}}</span> <span class="num">{{.Repository.NumForks}}</span>
</button> </button>
</a> </a>

4
templates/repo/home.tmpl

@ -57,12 +57,12 @@
</li> </li>
<li id="repo-commits-jump" class="repo-jump right"> <li id="repo-commits-jump" class="repo-jump right">
<a href="#"> <a href="#">
<button class="btn btn-small btn-gray btn-radius"><i class="octicon octicon-git-commit"></i></button> <button class="btn btn-small btn-gray btn-right-radius"><i class="octicon octicon-git-commit"></i></button>
</a> </a>
</li> </li>
<li id="repo-find-jump" class="repo-jump right"> <li id="repo-find-jump" class="repo-jump right">
<a href="#"> <a href="#">
<button class="btn btn-small btn-gray btn-radius"><i class="octicon octicon-list-unordered"></i></button> <button class="btn btn-small btn-gray btn-left-radius"><i class="octicon octicon-list-unordered"></i></button>
</a> </a>
</li> </li>
</ul> </ul>

2
templates/user/dashboard/dashboard.tmpl

@ -154,7 +154,7 @@
<strong class="repo">{{.Name}}</strong> <strong class="repo">{{.Name}}</strong>
</span> </span>
<span class="right repo-star"> <span class="right repo-star">
<i class="octicon octicon-star"></i>{{.NumStars}} <i class="octicon octicon-sync"></i>{{.Interval}}H
</span> </span>
</a> </a>
</li> </li>

Loading…
Cancel
Save