Added a Toggle View button to toggle the view for .wc files.

This commit is contained in:
quark2012 2020-03-26 08:27:14 +00:00
parent 2edef7c9ea
commit 49ed61004e
3 changed files with 12 additions and 0 deletions

View File

@ -112,6 +112,7 @@ $lang['System'] = 'System';
$lang['Tag'] = 'Tag'; $lang['Tag'] = 'Tag';
$lang['Text'] = 'Text'; $lang['Text'] = 'Text';
$lang['Time'] = 'Time'; $lang['Time'] = 'Time';
$lang['Toggle View'] = 'Toggle View';
$lang['Top committers'] = 'Top committers'; $lang['Top committers'] = 'Top committers';
$lang['Top projects'] = 'Top projects'; $lang['Top projects'] = 'Top projects';
$lang['Type'] = 'Type'; $lang['Type'] = 'Type';

View File

@ -253,6 +253,11 @@ function showRawCode()
function render_wiki_wc () function render_wiki_wc ()
{ {
$("#code_toggle_wc_view_button").button().click(function() {
$("#code_diff_old_code_view").toggle();
$("#code_diff_new_code_view").toggleClass("code_file_full_width");
return false;
});
creole_render_wiki ( creole_render_wiki (
"code_file_wiki_text", "code_file_wiki_text",
"code_diff_new_code_view", "code_diff_new_code_view",
@ -831,6 +836,7 @@ $this->load->view (
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download'); $download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference'); $diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
$fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference'); $fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
$toggle_wc_text = '<i class="fa fa-eye"></i> ' . $this->lang->line('Toggle View');
if ($file['created_rev'] != $file['head_rev']) if ($file['created_rev'] != $file['head_rev'])
{ {
@ -851,6 +857,8 @@ $this->load->view (
print $this->lang->line('CODE_REVISION_GRAPH'); print $this->lang->line('CODE_REVISION_GRAPH');
print '</a>'; print '</a>';
if ($is_wiki_file) { print anchor ('#', $toggle_wc_text, 'id="code_toggle_wc_view_button"'); }
print '</div>'; print '</div>';
print '<div class="metadata-commit-date">'; print '<div class="metadata-commit-date">';

View File

@ -450,6 +450,9 @@
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
#code_diff_new_code_view.code_file_full_width {
width: 100%;
}
#code_diff_full_code_view .navigator { #code_diff_full_code_view .navigator {
padding: 0.5em 0.8em 0.5em 0.8em; padding: 0.5em 0.8em 0.5em 0.8em;