Display the message after settings updating is completed.

This commit is contained in:
takezoe
2013-07-10 00:16:55 +09:00
parent 617370e822
commit 1978061a06
2 changed files with 11 additions and 3 deletions

View File

@@ -4,11 +4,12 @@ import service.{AccountService, SystemSettingsService}
import SystemSettingsService._
import util.AdminAuthenticator
import jp.sf.amateras.scalatra.forms._
import org.scalatra.FlashMapSupport
class SystemSettingsController extends SystemSettingsControllerBase
with SystemSettingsService with AccountService with AdminAuthenticator
trait SystemSettingsControllerBase extends ControllerBase {
trait SystemSettingsControllerBase extends ControllerBase with FlashMapSupport {
self: SystemSettingsService with AccountService with AdminAuthenticator =>
private case class SystemSettingsForm(allowAccountRegistration: Boolean)
@@ -19,11 +20,12 @@ trait SystemSettingsControllerBase extends ControllerBase {
get("/admin/system")(adminOnly {
admin.html.system(loadSystemSettings())
admin.html.system(loadSystemSettings(), flash.get("info"))
})
post("/admin/system", form)(adminOnly { form =>
saveSystemSettings(SystemSettings(form.allowAccountRegistration))
flash += "info" -> "Settings updated."
redirect("/admin/system")
})