[Notice] Announcing the End of Demo Server [Read me]
Jihan Kim 2013-04-16
fix code browser
@8e795983127057b13f4bd988b77b0fbc6a5d740c
public/javascripts/service/hive.code.Browser.js
--- public/javascripts/service/hive.code.Browser.js
+++ public/javascripts/service/hive.code.Browser.js
@@ -41,6 +41,7 @@
 		 */
 		function _initVar(htOptions){
 			htVar.rxHash = /^#/;
+			htVar.rxTmp = /\!\//;
 			htVar.sProjectName = htOptions.sProjectName;
 			htVar.sTplFileListItem = $("#tplFileListItem").html() || "";
 		}
@@ -92,16 +93,18 @@
 		 */
 		function _onSelectBranch(){
 			htElement.welSelectedBranch.text($(this).text());
-			$(window).trigger("hashchange");		
+			$(window).trigger("hashchange");
 		}
 		
 		/**
 		 * on hash change
 		 */
 		function _onHashChange(){
-			var sPath = getHash().replace(htVar.rxHash, "");
+			var sPath = getHash(true);//.replace(htVar.rxTmp, "!#/");
 	        var sBranch = window.encodeURIComponent(htElement.welSelectedBranch.text());
 	        var sURL = "code/" + sBranch + "/!" + sPath;
+	        sURL = sURL.replace(/\!\!/, '!#');
+	        console.log("hashchange", sURL);
 	        
 	        $.ajax(sURL, {
 				"datatype": "json",
@@ -115,6 +118,7 @@
 		 * callback function of _onHashChange
 		 */
 		function _onLoadListCode(oRes){
+			console.log("onload");
 			_updateFileInfo(oRes); 
 	
 			switch(oRes.type){
@@ -153,13 +157,14 @@
 			var aTplData = [];
 			
 			// 템플릿용 데이터로 가공해서 배열에 추가
-			var sPath = getHash().replace(htVar.rxHash, "");
+			var sPath = (getHash(true) || "");
 			var aData = _sortFolderList(htData.data);
+			
 			aData.forEach(function(htTmp){
 				htTmp.name = htTmp.title;
 				htTmp.dateAgo  = getDateAgo(htTmp.date); 
 				htTmp.message  = getEllipsis(htTmp.message, 70);
-				htTmp.filePath = "#" + sPath + "/" + htTmp.name;
+				htTmp.filePath = "#" + (sPath !== "/" ? sPath : "") + "/" + htTmp.name;
 				aTplData.push(htTmp);				
 			});
 
@@ -503,4 +508,4 @@
 		_init(htOptions || {});
 	};
 
-})("hive.code.Browser");
(No newline at end of file)
+})("hive.CodeBrowser");
(No newline at end of file)
public/javascripts/service/hive.code.Browser1.js
--- public/javascripts/service/hive.code.Browser1.js
+++ public/javascripts/service/hive.code.Browser1.js
@@ -16,7 +16,7 @@
 	
 		$(document).ready(function(){
 			$(window).bind('hashchange', function(e){
-				_updateDynaTree();
+//				_updateDynaTree();
 				
 		        //대기 표시 한다.
 		        //여기서 요청을 보내고
@@ -169,6 +169,7 @@
 		    	  $("#selected-branch").text('HEAD');
 		      }
 		      $(window).trigger('hashchange');
+		      _updateDynaTree();		      
 		});
 		
 		function getHash() {
@@ -193,6 +194,7 @@
 		*/
 		
 		$(".branch-item").click(function(ev) {
+			_updateDynaTree();			
 			$("#selected-branch").text($(this).text());
 			$(window).trigger('hashchange');
 		});
Add a comment
List