Browse Source

add organization setting page

fuxiaohei 5 years ago
parent
commit
fb53cc4fa8
3 changed files with 157 additions and 0 deletions
  1. 1 0
      cmd/web.go
  2. 5 0
      routers/org/org.go
  3. 151 0
      templates/org/setting.tmpl

+ 1 - 0
cmd/web.go

@@ -194,6 +194,7 @@ func runWeb(*cli.Context) {
194 194
 		r.Get("/:org/dashboard", org.Dashboard)
195 195
 		r.Get("/:org/members", org.Members)
196 196
 		r.Get("/:org/teams", org.Teams)
197
+		r.Get("/:org/setting", org.Setting)
197 198
 	})
198 199
 
199 200
 	m.Group("/:username/:reponame", func(r martini.Router) {

+ 5 - 0
routers/org/org.go

@@ -29,3 +29,8 @@ func Dashboard(ctx *middleware.Context, params martini.Params) {
29 29
 	ctx.Data["Title"] = "Dashboard"
30 30
 	ctx.HTML(200, "org/dashboard")
31 31
 }
32
+
33
+func Setting(ctx *middleware.Context, param martini.Params) {
34
+	ctx.Data["Title"] = "Setting"
35
+	ctx.HTML(200, "org/setting")
36
+}

+ 151 - 0
templates/org/setting.tmpl

@@ -0,0 +1,151 @@
1
+{{template "base/head" .}}
2
+{{template "base/navbar" .}}
3
+<div id="body-nav">
4
+    <div class="container">
5
+        <div class="btn-group pull-left" id="dashboard-switch">
6
+            <button type="button" class="btn btn-default">
7
+                <img src="//1.gravatar.com/avatar/f72f7454ce9d710baa506394f68f4132?s=28" alt="user-avatar"
8
+                     title="username">
9
+                gogits
10
+            </button>
11
+            <!--
12
+                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
13
+                            <span class="caret"></span>
14
+                        </button>
15
+                        <div class="dropdown-menu clone-group-btn no-propagation">
16
+                            <ul id="dashboard-switch-menu" class="list-unstyled">
17
+                                <li class="checked"><a href="#"><i class="fa fa-check"></i>
18
+                                    <img src="//1.gravatar.com/avatar/f72f7454ce9d710baa506394f68f4132?s=28" alt="user-avatar" title="username">
19
+                                    gogits/gogs</a>
20
+                                </li>
21
+                            </ul>
22
+                        </div>-->
23
+        </div>
24
+        <ul class="nav nav-pills pull-right">
25
+            <li><a href="/">Feed</a></li>
26
+            <li><a href="/issues">Issues</a></li>
27
+            <li class="active"><a href="#">Setting</a></li>
28
+            <!-- <li><a href="/pulls">Pull Requests</a></li>
29
+            <li><a href="/stars">Stars</a></li> -->
30
+        </ul>
31
+    </div>
32
+</div>
33
+<div id="body" class="container" data-page="org">
34
+    <div id="user-setting-nav" class="col-md-2 repo-setting-nav">
35
+        <ul class="list-group">
36
+            <li class="list-group-item active"><a href="#">Options</a></li>
37
+        </ul>
38
+    </div>
39
+    <div id="repo-setting-container" class="col-md-10">
40
+        {{template "base/alert" .}}
41
+        <div class="panel panel-default">
42
+            <div class="panel-heading">
43
+                Repository Options
44
+            </div>
45
+
46
+            <div class="panel-body">
47
+                <form action="/{{.Owner.Name}}/{{.Repository.Name}}/settings" method="post" class="form-horizontal">
48
+                    {{.CsrfTokenHtml}}
49
+                    <input type="hidden" name="action" value="update">
50
+
51
+                    <div class="form-group">
52
+                        <label class="col-md-3 text-right" for="org-setting-name">Name</label>
53
+
54
+                        <div class="col-md-9">
55
+                            <input class="form-control" name="name" value="" title="" id="org-setting-name"/>
56
+                        </div>
57
+                    </div>
58
+
59
+                    <div class="form-group">
60
+                        <label class="col-md-3 text-right" for="org-email">Email</label>
61
+
62
+                        <div class="col-md-9">
63
+                            <input class="form-control" name="email" value="" title="" id="org-email" type="email"/>
64
+                        </div>
65
+                    </div>
66
+
67
+                    <div class="form-group">
68
+                        <label class="col-md-3 text-right" for="org-desc">Description</label>
69
+
70
+                        <div class="col-md-9">
71
+                            <textarea class="form-control" name="desc" id="org-desc" rows="3">{{.Repository.Description}}</textarea>
72
+                        </div>
73
+                    </div>
74
+
75
+                    <div class="form-group">
76
+                        <label class="col-md-3 text-right" for="org-site">Official Site</label>
77
+
78
+                        <div class="col-md-9">
79
+                            <input type="url" class="form-control" name="site" value="{{.Repository.Website}}"
80
+                                   id="org-site"/>
81
+                        </div>
82
+                    </div>
83
+
84
+                    <div class="form-group">
85
+                        <label class="col-md-3 text-right" for="org-location">Location</label>
86
+
87
+                        <div class="col-md-9">
88
+                            <input class="form-control" name="email" value="" title="" id="org-location"/>
89
+                        </div>
90
+                    </div>
91
+
92
+                    <div class="form-group">
93
+                        <div class="col-md-9 col-md-offset-3">
94
+                            <button class="btn btn-primary" type="submit">Save Options</button>
95
+                        </div>
96
+                    </div>
97
+                </form>
98
+            </div>
99
+        </div>
100
+
101
+        <div class="panel panel-warning">
102
+            <div class="panel-heading">
103
+                Danger Zone
104
+            </div>
105
+            <div class="panel-body">
106
+                <button type="button" class="btn btn-default pull-right" href="#delete-org-modal" data-toggle="modal">
107
+                    Delete this organization
108
+                </button>
109
+                <dd>
110
+                <dt>Delete this organization</dt>
111
+                <dl>Once you delete this organization and all repositories in, there is no going back. Please be
112
+                    certain.
113
+                </dl>
114
+                </dd>
115
+
116
+                <div class="modal fade" id="delete-org-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
117
+                     aria-hidden="true">
118
+                    <div class="modal-dialog">
119
+                        <form action="/{{.Owner.Name}}/{{.Repository.Name}}/settings" method="post"
120
+                              class="modal-content">
121
+                            {{.CsrfTokenHtml}}
122
+                            <input type="hidden" name="action" value="delete">
123
+
124
+                            <div class="modal-header">
125
+                                <button type="button" class="close" data-dismiss="modal"
126
+                                        aria-hidden="true">&times;</button>
127
+                                <h4 class="modal-title" id="myModalLabel">Delete organization</h4>
128
+                            </div>
129
+
130
+                            <div class="modal-body">
131
+                                <div class="form-group">
132
+                                    <label>Please enter your organization name "<strong class="text-danger">{{.Repository.Name}}</strong>"</label>
133
+                                    <input name="organization" class="form-control" type="text"
134
+                                           placeholder="Type your organization name" required="required">
135
+                                </div>
136
+                            </div>
137
+
138
+                            <div class="modal-footer">
139
+                                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
140
+                                <button class="btn btn-danger btn-lg">I understand the consequences, delete this
141
+                                    organization
142
+                                </button>
143
+                            </div>
144
+                        </form>
145
+                    </div>
146
+                </div>
147
+            </div>
148
+        </div>
149
+    </div>
150
+</div>
151
+{{template "base/footer" .}}