| 1 |
package website.controller; |
| 2 |
|
| 3 |
import ufront.web.Controller; |
| 4 |
import ufront.web.result.*; |
| 5 |
import website.api.DocumentationApi; |
| 6 |
import ufront.core.OrderedStringMap; |
| 7 |
using tink.CoreApi; |
| 8 |
|
| 9 |
@cacheRequest |
| 10 |
class DocumentationController extends Controller { |
| 11 |
|
| 12 |
@inject public var api:DocumentationApi; |
| 13 |
|
| 14 |
@:route("/$page") |
| 15 |
public function documentationPage( ?page:String ) { |
| 16 |
var html = api.getDocumentationHTML( page ).sure(); |
| 17 |
var documentationPages = getDocumentationPages(); |
| 18 |
var docTitle = |
| 19 |
if ( page==null ) documentationPages.get('/documentation/'); |
| 20 |
else documentationPages.get('/documentation/$page/'); |
| 21 |
return new ViewResult({ |
| 22 |
title: '$docTitle - Haxelib Documentation', |
| 23 |
content: html, |
| 24 |
}); |
| 25 |
} |
| 26 |
|
| 27 |
public static function getDocumentationPages():OrderedStringMap<String> { |
| 28 |
var pages = new OrderedStringMap(); |
| 29 |
pages.set( "/documentation/", "Getting Started" ); |
| 30 |
pages.set( "/documentation/using-haxelib/", "Using Haxelib" ); |
| 31 |
pages.set( "/documentation/creating-a-haxelib-package/", "Creating a Haxelib" ); |
| 32 |
pages.set( "/documentation/per-project-setup/", "Per project setup" ); |
| 33 |
pages.set( "/documentation/haxelibs-in-projects/", "Adding libraries to projects" ); |
| 34 |
pages.set( "/documentation/faq/", "FAQ" ); |
| 35 |
// pages.set( "/documentation/api/", "API" ); |
| 36 |
return pages; |
| 37 |
} |
| 38 |
} |