mirror of
https://github.com/go-gitea/gitea
synced 2024-08-19 05:40:43 +02:00
Finish new home page of organization
This commit is contained in:
parent
7af7584d25
commit
5fbf8531e6
@ -235,7 +235,7 @@ func runWeb(*cli.Context) {
|
||||
r.Post("/:org/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
||||
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.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost)
|
||||
@ -264,7 +264,7 @@ func runWeb(*cli.Context) {
|
||||
}, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
||||
|
||||
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) {
|
||||
r.Get("/new", repo.CreateIssue)
|
||||
|
@ -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_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.options = Options
|
||||
settings.collaboration = Collaboration
|
||||
@ -221,6 +228,13 @@ org_name_holder = Organization Name
|
||||
org_name_helper = Great organization names are short and memorable.
|
||||
org_email_helper = Organization's Email receives all notifications and confirmations.
|
||||
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]
|
||||
create_repo = created repository <a href="/%s">%s</a>
|
||||
|
@ -179,6 +179,13 @@ migrate_type = 迁移类型
|
||||
migrate_type_helper = 本仓库将是 <span class="label label-blue label-radius">镜像</span>
|
||||
migrate_repo = 迁移仓库
|
||||
|
||||
clone_helper = 不知道如何操作?访问 <a target="_blank" href="http://git-scm.com/book/zh/Git-基础-取得项目的-Git-仓库">此处</a> 查看帮助!
|
||||
unwatch = 取消关注
|
||||
watch = 关注
|
||||
unstar = 取消点赞
|
||||
star = 点赞
|
||||
fork = 派生
|
||||
|
||||
settings = 仓库设置
|
||||
settings.options = 基本设置
|
||||
settings.collaboration = 管理协作者
|
||||
@ -221,6 +228,13 @@ org_name_holder = 组织名称
|
||||
org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。
|
||||
org_email_helper = 组织的邮箱用于接收所有通知和确认邮件。
|
||||
create_org = 创建组织
|
||||
repo_updated = 最后更新于
|
||||
people = 组织成员
|
||||
invite_someone = 邀请他人加入
|
||||
teams = 组织团队
|
||||
lower_members = 名成员
|
||||
lower_repositories = 个仓库
|
||||
create_new_team = 创建新的团队
|
||||
|
||||
[action]
|
||||
create_repo = 创建了仓库 <a href="/%s">%s</a>
|
||||
|
2
gogs.go
2
gogs.go
@ -17,7 +17,7 @@ import (
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.4.7.0809 Alpha"
|
||||
const APP_VER = "0.4.7.0810 Alpha"
|
||||
|
||||
func init() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
@ -32,8 +32,9 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
tables = append(tables, new(User), new(PublicKey), new(Repository), new(Watch),
|
||||
new(Action), new(Access), new(Issue), new(Comment), new(Oauth2), new(Follow),
|
||||
tables = append(tables, new(User), new(PublicKey),
|
||||
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(Milestone), new(Label), new(HookTask), new(Team), new(OrgUser), new(TeamUser),
|
||||
new(UpdateTask), new(Attachment))
|
||||
|
@ -106,6 +106,7 @@ func CreateOrganization(org, owner *User) (*User, error) {
|
||||
// Create default owner team.
|
||||
t := &Team{
|
||||
OrgId: org.Id,
|
||||
LowerName: strings.ToLower(OWNER_TEAM),
|
||||
Name: OWNER_TEAM,
|
||||
Authorize: ORG_ADMIN,
|
||||
NumMembers: 1,
|
||||
|
@ -137,6 +137,7 @@ type Repository struct {
|
||||
NumTags int `xorm:"-"`
|
||||
IsPrivate bool
|
||||
IsMirror bool
|
||||
*Mirror `xorm:"-"`
|
||||
IsFork bool `xorm:"NOT NULL DEFAULT false"`
|
||||
IsBare bool
|
||||
IsGoget bool
|
||||
@ -150,6 +151,11 @@ func (repo *Repository) GetOwner() (err error) {
|
||||
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.
|
||||
func (repo *Repository) DescriptionHtml() template.HTML {
|
||||
sanitize := func(s string) string {
|
||||
@ -953,21 +959,33 @@ type Watch struct {
|
||||
}
|
||||
|
||||
// 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 _, 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
|
||||
}
|
||||
_, 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 {
|
||||
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
|
||||
}
|
||||
_, 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
|
||||
}
|
||||
|
||||
// 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.
|
||||
func GetWatchers(rid int64) ([]*Watch, error) {
|
||||
watches := make([]*Watch, 0, 10)
|
||||
@ -1003,9 +1021,37 @@ func NotifyWatchers(act *Action) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsWatching checks if user has watched given repository.
|
||||
func IsWatching(uid, rid int64) bool {
|
||||
has, _ := x.Get(&Watch{0, uid, rid})
|
||||
type Star struct {
|
||||
Id int64
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
@ -44,7 +43,6 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||
}
|
||||
|
||||
if options.SignInRequire {
|
||||
fmt.Println(ctx.User.IsActive, setting.Service.RegisterEmailConfirm)
|
||||
if !ctx.IsSigned {
|
||||
// Ignore watch repository operation.
|
||||
if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
|
||||
|
@ -246,17 +246,17 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
||||
}
|
||||
|
||||
// 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)
|
||||
ctx.HTML(200, "repo/bare")
|
||||
if displayBare {
|
||||
ctx.HTML(200, "repo/bare")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.IsSigned {
|
||||
ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.Id, repo.Id)
|
||||
}
|
||||
if ctx.Repo.Repository.IsBare {
|
||||
return
|
||||
ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.Id, repo.Id)
|
||||
}
|
||||
|
||||
ctx.Data["TagName"] = ctx.Repo.TagName
|
||||
|
@ -40,6 +40,11 @@ img.avatar-48 {
|
||||
height: 48px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
img.avatar-100 {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#wrapper {
|
||||
padding: 0;
|
||||
margin: 0 0 -55px 0;
|
||||
@ -226,6 +231,9 @@ img.avatar-48 {
|
||||
.text-grey {
|
||||
color: #999999;
|
||||
}
|
||||
.text-black {
|
||||
color: #444444;
|
||||
}
|
||||
.markdown {
|
||||
background-color: white;
|
||||
font-size: 16px;
|
||||
@ -974,6 +982,7 @@ The register and sign-in page style
|
||||
border-left: none;
|
||||
}
|
||||
#repo-clone-help {
|
||||
clear: both;
|
||||
line-height: 48px;
|
||||
}
|
||||
#repo-clone-zip {
|
||||
@ -1665,3 +1674,99 @@ textarea#issue-add-content {
|
||||
box-sizing: border-box;
|
||||
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;
|
||||
}
|
||||
|
@ -372,6 +372,10 @@ dt {
|
||||
font-size: 10.8px;
|
||||
padding: .4em .9em;
|
||||
}
|
||||
.btn-medium {
|
||||
font-size: 12px;
|
||||
padding: .4em .9em;
|
||||
}
|
||||
.btn-large {
|
||||
font-size: 14.4px;
|
||||
}
|
||||
|
@ -5,4 +5,5 @@
|
||||
@import "gogs/sign";
|
||||
@import "gogs/repository";
|
||||
@import "gogs/settings";
|
||||
@import "gogs/issue";
|
||||
@import "gogs/issue";
|
||||
@import "gogs/organization";
|
@ -50,6 +50,11 @@ img.avatar-48{
|
||||
height: 48px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
img.avatar-100{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#wrapper {
|
||||
padding: 0;
|
||||
margin: 0 0 -55px 0;
|
||||
@ -242,4 +247,7 @@ clear: both;
|
||||
}
|
||||
.text-grey {
|
||||
color: #999999;
|
||||
}
|
||||
.text-black {
|
||||
color: #444444;
|
||||
}
|
96
public/ng/less/gogs/organization.less
Normal file
96
public/ng/less/gogs/organization.less
Normal file
@ -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;
|
||||
}
|
@ -97,6 +97,7 @@ border-top-right-radius: .25em;
|
||||
border-left: none;
|
||||
}
|
||||
#repo-clone-help {
|
||||
clear: both;
|
||||
line-height: 48px;
|
||||
}
|
||||
#repo-clone-zip {
|
||||
|
@ -5,14 +5,16 @@
|
||||
&:hover {
|
||||
}
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
font-size: 0.9*@baseFontSize;
|
||||
padding: .4em .9em;
|
||||
}
|
||||
|
||||
.btn-medium {
|
||||
font-size: @baseFontSize;
|
||||
padding: .4em .9em;
|
||||
}
|
||||
.btn-large {
|
||||
font-size: 1.2*@baseFontSize;
|
||||
font-size: 1.2*@baseFontSize;
|
||||
}
|
||||
|
||||
.btn-green {
|
||||
@ -23,7 +25,6 @@
|
||||
color: #FFF;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-blue {
|
||||
background-color: @btnBlueColor;
|
||||
border: 1px solid @btnBlueColor;
|
||||
|
@ -19,34 +19,33 @@ const (
|
||||
)
|
||||
|
||||
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"))
|
||||
if err != nil {
|
||||
if err == models.ErrUserNotExist {
|
||||
ctx.Handle(404, "org.Home(GetUserByName)", err)
|
||||
ctx.Handle(404, "GetUserByName", err)
|
||||
} else {
|
||||
ctx.Handle(500, "org.Home(GetUserByName)", err)
|
||||
ctx.Handle(500, "GetUserByName", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.Data["Org"] = org
|
||||
|
||||
ctx.Data["Repos"], err = models.GetRepositories(org.Id,
|
||||
ctx.IsSigned && org.IsOrgMember(ctx.User.Id))
|
||||
ctx.Data["Repos"], err = models.GetRepositories(org.Id, ctx.IsSigned && org.IsOrgMember(ctx.User.Id))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "org.Home(GetRepositories)", err)
|
||||
ctx.Handle(500, "GetRepositories", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = org.GetMembers(); err != nil {
|
||||
ctx.Handle(500, "org.Home(GetMembers)", err)
|
||||
ctx.Handle(500, "GetMembers", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Members"] = org.Members
|
||||
|
||||
if err = org.GetTeams(); err != nil {
|
||||
ctx.Handle(500, "org.Home(GetTeams)", err)
|
||||
ctx.Handle(500, "GetTeams", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Teams"] = org.Teams
|
||||
|
@ -204,36 +204,42 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||
ctx.Handle(500, "MigratePost", err)
|
||||
}
|
||||
|
||||
// func Action(ctx *middleware.Context, params martini.Params) {
|
||||
// var err error
|
||||
// switch params["action"] {
|
||||
// case "watch":
|
||||
// err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
|
||||
// case "unwatch":
|
||||
// err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
|
||||
// case "desc":
|
||||
// if !ctx.Repo.IsOwner {
|
||||
// ctx.Error(404)
|
||||
// return
|
||||
// }
|
||||
func Action(ctx *middleware.Context) {
|
||||
var err error
|
||||
switch ctx.Params(":action") {
|
||||
case "watch":
|
||||
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
|
||||
case "unwatch":
|
||||
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
|
||||
case "star":
|
||||
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
|
||||
case "unstar":
|
||||
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
|
||||
case "desc":
|
||||
if !ctx.Repo.IsOwner {
|
||||
ctx.Error(404)
|
||||
return
|
||||
}
|
||||
|
||||
// ctx.Repo.Repository.Description = ctx.Query("desc")
|
||||
// ctx.Repo.Repository.Website = ctx.Query("site")
|
||||
// err = models.UpdateRepository(ctx.Repo.Repository)
|
||||
// }
|
||||
ctx.Repo.Repository.Description = ctx.Query("desc")
|
||||
ctx.Repo.Repository.Website = ctx.Query("site")
|
||||
err = models.UpdateRepository(ctx.Repo.Repository)
|
||||
}
|
||||
|
||||
// if err != nil {
|
||||
// log.Error("repo.Action(%s): %v", params["action"], err)
|
||||
// ctx.JSON(200, map[string]interface{}{
|
||||
// "ok": false,
|
||||
// "err": err.Error(),
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
// ctx.JSON(200, map[string]interface{}{
|
||||
// "ok": true,
|
||||
// })
|
||||
// }
|
||||
if err != nil {
|
||||
log.Error(4, "repo.Action(%s): %v", ctx.Params(":action"), err)
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": false,
|
||||
"err": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
ctx.Redirect(ctx.Repo.RepoLink)
|
||||
return
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
|
||||
func Download(ctx *middleware.Context) {
|
||||
ext := "." + ctx.Params(":ext")
|
||||
|
@ -73,6 +73,10 @@ func Dashboard(ctx *middleware.Context) {
|
||||
mirrors := make([]*models.Repository, 0, len(repos)/2)
|
||||
for _, repo := range repos {
|
||||
if repo.IsMirror {
|
||||
if err = repo.GetMirror(); err != nil {
|
||||
ctx.Handle(500, "GetMirror: "+repo.Name, err)
|
||||
return
|
||||
}
|
||||
mirrors = append(mirrors, repo)
|
||||
}
|
||||
}
|
||||
|
@ -12,4 +12,4 @@ USER=$(whoami)
|
||||
HOME=$(grep "^$USER:" /etc/passwd | cut -d: -f6)
|
||||
export USER HOME PATH
|
||||
|
||||
cd "$(dirname $0)" && exec ./gogs web
|
||||
cd "$(pwd)" && exec ./gogs web
|
||||
|
@ -1 +1 @@
|
||||
0.4.7.0809 Alpha
|
||||
0.4.7.0810 Alpha
|
@ -1,70 +1,75 @@
|
||||
{{template "base/head" .}}
|
||||
{{template "base/navbar" .}}
|
||||
<div id="body-nav" class="org-nav">
|
||||
<div class="container clearfix">
|
||||
<div class="col-md-8" id="org-nav-wrapper">
|
||||
<img class="pull-left org-logo" src="{{.Org.AvatarLink}}?s=140" alt="" width="100"/>
|
||||
<div id="org-nav-info">
|
||||
<h2 class="org-name">{{.Org.FullName}}</h2>
|
||||
{{if .Org.Description}}<p class="org-description">{{.Org.Description}}</p>{{end}}
|
||||
<ul class="org-meta list-inline">
|
||||
{{if .Org.Website}}<li><i class="fa fa-link"></i><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>
|
||||
</ul>
|
||||
</div>
|
||||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div class="org-header" id="org-home-header">
|
||||
<div class="container clear">
|
||||
<img class="avatar-100 left" src="{{.Org.AvatarLink}}?s=140"/>
|
||||
<div id="org-home-header-info">
|
||||
<h2>{{.Org.FullName}} <a class="text-grey" href="/org/{{.Org.LowerName}}/settings"><span class="octicon octicon-gear"></span></a></h2>
|
||||
{{if .Org.Description}}<p>{{.Org.Description}}</p>{{end}}
|
||||
<ul class="text-grey">
|
||||
{{if .Org.Location}}<li><span class="octicon octicon-location"></span> <span>{{.Org.Location}}</span></li>{{end}}
|
||||
{{if .Org.Website}}<li><span class="octicon octicon-link"></span> <a target="_blank" href="{{.Org.Website}}">{{.Org.Website}}</a></li>{{end}}
|
||||
{{if .Org.Email}}<li><span class="octicon octicon-mail"></span> <a href="mailto:{{.Org.Email}}">{{.Org.Email}}</a></li>{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div id="org-home-repo-list" class="left grid-2-3">
|
||||
<div class="clear">
|
||||
<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>
|
||||
</div>
|
||||
<div id="org-repo-list">
|
||||
{{range .Repos}}
|
||||
<div class="org-repo-item">
|
||||
<ul class="org-repo-status right">
|
||||
<li><i class="octicon octicon-star"></i> {{.NumStars}}</li>
|
||||
<li><i class="octicon octicon-git-branch"></i> {{.NumForks}}</li>
|
||||
</ul>
|
||||
<h2><a href="/{{$.Org.Name}}/{{.Name}}">{{.Name}}</a></h2>
|
||||
<p class="org-repo-description">{{.Description}}</p>
|
||||
<p class="org-repo-updated">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="body" class="container">
|
||||
<div id="org">
|
||||
<div class="org-main col-md-8">
|
||||
<div class="org-toolbar clearfix">
|
||||
<a class="btn pull-right btn-success" href="/repo/create?org={{.Org.Id}}"><i class="fa fa-plus"></i> New Repository</a>
|
||||
</div>
|
||||
<hr style="width: 100%;border-color: #DDD"/>
|
||||
<div class="org-repo-list" id="org-repo-list">
|
||||
{{range .Repos}}
|
||||
<div class="org-repo-item">
|
||||
<div class="org-repo-status pull-right">
|
||||
<!-- <ul class="list-inline">
|
||||
<li><strong>Go</strong></li>
|
||||
<li><i class="i fa fa-star"></i><strong>6</strong></li>
|
||||
<li><i class="fa fa-code-fork"></i><strong>2</strong></li>
|
||||
</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-update">Updated {{TimeSince .Updated $.Lang}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="org-sidebar col-md-4">
|
||||
<div class="org-panel panel panel-default" id="org-sidebar-members">
|
||||
<div class="panel-heading"><strong><a href="/org/{{$.Org.Name}}/members">Members</a></strong></div>
|
||||
<div class="panel-body">
|
||||
{{range .Members}}
|
||||
<a class="org-member" href="/user/{{.Name}}" data-toggle="tooltip" title="{{.Name}}" data-placement="bottom"><img src="{{.AvatarLink}}?s=140" alt=""/></a>
|
||||
{{end}}
|
||||
</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>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-1-3 right">
|
||||
<div class="org-sidebar">
|
||||
<div class="panel panel-radius">
|
||||
<div class="panel-header">
|
||||
<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}}
|
||||
<a href="/{{.Name}}"><img src="{{.AvatarLink}}"></a>
|
||||
{{end}}
|
||||
</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>
|
||||
<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}}
|
||||
</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>
|
||||
{{template "base/footer" .}}
|
||||
{{template "ng/base/footer" .}}
|
@ -43,7 +43,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<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>
|
||||
{{else}}
|
||||
<a class="pull-right btn btn-default" href="/org/{{$.Org.Name}}/teams/{{.LowerName}}?action=join">Join</a>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<label for="owner" class="req">{{.i18n.Tr "repo.owner"}}</label>
|
||||
<input id="repo-owner-id" type="hidden" name="uid" value="{{.ContextUser.Id}}" />
|
||||
<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">
|
||||
<strong id="repo-owner-name">{{.ContextUser.Name}}</strong>
|
||||
</a>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<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}}" />
|
||||
<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/>
|
||||
<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>
|
||||
@ -30,25 +30,24 @@
|
||||
</div>
|
||||
</li>
|
||||
<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">
|
||||
<i class="octicon octicon-eye-watch"></i>{{if .IsWatchingRepo}}Unwatch{{else}}Watch{{end}}
|
||||
<span class="num">{{.Repository.NumWatches}}</span>
|
||||
<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>
|
||||
</button>
|
||||
</a>
|
||||
</li>
|
||||
<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">
|
||||
<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>
|
||||
</button>
|
||||
</a>
|
||||
</li>
|
||||
<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">
|
||||
<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>
|
||||
</button>
|
||||
</a>
|
||||
|
@ -57,12 +57,12 @@
|
||||
</li>
|
||||
<li id="repo-commits-jump" class="repo-jump right">
|
||||
<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>
|
||||
</li>
|
||||
<li id="repo-find-jump" class="repo-jump right">
|
||||
<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>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -154,7 +154,7 @@
|
||||
<strong class="repo">{{.Name}}</strong>
|
||||
</span>
|
||||
<span class="right repo-star">
|
||||
<i class="octicon octicon-star"></i>{{.NumStars}}
|
||||
<i class="octicon octicon-sync"></i>{{.Interval}}H
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user