From a8d8e7256249cb280b39d114dd6d6eadd4fec187 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Thu, 13 Mar 2014 14:08:49 +0800 Subject: [PATCH] single repository setting page ui --- public/css/gogs.css | 2 +- public/js/app.js | 6 +++--- routers/repo/single.go | 11 +++++++++++ templates/repo/nav.tmpl | 31 +++++++++++++++++++++++++++++++ templates/repo/setting.tmpl | 33 +++++++++++++++++++++++++++++++++ templates/repo/single.tmpl | 32 +------------------------------- templates/repo/toolbar.tmpl | 4 ++-- templates/user/dashboard.tmpl | 2 +- templates/user/profile.tmpl | 7 +------ web.go | 2 ++ 10 files changed, 86 insertions(+), 44 deletions(-) create mode 100644 templates/repo/nav.tmpl create mode 100644 templates/repo/setting.tmpl diff --git a/public/css/gogs.css b/public/css/gogs.css index 3d8dc3fddb7e..a44d4a938088 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -269,7 +269,7 @@ body { /* gogits user setting */ -#gogs-user-setting-nav > h4, #gogs-user-setting-container > h4, #gogs-ssh-keys > h4, #gogs-user-delete > h4 { +#gogs-user-setting-nav > h4, #gogs-user-setting-container > h4, #gogs-ssh-keys > h4, #gogs-user-delete > h4 ,#gogs-repo-setting-container .tab-pane > h4{ padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid #CCC; diff --git a/public/js/app.js b/public/js/app.js index a789122b1bf5..69d21020e813 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -41,9 +41,8 @@ var Gogits = { }); }; Gogits.initTabs = function () { - var $tabs = $('[data-toggle=tab]'); - $tabs.tab("show"); - $tabs.find("li:eq(" + index + ") a").tab("show"); + var $tabs = $('[data-init=tabs]'); + $tabs.find("li:eq(0) a").tab("show"); } })(jQuery); @@ -69,6 +68,7 @@ var Gogits = { function initCore() { Gogits.initTooltips(); + Gogits.initTabs(); Gogits.initModals(); } diff --git a/routers/repo/single.go b/routers/repo/single.go index db16a84b8a98..4870adbd0a51 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -28,3 +28,14 @@ func Single(params martini.Params, r render.Render, data base.TmplData) { r.HTML(200, "repo/single", data) } + +func Setting(r render.Render, data base.TmplData) { + if !data["IsRepositoryValid"].(bool) { + return + } + + data["Title"] = data["Title"].(string) + " - settings" + data["IsRepoToolbarSetting"] = true + + r.HTML(200, "repo/setting", data) +} diff --git a/templates/repo/nav.tmpl b/templates/repo/nav.tmpl new file mode 100644 index 000000000000..1e5248889744 --- /dev/null +++ b/templates/repo/nav.tmpl @@ -0,0 +1,31 @@ +
+
+
+
+ + + +
+
+ +
+
+ +
+
+

{{.Owner.Name}} / {{.Repository.Name}}

+
+
\ No newline at end of file diff --git a/templates/repo/setting.tmpl b/templates/repo/setting.tmpl new file mode 100644 index 000000000000..262b91a187de --- /dev/null +++ b/templates/repo/setting.tmpl @@ -0,0 +1,33 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +{{template "repo/nav" .}} +{{template "repo/toolbar" .}} +
+
+

Repository Settings

+ +
+
+
+ repo-options +
+
+

Delete Repository

+

Unexpected bad things will happen if you don't read this!

+

This action CANNOT be undone. This will delete the repository, wiki, issues, and comments permanently.

+ +
+ + +
+ +
+
+
+
+{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index 28bbea635fe8..96ca95bd8ef0 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -1,36 +1,6 @@ {{template "base/head" .}} {{template "base/navbar" .}} -
-
-
-
- - - -
-
- -
-
- -
-
-

{{.Owner.Name}} / {{.Repository.Name}}

-
-
+{{template "repo/nav" .}} {{template "repo/toolbar" .}}

Source Files:

diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl index 57408e18e821..fb2145ab3de5 100644 --- a/templates/repo/toolbar.tmpl +++ b/templates/repo/toolbar.tmpl @@ -11,7 +11,7 @@
  • develop
  • -
  • Source
  • +
  • Source
  • Commits
  • Issues 42
  • Pull Requests
  • @@ -32,7 +32,7 @@
  • Network
  • {{if .IsRepositoryOwner}} -
  • Settings
  • {{end}} +
  • Settings
  • {{end}}
    diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl index d422f8ffe426..e8fbe296058b 100644 --- a/templates/user/dashboard.tmpl +++ b/templates/user/dashboard.tmpl @@ -22,7 +22,7 @@
    diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 09fe4ae5b612..79e6062bcbeb 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -18,7 +18,7 @@
    -
    - {{template "base/footer" .}} \ No newline at end of file diff --git a/web.go b/web.go index 8e5bbaef0f52..f8d85562f73c 100644 --- a/web.go +++ b/web.go @@ -74,6 +74,8 @@ func runWeb(*cli.Context) { m.Any("/repo/create", auth.SignInRequire(true), binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create) m.Any("/repo/delete", auth.SignInRequire(true), repo.Delete) m.Any("/repo/list", auth.SignInRequire(false), repo.List) + + m.Get("/:username/:reponame/settings", auth.SignInRequire(false), auth.RepoAssignment(true), repo.Setting) m.Get("/:username/:reponame", auth.SignInRequire(false), auth.RepoAssignment(true), repo.Single) //m.Get("/:username/:reponame", repo.Repo)