mirror of https://github.com/go-gitea/gitea.git
finish new org settings page
This commit is contained in:
parent
4dbc322859
commit
00767a0522
|
@ -70,7 +70,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) {
|
||||||
}
|
}
|
||||||
log.Trace("Organization setting updated: %s", org.Name)
|
log.Trace("Organization setting updated: %s", org.Name)
|
||||||
ctx.Flash.Success(ctx.Tr("org.settings.update_setting_success"))
|
ctx.Flash.Success(ctx.Tr("org.settings.update_setting_success"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/org/" + org.Name + "/settings")
|
ctx.Redirect(org.HomeLink() + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
func SettingsDelete(ctx *middleware.Context) {
|
func SettingsDelete(ctx *middleware.Context) {
|
||||||
|
@ -79,11 +79,19 @@ func SettingsDelete(ctx *middleware.Context) {
|
||||||
|
|
||||||
org := ctx.Org.Organization
|
org := ctx.Org.Organization
|
||||||
if ctx.Req.Method == "POST" {
|
if ctx.Req.Method == "POST" {
|
||||||
// FIXME: validate password.
|
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
|
||||||
|
if models.IsErrUserNotExist(err) {
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_DELETE, nil)
|
||||||
|
} else {
|
||||||
|
ctx.Handle(500, "UserSignIn", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := models.DeleteOrganization(org); err != nil {
|
if err := models.DeleteOrganization(org); err != nil {
|
||||||
if models.IsErrUserOwnRepos(err) {
|
if models.IsErrUserOwnRepos(err) {
|
||||||
ctx.Flash.Error(ctx.Tr("form.org_still_own_repo"))
|
ctx.Flash.Error(ctx.Tr("form.org_still_own_repo"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/org/" + org.LowerName + "/settings/delete")
|
ctx.Redirect(org.HomeLink() + "/settings/delete")
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "DeleteOrganization", err)
|
ctx.Handle(500, "DeleteOrganization", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<div class="actions">
|
||||||
|
<div class="ui red basic inverted cancel button">
|
||||||
|
<i class="remove icon"></i>
|
||||||
|
{{.i18n.Tr "modal.no"}}
|
||||||
|
</div>
|
||||||
|
<div class="ui green basic inverted ok button">
|
||||||
|
<i class="checkmark icon"></i>
|
||||||
|
{{.i18n.Tr "modal.yes"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,36 +1,43 @@
|
||||||
{{template "ng/base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "ng/base/header" .}}
|
<div class="organization settings delete">
|
||||||
{{template "org/base/header" .}}
|
{{template "org/header" .}}
|
||||||
<div id="setting-wrapper" class="main-wrapper">
|
<div class="ui container">
|
||||||
<div id="org-setting" class="container clear">
|
<div class="ui grid">
|
||||||
{{template "org/settings/nav" .}}
|
{{template "org/settings/navbar" .}}
|
||||||
<div class="grid-4-5 left">
|
<div class="twelve wide column content">
|
||||||
<div class="setting-content">
|
{{template "base/alert" .}}
|
||||||
{{template "ng/base/alert" .}}
|
<h4 class="ui top attached warning header">
|
||||||
<div id="setting-content">
|
{{.i18n.Tr "org.settings.delete_account"}}
|
||||||
<div id="user-profile-setting-content" class="panel panel-warning panel-radius">
|
</h4>
|
||||||
<p class="panel-header"><strong>{{.i18n.Tr "org.settings.delete_account"}}</strong></p>
|
<div class="ui attached warning segment">
|
||||||
<div class="panel-body panel-content">
|
<div class="ui red message">
|
||||||
<span class="alert alert-red alert-radius block"><i class="octicon octicon-alert"></i>{{.i18n.Tr "org.settings.delete_prompt" | Str2html}}</span>
|
<p class="text left"><i class="octicon octicon-alert"></i> {{.i18n.Tr "org.settings.delete_prompt" | Str2html}}</p>
|
||||||
<form id="delete-org-form" action="{{AppSubUrl}}/org/{{.Org.LowerName}}/settings/delete" method="post">
|
</div>
|
||||||
{{.CsrfTokenHtml}}
|
<form class="ui form" id="delete-form" action="{{.Link}}" method="post">
|
||||||
<p class="field">
|
{{.CsrfTokenHtml}}
|
||||||
<span class="form-label"></span>
|
<input class="fake" type="password">
|
||||||
<button class="btn btn-red btn-large btn-radius" id="delete-org-btn" href="#delete-org-modal">{{.i18n.Tr "org.settings.confirm_delete_account"}}</button>
|
<div class="inline required field {{if .Err_Password}}error{{end}}">
|
||||||
</p>
|
<label for="password">{{.i18n.Tr "password"}}</label>
|
||||||
</form>
|
<input id="password" name="password" type="password" autofocus required>
|
||||||
<div class="white-popup-block mfp-hide" id="delete-org-modal">
|
|
||||||
<h1 class="text-red">{{.i18n.Tr "org.settings.delete_org_title"}}</h1>
|
|
||||||
<p>{{.i18n.Tr "org.settings.delete_org_desc"}}</p>
|
|
||||||
<br>
|
|
||||||
<button class="btn btn-red btn-large btn-radius" id="delete-org-submit">{{.i18n.Tr "settings.continue"}}</button>
|
|
||||||
<button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui red button delete-button" data-type="form" data-form="#delete-form">
|
||||||
|
{{.i18n.Tr "org.settings.confirm_delete_account"}}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "ng/base/footer" .}}
|
|
||||||
|
<div class="ui small basic delete modal">
|
||||||
|
<div class="ui icon header">
|
||||||
|
<i class="trash icon"></i>
|
||||||
|
{{.i18n.Tr "org.settings.delete_org_title"}}
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<p>{{.i18n.Tr "org.settings.delete_org_desc"}}</p>
|
||||||
|
</div>
|
||||||
|
{{template "base/delete_modal_actions" .}}
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
|
@ -1,12 +0,0 @@
|
||||||
<div id="setting-menu" class="grid-1-5 panel panel-radius left">
|
|
||||||
<div class="panel-header">
|
|
||||||
<strong>{{.i18n.Tr "org.settings"}}</strong>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<ul class="menu menu-vertical switching-list grid-1-5 left">
|
|
||||||
<li {{if .PageIsSettingsOptions}}class="current"{{end}}><a href="{{.Org.HomeLink}}/settings">{{.i18n.Tr "org.settings.options"}}</a></li>
|
|
||||||
<li {{if .PageIsSettingsHooks}}class="current"{{end}}><a href="{{.Org.HomeLink}}/settings/hooks">{{.i18n.Tr "repo.settings.hooks"}}</a></li>
|
|
||||||
<li {{if .PageIsSettingsDelete}}class="current"{{end}}><a href="{{.Org.HomeLink}}/settings/delete">{{.i18n.Tr "org.settings.delete"}}</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
<div class="user settings">
|
<div class="user settings delete">
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<div class="ui grid">
|
<div class="ui grid">
|
||||||
{{template "user/settings/navbar" .}}
|
{{template "user/settings/navbar" .}}
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
</h4>
|
</h4>
|
||||||
<div class="ui attached warning segment">
|
<div class="ui attached warning segment">
|
||||||
<div class="ui red message">
|
<div class="ui red message">
|
||||||
<p>{{.i18n.Tr "settings.delete_prompt" | Str2html}}</p>
|
<p class="text left"><i class="octicon octicon-alert"></i> {{.i18n.Tr "settings.delete_prompt" | Str2html}}</p>
|
||||||
</div>
|
</div>
|
||||||
<form class="ui form" id="delete-form" action="{{.Link}}" method="post">
|
<form class="ui form" id="delete-form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
@ -37,15 +37,6 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
|
<p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
{{template "base/delete_modal_actions" .}}
|
||||||
<div class="ui red basic inverted cancel button">
|
|
||||||
<i class="remove icon"></i>
|
|
||||||
{{.i18n.Tr "modal.no"}}
|
|
||||||
</div>
|
|
||||||
<div class="ui green basic inverted ok button">
|
|
||||||
<i class="checkmark icon"></i>
|
|
||||||
{{.i18n.Tr "modal.yes"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "base/footer" .}}
|
Loading…
Reference in New Issue