Skip to content

Commit 755eec7

Browse files
committed
Finish new repo settings page
1 parent 669552e commit 755eec7

25 files changed

+502
-347
lines changed

cmd/web.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,8 @@ func runWeb(*cli.Context) {
242242
}, reqSignIn)
243243

244244
m.Group("/:username/:reponame", func(r *macaron.Router) {
245-
r.Get("/settings", repo.Setting)
246-
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost)
247-
245+
r.Get("/settings", repo.Settings)
246+
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingsPost)
248247
m.Group("/settings", func(r *macaron.Router) {
249248
r.Get("/collaboration", repo.Collaboration)
250249
r.Post("/collaboration", repo.CollaborationPost)

conf/locale/locale_en-US.ini

+26
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ sign_up_now = Need an account? Sign up now.
5656

5757
[form]
5858
UserName = Username
59+
RepoName = Repository name
5960
Email = E-mail address
6061
Password = Password
6162
Retype = Re-type password
@@ -82,6 +83,9 @@ illegal_username = Your username contains illegal characters.
8283
illegal_repo_name = Repository name contains illegal characters.
8384
illegal_org_name = Organization name contains illegal characters.
8485
username_password_incorrect = Username or password is not correct.
86+
enterred_invalid_repo_name = Please make sure you entered repository name is correct.
87+
enterred_invalid_owner_name = Please make sure you entered owner name is correct.
88+
enterred_invalid_password = Please make sure you entered passord is correct.
8589
8690
invalid_ssh_key = Sorry, we're not able to verify your SSH key: %s
8791
auth_failed = Authentication failed: %v
@@ -143,12 +147,34 @@ license = License
143147
license_helper = Select a license file
144148
init_readme = Initialize this repository with a README.md
145149
create_repo = Create Repository
150+
default_branch = Default Branch
151+
mirror_interval = Mirror Interval(hour)
152+
goget_meta = Go-Get Meta
153+
goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span>
146154

147155
need_auth = Need Authorization
148156
migrate_type = Migration Type
149157
migrate_type_helper = This repository will be a <span class="label label-blue label-radius">Mirror</span>
150158
migrate_repo = Migrate Repository
151159

160+
settings = Settings
161+
settings.options = Options
162+
settings.collaboration = Collaboration
163+
settings.hooks = Webhooks
164+
settings.deploy_keys = Deploy Keys
165+
settings.basic_settings = Basic Settings
166+
settings.danger_zone = Danger Zone
167+
settings.site = Official Site
168+
settings.update_settings = Update Settings
169+
settings.transfer = Transfer Ownership
170+
settings.transfer_desc = Transfer this repo to another user or to an organization where you have admin rights.
171+
settings.delete = Delete This Repository
172+
settings.delete_desc = Once you delete a repository, there is no going back. Please be certain.
173+
settings.update_settings_success = Repository options has been successfully updated.
174+
settings.transfer_owner = New Owner
175+
settings.make_transfer = Make Transfer
176+
settings.confirm_delete = Confirm Deletion
177+
152178
[org]
153179
org_name_holder = Organization Name
154180
org_name_helper = Great organization names are short and memorable.

conf/locale/locale_zh-CN.ini

+26
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ sign_up_now = 还没帐户?马上注册。
5656

5757
[form]
5858
UserName = 用户名
59+
RepoName = 仓库名称
5960
Email = 邮箱地址
6061
Password = 密码
6162
Retype = 确认密码
@@ -82,6 +83,9 @@ illegal_username = 您的用户名包含非法字符。
8283
illegal_repo_name = 仓库名称包含非法字符。
8384
illegal_org_name = 组织名称包含非法字符。
8485
username_password_incorrect = 用户名或密码不正确。
86+
enterred_invalid_repo_name = 请检查您输入的仓库名称是正确。
87+
enterred_invalid_owner_name = 请检查您输入的新所有者用户名是否正确。
88+
enterred_invalid_password = 请检查您输入的密码是否正确。
8589

8690
invalid_ssh_key = 很抱歉,我们无法验证您输入的 SSH 密钥:%s
8791
auth_failed = 授权验证失败:%v
@@ -143,12 +147,34 @@ license = 授权许可
143147
license_helper = 请选择授权许可文件
144148
init_readme = 使用 README.md 文件初始化仓库
145149
create_repo = 创建仓库
150+
default_branch = 默认分支
151+
mirror_interval = 镜像同步周期(小时)
152+
goget_meta = Go-Get 支持
153+
goget_meta_helper = 本仓库将可以通过 <span class="label label-blue label-radius">Go Get</span> 获取
146154

147155
need_auth = 需要授权验证
148156
migrate_type = 迁移类型
149157
migrate_type_helper = 本仓库将是 <span class="label label-blue label-radius">镜像</span>
150158
migrate_repo = 迁移仓库
151159

160+
settings = 仓库设置
161+
settings.options = 基本设置
162+
settings.collaboration = 管理协作者
163+
settings.hooks = 管理 Web 钩子
164+
settings.deploy_keys = 管理部署密钥
165+
settings.basic_settings = 基本设置
166+
settings.danger_zone = 危险操作区
167+
settings.site = 官方网站
168+
settings.update_settings = 更新仓库设置
169+
settings.transfer = 转移仓库所有权
170+
settings.transfer_desc = 您可以将仓库转移至您拥有管理员权限的帐户或组织。
171+
settings.delete = 删除本仓库
172+
settings.delete_desc = 删除仓库操作不可逆转,请三思而后行。
173+
settings.update_settings_success = 仓库设置更新成功!
174+
settings.transfer_owner = 新拥有者
175+
settings.make_transfer = 确认转移仓库
176+
settings.confirm_delete = 确认删除仓库
177+
152178
[org]
153179
org_name_holder = 组织名称
154180
org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。

gogs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/gogits/gogs/modules/setting"
1818
)
1919

20-
const APP_VER = "0.4.7.0801 Alpha"
20+
const APP_VER = "0.4.7.0802 Alpha"
2121

2222
func init() {
2323
runtime.GOMAXPROCS(runtime.NumCPU())

models/user.go

+7
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ func (u *User) EncodePasswd() {
116116
u.Passwd = fmt.Sprintf("%x", newPasswd)
117117
}
118118

119+
// ValidtePassword checks if given password matches the one belongs to the user.
120+
func (u *User) ValidtePassword(passwd string) bool {
121+
newUser := &User{Passwd: passwd, Salt: u.Salt}
122+
newUser.EncodePasswd()
123+
return u.Passwd == newUser.Passwd
124+
}
125+
119126
// IsOrganization returns true if user is actually a organization.
120127
func (u *User) IsOrganization() bool {
121128
return u.Type == ORGANIZATION

modules/auth/repo_form.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs *binding.Errors, l
4848
}
4949

5050
type RepoSettingForm struct {
51-
RepoName string `form:"name" binding:"Required;AlphaDash;MaxSize(100)"`
51+
RepoName string `form:"repo_name" binding:"Required;AlphaDash;MaxSize(100)"`
5252
Description string `form:"desc" binding:"MaxSize(255)"`
5353
Website string `form:"site" binding:"Url;MaxSize(100)"`
5454
Branch string `form:"branch"`

modules/middleware/context.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ func (ctx *Context) HasError() bool {
9696
return hasErr.(bool)
9797
}
9898

99-
// HTML calls render.HTML underlying but reduce one argument.
99+
// HTML calls Context.HTML and converts template name to string.
100100
func (ctx *Context) HTML(status int, name base.TplName) {
101-
ctx.Render.HTML(status, string(name), ctx.Data)
101+
ctx.Context.HTML(status, string(name))
102102
}
103103

104104
// RenderWithErr used for page has form validation but need to prompt error to users.

public/ng/css/gogs.css

+112
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ The register and sign-in page style
851851
color: #888888;
852852
font-size: 1.6em;
853853
font-weight: normal;
854+
margin-bottom: 0;
854855
}
855856
#repo-header-name i {
856857
margin-right: 12px;
@@ -1211,6 +1212,9 @@ The register and sign-in page style
12111212
.code-view .lines-code > pre > ol.linenums > li.active {
12121213
background: #ffffdd;
12131214
}
1215+
.repo-setting-zone {
1216+
padding: 30px;
1217+
}
12141218
#setting-wrapper {
12151219
padding-bottom: 100px;
12161220
}
@@ -1237,17 +1241,27 @@ The register and sign-in page style
12371241
.setting-content {
12381242
margin-left: 32px;
12391243
}
1244+
#repo-setting-form,
12401245
#user-profile-form {
12411246
background-color: #FFF;
12421247
padding: 30px 0;
12431248
}
1249+
#repo-setting-form textarea,
1250+
#user-profile-form textarea {
1251+
margin-left: 4px;
1252+
height: 100px;
1253+
}
1254+
#repo-setting-form label,
12441255
#user-profile-form label,
1256+
#repo-setting-form .form-label,
12451257
#user-profile-form .form-label {
12461258
width: 240px;
12471259
}
1260+
#repo-setting-form .ipt,
12481261
#user-profile-form .ipt {
12491262
width: 360px;
12501263
}
1264+
#repo-setting-form .field,
12511265
#user-profile-form .field {
12521266
margin-bottom: 24px;
12531267
}
@@ -1298,3 +1312,101 @@ The register and sign-in page style
12981312
#user-ssh-add-form .field {
12991313
margin-bottom: 24px;
13001314
}
1315+
.repo-issue-wrapper {
1316+
padding: 18px 0;
1317+
}
1318+
.pr-main {
1319+
padding-right: 40px;
1320+
box-sizing: border-box;
1321+
}
1322+
.pr-sidebar {
1323+
border-left: 1px solid #DDD;
1324+
box-sizing: border-box;
1325+
}
1326+
#pr-sidebar-nav {
1327+
margin-top: 6px;
1328+
}
1329+
#pr-sidebar-nav li {
1330+
margin-bottom: 4px;
1331+
}
1332+
#pr-sidebar-nav li > a {
1333+
border: 1px solid transparent;
1334+
border-left: none;
1335+
}
1336+
#pr-sidebar-nav li > a:hover {
1337+
background-color: #FFF;
1338+
border-color: #DDD;
1339+
}
1340+
#pr-sidebar-nav .label {
1341+
font-size: 12px;
1342+
line-height: 1.4em;
1343+
margin-top: 1px;
1344+
}
1345+
#pr-sidebar-nav li.current a {
1346+
background-color: #FFF;
1347+
border-color: #DDD;
1348+
}
1349+
.pr-title .pr-num {
1350+
font-weight: normal;
1351+
color: #888;
1352+
}
1353+
.pr-meta {
1354+
color: #888;
1355+
}
1356+
.pr-meta .pr-author {
1357+
margin: 0 8px;
1358+
color: #444;
1359+
}
1360+
.pr-meta .pr-author:hover {
1361+
text-decoration: underline;
1362+
}
1363+
.pr-meta .pr-branch {
1364+
margin: 0 4px;
1365+
font-size: 12px;
1366+
padding: 4px 6px;
1367+
}
1368+
.pr-nav {
1369+
border-bottom: 1px solid #DDD;
1370+
margin-top: 16px;
1371+
}
1372+
.pr-nav .octicon {
1373+
margin-right: 4px;
1374+
}
1375+
.pr-nav li > a {
1376+
padding: 3px 9px !important;
1377+
border: 1px solid transparent;
1378+
border-bottom: none;
1379+
border-top-left-radius: .2em;
1380+
border-top-right-radius: .2em;
1381+
}
1382+
.pr-nav li > a .label {
1383+
padding: 1px 5px;
1384+
font-size: 12px;
1385+
margin-left: 4px;
1386+
}
1387+
.pr-nav li.current > a {
1388+
background-color: #FFF;
1389+
border-color: #E6E6E6;
1390+
}
1391+
.diff-bar .diff-add {
1392+
color: #65ad4e;
1393+
}
1394+
.diff-bar .diff-delete {
1395+
color: #d9453d;
1396+
}
1397+
.diff-bar .diff-status {
1398+
width: 50px;
1399+
background-color: #d9453d;
1400+
height: 10px;
1401+
margin-top: 7px;
1402+
margin-left: 4px;
1403+
margin-right: 4px;
1404+
border-radius: .2em;
1405+
}
1406+
.diff-bar .diff-status-inner {
1407+
width: 45%;
1408+
background-color: #65ad4e;
1409+
height: 10px;
1410+
border-top-left-radius: .2em;
1411+
border-bottom-left-radius: .2em;
1412+
}

