aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-02-05 20:37:05 +0100
committerPacien TRAN-GIRARD2015-02-05 20:37:05 +0100
commitde24f5b788c1ae6307eb360877ea3ce61c8f7a6a (patch)
tree7b2e454edb9901ae7cc2386659cff92bfb6c8486
parent9f6ba6c47e90640abb8203986acd1562fd48b84d (diff)
downloadminibay-de24f5b788c1ae6307eb360877ea3ce61c8f7a6a.tar.gz
Implement flash messages
-rw-r--r--app/controllers/Application.scala9
-rw-r--r--app/views/fragments/flashBanner.scala.html13
-rw-r--r--app/views/pages/ebeHomepage.scala.html2
-rw-r--r--app/views/pages/pepalHomepage.scala.html2
-rw-r--r--app/views/templates/ebe.scala.html2
-rw-r--r--app/views/templates/main.scala.html4
-rw-r--r--app/views/templates/pepal.scala.html2
-rw-r--r--public/stylesheets/main.css32
8 files changed, 59 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._
7object Application extends Controller { 7object 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)
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index a9d3a71..efbf978 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -81,6 +81,38 @@ p {
81 } 81 }
82} 82}
83 83
84/***** FLASH MESSAGES *****/
85
86.flash-message > * {
87 padding: 15px;
88 margin-bottom: 20px;
89 border: 1px solid transparent;
90}
91
92.flash-message > .success {
93 color: #3c763d;
94 background-color: #dff0d8;
95 border-color: #d6e9c6;
96}
97
98.flash-message > .info {
99 color: #31708f;
100 background-color: #d9edf7;
101 border-color: #bce8f1;
102}
103
104.flash-message > .warning {
105 color: #8a6d3b;
106 background-color: #fcf8e3;
107 border-color: #faebcc;
108}
109
110.flash-message > .error {
111 color: #a94442;
112 background-color: #f2dede;
113 border-color: #ebccd1;
114}
115
84/***** FOOTER *****/ 116/***** FOOTER *****/
85 117
86footer { 118footer {