doortts doortts 2014-02-06
flash-noti-popup: refactoring flash noti popup and add noti title option
- add title option to yobi.notify function
- remove scattered addon of alert.scala import
- unify flash noti pop script with title
@606758a077d3cd5e073dbdc3e29fdc61195c0119
 
app/views/common/alert.scala.html (deleted)
--- app/views/common/alert.scala.html
@@ -1,13 +0,0 @@
-<script type="text/javascript">
-$(document).ready(function(){
-	@if(flash.containsKey("warning")) {
-		$yobi.notify("@Messages(flash.get("warning"))", 3000);
-	}
-	@if(flash.containsKey("success")) {
-		$yobi.notify("@Messages(flash.get("success"))", 3000);
-	}
-	@if(flash.containsKey("info")) {
-		$yobi.notify("@Messages(flash.get("info"))", 3000);
-	}
-});
-</script>
app/views/common/scripts.scala.html
--- app/views/common/scripts.scala.html
+++ app/views/common/scripts.scala.html
@@ -132,5 +132,11 @@
             welTarget.tooltip("destroy");
             welTarget.popover("hide");
         });
+
+        // notify flash messages
+        @for(key <- flash.keys) {
+            $yobi.notify("@Messages(flash.get(key))", 3000);
+        }
+
     });
 </script>
app/views/error/notfound_default.scala.html
--- app/views/error/notfound_default.scala.html
+++ app/views/error/notfound_default.scala.html
@@ -32,5 +32,4 @@
             <span class="provider">Copyright © <a href="http://navercorp.com/" target="_blank">NAVER Corp.</a> Supported by <a href="http://developer.naver.com/wiki/pages/techSupport" target="_blank" class="d2-program"><span class="d2">D2</span><span class="program"> Program</span></a></span>
         </div>
     </footer>
-    @common.alert()
 }
app/views/projectLayout.scala.html
--- app/views/projectLayout.scala.html
+++ app/views/projectLayout.scala.html
@@ -13,5 +13,4 @@
             <span class="provider">Copyright © <a href="http://navercorp.com/" target="_blank">NAVER Corp.</a> Supported by <a href="http://developer.naver.com/wiki/pages/techSupport" target="_blank" class="d2-program"><span class="d2">D2</span><span class="program"> Program</span></a></span>
         </div>
     </footer>
-    @common.alert()
 }
app/views/siteLayout.scala.html
--- app/views/siteLayout.scala.html
+++ app/views/siteLayout.scala.html
@@ -36,5 +36,4 @@
             <span class="provider">Copyright © <a href="http://navercorp.com/" target="_blank">NAVER Corp.</a> Supported by <a href="http://developer.naver.com/wiki/pages/techSupport" target="_blank" class="d2-program"><span class="d2">D2</span><span class="program"> Program</span></a></span>
         </div>
     </footer>
-    @common.alert()
 }
public/javascripts/common/yobi.Common.js
--- public/javascripts/common/yobi.Common.js
+++ public/javascripts/common/yobi.Common.js
@@ -266,14 +266,19 @@
      * @param {String} sMessage
      * @param {Number} nDuration
      */
-    function notify(sMessage, nDuration){
+    function notify(sMessage, nDuration, sTitle){
         if(!htVar.oToast){
             htVar.oToast = new yobi.ui.Toast("#yobiToasts", {
                 "sTplToast": $("#tplYobiToast").text()
             });
         }
 
-        htVar.oToast.push(sMessage, nDuration);
+        if(sTitle){
+            htVar.oToast.push("<strong>" + sTitle + "</strong>" + "<br/>" + sMessage, nDuration);
+        } else {
+            htVar.oToast.push(sMessage, nDuration);
+        }
+
     }
 
     /**
Add a comment
List