public/ng/css/ui.css

+8
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,14 @@ svg:not(:root) {
173173
label {
174174
font-weight: bold;
175175
}
176+
textarea,
176177
input,
177178
.ipt {
178179
padding: .6em;
179180
line-height: normal;
180181
border: 1px solid #bbbbbb;
181182
}
183+
textarea:focus,
182184
input:focus,
183185
.ipt:focus {
184186
background-color: #f2fffc;
@@ -290,6 +292,9 @@ pre {
290292
overflow: auto;
291293
padding: 0;
292294
}
295+
dt {
296+
font-weight: bold;
297+
}
293298
.left {
294299
float: left;
295300
}
@@ -651,6 +656,9 @@ ul.menu-radius > li:last-child > a {
651656
background-color: #eeeeee;
652657
border-bottom: 1px solid #cccccc;
653658
}
659+
.panel .panel-body {
660+
background-color: white;
661+
}
654662
.panel .panel-body .panel-desc {
655663
margin-bottom: 20px;
656664
}

public/ng/js/gogs.js

+20
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,31 @@ function initRepoCreate() {
174174
console.log('initRepoCreate');
175175
}
176176

177+
function initRepoSetting() {
178+
// Confirmation of changing repository name.
179+
$('#repo-setting-form').submit(function (e) {
180+
var $reponame = $('#repo_name');
181+
if (($reponame.data('repo-name') != $reponame.val()) && !confirm('Repository name has been changed, do you want to continue?')) {
182+
e.preventDefault();
183+
return true;
184+
}
185+
});
186+
$('#transfer-button').click(function () {
187+
$('#transfer-form').show();
188+
});
189+
$('#delete-button').click(function () {
190+
$('#delete-form').show();
191+
});
192+
}
193+
177194
$(document).ready(function () {
178195
initCore();
179196
if ($('#repo-create-form').length || $('#repo-migrate-form').length) {
180197
initRepoCreate();
181198
}
199+
if ($('#repo-setting').length) {
200+
initRepoSetting();
201+
}
182202

183203
Tabs('#dashboard-sidebar-menu');
184204

public/ng/less/gogs.less

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
@import "gogs/dashboard";
55
@import "gogs/sign";
66
@import "gogs/repository";
7-
@import "gogs/settings";
7+
@import "gogs/settings";
8+
@import "gogs/issue";

public/ng/less/ui/panel.less

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
border-bottom: 1px solid@panelBorderColor;
99
}
1010
.panel-body {
11+
background-color: white;
1112
.panel-desc {
1213
margin-bottom: 20px;
1314
}

0 commit comments

Comments
 (0)