BlueMir 2012-11-29
apply markup : codeBrowser because main.scala.html, many files changed. it's not perfectly work. but it's working.
because main.scala.html, many files changed.
it's not perfectly work. but it's working.
@af28ddb7910be7e19ce117644ca1281b684737ca
app/controllers/CodeApp.java
--- app/controllers/CodeApp.java
+++ app/controllers/CodeApp.java
@@ -11,7 +11,9 @@
 import play.mvc.Result;
 import playRepository.RepositoryService;
 import utils.Config;
+import play.Logger;
 import views.html.code.codeView;
+import views.html.code.nohead;
 
 import javax.servlet.ServletException;
 import java.io.IOException;
@@ -25,6 +27,9 @@
         if (RepositoryService.VCS_GIT.equals(project.vcs)) {
             String msg = "Clone this Repository : git clone " + CodeApp.getURL(userName, projectName);
             List<String> branches = RepositoryService.getRepository(project).getBranches();
+            if(branches.size() == 0){
+                return ok(nohead.render("no Head", project));
+            }
             return ok(codeView.render(msg, project, branches));
         } else if (RepositoryService.VCS_SUBVERSION.equals(project.vcs)) {
             String msg = "Check out Repository : svn checkout " + CodeApp.getSvnURL(userName, projectName);
app/views/board/editPost.scala.html
--- app/views/board/editPost.scala.html
+++ app/views/board/editPost.scala.html
@@ -5,6 +5,7 @@
 @implicitField = @{ helper.FieldConstructor(simpleForm) }
 
 @main(title, project, utils.MenuType.BOARD) {
+<div class="page">
   @pageTitle(project,"Board")
   <div class="content-wrap">
     
@@ -61,10 +62,13 @@
       </div>
     }
   </div>
-  <script>nforge.require("board.vaildate");</script>
+</div>
 
-  @views.html.markdown()
-  <script type="text/javascript">
-    nforge.require('shortcut.submit');
-  </script>
+<script>nforge.require("board.vaildate");</script>
+
+@views.html.markdown()
+<script type="text/javascript">
+  nforge.require('shortcut.submit');
+</script>
+
 }
app/views/board/newPost.scala.html
--- app/views/board/newPost.scala.html
+++ app/views/board/newPost.scala.html
@@ -4,7 +4,8 @@
 @implicitField = @{ helper.FieldConstructor(simpleForm) }
 
 @main(title, project, utils.MenuType.BOARD) {
-@pageTitle(project,"Board")
+<div class="page">
+  @pageTitle(project,"Board")
   <div class="content-wrap">
     
     @helper.form(action=routes.BoardApp.savePost(project.owner, project.name), 'enctype -> "multipart/form-data", 'class->"nm"){
@@ -60,11 +61,11 @@
       </div>
     }
   </div>
+</div>
+<script>nforge.require("board.vaildate");</script>
 
-  <script>nforge.require("board.vaildate");</script>
-
-  @views.html.markdown()
-  <script type="text/javascript">
-  nforge.require('shortcut.submit');
-  </script>
+@views.html.markdown()
+<script type="text/javascript">
+nforge.require('shortcut.submit');
+</script>
 }
