Store original and parsed text in contenxt, compare to hide “toggle” link.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Apr 2011 09:28:37 +0000 (11:28 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Apr 2011 09:28:37 +0000 (11:28 +0200)
This also requires the latest snapshot of utils for the “text” parameter
of the StoreFilter.

pom.xml
src/main/resources/templates/include/viewPost.html
src/main/resources/templates/include/viewReply.html

diff --git a/pom.xml b/pom.xml
index 0dfac6e..985ceb0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
                <dependency>
                        <groupId>net.pterodactylus</groupId>
                        <artifactId>utils</artifactId>
-                       <version>0.9.1</version>
+                       <version>0.9.2-SNAPSHOT</version>
                </dependency>
                <dependency>
                        <groupId>junit</groupId>
index 676fa6a..4600d45 100644 (file)
                                        <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><% post.recipient.niceName|html></a></div>
                                <%/if>
                        <%/if>
-                       <div class="post-text raw-text<%if !raw> hidden<%/if>"><% post.text|html></div>
-                       <div class="post-text text<%if raw> hidden<%/if>"><% post.text|parse sone=post.sone></div>
+                       <% post.text|html|store key=originalText text=true>
+                       <% post.text|parse sone=post.sone|store key=parsedText text=true>
+                       <div class="post-text raw-text<%if !raw> hidden<%/if>"><% originalText></div>
+                       <div class="post-text text<%if raw> hidden<%/if>"><% parsedText></div>
                </div>
                <div class="post-status-line status-line">
                        <div class="bookmarks">
                        </div>
                        <span class='separator'>·</span>
                        <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
-                       <span class='separator'>·</span>
-                       <div class="show-source"><a href="viewPost.html?post=<% post.id|html>&amp;raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
+                       <%if ! originalText|match key=parsedText>
+                               <span class='separator'>·</span>
+                               <div class="show-source"><a href="viewPost.html?post=<% post.id|html>&amp;raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
+                       <%/if>
                        <div class="likes<%if post.likes.size|match value=0> hidden<%/if>">
                                <span class='separator'>·</span>
                                <span title="<% post.likes.soneNames|html>">↑<span class="like-count"><% post.likes.size></span></span>
index e179e01..5dc26fb 100644 (file)
@@ -8,13 +8,17 @@
        <div class="inner-part">
                <div>
                        <div class="author profile-link"><a href="viewSone.html?sone=<% reply.sone.id|html>"><% reply.sone.niceName|html></a></div>
-                       <div class="reply-text raw-text<%if !raw> hidden<%/if>"><% reply.text|html></div>
-                       <div class="reply-text text<%if raw> hidden<%/if>"><% reply.text|parse sone=reply.sone></div>
+                       <% reply.text|html|store key=originalText text=true>
+                       <% reply.text|parse sone=reply.sone|store key=parsedText text=true>
+                       <div class="reply-text raw-text<%if !raw> hidden<%/if>"><% originalText></div>
+                       <div class="reply-text text<%if raw> hidden<%/if>"><% parsedText></div>
                </div>
                <div class="reply-status-line status-line">
                        <div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
-                       <span class='separator'>·</span>
-                       <div class="show-reply-source"><a href="viewPost.html?post=<% post.id|html>&amp;raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
+                       <%if ! originalText|match key=parsedText>
+                               <span class='separator'>·</span>
+                               <div class="show-reply-source"><a href="viewPost.html?post=<% post.id|html>&amp;raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
+                       <%/if>
                        <div class="likes<%if reply.likes.size|match value=0> hidden<%/if>">
                                <span class='separator'>·</span>
                                <span title="<% reply.likes.soneNames|html>">↑<span class="like-count"><% reply.likes.size></span></span>