main.ssp 5.57 KB
Newer Older
1
2
3
4
5
6
7
8
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
<%@ var summary: Summary %>
<%@ var indexPage: ReportPage %>
<%@ var reportName: String %>
<%@ var page: ReportPage %>
<%@ var path: List[String] %>
<%@ var args: Map[String, Any] %>
9
10
<%@ var rootPath: String %>
#{
Peter van 't Hof's avatar
Peter van 't Hof committed
11
    def createMenu(page: ReportPage, path: List[String] = Nil, first: Boolean = true): String = {
12
        val buffer: StringBuffer = new StringBuffer()
13

Peter van 't Hof's avatar
Peter van 't Hof committed
14
        if (page.subPages.nonEmpty){
Peter van 't Hof's avatar
Peter van 't Hof committed
15
            buffer.append("<ul class=\"dropdown-menu\">")
16
        }
17
18
19
20
21
22
23

        for (subPage <- page.subPages) {
            val href: String = {
                if (path.isEmpty) rootPath + subPage._1 + "/index.html"
                else rootPath + path.mkString("","/","/") + subPage._1 + "/index.html"
            }

Peter van 't Hof's avatar
Peter van 't Hof committed
24
            buffer.append("<li")
Peter van 't Hof's avatar
Peter van 't Hof committed
25
            if(subPage._2.subPages.nonEmpty) buffer.append(" class=\"dropdown-submenu\"")
Peter van 't Hof's avatar
Peter van 't Hof committed
26
27
28
            buffer.append("><a href=\"" + href + "\"")
            if (first) buffer.append(" tabindex=\"-1\"")
            buffer.append(">" + subPage._1 + "</a>")
Peter van 't Hof's avatar
Peter van 't Hof committed
29
            buffer.append(createMenu(subPage._2, path ::: subPage._1 :: Nil, first = false))
30
31
            buffer.append("</li>")
        }
Peter van 't Hof's avatar
Peter van 't Hof committed
32
        if(page.subPages.nonEmpty) {
33
34
            buffer.append("</ul>\n")
        }
35
36
37
38
        buffer.toString
    }

    def getSubPage(path:List[String]): ReportPage = {
39
40
41
42
43
        path.foldLeft(indexPage)((c, p) => {
            val foundPages = c.subPages.filter(_._1 == p)
            require(foundPages.size == 1, "Name of page not found or duplicate is found, page:: " + p + " in path: " + path)
            foundPages.head._2
        })
44
45
46
47
48
    }
}#
<!DOCTYPE html>
<html>
    <head>
49
        <title>${reportName}</title>
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

        <!-- Bootstrap core JavaScript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->
        <script src="${rootPath}ext/js/jquery.min.js"></script>

        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="${rootPath}ext/css/bootstrap.min.css">

        <!-- Optional theme -->
        <link rel="stylesheet" href="${rootPath}ext/css/bootstrap-theme.min.css">

        <!-- Latest compiled and minified JavaScript -->
        <script src="${rootPath}ext/js/bootstrap.min.js"></script>

        <link rel="stylesheet" type="text/css" href="${rootPath}ext/css/bootstrap_dashboard.css">
        <link rel="stylesheet" type="text/css" href="${rootPath}ext/css/sortable-theme-bootstrap.css">

        <!-- sortable tables //-->
        <script src="${rootPath}ext/js/sortable.min.js"></script>
        <script language="JavaScript">
            <!--
            $(document).ready(function() {
Wai Yi Leung's avatar
Wai Yi Leung committed
73
                Sortable.init()
74

Wai Yi Leung's avatar
Wai Yi Leung committed
75
76
77
                $('body').scrollspy({
                    target: '.bs-sidebar',
                });
78
            });
Wai Yi Leung's avatar
Wai Yi Leung committed
79

80
81
            //-->
        </script>
82
83
84
    </head>
<body>

85
86
87
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
    <div class="navbar-header">
Peter van 't Hof's avatar
Peter van 't Hof committed
88
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
89
90
91
92
93
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
Peter van 't Hof's avatar
Peter van 't Hof committed
94
95

        <ul class="nav navbar-nav">
Peter van 't Hof's avatar
Peter van 't Hof committed
96
            <li class="root #if (path.isEmpty) active #end">
Peter van 't Hof's avatar
Peter van 't Hof committed
97
                <a class="navbar-brand" href="${rootPath}index.html">${reportName}
Peter van 't Hof's avatar
Peter van 't Hof committed
98
                    #if (indexPage.subPages.nonEmpty) <b class="caret"></b> #end
Peter van 't Hof's avatar
Peter van 't Hof committed
99
100
101
102
                </a>
                ${unescape(createMenu(indexPage))}
            </li>
        </ul>
103
    </div>
Peter van 't Hof's avatar
Peter van 't Hof committed
104
105

    <div class="collapse navbar-collapse navbar-ex1-collapse">
106
107
108
        <ul class="nav navbar-nav">
            <!-- ${path.size} //-->
            <!-- ${path} //-->
Peter van 't Hof's avatar
Peter van 't Hof committed
109
            #for (t <- 1 to path.size)
110
                #if(t == 0)
Peter van 't Hof's avatar
Peter van 't Hof committed
111
112
                    <li class="root">
                        <a href="${rootPath}index.html">Home
Peter van 't Hof's avatar
Peter van 't Hof committed
113
                            #if (indexPage.subPages.nonEmpty) <b class="caret"></b> #end
Peter van 't Hof's avatar
Peter van 't Hof committed
114
115
                        </a>
                        ${unescape(createMenu(indexPage))}
116
117
                    </li>
                #else
Peter van 't Hof's avatar
Peter van 't Hof committed
118
119
                    <li class="root #if (t == path.size) active #end">
                        <a href="${rootPath}${path.slice(0,t).mkString("", "/", "/")}index.html">${path( t - 1 )}
Peter van 't Hof's avatar
Peter van 't Hof committed
120
                            #if (getSubPage(path.slice(0, t)).subPages.nonEmpty) <b class="caret"></b> #end
Peter van 't Hof's avatar
Peter van 't Hof committed
121
122
123
                        </a>
                        ${unescape(createMenu(getSubPage(path.slice(0, t)), path.slice(0, t)))}
                    </li>
124
125
126
127
128
129
130
                #end
            #end

        </ul>
    </div>
    <!--/.nav-collapse -->
</div>
131
</nav>
132
133
134

<div class="container-fluid">
<div class="row">
Peter van 't Hof's avatar
Peter van 't Hof committed
135
    <div id="side-nav" class="col-sm-3 col-md-2 sidebar">
Wai Yi Leung's avatar
Wai Yi Leung committed
136
        <ul class="nav nav-sidebar nav-list bs-sidebar">
137
138
139
140
141
            #for ((name, url) <- page.sections)
                <li><a href="#${name}">${name}</a></li>
            #end
        </ul>
    </div>
Peter van 't Hof's avatar
Peter van 't Hof committed
142
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main content">
Peter van 't Hof's avatar
Peter van 't Hof committed
143
        #for ((name, section) <- page.sections)
Peter van 't Hof's avatar
Peter van 't Hof committed
144
            <div id="${name}" class="panel panel-primary">
Peter van 't Hof's avatar
Peter van 't Hof committed
145
146
147
148
149
150
                <div class="panel-heading">
                    <h3 class="panel-title" id="panel-title">
                        ${name}
                    </h3>
                </div>
            ${unescape(section.render(args))}
151
152
153
154
155
156
            </div>
        #end
    </div>
</div>
</div>

157
158
</body>
</html>