app/views/board/post.scala.html
--- app/views/board/post.scala.html
+++ app/views/board/post.scala.html
@@ -5,138 +5,139 @@
 @implicitField = @{ helper.FieldConstructor(simpleForm) }
 
 @main("상세보기", project, utils.MenuType.BOARD){
-@pageTitle(project,"Board")
-<div class="board-header">
-  <div class="board-id div">@post.id</div>
-  <h1 class="title div">@post.title</h1>
-  <div class="date div">@utils.TemplateHelper.agoString(post.ago())</div>
-</div>
-<div class="board-body">
-  <div class="author-info">
-    <a href="@routes.UserApp.userInfo(post.authorName)" class="pull-left img-rounded"><img src="/assets/images/default-avatar-34.png" class="media-object" width="32" height="32" alt="avatar"></a>
-    <div class="media-body">
-      <p>
-        <a href="@routes.UserApp.userInfo(post.authorName)"><strong>@post.authorName</strong></a> <!--<span class="name">(Loren Brichter)</span>-->
-      </p>
-      <p class="status">
-        <!--Hit <strong class="num">777</strong> -->Comment <strong class="num">@post.commentCount</strong><!-- Like <i class="ico ico-like-small"></i> <strong class="num">522</strong>-->
-      </p>
-        </div>
-    </div>
-    <div class="content" markdown resourceType=@Resource.BOARD_POST resourceId="@post.id">@post.contents</div>
-    <!--
-    <ul class="attaches wm">
-      <li class="attach"><i class="ico ico-clip"></i>K23.png (11KB)</li>
-      <li class="attach"><i class="ico ico-clip"></i>K23.png (11KB)</li>
-      <li class="attach"><i class="ico ico-clip"></i>K23.png (11KB)</li>
-    </ul>-->
-</div>
-<div class="board-comment-wrap">
-  <div class="comment-header"><strong>Comment</strong> <strong class="num">5</strong></div>
-  <ul class="comments">
-    @for(comment <-post.comments){
-    <li class="comment">
-      <a href="@routes.UserApp.userInfo(comment.authorName)" class="pull-left img-rounded"><img src="/assets/images/default-avatar-34.png" width="32" height="32" class="media-object" alt="avatar"></a>
+<div class="page board-view">
+  @pageTitle(project,"Board")
+  <div class="board-header">
+    <div class="board-id div">@post.id</div>
+    <h1 class="title div">@post.title</h1>
+    <div class="date div">@utils.TemplateHelper.agoString(post.ago())</div>
+  </div>
+  <div class="board-body">
+    <div class="author-info">
+      <a href="@routes.UserApp.userInfo(post.authorName)" class="pull-left img-rounded"><img src="/assets/images/default-avatar-34.png" class="media-object" width="32" height="32" alt="avatar"></a>
       <div class="media-body">
-        @roleCheck(session.get("userId"), project.id, Resource.BOARD_COMMENT, Operation.DELETE, comment.id){
-        <a class="pull-right close" href="@routes.BoardApp.deleteComment(project.owner, project.name, post.id, comment.id)">&times;</a>
-        }
-          <p class="commenter"><a href="@routes.UserApp.userInfo(comment.authorName)"><strong>@comment.authorName</strong></a><!-- <span class="name">(Sam sstephenson)</span> --> <span class="date">@utils.TemplateHelper.agoString(post.ago())</span></p>
-          <div class="comment-body" markdown resourceType=@Resource.BOARD_COMMENT resourceId=@comment.id>@comment.contents</div>
-          <!--
-          <ul class="attaches">
-              <li class="attach"><i class="ico ico-clip"></i><a href="/file-down">첨부파일(iabcde-test.exe) <i class="ico ico-blue-dot"></i> Donwload</a></li>
-          </ul>-->
-      </div>
-    </li>
-    }
-  </ul>
-    @roleCheck(session.get("userId"), project.id, Resource.BOARD_COMMENT, Operation.WRITE){
-    <div class="write-comment-box">
-      @helper.form(routes.BoardApp.saveComment(project.owner, project.name, post.id), 'class->"nm", 'enctype -> "multipart/form-data"){
-        <div class="write-comment-wrap">
-          <!-- when the user signed in..
-          <textarea class="text comment" name="comment></textarea>
-          -->
-          <style>
-          .write-comment-wrap div[div=preview] {
-            font-size: 12px;
-             width : 729px; 
-             min-height: 80px; 
-             margin:0px; 
-             display: inline-block;
-             vertical-align : middle;
-           }
-          .write-comment-wrap div{font-size: 10px;}
-          </style>
-          @helper.textarea(commentForm("contents"), 'placeholder->"로그인 후 댓글 입력이 가능합니다.", 'class->"text comment", 'markdown->true)
-          <button class="comment-btn">COMMENT</button>
-          <div class="file-attachment"></div>
-        </div>
-        <!--
-        <div class="attach-wrap">
-          <div class="thumb-wrap">
-            <img src="/images/default-avatar-34.png" class="img-rounded" width="32" height="32" alt="avatar">
+        <p>
+          <a href="@routes.UserApp.userInfo(post.authorName)"><strong>@post.authorName</strong></a> <!--<span class="name">(Loren Brichter)</span>-->
+        </p>
+        <p class="status">
+          <!--Hit <strong class="num">777</strong> -->Comment <strong class="num">@post.commentCount</strong><!-- Like <i class="ico ico-like-small"></i> <strong class="num">522</strong>-->
+        </p>
           </div>
-          <div class="attach-info-wrap">
-            <div>
-              <span class="progress-num">15%</span>
-              <span class="sp-line">&nbsp;</span>
-              <strong>total</strong>
-              <span class="total-num">50MB</span>
+      </div>
+      <div class="content" markdown resourceType=@Resource.BOARD_POST resourceId="@post.id">@post.contents</div>
+      <!--
+      <ul class="attaches wm">
+        <li class="attach"><i class="ico ico-clip"></i>K23.png (11KB)</li>
+        <li class="attach"><i class="ico ico-clip"></i>K23.png (11KB)</li>
+        <li class="attach"><i class="ico ico-clip"></i>K23.png (11KB)</li>
+      </ul>-->
+  </div>
+  <div class="board-comment-wrap">
+    <div class="comment-header"><strong>Comment</strong> <strong class="num">@post.comments.size()</strong></div>
+    <ul class="comments">
+      @for(comment <-post.comments){
+      <li class="comment">
+        <a href="@routes.UserApp.userInfo(comment.authorName)" class="pull-left img-rounded"><img src="/assets/images/default-avatar-34.png" width="32" height="32" class="media-object" alt="avatar"></a>
+        <div class="media-body">
+          @roleCheck(session.get("userId"), project.id, Resource.BOARD_COMMENT, Operation.DELETE, comment.id){
+          <a class="pull-right close" href="@routes.BoardApp.deleteComment(project.owner, project.name, post.id, comment.id)">&times;</a>
+          }
+            <p class="commenter"><a href="@routes.UserApp.userInfo(comment.authorName)"><strong>@comment.authorName</strong></a><!-- <span class="name">(Sam sstephenson)</span> --> <span class="date">@utils.TemplateHelper.agoString(post.ago())</span></p>
+            <div class="comment-body" markdown resourceType=@Resource.BOARD_COMMENT resourceId=@comment.id>@comment.contents</div>
+            <!--
+            <ul class="attaches">
+                <li class="attach"><i class="ico ico-clip"></i><a href="/file-down">첨부파일(iabcde-test.exe) <i class="ico ico-blue-dot"></i> Donwload</a></li>
+            </ul>-->
+        </div>
+      </li>
+      }
+    </ul>
+      @roleCheck(session.get("userId"), project.id, Resource.BOARD_COMMENT, Operation.WRITE){
+      <div class="write-comment-box">
+        @helper.form(routes.BoardApp.saveComment(project.owner, project.name, post.id), 'class->"nm", 'enctype -> "multipart/form-data"){
+          <div class="write-comment-wrap">
+            <!-- when the user signed in..
+            <textarea class="text comment" name="comment></textarea>
+            -->
+            <style>
+            .write-comment-wrap div[div=preview] {
+              font-size: 12px;
+               width : 729px; 
+               min-height: 80px; 
+               margin:0px; 
+               display: inline-block;
+               vertical-align : middle;
+             }
+            .write-comment-wrap div{font-size: 10px;}
+            </style>
+            @helper.textarea(commentForm("contents"), 'placeholder->"로그인 후 댓글 입력이 가능합니다.", 'class->"text comment", 'markdown->true)
+            <button class="comment-btn">COMMENT</button>
+            <div class="file-attachment"></div>
+          </div>
+          <!--
+          <div class="attach-wrap">
+            <div class="thumb-wrap">
+              <img src="/images/default-avatar-34.png" class="img-rounded" width="32" height="32" alt="avatar">
             </div>
-            <div class="progress-wrap">
-              <div class="progress n4">
-                <div class="bar orange" style="width: 40%;"></div>
+            <div class="attach-info-wrap">
+              <div>
+                <span class="progress-num">15%</span>
+                <span class="sp-line">&nbsp;</span>
+                <strong>total</strong>
+                <span class="total-num">50MB</span>
+              </div>
+              <div class="progress-wrap">
+                <div class="progress n4">
+                  <div class="bar orange" style="width: 40%;"></div>
+                </div>
+              </div>
+              <a href="#!/cancel"><i class="ico btn-cancel"></i></a>
+            </div>
+            <div class="btn-wrap">
+              <div class="ns-btn fake-file-wrap"><i class="ico ico-plus-blue"></i>UPLOAD
+                <input type="file" class="file">
               </div>
             </div>
-            <a href="#!/cancel"><i class="ico btn-cancel"></i></a>
           </div>
-          <div class="btn-wrap">
-            <div class="ns-btn fake-file-wrap"><i class="ico ico-plus-blue"></i>UPLOAD
-              <input type="file" class="file">
-            </div>
-          </div>
-        </div>
-        -->
-      }
-        <!--<div class="attached-files-wrap">
-          <ul class="attached-files">
-            <li class="attached-file"><strong>test-image.jpg(15MB)</strong><a href="#!/delete-attached-file" class="attached-delete"><i class="ico btn-delete"></i></a></li>
-            <li class="attached-file"><strong>test-image.jpg(15MB)</strong><a href="#!/delete-attached-file" class="attached-delete"><i class="ico btn-delete"></i></a></li>
-            <li class="attached-file"><strong>test-image.jpg(15MB)</strong><a href="#!/delete-attached-file" class="attached-delete"><i class="ico btn-delete"></i></a></li>
-          </ul>
-        </div>-->
+          -->
+        }
+          <!--<div class="attached-files-wrap">
+            <ul class="attached-files">
+              <li class="attached-file"><strong>test-image.jpg(15MB)</strong><a href="#!/delete-attached-file" class="attached-delete"><i class="ico btn-delete"></i></a></li>
+              <li class="attached-file"><strong>test-image.jpg(15MB)</strong><a href="#!/delete-attached-file" class="attached-delete"><i class="ico btn-delete"></i></a></li>
+              <li class="attached-file"><strong>test-image.jpg(15MB)</strong><a href="#!/delete-attached-file" class="attached-delete"><i class="ico btn-delete"></i></a></li>
+            </ul>
+          </div>-->
+      </div>
+    }
+  </div>
+  <div class="board-footer">
+      <!--<a href="/add-notification" class="add-btn"><i class="ico ico-plus-blue"></i>자동알림추가</a>-->
+      <a href="@routes.BoardApp.posts(project.owner, project.name)" class="n-btn gray small">LIST</a>
+      @roleCheck(session.get("userId"), project.id, Resource.BOARD_POST, Operation.DELETE){
+      <a data-toggle="modal" href="#deleteConfirm" class="n-btn gray small">DELETE</a>
+    }
+      @roleCheck(session.get("userId"), project.id, Resource.BOARD_POST, Operation.EDIT){
+      <a href="@routes.BoardApp.editPost(project.owner, project.name, post.id)" class="n-btn blue small">EDIT</a>
+    }
+  </div>
+
+  <!--삭제확인상자-->
+  <div class="modal hide fade" id="deleteConfirm">
+    <div class="modal-header">
+      <button type="button" class="close" data-dismiss="modal">×</button>
+      <h3>확인</h3>
     </div>
-  }
-</div>
-<div class="board-footer">
-    <!--<a href="/add-notification" class="add-btn"><i class="ico ico-plus-blue"></i>자동알림추가</a>-->
-    <a href="@routes.BoardApp.posts(project.owner, project.name)" class="n-btn gray small">LIST</a>
-    @roleCheck(session.get("userId"), project.id, Resource.BOARD_POST, Operation.DELETE){
-    <a data-toggle="modal" href="#deleteConfirm" class="n-btn gray small">DELETE</a>
-  }
-    @roleCheck(session.get("userId"), project.id, Resource.BOARD_POST, Operation.EDIT){
-    <a href="@routes.BoardApp.editPost(project.owner, project.name, post.id)" class="n-btn blue small">EDIT</a>
-  }
-</div>
-
-<!--삭제확인상자-->
-<div class="modal hide fade" id="deleteConfirm">
-  <div class="modal-header">
-    <button type="button" class="close" data-dismiss="modal">×</button>
-    <h3>확인</h3>
-  </div>
-  <div class="modal-body">
-    <p>게시글이 삭제되며 영원히 복구할수 없습니다.</p>
-    <p>그래도 삭제하시겠습니까?</p>
-  </div>
-  <div class="modal-footer">
-    <a class="btn btn-primary" href="@routes.BoardApp.deletePost(project.owner, project.name, post.id)">예</a>
-    <a href="#" class="btn" data-dismiss="modal">아니오</a>
+    <div class="modal-body">
+      <p>게시글이 삭제되며 영원히 복구할수 없습니다.</p>
+      <p>그래도 삭제하시겠습니까?</p>
+    </div>
+    <div class="modal-footer">
+      <a class="btn btn-primary" href="@routes.BoardApp.deletePost(project.owner, project.name, post.id)">예</a>
+      <a href="#" class="btn" data-dismiss="modal">아니오</a>
+    </div>
   </div>
 </div>
-
 @views.html.markdown()
 <script type="text/javascript">
   nforge.require('shortcut.submit');
app/views/board/postList.scala.html
--- app/views/board/postList.scala.html
+++ app/views/board/postList.scala.html
@@ -16,6 +16,7 @@
 }
 
 @main(title, project, utils.MenuType.BOARD) {
+<div class="page">
   @pageTitle(project,"Board")
   <div class="header-wrap">
     <div class="search-wrap board">
@@ -76,6 +77,7 @@
   </div>
   }
   @pagination(page, 5, "pagination")
+</div>
   <script type="text/javascript">
   nforge.require('board.list');
   </script>
app/views/code/codeView.scala.html
--- app/views/code/codeView.scala.html
+++ app/views/code/codeView.scala.html
@@ -1,196 +1,94 @@
 @(msg : String, project:Project, branches:List[String])
 
 @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>
-</ul>
-
-<div class="well">@msg</div>
-<div class="row" id="codeBrowser">
-    <div class="span3">
-        <ul id="codeRoot" class="well nav nav-list">
-            <li id="codeBrowserHeader"><a href="#">코드 탐색기</a></li>
+<div class="page code-browse">
+  @pageTitle(project, "Code Browser")
+  <ul class="nav nav-tabs code-tab">
+    <li class="active">
+      <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)">@Messages("Files")</a>
+    </li>
+    <li>
+      <a href="@routes.CodeHistoryApp.historyUntilHead(project.owner, project.name)">@Messages("Commits")</a>
+    </li>
+  </ul>
+  <span id="breadcrumbs">Breadcrumbs</span>
+  <div class="bubble-wrap gray">
+    <div class="inner-bubble repo-info">
+      <strong class="clone-label">CLONE THIS REPOSITORY</strong>
+      <input type="text" class="text repo-url" readonly value="@msg"><a href="#!/copy-url" class="copy-btn">COPY TO CLIPBOARD</a>
+      <div class="btn-group">
+        <button data-toggle="dropdown" class="btn dropdown-toggle d-label">HEAD</button>
+        <button data-toggle="dropdown" class="btn dropdown-toggle"><span class="caret"></span></button>
+        <ul class="dropdown-menu">
+          @for(name <- branches){
+          <li><a href="">@name</a></li>
+          }
         </ul>
+      </div>
     </div>
-    <div class="span9" >
-        <div>
-            <span id="breadcrumbs">Breadcrumbs</span>
-            <span>
-                <select id="branchSelector">
-                    @for(name <- branches){
-                        <option>@name</option>
-                    }
-                </select>
-            </span>
-        </div>
-        <div id="folderView">
-            <table class="table table-bordered">
-                <thead>
-                    <tr>
-                        <th>FileName</th>
-                        <th>Commit Message</th>
-                        <th>Commit Date</th>
-                        <th>Author</th>
-                    </tr>
-                </thead>
-                <tbody>
-                </tbody>
-            </table>
-        </div>
+    <hr class="double-sp"/>
+    <div class="code-browse-wrap">
+      <div class="code-browse-header">리비전 619e11d0dcae4fa88b56f94d1462faa566e82e16</div>
+      <div class="directory-wrap cell">
+        <div class="directory-header"><strong>FOLDER NAME</strong></div>
+        <!-- note..
+            depth : 20px + (depth * 5);
+            start depth : 0
+            first folder : 20 + (1 * 5 ) = 25px;
+            second folder : 20 + (2 * 5 ) = 30px;
+         -->
+        <ul class="directories" id="folderNav">
+          <li class="directory" data-path="/"><a href="#/"><i class="ico btn-folder open"></i>/</a></li>
+          <!--
+          <li class="directory selected" style="padding-left: 25px;"><a href="#!/folder" data-path="html"><i class="ico btn-folder closed"></i>html</a></li>
+          <li class="directory" style="padding-left: 25px;"><a href="#!/folder" data-path="images"><i class="ico btn-folder closed"></i>images</a></li>
+          <li class="directory" style="padding-left: 25px;"><a href="#!/folder" data-path="javascript"><i class="ico btn-folder closed"></i>javaspript</a></li>
+          <li class="directory" style="padding-left: 25px;"><a href="#!/folder" data-path="psd"><i class="ico btn-folder closed"></i>psd</a></li>
+          <li class="directory" style="padding-left: 25px;"><a href="#!/folder" data-path="stylesheets"><i class="ico btn-folder closed"></i>stylesheets</a></li>-->
+        </ul>
+      </div>
+      <div class="sp-wrap cell"></div>
+      <div class="file-wrap cell">
+        <table class="code-table sources" id="folderView">
+          <thead class="thead">
+            <tr>
+              <td class="filename"><strong>FILENAME</strong></td>
+              <td class="messages"><strong>COMMIT MESSAGES</strong></td>
+              <td class="date"><strong>COMMIT DATE</strong></td>
+              <td class="author"><strong>AUTHOR</strong></td>
+            </tr>
+          </thead>
+          <tbody class="tbody">
+            <tr>
+              <td class="filename"><a href="/code-file.html?filenema=gitignore">.gitignore</a></td>
+              <td class="messages"><a href="/code-commit.html?id=xxxx">fix bug</a></td>
+              <td class="date">5 days ago</td>
+              <td class="author"><a href="/uname" class="img-rounded"><img src="/images/default-avatar-34.png" width="32" height="32" alt="avatar"></a></td>
+            </tr>
+          </tbody>
+        </table>
         <div id="codeView" class="hide">
-            <div>
-                <span id="commiter"></span> | <span id="commitDate"></span> | <span id="commitMessage"></span>
-                <span class="pull-right"><a id="rawCode" class="btn btn-mini" target="_blank">Raw</a></span>
-            </div>
-            <hr />
-            <div>
-                <pre><code style="overflow:hidden"></code></pre>
-            </div>
+          <div>
+            <span id="commiter"></span> | <span id="commitDate"></span> | <span id="commitMessage"></span>
+            <span class="pull-right"><a id="rawCode" class="btn btn-mini" target="_blank">Raw</a></span>
+          </div>
+          <hr />
+          <div>
+            <pre><code style="overflow:hidden"></code></pre>
+          </div>
         </div>
-        
+      </div>
     </div>
-    
+  </div>
 </div>
-<div id="codeError" class="hide row">
-    <div class="well span12">
-        <p>HEAD커밋이 존재하지 않습니다. 다음과 같은 방법을 시도해 보세요</p>
-        <pre><code>@msg 
-touch readme.md
-git add readme.md
-git commit -m "init"
-git push origin master</code></pre>
-    </div>
-</div>
+
+
+
 <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>
 <style>
 @@IMPORT url("/assets/stylesheets/hljsstyles/googlecode.css");
 </style>
-<script>
-    $(document).ready(function(){      
-        $(window).bind('hashchange', function(e){
-          //대기 표시 한다.
-          //여기서 요청을 보내고
-          var path = getHash().replace(/^#/, "");
-          
-          $.ajax("code/!" + path, {
-            datatype : "json",
-            success : function(data, textStatus, jqXHR){
-              updateBreadcrumbs(path);
-              updateNav(path);
-              switch(data.type){
-                case "file" :
-                    handleFile(data);
-                  break;
-                case "folder" :
-                    handleFolder(data);
-                  break;
-              }
-            }
-          });
-          function handleFile(data){
-              //파일을 표시한다.
-              $("#commiter").text(data.author);
-              $("#commitMessage").text(data.msg);
-              $("#commitDate").text(data.date);
-              $("code").text(data.data);
-              $("#rawCode").attr("href", path.replace(/\/!/, ""));//TODO 현재 동작하지 않음.
-              
-              $("#folderView").hide();
-              $("#codeView").show();
-              $("code").highlight();
-          }
-          function handleFolder(data){
-              //폴더내용을 리스팅 한다.
-              $("#commiter").text(data.author);
-              $("#commitMessage").text(data.msg);
-              $("#commitDate").text(data.date);
-              
-              $("tbody").children().remove();
-              
-              for(var name in data.data){
-                var info = data.data[name];
-                var tablerow = makeTableRow(name, info.msg, info.date, info.author);
-                $("tbody").append(tablerow);
-              }
-
-              $("#folderView").show();
-              $("#codeView").hide();
-          }
-          function makeTableRow(name, message, date, author){
-            return $("<tr>")
-                .append(
-                    $("<td>").append(
-                        $("<a>").text(name).attr("href", "#" + (path !== "/" ? path : "") + "/" +name)
-                        )
-                    )
-                .append($("<td>").text(message))
-                .append($("<td>").text(date))
-                .append($("<td>").text(author));
-          }
-          function updateBreadcrumbs(path){
-            var $breadcrumbs = $("#breadcrumbs");
-            $($breadcrumbs).html('<a href="#/">/</a>');
-                        
-            var names = path.split("/");
-            var str = "#"
-            for(var i = 1; i < names.length; i++){
-              var name = names[i];
-              str += "/" + name;
-              $breadcrumbs.append(" &gt; ");
-              $("<a>").text(name).attr("href", str).appendTo($breadcrumbs);
-            }
-          }
-        });
-        $(window).trigger('hashchange');
-    });
-    
-    function getHash(){
-        //혹시 있을지도 모를 호완성을 위해.
-        return location.hash;
-        
-    }
-    function setHash(hash){
-        return location.hash = hash;
-    }
-    var stack = [];
-    function updateNav(path){
-        $.ajax("code/!" + path, {
-            success : function(data, textStatus, jqXHR){
-                data.path = path;
-                stack.push(data);
-                var $codeRoot = $("#codeRoot");
-                var $a = $codeRoot.find("li a[href='#"+ path +"']");
-                if($a.length !== 0) {
-                    stackTrace(stack);
-                } else {
-                    updateNav(path.substr(0, path.lastIndexOf("/")));
-                } 
-            }
-        });
-    }
-    function stackTrace(stack){
-        while(stack.length !== 0) {
-             var data = stack.pop();
-             if(data.type === "file") continue;
-             
-             var $ul = $("<ul>").addClass("nav nav-list");
-             for(var name in data.data){
-                if(data.data[name].type  !== "folder") continue;
-                
-                var $li = $("<li>");
-                $("<a>").attr("href", "#" + data.path + "/" + name).text(name).appendTo($li);
-                $li.appendTo($ul);
-             }
-             var parentStr = data.path.substr(0, data.path.lastIndexOf("/"));
-             $("#codeRoot").find("li a[href='#" + data.path + "']").parent().after($ul);
-        }
-    }
-    
-    $("#branchSelector option").click(function(){
-        alert($(this).text());
-    });
-    </script>
-}
(No newline at end of file)
+<script src="/assets/javascripts/code.js"></script>
+}
app/views/code/diff.scala.html
--- app/views/code/diff.scala.html
+++ app/views/code/diff.scala.html
@@ -1,6 +1,7 @@
 @(project: Project, patch: String)
 
 @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/history.scala.html
