UI: Confirmation box

This commit is contained in:
Unknwon 2014-09-29 18:52:28 -04:00
parent cd084dacf1
commit a046a31d2b
12 changed files with 60 additions and 39 deletions

View file

@ -65,7 +65,7 @@ There are 5 ways to install Gogs:
## Acknowledgments ## Acknowledgments
- Router and middleware mechanism of [martini](http://martini.codegangsta.io/). - Router and middleware mechanism of [Macaron](https://github.com/Unknwon/macaron).
- Mail Service, modules design is inspired by [WeTalk](https://github.com/beego/wetalk). - Mail Service, modules design is inspired by [WeTalk](https://github.com/beego/wetalk).
- System Monitor Status is inspired by [GoBlog](https://github.com/fuxiaohei/goblog). - System Monitor Status is inspired by [GoBlog](https://github.com/fuxiaohei/goblog).
- Usage and modification from [beego](http://beego.me) modules. - Usage and modification from [beego](http://beego.me) modules.

View file

@ -56,10 +56,10 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
## 特别鸣谢 ## 特别鸣谢
- [Macaron](https://github.com/Unknwon/macaron) 的路由与中间件机制。
- [beego](http://beego.me) 模块的使用与修改。
- 基于 [WeTalk](https://github.com/beego/wetalk) 修改的邮件服务和模块设计。 - 基于 [WeTalk](https://github.com/beego/wetalk) 修改的邮件服务和模块设计。
- 基于 [GoBlog](https://github.com/fuxiaohei/goblog) 修改的系统监视状态。 - 基于 [GoBlog](https://github.com/fuxiaohei/goblog) 修改的系统监视状态。
- [beego](http://beego.me) 模块的使用与修改。
- [martini](http://martini.codegangsta.io/) 的路由与中间件机制。
- 感谢 [gobuild.io](http://gobuild.io) 提供二进制编译与下载服务。 - 感谢 [gobuild.io](http://gobuild.io) 提供二进制编译与下载服务。
- 感谢 [lavachen](http://www.lavachen.cn/) 和 [Rocker](http://weibo.com/rocker1989) 设计的 Logo。 - 感谢 [lavachen](http://www.lavachen.cn/) 和 [Rocker](http://weibo.com/rocker1989) 设计的 Logo。

View file

@ -299,6 +299,7 @@ settings.transfer_desc = Transfer this repo to another user or to an organizatio
settings.new_owner_has_same_repo = New owner already has a repository with same name. settings.new_owner_has_same_repo = New owner already has a repository with same 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 remain access if new owner is an organization and you're one of the owners.</p>
settings.update_settings_success = Repository options has been successfully updated. settings.update_settings_success = Repository options has been successfully updated.
settings.transfer_owner = New Owner settings.transfer_owner = New Owner
settings.make_transfer = Make Transfer settings.make_transfer = Make Transfer

View file

@ -299,6 +299,7 @@ settings.transfer_desc = 您可以将仓库转移至您拥有管理员权限的
settings.new_owner_has_same_repo = 新的仓库拥有者已经存在同名仓库! settings.new_owner_has_same_repo = 新的仓库拥有者已经存在同名仓库!
settings.delete = 删除本仓库 settings.delete = 删除本仓库
settings.delete_desc = 删除仓库操作不可逆转,请三思而后行。 settings.delete_desc = 删除仓库操作不可逆转,请三思而后行。
settings.transfer_notices = <p>- 如果您转移给个人用户,您将对仓库失去所有权限。</p><p>- 如果您转移给您作为拥有者的组织,则可继续保持操作权限。</p>
settings.update_settings_success = 仓库设置更新成功! settings.update_settings_success = 仓库设置更新成功!
settings.transfer_owner = 新拥有者 settings.transfer_owner = 新拥有者
settings.make_transfer = 确认转移仓库 settings.make_transfer = 确认转移仓库

View file

@ -7,9 +7,6 @@ body {
width: 16px; width: 16px;
text-align: center; text-align: center;
} }
.fa {
font-size: 14px;
}
.container { .container {
max-width: 1170px; max-width: 1170px;
padding: 0 1.5em; padding: 0 1.5em;
@ -854,7 +851,7 @@ ol.linenums {
font-size: 2em; font-size: 2em;
} }
#dashboard-new-repo-menu { #dashboard-new-repo-menu {
top: 35px; top: 33px;
width: 180px; width: 180px;
background-color: #FFF; background-color: #FFF;
left: -132px; left: -132px;
@ -1889,7 +1886,6 @@ textarea#issue-add-content {
} }
#org-header > div > .menu-line > li.right > a .label { #org-header > div > .menu-line > li.right > a .label {
margin-left: 4px; margin-left: 4px;
font-size: .6em;
} }
#org-header > div > .menu-line > li.right .current { #org-header > div > .menu-line > li.right .current {
border-bottom: 2px solid #D26911; border-bottom: 2px solid #D26911;

View file

@ -437,11 +437,22 @@ function initRepoSetting() {
initHookTypeChange(); initHookTypeChange();
$('#transfer-button').click(function () { // Transfer repository.
$('#transfer-form').show(); $('#transfer-repo-btn').magnificPopup({
modal: true
}); });
$('#delete-button').click(function () { $('#transfer-repo-submit').click(function () {
$('#delete-form').show(); $.magnificPopup.close();
$('#transfer-repo-form').submit();
});
// Delete repository.
$('#delete-repo-btn').magnificPopup({
modal: true
});
$('#delete-repo-submit').click(function () {
$.magnificPopup.close();
$('#delete-repo-form').submit();
}); });
// Collaboration. // Collaboration.

File diff suppressed because one or more lines are too long

View file

@ -17,9 +17,6 @@ body {
width: 16px; width: 16px;
text-align: center; text-align: center;
} }
.fa {
font-size: 14px;
}
.container { .container {
max-width: 1170px; max-width: 1170px;
padding: 0 1.5em; padding: 0 1.5em;

View file

@ -160,7 +160,7 @@
} }
// the drop-down menu of #dashboard-new-repo // the drop-down menu of #dashboard-new-repo
#dashboard-new-repo-menu { #dashboard-new-repo-menu {
top: 35px; top: 33px;
width: 180px; width: 180px;
background-color: #FFF; background-color: #FFF;
left: -132px; left: -132px;

View file

@ -38,7 +38,6 @@
} }
.label{ .label{
margin-left: 4px; margin-left: 4px;
font-size: .6em;
} }
} }
.current { .current {

View file

@ -112,6 +112,9 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
} else if !isExist { } else if !isExist {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil) ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil)
return return
} else if !ctx.User.ValidtePassword(ctx.Query("password")) {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
return
} else if err = models.TransferOwnership(ctx.User, newOwner, ctx.Repo.Repository); err != nil { } else if err = models.TransferOwnership(ctx.User, newOwner, ctx.Repo.Repository); err != nil {
if err == models.ErrRepoAlreadyExist { if err == models.ErrRepoAlreadyExist {
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil) ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil)

View file

@ -81,12 +81,14 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="repo-setting-zone"> <div class="repo-setting-zone">
<button class="btn btn-gray btn-large btn-radius right" id="transfer-button">{{.i18n.Tr "repo.settings.transfer"}}</button> <button class="btn btn-gray btn-large btn-radius right" id="transfer-repo-btn" href="#transfer-repo-modal">{{.i18n.Tr "repo.settings.transfer"}}</button>
<dt>{{.i18n.Tr "repo.settings.transfer"}}</dt> <dt>{{.i18n.Tr "repo.settings.transfer"}}</dt>
<dl>{{.i18n.Tr "repo.settings.transfer_desc"}}</dl> <dl>{{.i18n.Tr "repo.settings.transfer_desc"}}</dl>
<div class="hide" id="transfer-form"> <div class="white-popup-block mfp-hide" id="transfer-repo-modal">
<h1 class="text-red">{{.i18n.Tr "repo.settings.transfer"}}</h1>
{{.i18n.Tr "repo.settings.transfer_notices" | Str2html}}
<br> <br>
<form class="form-align form panel container panel-radius" action="{{.RepoLink}}/settings" method="post"> <form class="form-align form panel container panel-radius" id="transfer-repo-form" action="{{.RepoLink}}/settings" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input type="hidden" name="action" value="transfer"> <input type="hidden" name="action" value="transfer">
<div class="panel-content"> <div class="panel-content">
@ -94,22 +96,30 @@
<label class="req" for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> <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 /> <input class="ipt ipt-large ipt-radius" id="repo_name" name="repo_name" required />
</div> </div>
<div class="field">
<label class="req" for="new_owner_name">{{.i18n.Tr "repo.settings.transfer_owner"}}</label> <label class="req" for="new_owner_name">{{.i18n.Tr "repo.settings.transfer_owner"}}</label>
<input class="ipt ipt-large ipt-radius" id="new_owner_name" name="new_owner_name" required/> <input class="ipt ipt-large ipt-radius" id="new_owner_name" name="new_owner_name" required/>
<span class="form-label"></span> </div>
<button class="btn btn-large btn-red btn-radius right">{{.i18n.Tr "repo.settings.make_transfer"}}</button> <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> </div>
</form> </form>
<br>
<button class="btn btn-large btn-red btn-radius" id="transfer-repo-submit">{{.i18n.Tr "repo.settings.make_transfer"}}</button>
<button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button>
</div> </div>
</div> </div>
<hr> <hr>
<div class="repo-setting-zone"> <div class="repo-setting-zone">
<button class="btn btn-gray btn-large btn-radius pull-right" id="delete-button">{{.i18n.Tr "repo.settings.delete"}}</button> <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>
<dt>{{.i18n.Tr "repo.settings.delete"}}</dt> <dt>{{.i18n.Tr "repo.settings.delete"}}</dt>
<dl>{{.i18n.Tr "repo.settings.delete_desc"}}</dl> <dl>{{.i18n.Tr "repo.settings.delete_desc"}}</dl>
<div class="hide" id="delete-form"> <div class="white-popup-block mfp-hide" id="delete-repo-modal">
<h1 class="text-red">{{.i18n.Tr "repo.settings.delete"}}</h1>
<br> <br>
<form class="form-align form panel container panel-radius" action="{{.RepoLink}}/settings" method="post"> <form class="form-align form panel container panel-radius" id="delete-repo-form" action="{{.RepoLink}}/settings" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input type="hidden" name="action" value="delete"> <input type="hidden" name="action" value="delete">
<div class="panel-content"> <div class="panel-content">
@ -117,12 +127,15 @@
<label class="req" for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> <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 /> <input class="ipt ipt-large ipt-radius" id="repo_name" name="repo_name" required />
</div> </div>
<div class="field">
<label class="req" for="password">{{.i18n.Tr "password"}}</label> <label class="req" for="password">{{.i18n.Tr "password"}}</label>
<input class="ipt ipt-large ipt-radius" id="password" name="password" type="password" required/> <input class="ipt ipt-large ipt-radius" id="password" name="password" type="password" required/>
<span class="form-label"></span> </div>
<button class="btn btn-large btn-red btn-radius right">{{.i18n.Tr "repo.settings.confirm_delete"}}</button>
</div> </div>
</form> </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>