Suwon Chae 2015-03-14
site-admin: show warning affix when admin user was logged in
@ce6b94f1354dd86f020cd2574416e05219502220
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -6154,3 +6154,14 @@
         text-align:center;
     }
 }
+
+.admin-logged-in-affix {
+  z-index:999;
+  padding: 10px 10px;
+  width:100%;
+  color:white;
+  font-size:20px;
+  background-color: #ad0000;
+  text-align: center;
+  font-weight: bold;
+}
app/controllers/UserApp.java
--- app/controllers/UserApp.java
+++ app/controllers/UserApp.java
@@ -926,4 +926,12 @@
             return forbidden(json);
         }
     }
+
+    public static boolean isSiteAdminLoggedInSession(){
+        if(SiteAdmin.SITEADMIN_DEFAULT_LOGINID.equals(session().get(SESSION_LOGINID))){
+            return true;
+        } else {
+            return false;
+        }
+    }
 }
app/views/layout.scala.html
--- app/views/layout.scala.html
+++ app/views/layout.scala.html
@@ -46,6 +46,9 @@
 </head>
 
 <body class="@theme">
+    @if(UserApp.isSiteAdminLoggedInSession){
+        <div class="admin-logged-in-affix" data-spy="affix" data-offset-top="30">@Messages("user.siteAdminLoggedInAffix") <span class="small-font">@Messages("user.siteAdminLoggedInAffix.maxim")</span></div>
+    }
 @partial_update_notification()
 @content
 @common.scripts()
conf/messages
--- conf/messages
+++ conf/messages
@@ -894,6 +894,8 @@
 user.newPassword = New password
 user.notExists.name = User not exists
 user.password = Password
+user.siteAdminLoggedInAffix = You are Admin now!
+user.siteAdminLoggedInAffix.maxim = With great power comes great responsibility
 user.role.anonymous = Anonymous
 user.role.guest = Guest
 user.role.manager = Manager
conf/messages.ko-KR
--- conf/messages.ko-KR
+++ conf/messages.ko-KR
@@ -894,6 +894,8 @@
 user.newPassword = 신규 비밀번호
 user.notExists.name = 존재하지 않는 사용자입니다.
 user.password = 비밀번호
+user.siteAdminLoggedInAffix = 관리자로 로그인 하였습니다!
+user.siteAdminLoggedInAffix.maxim = - 큰 힘에는 큰 책임이 따릅니다
 user.role.anonymous = 익명 사용자
 user.role.guest = 지나가던 사람
 user.role.manager = 관리자
Add a comment
List