--- app/views/code/history.scala.html
+++ app/views/code/history.scala.html
@@ -4,7 +4,7 @@
 @import java.net.URLEncoder
 
 @main(Messages("title.commitHistory"), project, utils.MenuType.CODE) {
-
+<div class="page">
 @defining(RepositoryService.getRepository(project).getBranches()) { branches =>
     @if(branches.length > 0) {
         <select id="branch" name="branch">
@@ -15,6 +15,7 @@
             }
         </select>
     }
+
 }
 
 @defining(
@@ -58,5 +59,5 @@
         </script>
     }
 }
-
+</div>
 }
app/views/code/nohead.scala.html
--- app/views/code/nohead.scala.html
+++ app/views/code/nohead.scala.html
@@ -1,12 +1,17 @@
 @(url: String, project: 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>
-    </ul>
+<div class="page">
+  <ul class="nav nav-tabs code-tab">
+    <li>
+      <a href="@routes.CodeApp.codeBrowser(project.owner, project.name)">@Messages("Files")</a>
+    </li>
+    <li class="active">
+      <a href="@routes.CodeHistoryApp.historyUntilHead(project.owner, project.name)">@Messages("Commits")</a>
+    </li>
+  </ul>
 
-    <div id="codeError" class="row">
+    <div id="codeError" class="row-fluid">
         <div class="well span12">
             <p>HEAD커밋이 존재하지 않습니다. 다음과 같은 방법을 시도해 보세요</p>
             <pre><code>git clone @url
@@ -16,4 +21,5 @@
 git push origin master</code></pre>
         </div>
     </div>
+</div>
 }
