From 49ed61004e19150507e132237f6b718d802c6d52 Mon Sep 17 00:00:00 2001 From: quark2012 Date: Thu, 26 Mar 2020 08:27:14 +0000 Subject: [PATCH] Added a Toggle View button to toggle the view for .wc files. --- codepot/src/codepot/language/english/common_lang.php | 1 + codepot/src/codepot/views/code_file.php | 8 ++++++++ codepot/src/css/code.css | 3 +++ 3 files changed, 12 insertions(+) diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 031c1da0..57708f32 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -112,6 +112,7 @@ $lang['System'] = 'System'; $lang['Tag'] = 'Tag'; $lang['Text'] = 'Text'; $lang['Time'] = 'Time'; +$lang['Toggle View'] = 'Toggle View'; $lang['Top committers'] = 'Top committers'; $lang['Top projects'] = 'Top projects'; $lang['Type'] = 'Type'; diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index ccabccbe..afe0e832 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -253,6 +253,11 @@ function showRawCode() 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 ( "code_file_wiki_text", "code_diff_new_code_view", @@ -831,6 +836,7 @@ $this->load->view ( $download_anchor_text = ' ' . $this->lang->line('Download'); $diff_anchor_text = ' ' . $this->lang->line('Difference'); $fulldiff_anchor_text = ' ' . $this->lang->line('Full Difference'); + $toggle_wc_text = ' ' . $this->lang->line('Toggle View'); if ($file['created_rev'] != $file['head_rev']) { @@ -851,6 +857,8 @@ $this->load->view ( print $this->lang->line('CODE_REVISION_GRAPH'); print ''; + if ($is_wiki_file) { print anchor ('#', $toggle_wc_text, 'id="code_toggle_wc_view_button"'); } + print ''; print '
'; diff --git a/codepot/src/css/code.css b/codepot/src/css/code.css index 7b86de44..def19fb1 100644 --- a/codepot/src/css/code.css +++ b/codepot/src/css/code.css @@ -450,6 +450,9 @@ -webkit-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 { padding: 0.5em 0.8em 0.5em 0.8em;