@@ -88,23 +88,118 @@ public function handleRequest(AphrontRequest $request) {
88
88
$ crumbs ->addTextCrumb ($ method ->getAPIMethodName ());
89
89
$ crumbs ->setBorder (true );
90
90
91
+ $ documentation_pages = $ method ->getDocumentationPages ($ viewer );
92
+
93
+ $ documentation_view = $ this ->newDocumentationView (
94
+ $ method ,
95
+ $ documentation_pages );
96
+
91
97
$ view = id (new PHUITwoColumnView ())
92
98
->setHeader ($ header )
93
99
->setFooter (array (
100
+
101
+ id (new PhabricatorAnchorView ())
102
+ ->setAnchorName ('overview ' ),
94
103
$ info_box ,
95
- $ method ->getMethodDocumentation (),
104
+
105
+ id (new PhabricatorAnchorView ())
106
+ ->setAnchorName ('documentation ' ),
107
+ $ documentation_view ,
108
+
109
+ id (new PhabricatorAnchorView ())
110
+ ->setAnchorName ('call ' ),
96
111
$ form_box ,
112
+
113
+ id (new PhabricatorAnchorView ())
114
+ ->setAnchorName ('examples ' ),
97
115
$ this ->renderExampleBox ($ method , null ),
98
116
));
99
117
100
118
$ title = $ method ->getAPIMethodName ();
101
119
120
+ $ nav = $ this ->newNavigationView ($ method , $ documentation_pages );
121
+
102
122
return $ this ->newPage ()
103
123
->setTitle ($ title )
104
124
->setCrumbs ($ crumbs )
125
+ ->setNavigation ($ nav )
105
126
->appendChild ($ view );
106
127
}
107
128
129
+ private function newDocumentationView (
130
+ ConduitAPIMethod $ method ,
131
+ array $ documentation_pages ) {
132
+ assert_instances_of ($ documentation_pages , 'ConduitAPIDocumentationPage ' );
133
+
134
+ $ viewer = $ this ->getViewer ();
135
+
136
+ $ description_properties = id (new PHUIPropertyListView ());
137
+
138
+ $ description_properties ->addTextContent (
139
+ new PHUIRemarkupView ($ viewer , $ method ->getMethodDescription ()));
140
+
141
+ $ description_box = id (new PHUIObjectBoxView ())
142
+ ->setHeaderText (pht ('Method Description ' ))
143
+ ->setBackground (PHUIObjectBoxView::BLUE_PROPERTY )
144
+ ->appendChild ($ description_properties );
145
+
146
+ $ view = array ();
147
+ $ view [] = $ description_box ;
148
+
149
+ foreach ($ documentation_pages as $ page ) {
150
+ $ view [] = $ page ->newView ();
151
+ }
152
+
153
+ return $ view ;
154
+ }
155
+
156
+ private function newNavigationView (
157
+ ConduitAPIMethod $ method ,
158
+ array $ documentation_pages ) {
159
+ assert_instances_of ($ documentation_pages , 'ConduitAPIDocumentationPage ' );
160
+
161
+ $ console_uri = urisprintf (
162
+ '/method/%s/ ' ,
163
+ $ method ->getAPIMethodName ());
164
+ $ console_uri = $ this ->getApplicationURI ($ console_uri );
165
+ $ console_uri = new PhutilURI ($ console_uri );
166
+
167
+ $ nav = id (new AphrontSideNavFilterView ())
168
+ ->setBaseURI ($ console_uri );
169
+
170
+ $ nav ->selectFilter (null );
171
+
172
+ $ nav ->newLink ('overview ' )
173
+ ->setHref ('#overview ' )
174
+ ->setName (pht ('Overview ' ))
175
+ ->setIcon ('fa-list ' );
176
+
177
+ $ nav ->newLink ('documentation ' )
178
+ ->setHref ('#documentation ' )
179
+ ->setName (pht ('Documentation ' ))
180
+ ->setIcon ('fa-book ' );
181
+
182
+ foreach ($ documentation_pages as $ page ) {
183
+ $ nav ->newLink ($ page ->getAnchor ())
184
+ ->setHref ('# ' .$ page ->getAnchor ())
185
+ ->setName ($ page ->getName ())
186
+ ->setIcon ($ page ->getIconIcon ())
187
+ ->setIndented (true );
188
+ }
189
+
190
+ $ nav ->newLink ('call ' )
191
+ ->setHref ('#call ' )
192
+ ->setName (pht ('Call Method ' ))
193
+ ->setIcon ('fa-play ' );
194
+
195
+ $ nav ->newLink ('examples ' )
196
+ ->setHref ('#examples ' )
197
+ ->setName (pht ('Examples ' ))
198
+ ->setIcon ('fa-folder-open-o ' );
199
+
200
+ return $ nav ;
201
+ }
202
+
108
203
private function buildMethodProperties (ConduitAPIMethod $ method ) {
109
204
$ viewer = $ this ->getViewer ();
110
205
@@ -171,7 +266,6 @@ private function buildMethodProperties(ConduitAPIMethod $method) {
171
266
pht ('Errors ' ),
172
267
$ error_description );
173
268
174
-
175
269
$ scope = $ method ->getRequiredScope ();
176
270
switch ($ scope ) {
177
271
case ConduitAPIMethod::SCOPE_ALWAYS :
@@ -201,11 +295,6 @@ private function buildMethodProperties(ConduitAPIMethod $method) {
201
295
$ oauth_description ,
202
296
));
203
297
204
- $ view ->addSectionHeader (
205
- pht ('Description ' ), PHUIPropertyListView::ICON_SUMMARY );
206
- $ view ->addTextContent (
207
- new PHUIRemarkupView ($ viewer , $ method ->getMethodDescription ()));
208
-
209
298
return $ view ;
210
299
}
211
300
0 commit comments