mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Add dropdown and make plain text view style.
Summary: part of the task of "Port Diffusion's Browse File view to Phabricator" Test Plan: view the plain view style Reviewed By: epriestley Reviewers: epriestley CC: epriestley Differential Revision: 80
This commit is contained in:
parent
4c9850278c
commit
daf7a07064
1 changed files with 44 additions and 3 deletions
|
@ -28,6 +28,48 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
'view' => 'browse',
|
||||
));
|
||||
|
||||
$select_map = array(
|
||||
//'highlighted' => 'View as Highlighted Text',
|
||||
//'blame' => 'View as Highlighted Text with Blame',
|
||||
'plain' => 'View as Plain Text',
|
||||
//'plainblame' => 'View as Plain Text with Blame',
|
||||
);
|
||||
$selected = $this->getRequest()->getStr('view');
|
||||
$select = '<select name="view">';
|
||||
foreach ($select_map as $k => $v) {
|
||||
$option = phutil_render_tag(
|
||||
'option',
|
||||
array(
|
||||
'value' => $k,
|
||||
'selected' => ($k == $selected) ? 'selected' : null,
|
||||
),
|
||||
phutil_escape_html($v));
|
||||
|
||||
$select .= $option;
|
||||
}
|
||||
$select .= '</select>';
|
||||
|
||||
if ($selected == 'plain') {
|
||||
$style =
|
||||
"margin: 1em 2em; width: 90%; height: 80em; font-family: monospace";
|
||||
} else {
|
||||
// default style.
|
||||
$style =
|
||||
"margin: 1em 2em; width: 90%; height: 80em; font-family: monospace";
|
||||
}
|
||||
|
||||
// TODO: blame, color, line numbers, highlighting, etc etc
|
||||
|
||||
$view_form = phutil_render_tag(
|
||||
'form',
|
||||
array(
|
||||
'action' => $this->getRequest()->getRequestURI(),
|
||||
'method' => 'get',
|
||||
'style' => 'display: inline',
|
||||
),
|
||||
$select.
|
||||
'<button>view</button>');
|
||||
|
||||
$file_query = DiffusionFileContentQuery::newFromDiffusionRequest(
|
||||
$this->diffusionRequest);
|
||||
$file_content = $file_query->loadFileContent();
|
||||
|
@ -35,14 +77,13 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
$corpus = phutil_render_tag(
|
||||
'textarea',
|
||||
array(
|
||||
'style' => 'margin: 1em 2em; width: 90%; height: 80em;',
|
||||
'style' => $style,
|
||||
),
|
||||
phutil_escape_html($file_content->getCorpus()));
|
||||
|
||||
$content[] = $view_form;
|
||||
$content[] = $corpus;
|
||||
|
||||
// TODO: blame, color, line numbers, highlighting, etc etc
|
||||
|
||||
$nav = $this->buildSideNav('browse', true);
|
||||
$nav->appendChild($content);
|
||||
|
||||
|
|
Loading…
Reference in a new issue