Skip to content

Commit

Permalink
Item14776: separate diff.tmpl and diffview.tmpl
Browse files Browse the repository at this point in the history
- diff.tmpl is used for parameter defaults
- diffview.tmpl is used to render the diff view
- missing definition of diff::control::quit
  • Loading branch information
MichaelDaum committed Oct 25, 2018
1 parent 5f538e6 commit 41831e4
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions data/System/DiffPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1540454078" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1540458596" format="1.1" version="1"}%
---+!! %TOPIC%
%FORMFIELD{"Description"}%

Expand Down Expand Up @@ -30,7 +30,7 @@ You type:

You get:

<a href="%ATTACHURLPATH%/DiffScreenshot.png"><img src='%ATTACHURLPATH%/DiffScreenshot.png' width='400' alt='diff screenshot' /></a>
<a href="%ATTACHURLPATH%/DiffScreenshot.png"><img src='%ATTACHURLPATH%/DiffScreenshot.png' width='500' alt='diff screenshot' /></a>

---++ Syntax

Expand Down Expand Up @@ -112,7 +112,7 @@ scripts with a call to =diff=.

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 25 Oct 2018 | implement a separate DIFFCONTROL macro |
| 25 Oct 2018 | implement a separate DIFFCONTROL macro; separate diff.tmpl and diffview.tmpl |
| 11 Jun 2018 | fix changes not displayed under certain conditions |
| 09 Jan 2018 | throw an access exception instead of showing an inline error diffing revisions |
| 01 Jun 2016 | initial release |
Expand All @@ -127,4 +127,4 @@ scripts with a call to =diff=.
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Home" title="Home" value="https://foswiki.org/Extensions/%25$ROOTMODULE%25"}%
%META:FIELD{name="Support" title="Support" value="https://foswiki.org/Support/%25$ROOTMODULE%25"}%
%META:FILEATTACHMENT{name="DiffScreenshot.png" attachment="DiffScreenshot.png" attr="" comment="" date="1540454078" size="112670" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="DiffScreenshot.png" attachment="DiffScreenshot.png" attr="" comment="" date="1540458596" size="112670" user="ProjectContributor" version="1"}%
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/DiffPlugin.pm
Expand Up @@ -21,7 +21,7 @@ use warnings;
use Foswiki::Func ();
#use Foswiki::Plugins::DiffPlugin::Core(); # only enable during development of DiffPlugin

our $VERSION = '2.00';
our $VERSION = '2.01';
our $RELEASE = '25 Oct 2018';
our $SHORTDESCRIPTION = 'Compare difference between topics and revisions';
our $NO_PREFS_IN_TOPIC = 1;
Expand Down
5 changes: 3 additions & 2 deletions lib/Foswiki/Plugins/DiffPlugin/Core.pm
Expand Up @@ -73,7 +73,7 @@ sub handleDiffScript {
Foswiki::UI::checkTopicExists($session, $web, $topic, 'diff');

my $meta = Foswiki::Meta->new($session, $web, $topic);
my $tmpl = Foswiki::Func::readTemplate("diff");
my $tmpl = Foswiki::Func::readTemplate("diffview");
$tmpl = $meta->expandMacros($tmpl);
$tmpl = $meta->renderTML($tmpl);
$session->writeCompletePage($tmpl);
Expand Down Expand Up @@ -203,7 +203,8 @@ sub handleDiffMacro {
my $opts = $this->_getOpts($session, $params, $topic, $web);

$this->addAssets;
Foswiki::Func::loadTemplate("diff");
Foswiki::Func::loadTemplate("diff")
unless Foswiki::Func::expandTemplate("diff"); # prevent loading it twice

# SMELL: deep error in store
#die ("asked for old rev=$opts->{oldRev} but got $oldTestRev") unless $opts->{oldRev} eq $oldTestRev;
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/DiffPlugin/MANIFEST
Expand Up @@ -21,3 +21,4 @@ pub/System/DiffPlugin/diff.uncompressed.css 0644
pub/System/DiffPlugin/Makefile 0644
templates/diff.pattern.tmpl 0644
templates/diff.tmpl 0644
templates/diffview.tmpl 0644
Binary file modified pub/System/DiffPlugin/DiffScreenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions templates/diff.tmpl
@@ -1,5 +1,3 @@
%TMPL:DEF{"content"}%%TMPL:P{"diff"}%%TMPL:END%

%TMPL:DEF{"diff"}%%DIFF{
newrev="%TMPL:P{"newrev"}%"
oldrev="%TMPL:P{"oldrev"}%"
Expand Down Expand Up @@ -30,6 +28,8 @@
%TMPL:DEF{"diff::control::end::disabled::icon"}%<img src='%PUBURLPATH%/%SYSTEMWEB%/DiffPlugin/control-end-gray.png' alt='start' width='16' height='16' />%TMPL:END%
%TMPL:DEF{"diff::control::quit::icon"}%<img src='%PUBURLPATH%/%SYSTEMWEB%/FamFamFamSilkIcons/cross.png' alt='quit' width='16' height='16' />%TMPL:END%

%TMPL:DEF{"diff::control::quit"}%<a href='%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%'>%TMPL:P{"diff::control::quit::icon"}%</a>%TMPL:END%

%TMPL:DEF{"diff::control::start"}%%IF{"$oldrev>1"
then="<a href='%SCRIPTURLPATH{"diff"}%/%WEB%/%TOPIC%?rev=2&context=%TMPL:P{"context"}%&offset=$offset' title='%MAKETEXT{"Oldest revision"}%'>
%TMPL:P{"diff::control::start::icon"}%
Expand Down
2 changes: 2 additions & 0 deletions templates/diffview.tmpl
@@ -0,0 +1,2 @@
%TMPL:INCLUDE{"foswiki"}%%TMPL:INCLUDE{"diff"}%%{}%
%TMPL:DEF{"content"}%%TMPL:P{"diff"}%%TMPL:END%

0 comments on commit 41831e4

Please sign in to comment.