]> source.dussan.org Git - gitea.git/commitdiff
Mirror fix and update
authorUnknown <joe2010xtmf@163.com>
Sat, 29 Mar 2014 14:01:52 +0000 (10:01 -0400)
committerUnknown <joe2010xtmf@163.com>
Sat, 29 Mar 2014 14:01:52 +0000 (10:01 -0400)
README.md
models/repo.go
routers/api/v1/miscellaneous.go [new file with mode: 0644]
routers/preview.go [deleted file]
templates/issue/create.tmpl
templates/issue/view.tmpl
templates/user/signin.tmpl
web.go

index 7d688506d6d27afadca14b496fdbed350f743132..e88a247705a03e25c2a340d1eb3e1f3e70cf57f7 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,6 +7,8 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language
 
 ##### Current version: 0.1.9 Alpha
 
+#### Due to testing purpose, data of [try.gogits.org](http://try.gogits.org) has been reset in March 29, 2014 and will reset multiple times after. Please do NOT put your important data on the site.
+
 #### Other language version
 
 - [简体中文](README_ZH.md)
index 4be655d2870835a494fdbf0bd411a66b3b800bf9..a848694da6fb1d991f57604b61466b0a3785ea76 100644 (file)
@@ -198,12 +198,19 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
 
        c := exec.Command("git", "update-server-info")
        c.Dir = repoPath
-       err = c.Run()
-       if err != nil {
+       if err = c.Run(); err != nil {
                log.Error("repo.CreateRepository(exec update-server-info): %v", err)
        }
 
-       return repo, NewRepoAction(user, repo)
+       if err = NewRepoAction(user, repo); err != nil {
+               log.Error("repo.CreateRepository(NewRepoAction): %v", err)
+       }
+
+       if err = WatchRepo(user.Id, repo.Id, true); err != nil {
+               log.Error("repo.CreateRepository(WatchRepo): %v", err)
+       }
+
+       return repo, nil
 }
 
 // extractGitBareZip extracts git-bare.zip to repository path.
diff --git a/routers/api/v1/miscellaneous.go b/routers/api/v1/miscellaneous.go
new file mode 100644 (file)
index 0000000..0ff1eb0
--- /dev/null
@@ -0,0 +1,18 @@
+// 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 v1
+
+import (
+       "github.com/gogits/gogs/modules/base"
+       "github.com/gogits/gogs/modules/middleware"
+)
+
+func Markdown(ctx *middleware.Context) {
+       content := ctx.Query("content")
+       ctx.Render.JSON(200, map[string]interface{}{
+               "ok":      true,
+               "content": string(base.RenderMarkdown([]byte(content), "")),
+       })
+}
diff --git a/routers/preview.go b/routers/preview.go
deleted file mode 100644 (file)
index cc34c8f..0000000
+++ /dev/null
@@ -1,17 +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 routers
-
-import "github.com/gogits/gogs/modules/middleware"
-
-func Preview(ctx *middleware.Context) {
-       content := ctx.Query("content")
-       // todo : gfm render content
-       // content = Markdown(content)
-       ctx.Render.JSON(200, map[string]interface{}{
-               "ok":      true,
-               "content": "preview : " + content,
-       })
-}
index b8a533a198e5036b57033a7fa1d4c3ce8adcf77c..f5cec0c05a29a41a1021d94eb49bb1dd058ece36 100644 (file)
                 </div>
                 <div class="form-group panel-body">
                     <div class="md-help pull-right"><!-- todo help link -->
-                        Content with <a href="#">Markdown</a>
+                        Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
                     </div>
                     <ul class="nav nav-tabs" data-init="tabs">
                         <li class="active issue-write"><a href="#issue-textarea" data-toggle="tab">Write</a></li>
-                        <li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/preview?repo=repo_id&issue=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li>
+                        <li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/api/v1/markdown?repo=repo_id&issue=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li>
                     </ul>
                     <div class="tab-content">
                         <div class="tab-pane" id="issue-textarea">
index 431b1d104262fa6ffe8c630db58bcebc8a83edaa..c357f5354ca7d318e8fc112fcec92256c4555470 100644 (file)
                         <div class="panel-body">
                             <div class="form-group">
                                 <div class="md-help pull-right"><!-- todo help link -->
-                                    Content with <a href="#">Markdown</a>
+                                    Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
                                 </div>
                                 <ul class="nav nav-tabs" data-init="tabs">
                                     <li class="active issue-write"><a href="#issue-textarea" data-toggle="tab">Write</a></li>
-                                    <li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/preview?repo=repo_id&issue=issue_id&comment=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li>
+                                    <li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/api/v1/markdown?repo=repo_id&issue=issue_id&comment=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li>
                                 </ul>
                                 <div class="tab-content">
                                     <div class="tab-pane" id="issue-textarea">
index 49a22626333d5ba94cf0d4c5786b96bdc2004da0..b6c39af1b85ff9fc34f3a7021ee862a1e1352e1f 100644 (file)
@@ -44,7 +44,7 @@
         </div>
 
         <div class="form-group text-center" id="social-login">
-            <a class="btn btn-danger btn-lg">Register new account</a>
+            <a class="btn btn-danger btn-lg" href="/user/sign_up">Register new account</a>
         </div>
     </form>
 </div>
diff --git a/web.go b/web.go
index 451e52ff8c44f212ff135ba14823d6567db5f507..7725791e848d20acbf5b97ffcb1fe6826034c85d 100644 (file)
--- a/web.go
+++ b/web.go
@@ -24,6 +24,7 @@ import (
        "github.com/gogits/gogs/modules/middleware"
        "github.com/gogits/gogs/routers"
        "github.com/gogits/gogs/routers/admin"
+       "github.com/gogits/gogs/routers/api/v1"
        "github.com/gogits/gogs/routers/dev"
        "github.com/gogits/gogs/routers/repo"
        "github.com/gogits/gogs/routers/user"
@@ -72,6 +73,7 @@ func newMartini() *martini.ClassicMartini {
 }
 
 func runWeb(*cli.Context) {
+       fmt.Println("Server is running...")
        globalInit()
        base.NewServices()
        checkRunMode()
@@ -95,7 +97,10 @@ func runWeb(*cli.Context) {
        m.Get("/pulls", reqSignIn, user.Pulls)
        m.Get("/stars", reqSignIn, user.Stars)
        m.Get("/help", routers.Help)
-       m.Post("/preview", routers.Preview)
+
+       m.Group("/api/v1", func(r martini.Router) {
+               r.Post("/markdown", v1.Markdown)
+       })
 
        avt := avatar.CacheServer("public/img/avatar/", "public/img/avatar_default.jpg")
        m.Get("/avatar/:hash", avt.ServeHTTP)