parent
b2801a2e98
commit
e0f9c628c5
@ -0,0 +1,69 @@
|
||||
// Copyright 2014 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
|
||||
|
||||
type AuthorizeType int
|
||||
|
||||
const (
|
||||
ORG_READABLE AuthorizeType = iota + 1
|
||||
ORG_WRITABLE
|
||||
ORG_ADMIN
|
||||
)
|
||||
|
||||
// Team represents a organization team.
|
||||
type Team struct {
|
||||
Id int64
|
||||
OrgId int64 `xorm:"INDEX"`
|
||||
Name string
|
||||
Description string
|
||||
Authorize AuthorizeType
|
||||
NumMembers int
|
||||
NumRepos int
|
||||
}
|
||||
|
||||
// NewTeam creates a record of new team.
|
||||
func NewTeam(t *Team) error {
|
||||
_, err := x.Insert(t)
|
||||
return err
|
||||
}
|
||||
|
||||
// ________ ____ ___
|
||||
// \_____ \_______ ____ | | \______ ___________
|
||||
// / | \_ __ \/ ___\| | / ___// __ \_ __ \
|
||||
// / | \ | \/ /_/ > | /\___ \\ ___/| | \/
|
||||
// \_______ /__| \___ /|______//____ >\___ >__|
|
||||
// \/ /_____/ \/ \/
|
||||
|
||||
// OrgUser represents an organization-user relation.
|
||||
type OrgUser struct {
|
||||
Id int64
|
||||
Uid int64 `xorm:"INDEX"`
|
||||
OrgId int64 `xorm:"INDEX"`
|
||||
IsPublic bool
|
||||
IsOwner bool
|
||||
NumTeam int
|
||||
}
|
||||
|
||||
// GetOrgUsersByUserId returns all organization-user relations by user ID.
|
||||
func GetOrgUsersByUserId(uid int64) ([]*OrgUser, error) {
|
||||
ous := make([]*OrgUser, 0, 10)
|
||||
err := x.Where("uid=?", uid).Find(&ous)
|
||||
return ous, err
|
||||
}
|
||||
|
||||
// ___________ ____ ___
|
||||
// \__ ___/___ _____ _____ | | \______ ___________
|
||||
// | |_/ __ \\__ \ / \| | / ___// __ \_ __ \
|
||||
// | |\ ___/ / __ \| Y Y \ | /\___ \\ ___/| | \/
|
||||
// |____| \___ >____ /__|_| /______//____ >\___ >__|
|
||||
// \/ \/ \/ \/ \/
|
||||
|
||||
// TeamUser represents an team-user relation.
|
||||
type TeamUser struct {
|
||||
Id int64
|
||||
Uid int64
|
||||
OrgId int64 `xorm:"INDEX"`
|
||||
TeamId int64
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// Copyright 2014 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 auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
type CreateOrganizationForm struct {
|
||||
OrgName string `form:"orgname" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
}
|
||||
|
||||
func (f *CreateOrganizationForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"OrgName": "Organization name",
|
||||
"Email": "E-mail address",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *CreateOrganizationForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context) {
|
||||
data := ctx.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
validate(errs, data, f)
|
||||
}
|
@ -1 +1 @@
|
||||
0.4.5.0624 Alpha
|
||||
0.4.5.0625 Alpha
|
@ -1,73 +0,0 @@
|
||||
{{template "base/head" .}}
|
||||
{{template "base/navbar" .}}
|
||||
<div id="body-nav">
|
||||
<div class="container">
|
||||
<div class="btn-group pull-left" id="dashboard-switch">
|
||||
<button type="button" class="btn btn-default">
|
||||
<img src="//1.gravatar.com/avatar/f72f7454ce9d710baa506394f68f4132?s=28" alt="user-avatar" title="username">
|
||||
gogits
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<div class="dropdown-menu clone-group-btn no-propagation">
|
||||
<ul id="dashboard-switch-menu" class="list-unstyled">
|
||||
<li class="checked"><a href="#"><i class="fa fa-check"></i>
|
||||
<img src="//1.gravatar.com/avatar/f72f7454ce9d710baa506394f68f4132?s=28" alt="user-avatar" title="username">
|
||||
gogits/gogs</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav nav-pills pull-right">
|
||||
<li class="active"><a href="/">Feed</a></li>
|
||||
<li><a href="/issues">Issues</a></li>
|
||||
<li><a href="#">Setting</a></li>
|
||||
<!-- <li><a href="/pulls">Pull Requests</a></li>
|
||||
<li><a href="/stars">Stars</a></li> -->
|
||||
</ul>
|
||||
<h3>News Feed</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div id="body" class="container" data-page="user">
|
||||
{{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}}
|
||||
<div id="feed-left" class="col-md-8">
|
||||
<ul class="list-unstyled activity-list">
|
||||
{{range .Feeds}}
|
||||
<li>
|
||||
<i class="icon fa fa-{{ActionIcon .OpType}}"></i>
|
||||
<div class="info"><span class="meta">{{TimeSince .Created}}</span><br>{{ActionDesc . | str2html}}</div>
|
||||
<span class="clearfix"></span>
|
||||
</li>
|
||||
{{else}}
|
||||
<li>Oh. Looks like there isn't any activity here yet. Get Busy!</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
<div id="feed-right" class="col-md-4">
|
||||
<div class="panel panel-default repo-panel">
|
||||
<div class="panel-heading">Repositories
|
||||
<div class="btn-group pull-right" id="user-dashboard-repo-new">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus-square"></i>New</button>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="/repo/create"><i class="fa fa-book"></i>Repository</a></li>
|
||||
<li><a href="/repo/migrate"><i class="fa fa-clipboard"></i>Migration</a></li>
|
||||
<!-- <li><a href="#"><i class="fa fa-users"></i>Organization</a></li> -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<ul class="list-group">{{range .MyRepos}}
|
||||
<li class="list-group-item"><a href="/{{$.SignedUserName}}/{{.Name}}">
|
||||
<!-- <span class="stars pull-right"><i class="fa fa-star"></i>{{.NumStars}}</span> -->
|
||||
<i class="fa fa-book"></i>{{.Name}}{{if .IsPrivate}} <span class="label label-default">Private</span>{{end}}</a>
|
||||
</li>{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
Loading…
Reference in new issue