new repo options UI

This commit is contained in:
Unknwon 2015-08-30 03:21:59 +08:00
parent d01f688257
commit c6b039c6f9
10 changed files with 196 additions and 155 deletions

View File

@ -109,7 +109,6 @@ There are 5 ways to install Gogs:
## Contributors ## Contributors
- The [core team](http://gogs.io/team) of this project.
- Ex-team members [@lunny](https://github.com/lunny) and [@fuxiaohei](https://github.com/fuxiaohei). - Ex-team members [@lunny](https://github.com/lunny) and [@fuxiaohei](https://github.com/fuxiaohei).
- See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors. - See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors.
- See [TRANSLATORS](conf/locale/TRANSLATORS) for full list of translators. - See [TRANSLATORS](conf/locale/TRANSLATORS) for full list of translators.

View File

@ -64,7 +64,6 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
## 贡献成员 ## 贡献成员
- 本项目的 [开发团队](http://gogs.io/team)。
- 前团队成员 [@lunny](https://github.com/lunny) 和 [@fuxiaohei](https://github.com/fuxiaohei)。 - 前团队成员 [@lunny](https://github.com/lunny) 和 [@fuxiaohei](https://github.com/fuxiaohei)。
- 您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。 - 您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。
- 您可以通过查看 [TRANSLATORS](conf/locale/TRANSLATORS) 文件获取完整的翻译人员列表。 - 您可以通过查看 [TRANSLATORS](conf/locale/TRANSLATORS) 文件获取完整的翻译人员列表。

View File

@ -503,7 +503,9 @@ settings.transfer_desc = Transfer this repository to another user or to an organ
settings.new_owner_has_same_repo = The new owner already has a repository with same name. Please choose another name. settings.new_owner_has_same_repo = The new owner already has a repository with same name. Please choose another name.
settings.delete = Delete This Repository settings.delete = Delete This Repository
settings.delete_desc = Once you delete a repository, there is no going back. Please be certain. settings.delete_desc = Once you delete a repository, there is no going back. Please be certain.
settings.transfer_notices = <p>- You will lose access if new owner is a individual user.</p><p>- You will conserve access if new owner is an organization and if you're one of the owners.</p> settings.transfer_notices = - You will lose access if new owner is a individual user.<br>- You will conserve access if new owner is an organization and if you're one of the owners.
settings.transfer_form_title = Please enter following information to confirm your operation:
settings.delete_notices = - This operation <strong>CANNOT</strong> be undone.<br>- This operation will permanently delete the everything of this repository, including Git data, issues, comments and accesses of collaborators.
settings.update_settings_success = Repository options has been updated successfully. settings.update_settings_success = Repository options has been updated successfully.
settings.transfer_owner = New Owner settings.transfer_owner = New Owner
settings.make_transfer = Make Transfer settings.make_transfer = Make Transfer

View File

@ -47,12 +47,12 @@ func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) bi
} }
type RepoSettingForm struct { type RepoSettingForm struct {
RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"` RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `form:"desc" binding:"MaxSize(255)"` Description string `binding:"MaxSize(255)"`
Website string `form:"site" binding:"Url;MaxSize(100)"` Website string `binding:"Url;MaxSize(100)"`
Branch string `form:"branch"` Branch string
Interval int `form:"interval"` Interval int
Private bool `form:"private"` Private bool
} }
func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -492,6 +492,9 @@ $(document).ready(function () {
$('.show-panel.button').click(function () { $('.show-panel.button').click(function () {
$($(this).data('panel')).show(); $($(this).data('panel')).show();
}); });
$('.show-modal.button').click(function () {
$($(this).data('modal')).modal('show');
});
initCommentForm(); initCommentForm();
initInstall(); initInstall();

View File

@ -79,6 +79,25 @@
} }
} }
&.options {
input {
width: 50%!important;
min-width: 300px;
}
#interval {
width: 100px!important;
min-width: 100px;
}
.danger {
.item {
padding: 20px 15px;
}
.ui.divider {
margin: 0;
}
}
}
@comment-avatar-width: 3em; @comment-avatar-width: 3em;
&.new.issue { &.new.issue {
.comment.form { .comment.form {
@ -733,3 +752,10 @@
} }
} }
} }
#transfer-repo-modal,
#delete-repo-modal {
.ui.message {
width: 100%!important;
}
}

