BlueMir 2012-11-27
display selected menu
@e907d6f3ffb7c5d84a59996c9cd0aee493531269
 
app/utils/MenuType.java (added)
+++ app/utils/MenuType.java
@@ -0,0 +1,12 @@
+package utils;
+
+public enum MenuType {
+	SITE_HOME(1), NEW_PROJECT(2), PROJECTS(3), HELP(4), SITE_SETTING(5), USER(6),
+    PROJECT_HOME(100), BOARD(101), CODE(102), ISSUE(103), TASK(104), PROJECT_SETTING(105), NONE(0); 
+    
+    private int type;
+    
+    private MenuType(int type) {
+        this.type = type;
+    }
+}
app/views/board/editPost.scala.html
--- app/views/board/editPost.scala.html
+++ app/views/board/editPost.scala.html
@@ -4,7 +4,7 @@
 @import models.enumeration.Resource
 @implicitField = @{ helper.FieldConstructor(simpleForm) }
 
-@main(title, project) {
+@main(title, project, utils.MenuType.BOARD) {
   @pageTitle(project,"Board")
   <div class="content-wrap">
     
app/views/board/newPost.scala.html
--- app/views/board/newPost.scala.html
+++ app/views/board/newPost.scala.html
@@ -3,7 +3,7 @@
 @import utils.TemplateHelper._
 @implicitField = @{ helper.FieldConstructor(simpleForm) }
 
-@main(title, project) {
+@main(title, project, utils.MenuType.BOARD) {
 @pageTitle(project,"Board")
   <div class="content-wrap">
     
app/views/board/post.scala.html
--- app/views/board/post.scala.html
+++ app/views/board/post.scala.html
@@ -4,7 +4,7 @@
 @import models.enumeration.Resource
 @implicitField = @{ helper.FieldConstructor(simpleForm) }
 
-@main("상세보기", project){
+@main("상세보기", project, utils.MenuType.BOARD){
 @pageTitle(project,"Board")
 <div class="board-header">
   <div class="board-id div">@post.id</div>
app/views/board/postList.scala.html
--- app/views/board/postList.scala.html
+++ app/views/board/postList.scala.html
@@ -15,7 +15,7 @@
   </th>
 }
 
-@main(title, project) {
+@main(title, project, utils.MenuType.BOARD) {
   @pageTitle(project,"Board")
   <div class="header-wrap">
     <div class="search-wrap board">
app/views/code/codeView.scala.html
--- app/views/code/codeView.scala.html
+++ app/views/code/codeView.scala.html
@@ -1,6 +1,6 @@
 @(msg : String, project:Project, branches:List[String])
 
-@main("코드", project){
+@main("코드", project, utils.MenuType.CODE){
 <ul class="nav nav-tabs">
     <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)">@Messages("Files")</a></li>
     <a href="@routes.CodeHistoryApp.historyUntilHead(project.owner, project.name)">@Messages("Commits")</a></li>
app/views/code/diff.scala.html
--- app/views/code/diff.scala.html
+++ app/views/code/diff.scala.html
@@ -1,6 +1,6 @@
 @(project: Project, patch: String)
 
-@main(Messages("Commit"), project) {
+@main(Messages("Commit"), project, utils.MenuType.CODE) {
 <script type="text/javascript" src="/assets/javascripts/hljs.js"></script>
 <script type="text/javascript" src="/assets/javascripts/hljs.jquery.js"></script>
 <script type="text/javascript" src="/assets/javascripts/languages/allinone.js"></script>
app/views/code/gitView.scala.html
--- app/views/code/gitView.scala.html
+++ app/views/code/gitView.scala.html
@@ -1,4 +1,5 @@
-@(url : String, project:Project) @main("코드", project){
+@(url : String, project:Project)
+@main("코드", project, utils.MenuType.CODE){
 <ul class="nav nav-tabs">
   <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)">@Messages("Files")</a>
   </li>
app/views/code/history.scala.html
--- app/views/code/history.scala.html
+++ app/views/code/history.scala.html
@@ -3,7 +3,7 @@
 @import playRepository.RepositoryService
 @import java.net.URLEncoder
 
-@main(Messages("title.commitHistory"), project) {
+@main(Messages("title.commitHistory"), project, utils.MenuType.CODE) {
 
 @defining(RepositoryService.getRepository(project).getBranches()) { branches =>
     @if(branches.length > 0) {
app/views/code/nohead.scala.html
--- app/views/code/nohead.scala.html
+++ app/views/code/nohead.scala.html
@@ -1,6 +1,6 @@
 @(url: String, project: Project)
 
-@main(Messages("Commit History"), project) {
+@main(Messages("Commit History"), project, utils.MenuType.CODE) {
     <ul class="nav nav-tabs">
         <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)">@Messages("code.files")</a></li>
         <a href="@routes.CodeHistoryApp.historyUntilHead(project.owner, project.name)">@Messages("code.commits")</a></li>
app/views/code/svnView.scala.html
--- app/views/code/svnView.scala.html
+++ app/views/code/svnView.scala.html
@@ -1,4 +1,6 @@
-@(url : String, project:Project) @main("코드", project){
+@(url : String, project:Project)
+
+@main("코드", project, utils.MenuType.CODE){
 <ul class="nav nav-tabs">
     <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)">@Messages("Files")</a></li>
     <a href="@routes.CodeHistoryApp.historyUntilHead(project.owner, project.name)">@Messages("Commits")</a></li>
app/views/help/toc.scala.html
--- app/views/help/toc.scala.html
+++ app/views/help/toc.scala.html
@@ -1,6 +1,6 @@
 @(message: String)
 
-@home(message) {
+@home(message, utils.MenuType.HELP) {
 <div class="container page-wrap">
 <div class="page" markdown>
 Help
app/views/home.scala.html
--- app/views/home.scala.html
+++ app/views/home.scala.html
@@ -1,7 +1,7 @@
-@(title: String)(content: Html)
+@(title: String, menuType:utils.MenuType)(content: Html)
 
 @layout(Messages(title))("orange") {
-    @views.html.navbar()
+    @views.html.navbar(menuType)
     <div class="container page-wrap">
         @views.html.alert()
         @content
app/views/index.scala.html
--- app/views/index.scala.html
+++ app/views/index.scala.html
@@ -1,6 +1,6 @@
 @(projects:List[Project]) 
 
-@home("Welcome to nForge") {
+@home("Welcome to nForge", utils.MenuType.SITE_HOME) {
     <div class="page@if(!session.contains("userId")){ full}">
         <div class="center-wrap tag-line-wrap">
             <h1 class="title"><span class="high-light">Open Source</span> N4</h1>
app/views/issue/editIssue.scala.html
--- app/views/issue/editIssue.scala.html
+++ app/views/issue/editIssue.scala.html
@@ -10,7 +10,7 @@
   }
 }
 
-@main(Messages(title), project) {
+@main(Messages(title), project, utils.MenuType.ISSUE) {
 <style>
 @@IMPORT url("/assets/stylesheets/issue.css");
 </style>
app/views/issue/issue.scala.html
--- app/views/issue/issue.scala.html
+++ app/views/issue/issue.scala.html
@@ -14,7 +14,7 @@
     content
   }
 }
-@main(Messages(title),project) {
+@main(Messages(title),project, utils.MenuType.ISSUE) {
 <style>
 @@IMPORT url("/assets/stylesheets/issue.css");
 </style>
app/views/issue/issueError.scala.html
--- app/views/issue/issueError.scala.html
+++ app/views/issue/issueError.scala.html
@@ -1,6 +1,6 @@
 @(message:String, returnURL:Call, project:Project)
 
-@main("Warnning!", project){
+@main("Warnning!", project, utils.MenuType.ISSUE){
 	<div class="alert alert-error">
 	@Messages(message)
 	</div>
app/views/issue/issueList.scala.html
--- app/views/issue/issueList.scala.html
+++ app/views/issue/issueList.scala.html
@@ -35,7 +35,7 @@
 
 }
 
-@main(Messages(title), project){
+@main(Messages(title), project, utils.MenuType.ISSUE){
 <style>
 @@IMPORT url("/assets/stylesheets/issue.css");
 </style>
app/views/issue/newIssue.scala.html
--- app/views/issue/newIssue.scala.html
+++ app/views/issue/newIssue.scala.html
@@ -10,7 +10,7 @@
   }
 }
 
-@main(Messages(title), project) {
+@main(Messages(title), project, utils.MenuType.ISSUE) {
     <style>
     @@IMPORT url("/assets/stylesheets/issue.css");
     </style>
app/views/issue/notExistingPage.scala.html
--- app/views/issue/notExistingPage.scala.html
+++ app/views/issue/notExistingPage.scala.html
@@ -2,7 +2,7 @@
 
 @import helper.twitterBootstrap._
 
-@main(title, project) {
+@main(title, project, utils.MenuType.NONE) {
     <h1>존재하지 않는 게시물 입니다.</h1>
     <a href="@routes.IssueApp.issues(project.owner, project.name, "all")" class="btn">목록으로 가기</a>
 }
app/views/login.scala.html
--- app/views/login.scala.html
+++ app/views/login.scala.html
@@ -1,6 +1,6 @@
 @(message:String, userForm:Form[User])
 
-@home(message) {
+@home(message, utils.MenuType.NONE) {
 <div class="page full">
         <div class="center-wrap tag-line-wrap login">
             <h1 class="title"><span class="high-light">Open Source</span> N4</h1>
app/views/main.scala.html
--- app/views/main.scala.html
+++ app/views/main.scala.html
@@ -1,14 +1,16 @@
-@(title:String, project:Project)(content: Html)
+@(title:String, project:Project, menuType:utils.MenuType)(content: Html)
+
+@import utils._
 
 @layout(Messages(title))("") {
     <header class="gnb-outer">
-      @topmenu(project)
+      @topmenu(project, menuType)
       <div class="sub-menu-sp"></div>
       @sidemenu(project)
     </header>
     <div class="container page-wrap">
       <div class="page">
-	    @views.html.alert()
+	      @views.html.alert()
         @content    
       </div>
     </div>
app/views/navbar.scala.html
--- app/views/navbar.scala.html
+++ app/views/navbar.scala.html
@@ -1,4 +1,11 @@
+@(menuType:utils.MenuType)
+
 @import utils.TemplateHelper._
+@import utils._
+
+@isActiveMenu(m_type:MenuType) = @{
+    if(m_type == menuType){ "selected" }
+}
 
 <header class="gnb-outer">
     <div class="gnb-inner">
@@ -7,13 +14,13 @@
             <a href="@routes.Application.index()" class="logo"></a>
             <ul class="gnb-menus unstyled">
                 <li class="menu">
-                    <a href="@routes.ProjectApp.newProject()">NEW PROJECT</a>
+                    <a href="@routes.ProjectApp.newProject()" class="@isActiveMenu(MenuType.NEW_PROJECT)">NEW PROJECT</a>
                 </li>
                 <li class="menu">
-                    <a href="@routes.ProjectApp.projects()">PROJECTS</a>
+                    <a href="@routes.ProjectApp.projects()" class="@isActiveMenu(MenuType.PROJECTS)">PROJECTS</a>
                 </li>
                 <li class="menu">
-                    <a href="@routes.HelpApp.help()">HELP</a>
+                    <a href="@routes.HelpApp.help()" class="@isActiveMenu(MenuType.HELP)">HELP</a>
                 </li>
             </ul>
             <ul class="gnb-menus right unstyled">
app/views/project/newProject.scala.html
--- app/views/project/newProject.scala.html
+++ app/views/project/newProject.scala.html
@@ -2,7 +2,7 @@
 
 @import playRepository.RepositoryService
 
-@home(title){
+@home(title, utils.MenuType.NEW_PROJECT){
     <div class="page">
         <div class="form-wrap new-project">
             <div class="bread-crumb-wrap">
app/views/project/projectHome.scala.html
--- app/views/project/projectHome.scala.html
+++ app/views/project/projectHome.scala.html
@@ -1,6 +1,6 @@
 @(message: String, project: Project) 
 
-@main(message, project) {
+@main(message, project, utils.MenuType.PROJECT_HOME) {
     @pageTitle(project,"Project Home")
     <div class="bubble-wrap dark-gray project-home">
         <div class="inner logo">
app/views/project/projectMngMain.scala.html
--- app/views/project/projectMngMain.scala.html
+++ app/views/project/projectMngMain.scala.html
@@ -2,7 +2,7 @@
 
 @layout(Messages(title))("") {
     <header class="gnb-outer">
-      @topmenu(project)
+      @topmenu(project, utils.MenuType.PROJECT_SETTING)
       <div class="sub-menu-sp"></div>
       @submenu(title, project)
       @sidemenu(project)
app/views/project/statistics.scala.html
--- app/views/project/statistics.scala.html
+++ app/views/project/statistics.scala.html
@@ -1,5 +1,5 @@
 @(message: String)(project:Project)
 
-@main(message, project) {
+@main(message, project, utils.MenuType.ISSUE) {
     <h1>underconstruction.html</h1>
 }
(No newline at end of file)
app/views/project/unauthorized.scala.html
--- app/views/project/unauthorized.scala.html
+++ app/views/project/unauthorized.scala.html
@@ -1,6 +1,6 @@
 @(project: Project) 
 
-@main("Permission Denied", project) {
+@main("Permission Denied", project, utils.MenuType.NONE) {
     @pageTitle(project,"Project Home")
     <div>Permission Denied</div>
 }
app/views/projectList.scala.html
--- app/views/projectList.scala.html
+++ app/views/projectList.scala.html
@@ -1,6 +1,6 @@
 @(message: String, currentPage: Page[Project], filter:String, allNum:Int, openNum:Int)
 
-@home(message) {
+@home(message, utils.MenuType.PROJECTS) {
   <div class="page">
     <div class="header-wrap">
       <div class="stats-wrap">
app/views/search/contentsSearch.scala.html
--- app/views/search/contentsSearch.scala.html
+++ app/views/search/contentsSearch.scala.html
@@ -1,7 +1,7 @@
 @(title: String, project: Project, filter: String, resultIssues: Page[Issue], resultPosts: Page[Post])
 @import utils.TemplateHelper._
 
-@main(title, project) {
+@main(title, project, utils.MenuType.NONE) {
 <input class="filter" type="hidden" value="@filter" />
 <div class="row">
     <div class="span12">
app/views/site/siteMngMain.scala.html
--- app/views/site/siteMngMain.scala.html
+++ app/views/site/siteMngMain.scala.html
@@ -1,6 +1,6 @@
 @(title: String)(content: Html)
 
-@home(Messages(title)) {
+@home(Messages(title), utils.MenuType.SITE_SETTING) {
     <div class="page full">
         <div class="row-fluid">
             <div class="span2">
app/views/task/taskView.scala.html
--- app/views/task/taskView.scala.html
+++ app/views/task/taskView.scala.html
@@ -1,6 +1,6 @@
 @(project:Project) 
 @import utils.TemplateHelper._
-@main("TaskManager", project){
+@main("TaskManager", project, utils.MenuType.TASK){
 <style>
     @@IMPORT url(@getCSSLink("taskboard"));
 </style>
app/views/topmenu.scala.html
--- app/views/topmenu.scala.html
+++ app/views/topmenu.scala.html
@@ -1,7 +1,12 @@
-@(project:Project)
-@isActiveMenu(call: Call) = @{
-  if(request().uri().toString().equals(call.toString())){"active"}
+@(project:Project, menuType:utils.MenuType)
+
+@import utils._
+
+
+@isActiveMenu(m_type:MenuType) = @{
+    if(m_type == menuType) {"selected"}
 }
+
 @isVisible(resource: models.enumeration.Resource)(content: => Html) = @{
   roleCheck(session.get("userId"), project.id, resource, models.enumeration.Operation.READ){
     content
@@ -15,21 +20,21 @@
             <a href="@routes.Application.index()" class="logo"></a>
             <ul class="gnb-menus unstyled">
                 <li class="menu">
-                    <a href="@routes.ProjectApp.project(project.owner, project.name)">PROJECT HOME</a>
+                    <a href="@routes.ProjectApp.project(project.owner, project.name)" class="@isActiveMenu(MenuType.PROJECT_HOME)">PROJECT HOME</a>
                 </li>
                 @isVisible(models.enumeration.Resource.BOARD_POST){
-                <li class="menu @isActiveMenu(routes.ProjectApp.project(project.owner, project.name))">
-                    <a href="@routes.BoardApp.posts(project.owner, project.name)">BOARD</a>
+                <li class="menu">
+                    <a href="@routes.BoardApp.posts(project.owner, project.name)" class="@isActiveMenu(MenuType.BOARD)">BOARD</a>
                 </li>
                 }
                 @isVisible(models.enumeration.Resource.CODE){
                 <li class="menu">
-                    <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)">CODE</a>
+                    <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)" class="@isActiveMenu(MenuType.CODE)">CODE</a>
                 </li>
                 }
                 @isVisible(models.enumeration.Resource.ISSUE_POST){
                 <li class="menu">
-                    <a href="@routes.IssueApp.issues(project.owner, project.name,"open")">ISSUE</a>
+                    <a href="@routes.IssueApp.issues(project.owner, project.name,"open")" class="@isActiveMenu(MenuType.ISSUE)">ISSUE</a>
                 </li>
                 }
                 @isVisible(models.enumeration.Resource.WIKI_PAGE){
app/views/underconstruction.scala.html
--- app/views/underconstruction.scala.html
+++ app/views/underconstruction.scala.html
@@ -1,5 +1,5 @@
 @(title:String)
 
-@home(title){
+@home(title, utils.MenuType.NONE){
     <h1>underconstruction.html</h1>
 }
(No newline at end of file)
app/views/user/edit.scala.html
--- app/views/user/edit.scala.html
+++ app/views/user/edit.scala.html
@@ -5,7 +5,7 @@
 
 @implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.render) }
  
-@home("Users Info") {
+@home("Users Info", utils.MenuType.USER) {
     @helper.form(action=routes.UserApp.save()){
         @helper.inputText(userForm("email"))
         <div id="picPath">업로드된 파일이 없습니다.</div>
app/views/user/info.scala.html
--- app/views/user/info.scala.html
+++ app/views/user/info.scala.html
@@ -1,6 +1,6 @@
 @(user:User)
 
-@home("Users Info") {
+@home("Users Info", utils.MenuType.USER) {
 <div class="page">
   <div>name : @user.name</div>
   <div>
app/views/user/memberInfo.scala.html
--- app/views/user/memberInfo.scala.html
+++ app/views/user/memberInfo.scala.html
@@ -1,6 +1,6 @@
 @(user:User)
 
-@home("Users Info") {
+@home("Users Info", utils.MenuType.USER) {
 <div class="page">
   <div>name : @user.name</div>
   <div>
app/views/user/signup.scala.html
--- app/views/user/signup.scala.html
+++ app/views/user/signup.scala.html
@@ -1,6 +1,6 @@
 @(message: String, newUserForm: Form[User]) 
 
-@home(message) {
+@home(message, utils.MenuType.NONE) {
     <div class="page full">
         <div class="center-wrap tag-line-wrap signup">
             <h1 class="title"><span class="high-light">Sign Up For</span> N4</h1>
Add a comment
List