[Notice] Announcing the End of Demo Server [Read me]
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
2017-01-16
@**
* Yobi, Project Hosting SW
*
* Copyright 2012 NAVER Corp.
* http://yobi.io
*
* @author Ahn Hyeok Jun
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**@
@(project:Project, branches:List[String], recursiveData:List[com.fasterxml.jackson.databind.node.ObjectNode], branch:String, path:String)
@import utils.TemplateHelper._
@import utils.TemplateHelper.Branches._
@import utils.TemplateHelper.CodeBrowser._
@import java.net.URLEncoder
@parseFileInfo(files:com.fasterxml.jackson.databind.node.ObjectNode) = {
@fieldText(files, "type") match {
case "folder" => {
@partial_view_folder(project, files.get("data"), branch, fieldText(files, "path"))
}
case "file" => {
@partial_view_file(project, files, branch, path)
}
}
}
@makeBreadCrumbs(pagePath:String) = @{
if(pagePath != null){
var basePath = routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), "").toString()
var partialPath = ""
pagePath.split("/").toList.map { p =>
if(partialPath == ""){
partialPath = p
} else {
partialPath = partialPath + "/" + p
}
Html("<a href=\"" + getCorrectedPath(basePath, partialPath) + "\">" + p + "</a>")
}
}
}
@projectLayout(Messages("menu.code"), project, utils.MenuType.CODE){
@projectMenu(project, utils.MenuType.CODE, "main-menu-only")
<div class="page-wrap-outer">
<div class="project-page-wrap">
<div class="code-browse-wrap">
@if(fieldText(recursiveData{0}, "type").eq("folder")){
<ul class="nav nav-tabs">
@if(path.lastIndexOf("/") > 0){
<li class="active"><a href="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), path.substring(0, path.lastIndexOf("/")))">@Messages("code.files")</a></li>
} else {
<li class="active"><a href="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), path)">@Messages("code.files")</a></li>
}
@if(branch.eq("HEAD")){
<li><a href="@routes.CodeHistoryApp.historyUntilHead(project.owner, project.name)">@Messages("code.commits")</a></li>
} else {
<li><a href="@routes.CodeHistoryApp.history(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), null)">@Messages("code.commits")</a></li>
}
@if(project.isGit) {
<li>
<a href="@routes.BranchApp.branches(project.owner, project.name)">@Messages("title.branches")</a>
</li>
}
</ul>
}
<div class="code-browse-header">
<select id="branches" data-toggle="select2" data-format="branch" data-dropdown-css-class="branches"
class="pull-left @if(fieldText(recursiveData{0}, "type").eq("file")){mb10}">
@for(branchName <- branches){
<option value="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branchItemName(branchName), "UTF-8"), path)"
@if(branchItemName(branchName) == branchItemName(branch)){ selected }>
@branchName
</option>
}
</select>
<div id="breadcrumbs" class="code-breadcrumb-wrap ml10 pull-left">
<a href="@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), "")">@project.name</a>@makeBreadCrumbs(path)
</div>
@if(project.isGit) {
<div class="pull-right">
<a href="@routes.CodeApp.download(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"))" class="ybtn">
@Messages("code.download")</a>
</div>
}
</div>
<div class="code-viewer-wrap">
<div id="spin" style="position:fixed; top:50%; left:50%"></div>
@for(fileInfo <- recursiveData){
@parseFileInfo(fileInfo)
}
</div>
</div>
</div>
</div>
@common.select2()
<link rel="stylesheet" type="text/css" href="@routes.Assets.at("stylesheets/dynatree/skin/ui.dynatree.css")" />
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/moment-with-langs.min.js")"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#branches").on("change", function(event){
location.href= $(this).val();
});
// help popover at open with browser button
$("#open-in-browser").popover({trigger: "hover", placement: "top"});
$yobi.loadModule("code.Browser", {
"sProjectName": "@project.name",
"sInitialPath": "@path",
"sMetaInfoURL": "@routes.CodeApp.ajaxRequestWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), "")",
"sBasePathURL": "@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, URLEncoder.encode(branch, "UTF-8"), "")"
});
});
</script>
}