app/views/issue/editIssue.scala.html
--- app/views/issue/editIssue.scala.html
+++ app/views/issue/editIssue.scala.html
@@ -11,6 +11,8 @@
 }
 
 @main(Messages(title), project, utils.MenuType.ISSUE) {
+<div class="page">
+
 <style>
 @@IMPORT url("/assets/stylesheets/issue.css");
 </style>
@@ -91,4 +93,5 @@
     }
   });
 </script>
+</div>
 }
app/views/issue/issue.scala.html
--- app/views/issue/issue.scala.html
+++ app/views/issue/issue.scala.html
@@ -15,6 +15,7 @@
   }
 }
 @main(Messages(title),project, utils.MenuType.ISSUE) {
+<div class="page">
 <style>
 @@IMPORT url("/assets/stylesheets/issue.css");
 </style>
@@ -162,4 +163,5 @@
     }
   });
 </script>
+</div>
 }
app/views/issue/issueError.scala.html
--- app/views/issue/issueError.scala.html
+++ app/views/issue/issueError.scala.html
@@ -1,8 +1,12 @@
 @(message:String, returnURL:Call, project:Project)
 
 @main("Warnning!", project, utils.MenuType.ISSUE){
+<div class="page">
+
 	<div class="alert alert-error">
 	@Messages(message)
 	</div>
     <a class="btn" href="@returnURL">돌아가기</a>
+</div>
+
 }
