-
Notifications
You must be signed in to change notification settings - Fork 142
/
Messages.scala
37 lines (28 loc) · 1.08 KB
/
Messages.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package controllers.basic
import javax.inject.Inject
import controllers.stack.Pjax
import jp.t2v.lab.play2.auth.AuthElement
import play.api.mvc.Controller
import views.html
import jp.t2v.lab.play2.auth.sample.Role._
import play.api.Environment
import play.twirl.api.Html
class Messages @Inject() (val environment: Environment) extends Controller with AuthElement with AuthConfigImpl {
def main = StackAction(AuthorityKey -> NormalUser) { implicit request =>
val title = "message main"
Ok(html.message.main(title))
}
def list = StackAction(AuthorityKey -> NormalUser) { implicit request =>
val title = "all messages"
Ok(html.message.list(title))
}
def detail(id: Int) = StackAction(AuthorityKey -> NormalUser) { implicit request =>
val title = "messages detail "
Ok(html.message.detail(title + id))
}
def write = StackAction(AuthorityKey -> Administrator) { implicit request =>
val title = "write message"
Ok(html.message.write(title))
}
protected implicit def template(implicit user: User): String => Html => Html = html.basic.fullTemplate(user)
}