From 1d30f545d65fe2d7fe6e0a88fbb693ca68e9417e Mon Sep 17 00:00:00 2001 From: lunny Date: Mon, 24 Mar 2014 14:28:20 +0000 Subject: [PATCH 01/21] Init commit --- .gitignore | 22 ++++++++++++++++++++++ LICENSE | 27 +++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6cd1df2b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..3af16b072 --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2014 +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the {organization} nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file From 3473aa9e42b670aecaf328c8d281d91b0f7f8923 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 24 Mar 2014 23:30:02 +0800 Subject: [PATCH 02/21] repo single file raw button --- templates/repo/single_file.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index 40ef44eb1..2a28f0b54 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -5,6 +5,7 @@ {{else}} {{end}}{{.FileName}} + Raw {{if .FileIsLarge}}

Need help cloning? Visit Help!

+
+
diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index a1c3cfbb2..56e6746c7 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -9,7 +9,7 @@ {{else}}
{{ $n := len .Treenames}} - {{if not .IsFile}}{{end}} + {{if not .IsFile}}{{end}} {{if .FileIsLarge}} - {{if .FileIsLarge}} - From 79633ab1fbb823ca2f6267e99bb8912ce227d293 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Tue, 25 Mar 2014 00:09:58 +0800 Subject: [PATCH 09/21] file size and file raw style update --- public/css/gogs.css | 6 ++++++ templates/repo/single_file.tmpl | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index 434af0359..8b031d6ed 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -676,6 +676,12 @@ html, body { margin: 0 .5em 0 0; } +.file-content .file-head .file-size{ + font-size: 13px; + color: #888; + margin-left: 1em; +} + .file-content .file-body { padding: 30px 30px 50px; border: none; diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index d00bffa95..45586012b 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -5,7 +5,7 @@ {{.FileName}} {{else}} - {{.FileName}} {{FileSize .FileSize}} + {{.FileName}} {{FileSize .FileSize}}
Raw @@ -17,7 +17,7 @@
{{if not .FileIsText}} {{else}} {{if .ReadmeExist}} From 123c7b44e81ce5e51448a01965843516b586e3e0 Mon Sep 17 00:00:00 2001 From: slene Date: Tue, 25 Mar 2014 00:42:57 +0800 Subject: [PATCH 10/21] fix --- routers/repo/repo.go | 1 + templates/repo/single_file.tmpl | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 76d55554b..cd28d52ca 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -156,6 +156,7 @@ func Single(ctx *middleware.Context, params martini.Params) { } if readmeFile != nil { + ctx.Data["ReadmeInSingle"] = true ctx.Data["ReadmeExist"] = true if blob, err := readmeFile.LookupBlob(); err != nil { ctx.Handle(404, "repo.Single(readmeFile.LookupBlob)", err) diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index 45586012b..cf398595e 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -2,22 +2,28 @@
{{if .ReadmeExist}} + {{if .ReadmeInSingle}} {{.FileName}} + {{else}} + {{.FileName}} {{FileSize .FileSize}} + {{end}} {{else}} {{.FileName}} {{FileSize .FileSize}} -
- - Raw - - - -
+ {{end}} + {{if not .ReadmeInSingle}} +
+ + Raw + + + +
{{end}}
{{if not .FileIsText}} {{else}} {{if .ReadmeExist}} From 743fee60158edb5815b86504db29b268f29e1cbf Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 24 Mar 2014 12:43:51 -0400 Subject: [PATCH 11/21] Fix --- routers/dashboard.go | 9 +++++++++ templates/repo/single_file.tmpl | 14 +++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/routers/dashboard.go b/routers/dashboard.go index 76ecc3f67..2c81cf23c 100644 --- a/routers/dashboard.go +++ b/routers/dashboard.go @@ -5,6 +5,7 @@ package routers import ( + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/routers/user" ) @@ -14,6 +15,14 @@ func Home(ctx *middleware.Context) { user.Dashboard(ctx) return } + + // Check auto-login. + userName := ctx.GetCookie(base.CookieUserName) + if len(userName) != 0 { + ctx.Redirect("/user/login") + return + } + ctx.Data["PageIsHome"] = true ctx.HTML(200, "home") } diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index 45586012b..6c7e5650a 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -6,14 +6,14 @@ {{else}} {{.FileName}} {{FileSize .FileSize}} -
- - Raw - - - -
{{end}} +
+ + Raw + + + +
{{if not .FileIsText}}