(No newline at end of file)
app/views/issue/issueList.scala.html
--- app/views/issue/issueList.scala.html
+++ app/views/issue/issueList.scala.html
@@ -36,6 +36,8 @@
 }
 
 @main(Messages(title), project, utils.MenuType.ISSUE){
+<div class="page">
+
 <style>
 @@IMPORT url("/assets/stylesheets/issue.css");
 </style>
@@ -109,4 +111,5 @@
   nforge.require('issue.label', '@routes.IssueLabelApp.getAll(project.owner, project.name)', '@routes.IssueLabelApp.post(project.owner, project.name)', {editable: true});
   nforge.require('issue.list');
 </script>
+</div>
 }
app/views/issue/newIssue.scala.html
--- app/views/issue/newIssue.scala.html
+++ app/views/issue/newIssue.scala.html
@@ -11,6 +11,7 @@
 }
 
 @main(Messages(title), project, utils.MenuType.ISSUE) {
+<div class="page">
     <style>
     @@IMPORT url("/assets/stylesheets/issue.css");
     </style>
@@ -75,4 +76,5 @@
   nforge.require('shortcut.submit');
   nforge.require('issue.label', '@routes.IssueLabelApp.getAll(project.owner, project.name)', '@routes.IssueLabelApp.post(project.owner, project.name)');
 </script>
+</div>
 }
