Browse Source

begin twig

tags/0.1.0
Robin Thoni 8 years ago
parent
commit
58c447c450
3 changed files with 182 additions and 3 deletions
  1. 2
    1
      composer.json
  2. 12
    2
      src/Doc/Business/LuDocBusiness.php
  3. 168
    0
      src/Doc/Templates/index.html.twig

+ 2
- 1
composer.json View File

@@ -12,7 +12,8 @@
12 12
       "url":  "https://git.rthoni.com/luticate/utils.git"
13 13
     }],
14 14
     "require": {
15
-      "luticate/utils": "*"
15
+      "luticate/utils": "*",
16
+      "twig/twig": "1.x-dev"
16 17
     },
17 18
     "autoload": {
18 19
       "psr-4": {

+ 12
- 2
src/Doc/Business/LuDocBusiness.php View File

@@ -11,6 +11,9 @@ namespace Luticate\Doc\Business;
11 11
 use Luticate\Utils\LuRoute;
12 12
 use Luticate\Utils\LuRouteDbo;
13 13
 use ReflectionMethod;
14
+use Twig_Autoloader;
15
+use Twig_Environment;
16
+use Twig_Loader_Filesystem;
14 17
 
15 18
 class LuDocBusiness
16 19
 {
@@ -79,7 +82,14 @@ class LuDocBusiness
79 82
         /**
80 83
          * @var $businesses LuRouteDbo[]
81 84
          */
82
-        foreach ($businesses_ as $businesses) {
85
+
86
+        $loader = new Twig_Loader_Filesystem(__DIR__ . "/Templates");
87
+        $twig = new Twig_Environment($loader, array());
88
+        $template = $twig->loadTemplate("index.html.twig");
89
+        $content = $template->render(array());
90
+        echo $content;
91
+
92
+        /*foreach ($businesses_ as $businesses) {
83 93
             $businessHyphen = self::getBusinessHyphen($businesses[0]->getBusinessClass());
84 94
             $businessName = self::getBusinessName($businesses[0]->getBusinessClass());
85 95
             echo '<a href="doc/' . $businessHyphen . '"><h1>' . $businessName . "</h1></a>";
@@ -88,7 +98,7 @@ class LuDocBusiness
88 98
                 echo '<a href="doc/' . $businessHyphen . '/' . $business->getBusinessMethod()
89 99
                     . '">' . $business->getMethod() . " " . $business->getUrl() . "</a><br />";
90 100
             }
91
-        }
101
+        }*/
92 102
         exit;
93 103
     }
94 104
 

+ 168
- 0
src/Doc/Templates/index.html.twig View File

@@ -0,0 +1,168 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="utf-8" />
5
+    <meta name="viewport" content="width=device-width" />
6
+    <title>Documentation</title>
7
+
8
+    <style>
9
+        .help-page h1,
10
+        .help-page .h1,
11
+        .help-page h2,
12
+        .help-page .h2,
13
+        .help-page h3,
14
+        .help-page .h3,
15
+        #body.help-page,
16
+        .help-page-table th,
17
+        .help-page-table pre,
18
+        .help-page-table p {
19
+            font-family: "Segoe UI Light", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
20
+        }
21
+
22
+        .help-page pre.wrapped {
23
+            white-space: -moz-pre-wrap;
24
+            white-space: -pre-wrap;
25
+            white-space: -o-pre-wrap;
26
+            white-space: pre-wrap;
27
+        }
28
+
29
+        .help-page .warning-message-container {
30
+            margin-top: 20px;
31
+            padding: 0 10px;
32
+            color: #525252;
33
+            background: #EFDCA9;
34
+            border: 1px solid #CCCCCC;
35
+        }
36
+
37
+        .help-page-table {
38
+            width: 100%;
39
+            border-collapse: collapse;
40
+            text-align: left;
41
+            margin: 0 0 20px 0;
42
+            border-top: 1px solid #D4D4D4;
43
+        }
44
+
45
+        .help-page-table th {
46
+            text-align: left;
47
+            font-weight: bold;
48
+            border-bottom: 1px solid #D4D4D4;
49
+            padding: 5px 6px 5px 6px;
50
+        }
51
+
52
+        .help-page-table td {
53
+            border-bottom: 1px solid #D4D4D4;
54
+            padding: 10px 8px 10px 8px;
55
+            vertical-align: top;
56
+        }
57
+
58
+        .help-page-table pre,
59
+        .help-page-table p {
60
+            margin: 0;
61
+            padding: 0;
62
+            font-family: inherit;
63
+            font-size: 100%;
64
+        }
65
+
66
+        .help-page-table tbody tr:hover td {
67
+            background-color: #F3F3F3;
68
+        }
69
+
70
+        .help-page a:hover {
71
+            background-color: transparent;
72
+        }
73
+
74
+        .help-page .sample-header {
75
+            border: 2px solid #D4D4D4;
76
+            background: #00497E;
77
+            color: #FFFFFF;
78
+            padding: 8px 15px;
79
+            border-bottom: none;
80
+            display: inline-block;
81
+            margin: 10px 0 0 0;
82
+        }
83
+
84
+        .help-page .sample-content {
85
+            display: block;
86
+            border-width: 0;
87
+            padding: 15px 20px;
88
+            background: #FFFFFF;
89
+            border: 2px solid #D4D4D4;
90
+            margin: 0 0 10px 0;
91
+        }
92
+
93
+        .help-page .api-name {
94
+            width: 40%;
95
+        }
96
+
97
+        .help-page .api-documentation {
98
+            width: 60%;
99
+        }
100
+
101
+        .help-page .parameter-name {
102
+            width: 20%;
103
+        }
104
+
105
+        .help-page .parameter-documentation {
106
+            width: 40%;
107
+        }
108
+
109
+        .help-page .parameter-type {
110
+            width: 20%;
111
+        }
112
+
113
+        .help-page .parameter-annotations {
114
+            width: 20%;
115
+        }
116
+
117
+        .help-page h1,
118
+        .help-page .h1 {
119
+            font-size: 36px;
120
+            line-height: normal;
121
+        }
122
+
123
+        .help-page h2,
124
+        .help-page .h2 {
125
+            font-size: 24px;
126
+        }
127
+
128
+        .help-page h3,
129
+        .help-page .h3 {
130
+            font-size: 20px;
131
+        }
132
+
133
+        #body.help-page {
134
+            font-size: 14px;
135
+            line-height: 143%;
136
+            color: #333;
137
+        }
138
+
139
+        .help-page a {
140
+            color: #0000EE;
141
+            text-decoration: none;
142
+        }
143
+    </style>
144
+</head>
145
+<body>
146
+
147
+<header class="help-page">
148
+    <div class="content-wrapper">
149
+        <div class="float-left">
150
+            <h1>Documentation</h1>
151
+        </div>
152
+    </div>
153
+</header>
154
+<div id="body" class="help-page">
155
+    <section class="featured">
156
+        <div class="content-wrapper">
157
+            <h2>Introduction</h2>
158
+            <p>
159
+                This is the official Chronos API documentation.
160
+            </p>
161
+        </div>
162
+    </section>
163
+    <section class="content-wrapper main-content clear-fix">
164
+
165
+</section>
166
+    </div>
167
+</body>
168
+</html>

Loading…
Cancel
Save