View File

@ -24,8 +24,7 @@
</div> </div>
<div class="inline field"> <div class="inline field">
<label></label> <button class="ui green button">{{$.i18n.Tr "repo.settings.update_githook"}}</button>
<button class="ui green button" id="change-reponame-btn" href="#change-reponame-modal">{{$.i18n.Tr "repo.settings.update_githook"}}</button>
</div> </div>
{{end}} {{end}}
</form> </form>

View File

@ -1,144 +1,157 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="repository settings options">
<div id="repo-wrapper"> {{template "repo/header" .}}
{{template "repo/header_old" .}} <div class="ui container">
<div id="setting-wrapper" class="main-wrapper"> <div class="ui grid">
<div id="repo-setting" class="container clear"> {{template "repo/settings/navbar" .}}
{{template "repo/settings/nav" .}} <div class="twelve wide column content">
<div class="grid-4-5 left"> {{template "base/alert" .}}
<div class="setting-content"> <h4 class="ui top attached header">
{{template "ng/base/alert" .}} {{.i18n.Tr "repo.settings.basic_settings"}}
<div id="setting-content"> </h4>
<div class="panel panel-radius"> <div class="ui attached segment">
<div class="panel-header"> <form class="ui form" action="{{.Link}}" method="post">
<strong>{{.i18n.Tr "repo.settings.basic_settings"}}</strong> {{.CsrfTokenHtml}}
</div> <input type="hidden" name="action" value="update">
<form class="form form-align panel-body" id="repo-setting-form" action="{{.RepoLink}}/settings" method="post"> <div class="required field {{if .Err_RepoName}}error{{end}}">
{{.CsrfTokenHtml}} <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
<input type="hidden" name="action" value="update"> <input id="repo_name" name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required>
<div class="field"> </div>
<label class="req" for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> <div class="field {{if .Err_Description}}error{{end}}">
<input class="ipt ipt-large ipt-radius {{if .Err_RepoName}}ipt-error{{end}}" id="repo_name" name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" required /> <label for="description">{{$.i18n.Tr "repo.repo_desc"}}</label>
</div> <textarea id="description" name="description" rows="2">{{.Repository.Description}}</textarea>
<div class="white-popup-block mfp-hide" id="change-reponame-modal"> </div>
<h1 class="text-red">{{.i18n.Tr "repo.settings.change_reponame"}}</h1> <div class="field {{if .Err_Website}}error{{end}}">
<p>{{.i18n.Tr "repo.settings.change_reponame_desc"}}</p> <label for="website">{{.i18n.Tr "repo.settings.site"}}</label>
<br> <input id="website" name="website" type="url" value="{{.Repository.Website}}">
<button class="btn btn-red btn-large btn-radius" id="change-reponame-submit">{{.i18n.Tr "settings.continue"}}</button> </div>
<button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button>
</div> <div class="ui divider"></div>
<div class="field clear"> {{if not .Repository.IsBare}}
<label class="left" for="desc">{{.i18n.Tr "repo.repo_desc"}}</label> <div class="required inline field">
<textarea class="ipt ipt-large ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="desc" name="desc">{{.Repository.Description}}</textarea> <label>{{.i18n.Tr "repo.default_branch"}}</label>
</div> <div class="ui selection dropdown">
<div class="field"> <input type="hidden" id="branch" name="branch" value="{{.Repository.DefaultBranch}}">
<label for="website">{{.i18n.Tr "repo.settings.site"}}</label> <div class="default text">{{.Repository.DefaultBranch}}</div>
<input class="ipt ipt-large ipt-radius {{if .Err_Website}}ipt-error{{end}}" id="website" name="site" type="url" value="{{.Repository.Website}}" /> <i class="dropdown icon"></i>
</div> <div class="menu">
<hr> {{range .Branches}}
<br> <div class="item" data-value="{{.}}">{{.}}</div>
{{if not .Repository.IsBare}} {{end}}
<div class="field"> </div>
<label>{{.i18n.Tr "repo.default_branch"}}</label> </div>
<select name="branch"> </div>
{{if .Repository.DefaultBranch}}<option value="{{.Repository.DefaultBranch}}">{{.Repository.DefaultBranch}}</option>{{end}} {{end}}
{{range .Branches}} {{if not .Repository.IsFork}}
{{if not (eq . $.Repository.DefaultBranch)}}<option value="{{.}}">{{.}}</option>{{end}} <div class="inline field">
{{end}} <label>{{.i18n.Tr "repo.visibility"}}</label>
</select> <div class="ui checkbox">
</div> <input name="private" type="checkbox" {{if .private}}checked{{end}}>
{{end}} <label>{{.i18n.Tr "repo.visiblity_helper" | Safe}}</label>
{{if .Repository.IsMirror}}
<div class="field">
<label for="interval">{{.i18n.Tr "repo.mirror_interval"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Interval}}ipt-error{{end}}" id="interval" name="interval" type="number" value="{{.MirrorInterval}}" />
</div>
{{end}}
<div class="field">
<label for="visibility">{{.i18n.Tr "repo.visibility"}}</label>
<input class="ipt-chk" id="visibility" name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}} />
<span>{{.i18n.Tr "repo.visiblity_helper" | Str2html}}</span>
</div>
<div class="field">
<span class="form-label"></span>
<button class="btn btn-green btn-large btn-radius" id="change-reponame-btn" href="#change-reponame-modal">{{.i18n.Tr "repo.settings.update_settings"}}</button>
</div>
</form>
</div>
</div>
</div> </div>
<br> </div>
<div class="setting-content"> {{end}}
<div id="setting-content"> {{if .Repository.IsMirror}}
<div id="user-profile-setting-content" class="panel panel-warning panel-radius"> <div class="inline field {{if .Err_Interval}}error{{end}}">
<div class="panel-header"> <label for="interval">{{.i18n.Tr "repo.mirror_interval"}}</label>
<strong>{{.i18n.Tr "repo.settings.danger_zone"}}</strong> <input id="interval" name="interval" type="number" value="{{.MirrorInterval}}">
</div> </div>
<div class="panel-body"> {{end}}
<div class="repo-setting-zone">
<button class="btn btn-gray btn-large btn-radius right" id="transfer-repo-btn" href="#transfer-repo-modal">{{.i18n.Tr "repo.settings.transfer"}}</button> <div class="field">
<dt>{{.i18n.Tr "repo.settings.transfer"}}</dt> <button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
<dl>{{.i18n.Tr "repo.settings.transfer_desc"}}</dl> </div>
<div class="white-popup-block mfp-hide" id="transfer-repo-modal"> </form>
<h1 class="text-red">{{.i18n.Tr "repo.settings.transfer"}}</h1> </div>
{{.i18n.Tr "repo.settings.transfer_notices" | Str2html}}
<br> <h4 class="ui top attached warning header">
<form class="form-align form panel container panel-radius" id="transfer-repo-form" action="{{.RepoLink}}/settings" method="post"> {{.i18n.Tr "repo.settings.danger_zone"}}
{{.CsrfTokenHtml}} </h4>
<input type="hidden" name="action" value="transfer"> <div class="ui attached warning table danger segment">
<div class="panel-content"> <div class="item">
<div class="field"> <div class="ui right">
<label class="req" for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> <button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{.i18n.Tr "repo.settings.transfer"}}</button>
<input class="ipt ipt-large ipt-radius" id="repo_name" name="repo_name" required /> </div>
</div> <div>
<div class="field"> <h5>{{.i18n.Tr "repo.settings.transfer"}}</h5>
<label class="req" for="new_owner_name">{{.i18n.Tr "repo.settings.transfer_owner"}}</label> <p>{{.i18n.Tr "repo.settings.transfer_desc"}}</p>
<input class="ipt ipt-large ipt-radius" id="new_owner_name" name="new_owner_name" required/> </div>
</div> </div>
<div class="field">
<label class="req" for="password">{{.i18n.Tr "password"}}</label> <div class="ui divider"></div>
<input class="ipt ipt-large ipt-radius" id="password" name="password" type="password" required/>
</div> <div class="item">
</div> <div class="ui right">
</form> <button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{.i18n.Tr "repo.settings.delete"}}</button>
<br> </div>
<button class="btn btn-large btn-red btn-radius" id="transfer-repo-submit">{{.i18n.Tr "repo.settings.make_transfer"}}</button> <div>
<button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button> <h5>{{.i18n.Tr "repo.settings.delete"}}</h5>
</div> <p>{{.i18n.Tr "repo.settings.delete_desc"}}</p>
</div> </div>
<hr> </div>
<div class="repo-setting-zone"> </div>
<button class="btn btn-gray btn-large btn-radius pull-right" id="delete-repo-btn" href="#delete-repo-modal">{{.i18n.Tr "repo.settings.delete"}}</button> </div>
<dt>{{.i18n.Tr "repo.settings.delete"}}</dt>
<dl>{{.i18n.Tr "repo.settings.delete_desc"}}</dl>
<div class="white-popup-block mfp-hide" id="delete-repo-modal">
<h1 class="text-red">{{.i18n.Tr "repo.settings.delete"}}</h1>
<br>
<form class="form-align form panel container panel-radius" id="delete-repo-form" action="{{.RepoLink}}/settings" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="delete">
<div class="panel-content">
<div class="field">
<label class="req" for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
<input class="ipt ipt-large ipt-radius" id="repo_name" name="repo_name" required />
</div>
<div class="field">
<label class="req" for="password">{{.i18n.Tr "password"}}</label>
<input class="ipt ipt-large ipt-radius" id="password" name="password" type="password" required/>
</div>
</div>
</form>
<br>
<button class="btn btn-large btn-red btn-radius" id="delete-repo-submit">{{.i18n.Tr "repo.settings.confirm_delete"}}</button>
<button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div>
</div> </div>
{{template "ng/base/footer" .}}
<div class="ui small modal" id="transfer-repo-modal">
<div class="header">
{{.i18n.Tr "repo.settings.transfer"}}
</div>
<div class="content">
<div class="ui warning message text left">{{.i18n.Tr "repo.settings.transfer_notices" | Str2html}}</div>
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="transfer">
<div class="field">
<label>
{{.i18n.Tr "repo.settings.transfer_form_title"}}
<span class="text red">{{.Repository.Name}}</span>
</label>
</div>
<div class="required field">
<label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
<input id="repo_name" name="repo_name" required>
</div>
<div class="required field">
<label for="new_owner_name">{{.i18n.Tr "repo.settings.transfer_owner"}}</label>
<input id="new_owner_name" name="new_owner_name" required>
</div>
<div class="text right actions">
<div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
<button class="ui red button">{{.i18n.Tr "repo.settings.make_transfer"}}</button>
</div>
</form>
</div>
</div>
<div class="ui small modal" id="delete-repo-modal">
<div class="header">
{{.i18n.Tr "repo.settings.delete"}}
</div>
<div class="content">
<div class="ui warning message text left">{{.i18n.Tr "repo.settings.delete_notices" | Str2html}}</div>
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="delete">
<div class="field">
<label>
{{.i18n.Tr "repo.settings.transfer_form_title"}}
<span class="text red">{{.Repository.Name}}</span>
</label>
</div>
<div class="required field">
<label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
<input id="repo_name" name="repo_name" required>
</div>
<div class="text right actions">
<div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
<button class="ui red button">{{.i18n.Tr "repo.settings.confirm_delete"}}</button>
</div>
</form>
</div>
</div>
{{template "base/footer" .}}