app/views/issue/notExistingPage.scala.html
--- app/views/issue/notExistingPage.scala.html
+++ app/views/issue/notExistingPage.scala.html
@@ -3,6 +3,8 @@
 @import helper.twitterBootstrap._
 
 @main(title, project, utils.MenuType.NONE) {
+<div class="page">
     <h1>존재하지 않는 게시물 입니다.</h1>
     <a href="@routes.IssueApp.issues(project.owner, project.name, "all")" class="btn">목록으로 가기</a>
+</div>
 }
app/views/main.scala.html
--- app/views/main.scala.html
+++ app/views/main.scala.html
@@ -3,20 +3,18 @@
 @import utils._
 
 @layout(Messages(title))("") {
-    <header class="gnb-outer">
-      @topmenu(project, menuType)
-      <div class="sub-menu-sp"></div>
-      @sidemenu(project)
-    </header>
-    <div class="container page-wrap">
-      <div class="page">
-	      @views.html.alert()
-        @content    
-      </div>
+  <header class="gnb-outer">
+    @topmenu(project, menuType)
+    <div class="sub-menu-sp"></div>
+    @sidemenu(project)
+  </header>
+  <div class="container page-wrap">
+    @views.html.alert()
+    @content
+  </div>
+  <footer class="page-footer-outer">
+    <div class="page-footer">
+      <span class="provider">Powered by <strong>nFORGE.</strong></span>
     </div>
-    <footer class="page-footer-outer">
-        <div class="page-footer">
-            <span class="provider">Powered by <strong>nFORGE.</strong></span>
-        </div>
-    </footer>  
+  </footer>
 }
