diff options
author | Pacien TRAN-GIRARD | 2015-02-05 20:37:05 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-02-05 20:37:05 +0100 |
commit | de24f5b788c1ae6307eb360877ea3ce61c8f7a6a (patch) | |
tree | 7b2e454edb9901ae7cc2386659cff92bfb6c8486 /app | |
parent | 9f6ba6c47e90640abb8203986acd1562fd48b84d (diff) | |
download | minibay-de24f5b788c1ae6307eb360877ea3ce61c8f7a6a.tar.gz |
Implement flash messages
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/Application.scala | 9 | ||||
-rw-r--r-- | app/views/fragments/flashBanner.scala.html | 13 | ||||
-rw-r--r-- | app/views/pages/ebeHomepage.scala.html | 2 | ||||
-rw-r--r-- | app/views/pages/pepalHomepage.scala.html | 2 | ||||
-rw-r--r-- | app/views/templates/ebe.scala.html | 2 | ||||
-rw-r--r-- | app/views/templates/main.scala.html | 4 | ||||
-rw-r--r-- | app/views/templates/pepal.scala.html | 2 |
7 files changed, 27 insertions, 7 deletions
diff --git a/app/controllers/Application.scala b/app/controllers/Application.scala index 3380e38..12375df 100644 --- a/app/controllers/Application.scala +++ b/app/controllers/Application.scala | |||
@@ -7,15 +7,16 @@ import play.api.mvc._ | |||
7 | object Application extends Controller { | 7 | object Application extends Controller { |
8 | 8 | ||
9 | def index = Action { | 9 | def index = Action { |
10 | Ok(views.html.pages.index("Your new application is ready.")) | 10 | Redirect("/ebe").flashing("warning" -> "hey") |
11 | //Ok(views.html.pages.index("Your new application is ready.")) | ||
11 | } | 12 | } |
12 | 13 | ||
13 | def ebe = Action { | 14 | def ebe = Action { implicit request => |
14 | Ok(views.html.pages.ebeHomepage()) | 15 | Ok(views.html.pages.ebeHomepage()) |
15 | } | 16 | } |
16 | 17 | ||
17 | def pepal = Action { | 18 | def pepal = Action { implicit request => |
18 | Ok(views.html.pages.pepalHomepage()) | 19 | Ok(views.html.pages.pepalHomepage()) |
19 | } | 20 | } |
20 | 21 | ||
21 | } \ No newline at end of file | 22 | } |
diff --git a/app/views/fragments/flashBanner.scala.html b/app/views/fragments/flashBanner.scala.html new file mode 100644 index 0000000..41766f9 --- /dev/null +++ b/app/views/fragments/flashBanner.scala.html | |||
@@ -0,0 +1,13 @@ | |||
1 | @()(implicit flash:Flash) | ||
2 | |||
3 | @displayFlash(flashType: String) = { | ||
4 | @for(message <- flash.get(flashType)) { | ||
5 | <div class="@flashType"> | ||
6 | @message | ||
7 | </div> | ||
8 | } | ||
9 | } | ||
10 | |||
11 | @for(flashType <- List("success", "info", "warning", "error")) { | ||
12 | @displayFlash(flashType) | ||
13 | } | ||
diff --git a/app/views/pages/ebeHomepage.scala.html b/app/views/pages/ebeHomepage.scala.html index bf11462..da1fb08 100644 --- a/app/views/pages/ebeHomepage.scala.html +++ b/app/views/pages/ebeHomepage.scala.html | |||
@@ -1,3 +1,5 @@ | |||
1 | @()(implicit flash: Flash) | ||
2 | |||
1 | @templates.ebe("eBé") { | 3 | @templates.ebe("eBé") { |
2 | 4 | ||
3 | <div class="action-buttons pure-g"> | 5 | <div class="action-buttons pure-g"> |
diff --git a/app/views/pages/pepalHomepage.scala.html b/app/views/pages/pepalHomepage.scala.html index 6eb7070..b4a8e9c 100644 --- a/app/views/pages/pepalHomepage.scala.html +++ b/app/views/pages/pepalHomepage.scala.html | |||
@@ -1,3 +1,5 @@ | |||
1 | @()(implicit flash: Flash) | ||
2 | |||
1 | @templates.pepal("PéPal") { | 3 | @templates.pepal("PéPal") { |
2 | 4 | ||
3 | <div class="action-buttons pure-g"> | 5 | <div class="action-buttons pure-g"> |
diff --git a/app/views/templates/ebe.scala.html b/app/views/templates/ebe.scala.html index dbc1a88..2bab310 100644 --- a/app/views/templates/ebe.scala.html +++ b/app/views/templates/ebe.scala.html | |||
@@ -1,3 +1,3 @@ | |||
1 | @(title: String)(content: Html) | 1 | @(title: String)(content: Html)(implicit flash: Flash) |
2 | 2 | ||
3 | @templates.main{@fragments.ebeLogo()}{@fragments.ebeSlogan()}(title)(content) | 3 | @templates.main{@fragments.ebeLogo()}{@fragments.ebeSlogan()}(title)(content) |
diff --git a/app/views/templates/main.scala.html b/app/views/templates/main.scala.html index dadfc03..278b205 100644 --- a/app/views/templates/main.scala.html +++ b/app/views/templates/main.scala.html | |||
@@ -1,4 +1,4 @@ | |||
1 | @(logo: Html)(slogan: Html)(title: String)(content: Html) | 1 | @(logo: Html)(slogan: Html)(title: String)(content: Html)(implicit flash: Flash) |
2 | 2 | ||
3 | <!DOCTYPE html> | 3 | <!DOCTYPE html> |
4 | 4 | ||
@@ -50,6 +50,8 @@ | |||
50 | </div> | 50 | </div> |
51 | </header> | 51 | </header> |
52 | 52 | ||
53 | <div class="flash-message">@fragments.flashBanner()</div> | ||
54 | |||
53 | <div class="content">@content</div> | 55 | <div class="content">@content</div> |
54 | 56 | ||
55 | <footer> | 57 | <footer> |
diff --git a/app/views/templates/pepal.scala.html b/app/views/templates/pepal.scala.html index e71482d..ec6d5dd 100644 --- a/app/views/templates/pepal.scala.html +++ b/app/views/templates/pepal.scala.html | |||
@@ -1,3 +1,3 @@ | |||
1 | @(title: String)(content: Html) | 1 | @(title: String)(content: Html)(implicit flash: Flash) |
2 | 2 | ||
3 | @templates.main{@fragments.pepalLogo()}{@fragments.pepalSlogan()}(title)(content) | 3 | @templates.main{@fragments.pepalLogo()}{@fragments.pepalSlogan()}(title)(content) |