summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-12 14:06:42 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-12 14:06:42 -0400
commit54e95fa367d8f9394522ce1fa6905a38974cbd23 (patch)
tree9318f670716cad34fe0b7e05e510b492fd4e0839 /modules
parentf1130ce5e9fa63df5e472a9c5fbd3e875f1ba9f5 (diff)
downloadgitea-54e95fa367d8f9394522ce1fa6905a38974cbd23.tar.gz
gitea-54e95fa367d8f9394522ce1fa6905a38974cbd23.zip
Finish add new milestone
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/issue.go35
-rw-r--r--modules/auth/publickey.go (renamed from modules/auth/setting.go)0
-rw-r--r--modules/auth/release.go36
-rw-r--r--modules/auth/repo.go96
-rw-r--r--modules/middleware/repo.go1
5 files changed, 96 insertions, 72 deletions
diff --git a/modules/auth/issue.go b/modules/auth/issue.go
deleted file mode 100644
index f3cad520ce..0000000000
--- a/modules/auth/issue.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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 CreateIssueForm struct {
- IssueName string `form:"title" binding:"Required;MaxSize(50)"`
- MilestoneId int64 `form:"milestoneid"`
- AssigneeId int64 `form:"assigneeid"`
- Labels string `form:"labels"`
- Content string `form:"content"`
-}
-
-func (f *CreateIssueForm) Name(field string) string {
- names := map[string]string{
- "IssueName": "Issue name",
- }
- return names[field]
-}
-
-func (f *CreateIssueForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
- data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
- validate(errors, data, f)
-}
diff --git a/modules/auth/setting.go b/modules/auth/publickey.go
index b828c92b57..b828c92b57 100644
--- a/modules/auth/setting.go
+++ b/modules/auth/publickey.go
diff --git a/modules/auth/release.go b/modules/auth/release.go
deleted file mode 100644
index 7fadb3c080..0000000000
--- a/modules/auth/release.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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 NewReleaseForm struct {
- TagName string `form:"tag_name" binding:"Required"`
- Title string `form:"title" binding:"Required"`
- Content string `form:"content" binding:"Required"`
- Prerelease bool `form:"prerelease"`
-}
-
-func (f *NewReleaseForm) Name(field string) string {
- names := map[string]string{
- "TagName": "Tag name",
- "Title": "Release title",
- "Content": "Release content",
- }
- return names[field]
-}
-
-func (f *NewReleaseForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
- data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
- validate(errors, data, f)
-}
diff --git a/modules/auth/repo.go b/modules/auth/repo.go
index f880cdf5d5..92ca839f85 100644
--- a/modules/auth/repo.go
+++ b/modules/auth/repo.go
@@ -14,6 +14,13 @@ import (
"github.com/gogits/gogs/modules/middleware/binding"
)
+// __________ .__ __
+// \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
+// | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
+// | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
+// |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
+// \/ \/|__| \/ \/
+
type CreateRepoForm struct {
RepoName string `form:"repo" binding:"Required;AlphaDash;MaxSize(100)"`
Private bool `form:"private"`
@@ -63,7 +70,7 @@ func (f *MigrateRepoForm) Validate(errors *binding.Errors, req *http.Request, co
type RepoSettingForm struct {
RepoName string `form:"name" binding:"Required;AlphaDash;MaxSize(100)"`
Description string `form:"desc" binding:"MaxSize(100)"`
- Website string `form:"url" binding:"Url;MaxSize(100)"`
+ Website string `form:"site" binding:"Url;MaxSize(100)"`
Branch string `form:"branch"`
Interval int `form:"interval"`
Private bool `form:"private"`
@@ -84,6 +91,13 @@ func (f *RepoSettingForm) Validate(errors *binding.Errors, req *http.Request, co
validate(errors, data, f)
}
+// __ __ ___. .__ .__ __
+// / \ / \ ____\_ |__ | |__ | |__ ____ | | __
+// \ \/\/ // __ \| __ \| | \| | \ / _ \| |/ /
+// \ /\ ___/| \_\ \ Y \ Y ( <_> ) <
+// \__/\ / \___ >___ /___| /___| /\____/|__|_ \
+// \/ \/ \/ \/ \/ \/
+
type NewWebhookForm struct {
Url string `form:"url" binding:"Required;Url"`
ContentType string `form:"content_type" binding:"Required"`
@@ -104,3 +118,83 @@ func (f *NewWebhookForm) Validate(errors *binding.Errors, req *http.Request, con
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
validate(errors, data, f)
}
+
+// .___
+// | | ______ ________ __ ____
+// | |/ ___// ___/ | \_/ __ \
+// | |\___ \ \___ \| | /\ ___/
+// |___/____ >____ >____/ \___ >
+// \/ \/ \/
+
+type CreateIssueForm struct {
+ IssueName string `form:"title" binding:"Required;MaxSize(50)"`
+ MilestoneId int64 `form:"milestoneid"`
+ AssigneeId int64 `form:"assigneeid"`
+ Labels string `form:"labels"`
+ Content string `form:"content"`
+}
+
+func (f *CreateIssueForm) Name(field string) string {
+ names := map[string]string{
+ "IssueName": "Issue name",
+ }
+ return names[field]
+}
+
+func (f *CreateIssueForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
+ data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
+ validate(errors, data, f)
+}
+
+// _____ .__.__ __
+// / \ |__| | ____ _______/ |_ ____ ____ ____
+// / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
+// / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
+// \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
+// \/ \/ \/ \/ \/
+
+type CreateMilestoneForm struct {
+ Title string `form:"title" binding:"Required;MaxSize(50)"`
+ Content string `form:"content"`
+ Deadline string `form:"due_date"`
+}
+
+func (f *CreateMilestoneForm) Name(field string) string {
+ names := map[string]string{
+ "Title": "Milestone name",
+ }
+ return names[field]
+}
+
+func (f *CreateMilestoneForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
+ data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
+ validate(errors, data, f)
+}
+
+// __________ .__
+// \______ \ ____ | | ____ _____ ______ ____
+// | _// __ \| | _/ __ \\__ \ / ___// __ \
+// | | \ ___/| |_\ ___/ / __ \_\___ \\ ___/
+// |____|_ /\___ >____/\___ >____ /____ >\___ >
+// \/ \/ \/ \/ \/ \/
+
+type NewReleaseForm struct {
+ TagName string `form:"tag_name" binding:"Required"`
+ Title string `form:"title" binding:"Required"`
+ Content string `form:"content" binding:"Required"`
+ Prerelease bool `form:"prerelease"`
+}
+
+func (f *NewReleaseForm) Name(field string) string {
+ names := map[string]string{
+ "TagName": "Tag name",
+ "Title": "Release title",
+ "Content": "Release content",
+ }
+ return names[field]
+}
+
+func (f *NewReleaseForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
+ data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
+ validate(errors, data, f)
+}
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index ff99f82897..1bd1ea475d 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -128,6 +128,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
}
repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
+ repo.NumOpenMilestones = repo.NumMilestones - repo.NumClosedMilestones
ctx.Repo.Repository = repo
ctx.Data["IsBareRepo"] = ctx.Repo.Repository.IsBare