Browse Source

UI: Confirmation box

pull/521/head
Unknwon 10 years ago
parent
commit
a046a31d2b
  1. 2
      README.md
  2. 4
      README_ZH.md
  3. 1
      conf/locale/locale_en-US.ini
  4. 1
      conf/locale/locale_zh-CN.ini
  5. 6
      public/ng/css/gogs.css
  6. 19
      public/ng/js/gogs.js
  7. 8
      public/ng/js/min/gogs-min.js
  8. 3
      public/ng/less/gogs/base.less
  9. 2
      public/ng/less/gogs/dashboard.less
  10. 1
      public/ng/less/gogs/organization.less
  11. 3
      routers/repo/setting.go
  12. 33
      templates/repo/settings/options.tmpl

2
README.md

@ -65,7 +65,7 @@ There are 5 ways to install Gogs:
## 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).
- System Monitor Status is inspired by [GoBlog](https://github.com/fuxiaohei/goblog).
- Usage and modification from [beego](http://beego.me) modules.

4
README_ZH.md

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

1
conf/locale/locale_en-US.ini

@ -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.delete = Delete This Repository
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.transfer_owner = New Owner
settings.make_transfer = Make Transfer

1
conf/locale/locale_zh-CN.ini

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

6
public/ng/css/gogs.css

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

19
public/ng/js/gogs.js

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

8
public/ng/js/min/gogs-min.js vendored

File diff suppressed because one or more lines are too long

3
public/ng/less/gogs/base.less

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

2
public/ng/less/gogs/dashboard.less

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

1
public/ng/less/gogs/organization.less

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

3
routers/repo/setting.go

@ -112,6 +112,9 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
} else if !isExist {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil)
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 {
if err == models.ErrRepoAlreadyExist {
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil)

33
templates/repo/settings/options.tmpl

@ -81,12 +81,14 @@
</div>
<div class="panel-body">
<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>
<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>
<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}}
<input type="hidden" name="action" value="transfer">
<div class="panel-content">
@ -94,22 +96,30 @@
<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="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/>
<span class="form-label"></span>
<button class="btn btn-large btn-red btn-radius right">{{.i18n.Tr "repo.settings.make_transfer"}}</button>
</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="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>
<hr>
<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>
<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>
<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}}
<input type="hidden" name="action" value="delete">
<div class="panel-content">
@ -117,12 +127,15 @@
<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/>
<span class="form-label"></span>
<button class="btn btn-large btn-red btn-radius right">{{.i18n.Tr "repo.settings.confirm_delete"}}</button>
</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>

Loading…
Cancel
Save