(No newline at end of file)
app/views/project/projectHome.scala.html
--- app/views/project/projectHome.scala.html
+++ app/views/project/projectHome.scala.html
@@ -1,6 +1,7 @@
 @(message: String, project: Project) 
 
 @main(message, project, utils.MenuType.PROJECT_HOME) {
+<div class="page">
     @pageTitle(project,"Project Home")
     <div class="bubble-wrap dark-gray project-home">
         <div class="inner logo">
@@ -64,7 +65,7 @@
            </div>
         </div>
         }
+  @views.html.markdown()
     </div>
-
-@views.html.markdown()
+</div>
 }
app/views/project/statistics.scala.html
--- app/views/project/statistics.scala.html
+++ app/views/project/statistics.scala.html
@@ -1,5 +1,7 @@
 @(message: String)(project:Project)
 
 @main(message, project, utils.MenuType.ISSUE) {
+<div class="page">
     <h1>underconstruction.html</h1>
+</div>
 }
(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,9 @@
 @(project: Project) 
 
 @main("Permission Denied", project, utils.MenuType.NONE) {
+<div class="page">
+
     @pageTitle(project,"Project Home")
     <div>Permission Denied</div>
+</div>
 }
app/views/search/contentsSearch.scala.html
--- app/views/search/contentsSearch.scala.html
+++ app/views/search/contentsSearch.scala.html
@@ -2,6 +2,8 @@
 @import utils.TemplateHelper._
 
 @main(title, project, utils.MenuType.NONE) {
+<div class="page">
+
 <input class="filter" type="hidden" value="@filter" />
 <div class="row">
     <div class="span12">
@@ -66,4 +68,5 @@
     </div>
 </div>
 <script type="text/javascript">nforge.require('pages.contentSearch');</script>
+</div>
 }
(No newline at end of file)
app/views/task/taskView.scala.html
--- app/views/task/taskView.scala.html
+++ app/views/task/taskView.scala.html
@@ -1,6 +1,7 @@
 @(project:Project) 
 @import utils.TemplateHelper._
 @main("TaskManager", project, utils.MenuType.TASK){
+<div class="page">
 <style>
     @@IMPORT url(@getCSSLink("taskboard"));
 </style>
@@ -183,4 +184,5 @@
 <script type="text/javascript" src="http://underscorejs.org/underscore.js"></script>
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
 <script type="text/javascript" src="https://raw.github.com/angular-ui/angular-ui/master/build/angular-ui.min.js"></script>
+</div>
 }
 
public/javascripts/code.js (added)
+++ public/javascripts/code.js
@@ -0,0 +1,173 @@
+$(document).ready(function(){      
+      $(window).bind('hashchange', function(e){
+        //대기 표시 한다.
+        //여기서 요청을 보내고
+        var path = getHash().replace(/^#/, "");
+        
+        $.ajax("code/!" + path, {
+          datatype : "json",
+          success : function(data, textStatus, jqXHR){
+            updateBreadcrumbs(path);
+            updateNav(path);
+            switch(data.type){
+              case "file" :
+                  handleFile(data);
+                break;
+              case "folder" :
+                  handleFolder(data);
+                break;
+            }
+          },
+          error : function(){
+            $("#codeError").show();
+          }
+        });
+        function handleFile(data){
+            //파일을 표시한다.
+            $("#commiter").text(data.author);
+            $("#commitMessage").text(data.msg);
+            $("#commitDate").text(data.date.substr(0,3));
+            $("code").text(data.data);
+            $("#rawCode").attr("href", path.replace(/\/!/, ""));//TODO 현재 동작하지 않음.
+            
+            $("#folderView").hide();
+            $("#codeView").show();
+            $("code").highlight();
+        }
+        function handleFolder(data){
+            //폴더내용을 리스팅 한다.
+            $("#commiter").text(data.author);
+            $("#commitMessage").text(data.msg);
+            $("#commitDate").text(data.date);
+            
+            $("tbody").children().remove();
+            
+            for(var name in data.data){
+              var info = data.data[name];
+              var tablerow = makeTableRow(name, info.msg, info.date, info.author);
+              $("tbody").append(tablerow);
+            }
+
+            $("#folderView").show();
+            $("#codeView").hide();
+        }
+        function makeTableRow(name, message, date, author){
+          return $("<tr>")
+              .append(
+                  $("<td>").append(
+                      $("<a>").text(name).attr("href", "#" + (path !== "/" ? path : "") + "/" +name)
+                    ).addClass("filename")
+                  )
+              .append($("<td>").text(message).addClass("message"))
+              .append($("<td>").text("just now"/*date*/).addClass("date"))
+              //.append($("<td>").text(author).addClass("author"))
+              .append($('<td class="author"><a href="/'+ author+'" class="img-rounded"><img src="/assets/images/default-avatar-34.png" width="32" height="32" alt="avatar"></a></td>'));
+        }
+        function updateBreadcrumbs(path){
+          var $breadcrumbs = $("#breadcrumbs");
+          $($breadcrumbs).html('<a href="#/">/</a>');
+                      
+          var names = path.split("/");
+          var str = "#"
+          for(var i = 1; i < names.length; i++){
+            var name = names[i];
+            str += "/" + name;
+            $breadcrumbs.append(" &gt; ");
+            $("<a>").text(name).attr("href", str).appendTo($breadcrumbs);
+          }
+        }
+      });
+      $(window).trigger('hashchange');
+  });
+  
+  function getHash(){
+      //혹시 있을지도 모를 호완성을 위해.
+      return location.hash;
+      
+  }
+  function setHash(hash){
+      return location.hash = hash;
+  }
+  function standizePath(path){
+    return "/" + path.split("/").filter(isEmpty).join("/");
+    function isEmpty(data){
+      if(data == ""){
+        return false;
+      } else {
+        return true;
+      }
+    }
+  }
+
+  function updateNav(path){
+    console.log("update triggered!");
+    var stack = [];
+    var pathSeg = path.split("/");
+    pathSeg = pathSeg.filter(function(data){if(data == "") return false; else return true;});
+    path = "/" + pathSeg.join("/");
+    while(true){
+      if($("#folderNav").find("li[data-path='" + path +"']").length == 0){
+        stack.push(path);
+        pathSeg.pop();
+        path = "/" + pathSeg.join("/");
+      } else {
+        stack.push(path);
+        break;
+      }
+    }
+    //request all
+    //check response
+    var count = stack.length;
+    stack.map(function(path){
+      $.ajax("code/!" + path, {
+        success : function(data){
+          stack = stack.map(function(d){
+            if(path == d){
+              data.path = path;
+              return data;
+            } else {
+              return d;
+            }
+          });
+
+          if(--count <= 0){
+            addItem(stack);
+          }
+        }
+      });
+      return path;
+    });
+  }
+  function addItem(stack){
+    
+    $folderNav = $("#folderNav");
+
+    while(stack.length !== 0){
+      var data = stack.pop();
+      if(data.type === "file") continue;
+
+      var $target = $folderNav.find("li[data-path='" + data.path + "']");
+      for(var name in data.data){
+        if(data.data[name].type === "file") continue;
+        var tpath = (data.path == "/"? "" : data.path) + "/" +name;
+        if($folderNav.find("li[data-path='" + tpath + "']").length == 0){
+          var $li = makeListItem(name, data.path);
+          $target.after($li);
+        }
+      }
+    }
+    function makeListItem(name, path){
+      var depth = path.split("/").length - 1;
+      if(path =="/") depth -= 1;
+      var margin = depth * 5 + 25;
+      var tpath = (path == "/"? "" : path) + "/" +name
+      var $a = $("<a>").attr("href", "#" + tpath).appendTo($li);
+      $("<i>").addClass("ico btn-folder").appendTo($a);
+      $a.append(name);
+      return $("<li>").addClass("directory").attr("data-path", tpath).css({paddingLeft: margin}).append($a);
+    }
+  }
+  
+  $("#branchSelector option").click(function(){
+      alert($(this).text());
+  });(No newline at end of file)
Add a comment
List