mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
Display the message after settings updating is completed.
This commit is contained in:
@@ -4,11 +4,12 @@ import service.{AccountService, SystemSettingsService}
|
|||||||
import SystemSettingsService._
|
import SystemSettingsService._
|
||||||
import util.AdminAuthenticator
|
import util.AdminAuthenticator
|
||||||
import jp.sf.amateras.scalatra.forms._
|
import jp.sf.amateras.scalatra.forms._
|
||||||
|
import org.scalatra.FlashMapSupport
|
||||||
|
|
||||||
class SystemSettingsController extends SystemSettingsControllerBase
|
class SystemSettingsController extends SystemSettingsControllerBase
|
||||||
with SystemSettingsService with AccountService with AdminAuthenticator
|
with SystemSettingsService with AccountService with AdminAuthenticator
|
||||||
|
|
||||||
trait SystemSettingsControllerBase extends ControllerBase {
|
trait SystemSettingsControllerBase extends ControllerBase with FlashMapSupport {
|
||||||
self: SystemSettingsService with AccountService with AdminAuthenticator =>
|
self: SystemSettingsService with AccountService with AdminAuthenticator =>
|
||||||
|
|
||||||
private case class SystemSettingsForm(allowAccountRegistration: Boolean)
|
private case class SystemSettingsForm(allowAccountRegistration: Boolean)
|
||||||
@@ -19,11 +20,12 @@ trait SystemSettingsControllerBase extends ControllerBase {
|
|||||||
|
|
||||||
|
|
||||||
get("/admin/system")(adminOnly {
|
get("/admin/system")(adminOnly {
|
||||||
admin.html.system(loadSystemSettings())
|
admin.html.system(loadSystemSettings(), flash.get("info"))
|
||||||
})
|
})
|
||||||
|
|
||||||
post("/admin/system", form)(adminOnly { form =>
|
post("/admin/system", form)(adminOnly { form =>
|
||||||
saveSystemSettings(SystemSettings(form.allowAccountRegistration))
|
saveSystemSettings(SystemSettings(form.allowAccountRegistration))
|
||||||
|
flash += "info" -> "Settings updated."
|
||||||
redirect("/admin/system")
|
redirect("/admin/system")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
@(settings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
@(settings: service.SystemSettingsService.SystemSettings, info: Option[Any])(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@html.main("System Settings"){
|
@html.main("System Settings"){
|
||||||
@menu("system"){
|
@menu("system"){
|
||||||
|
@if(info.isDefined){
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||||
|
@info
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<form action="@path/admin/system" method="POST" validate="true">
|
<form action="@path/admin/system" method="POST" validate="true">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-header">System Settings</div>
|
<div class="box-header">System Settings</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user