diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2020-04-10 13:34:23 +0100 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2020-04-10 13:34:23 +0100 |
| commit | 78400d587ea5367d3424333913ff4f94ca3f1908 (patch) | |
| tree | 2cf5f5ff8069740b0b7dd00853a4ea8c13d6e05c /src/main/resources/templates/lib.ftlh | |
| parent | d5a608143ad2250d8b35b9e4a488d39faaf5a021 (diff) | |
| download | reddit-lite-78400d587ea5367d3424333913ff4f94ca3f1908.tar.xz reddit-lite-78400d587ea5367d3424333913ff4f94ca3f1908.zip | |
Reimplement in Kotlin
Diffstat (limited to 'src/main/resources/templates/lib.ftlh')
| -rw-r--r-- | src/main/resources/templates/lib.ftlh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/main/resources/templates/lib.ftlh b/src/main/resources/templates/lib.ftlh new file mode 100644 index 0000000..9b9e96b --- /dev/null +++ b/src/main/resources/templates/lib.ftlh @@ -0,0 +1,62 @@ +<#macro wrapper title> +<html> + <head> + <title>${title}</title> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" /> + </head> + <body> + <#nested> + </body> +</html> +</#macro> + +<#macro header subreddit> + <div class="header"> + <a class="subreddit-title" href="/r/${subreddit}">/r/${subreddit}</a> + <span class="header-links"> + <#nested> + </span> + </div> +</#macro> + +<#macro postSummary post> + <div class="post-body"> + <div> + <a class="post-title" href="${post.primaryLink}">${post.title}</a> + <span class="post-domain">(${post.domain})</span> + </div> + <div class="post-info"> + <span class="nowrap"><@pluralise post.score "point"/></span> + <span class="nowrap">by ${post.author}</span> + <span class="nowrap"> in <a class="subreddit-link" href="${post.subredditPath}">${post.subredditPath}</a></span> + <span class="nowrap">${post.relativeCreatedDate}</span> | <span class="nowrap"><a href="${post.subredditPath}/comments/${post.id}"><@pluralise post.commentCount, "comment"/></a></span> + </div> + </div> +</#macro> + +<#macro postComment comment> + <div class="comment<#if comment.isChild()> child</#if>"> + <#if comment.author?has_content> + <details open> + <summary> + <span class="comment-details">${comment.author} <#if comment.flairText?has_content>${comment.flairText}</#if> | ${comment.relativeCreatedDate} | <@pluralise comment.score "point"/></span> + </summary> + <div class="comment-text">${comment.bodyHtmlUnescaped?no_esc}</div> + <#list comment.replies as childComment> + <@postComment childComment/> + </#list> + </details> + <#else> + <a href="#">TODO Load more comments...</a> + </#if> + </div> +</#macro> + +<#macro pluralise count word> + <#if count == 1> + ${count} ${word} + <#else> + ${count} ${word}s + </#if> +</#macro>
\ No newline at end of file |