Skip to content

Commit

Permalink
Use the uri() method everywhere possible in the templates
Browse files Browse the repository at this point in the history
For better maintenance, most (if not all) URI used in the templates
should be the result of a method call.
  • Loading branch information
book committed May 27, 2016
1 parent a40d873 commit cc7095d
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions views/admin/comments/list.tt
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@
[% END %]
</td>

<td width="15%"> <a href="/posts/[% comment.post.slug %]"> [% comment.post.title %] </a> </td>
<td width="15%"> <a href="[% comment.post.uri %]"> [% comment.post.title %] </a> </td>

<td width="10%">
[% IF comment.reply_to %]
<a href="/posts/[% comment.post.slug %]#comment_[% comment.reply_to %]"> Reply </a>
<a href="[% comment.post.uri %]#comment_[% comment.reply_to %]"> Reply </a>
[% ELSE %]
[% IF comment.status == 'approved' %]
<a href="/posts/[% comment.post.slug %]#comment_[% comment.id %]"> Comment </a>
<a href="[% comment.post.uri %]#comment_[% comment.id %]"> Comment </a>
[% ELSE %]
Comment
[% END %]
Expand Down
14 changes: 7 additions & 7 deletions views/admin/posts/list.tt
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@

<tr>
<td width="20%">
<b> <i class="icon-user"></i> <a href="/posts/user/[% post.user.username %]">[% post.user.username %]</a></b>
<b> <i class="icon-user"></i> <a href="[% post.user.uri %]">[% post.user.username %]</a></b>
<br />
<b> [% post.user.first_name %] [% post.user.last_name %] </b>
<br />
<i> [% post.created_date %] </i>
</td>

<td width="25%">
<b> <a href="/posts/[% post.slug %]"> [% post.title %] </a> </b>
<b> <a href="[% post.uri %]"> [% post.title %] </a> </b>
<br />
<br />

Expand Down Expand Up @@ -78,23 +78,23 @@

<td>
[% FOREACH post_category IN post.post_categories %]
<a href="/posts/category/[% post_category.category.slug %]"> [% post_category.category.name %] </a>
<a href="[% post_category.category.uri %]"> [% post_category.category.name %] </a>
[% END %]
</td>

<td width="5%">
[% FOREACH post_tag IN post.post_tags %]
<a href="/posts/tag/[% post_tag.tag.slug %]"> [% post_tag.tag.name %] </a>
<a href="[% post_tag.tag.uri %]"> [% post_tag.tag.name %] </a>
[% END %]
</td>

<td width="5">
<a href="/posts/[% post.slug %]#comments"> [% post.nr_of_comments %] </a>
<a href="[% post.uri %]#comments"> [% post.nr_of_comments %] </a>
</td>

<td width="10%">
<a href="/posts/[% post.slug %]"> <button class="btn btn-xs btn-success"><i class="icon-eye-open"></i> </button> </a>
<a href="/dashboard/posts/edit/[% post.slug %]"> <button class="btn btn-xs btn-warning"><i class="icon-pencil"></i> </button> </a>
<a href="[% post.uri %]"> <button class="btn btn-xs btn-success"><i class="icon-eye-open"></i> </button> </a>
<a href="[% post.edit_uri %]"> <button class="btn btn-xs btn-warning"><i class="icon-pencil"></i> </button> </a>
</td>
</tr>

Expand Down
2 changes: 1 addition & 1 deletion views/comments/builtin/comment_form.tt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[% IF vars.user.username %]

<div class="form-group">
Comment as <b><i class="icon-user"></i> <a href="/posts/user/[% vars.user.username %]">[% vars.user.username %]</a></b>
Comment as <b><i class="icon-user"></i> <a href="[% vars.user.uri %]">[% vars.user.username %]</a></b>
<input type="hidden" name="comment_as" email" value="[% vars.user.id %]" />
</div>

Expand Down
4 changes: 2 additions & 2 deletions views/comments/builtin/list_comments.tt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
[% ELSE %]
<div class="comment-author comment-author-registered">
<i class="icon-user"></i> <a href="/posts/user/[% comment.uid.username %][% settings.static && '.html' %]" >[% comment.uid.username %]</a>
<i class="icon-user"></i> <a href="[% comment.uid.uri %]" >[% comment.uid.username %]</a>
</div>
[% END %]

Expand Down Expand Up @@ -50,7 +50,7 @@
</div>
[% ELSE %]
<div class="comment-author comment-author-registered">
<i class="icon-user"></i> <a href="/posts/user/[% reply.uid.username %][% settings.static && '.html' %]" >[% reply.uid.username %]</a>
<i class="icon-user"></i> <a href="[% reply.uid.uri %]" >[% reply.uid.username %]</a>
</div>
[% END %]

Expand Down
8 changes: 4 additions & 4 deletions views/index.tt
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
[% END %]
[% FOREACH post in posts %]
<div class="entry">
<h2><a href="/posts/[% post.slug %][% settings.static && '.html' %]">[% post.title %]</a></h2>
<h2><a href="[% post.uri %]">[% post.title %]</a></h2>

<!-- Meta details -->
<div class="meta">
<div class="block_elements">
<i class="icon-calendar"></i> [% post.created_date %]
</div>
<div class="block_elements">
<i class="icon-user"></i> <a href="/posts/user/[% post.user.username %][% settings.static && '.html' %]">[% post.user.username %]</a>
<i class="icon-user"></i> <a href="[% post.user.uri %]">[% post.user.username %]</a>
</div>

[% FOREACH category in post.post_categories %]
<div class="block_elements">
<i class="icon-list"></i> <a href="[% session.app_url %]/posts/category/[% category.category.slug %][% settings.static && '.html' %]">[% category.category.name %]</a>
<i class="icon-list"></i> <a href="[% category.category.uri %]">[% category.category.name %]</a>
</div>
[% END %]

Expand All @@ -61,7 +61,7 @@
</div>

<!-- Read more -->
<a href="[% session.app_url %]/posts/[% post.slug %][% settings.static && '.html' %]" class="btn btn-info">Read More...</a>
<a href="[% post.uri %]" class="btn btn-info">Read More...</a>
</div>
[% END %]
[% IF posts.first %]
Expand Down
4 changes: 2 additions & 2 deletions views/post.tt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<i class="icon-calendar"></i> [% post.created_date %]
</div>
<div class="block_elements">
<i class="icon-user"></i> <a href="/posts/user/[% post.user.username %][% settings.static && '.html' %]">[% post.user.username %]</a>
<i class="icon-user"></i> <a href="[% post.user.uri %]">[% post.user.username %]</a>
</div>

[% FOREACH category in post.post_categories %]
<div class="block_elements">
<i class="icon-list"></i> <a href="[% session.app_url %]/posts/category/[% category.category.slug %][% settings.static && '.html' %]">[% category.category.name %]</a>
<i class="icon-list"></i> <a href="[% category.category.uri %]">[% category.category.name %]</a>
</div>
[% END %]

Expand Down
10 changes: 5 additions & 5 deletions views/post_sidebar.tt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4> Categories </h4>
<ul class="simple-list">
[% FOREACH category in categories %]
<li><a href="[% session.app_url %]/posts/category/[% category.slug %][% settings.static && '.html' %]"> [% category.name %] </a></li>
<li><a href="[% category.uri %]"> [% category.name %] </a></li>
[% END %]
</ul>
</div>
Expand All @@ -16,14 +16,14 @@
<div class="tab-pane fade in active" id="recent">
<ul class="simple-list">
[% FOREACH recent_post in recent %]
<li><a href="[% session.app_url %]/posts/[% recent_post.slug %][% settings.static && '.html' %]">[% recent_post.title %]</a></li>
<li><a href="[% recent_post.uri %]">[% recent_post.title %]</a></li>
[% END %]
</ul>
</div>
<div class="tab-pane fade" id="popular">
<ul class="simple-list">
[% FOREACH popular_post in popular %]
<li><a href="[% session.app_url %]/posts/[% popular_post.slug %][% settings.static && '.html' %]">[% popular_post.title %]</a></li>
<li><a href="[% popular_post.uri %]">[% popular_post.title %]</a></li>
[% END %]
</ul>
</div>
Expand All @@ -33,9 +33,9 @@
<h4 class="widget-head">Tags</h4>
<ul id="tag-list" class="cf">
[% FOREACH tag in post.post_tags %]
<li><a class="btn btn-info" href="[% session.app_url %]/posts/tag/[% tag.tag.slug %][% settings.static && '.html' %]">[% tag.tag.name %]</a></li>
<li><a class="btn btn-info" href="[% tag.tag.uri %]">[% tag.tag.name %]</a></li>
[% END %]
</ul>
</div>
</div>
</div>
</div>
10 changes: 5 additions & 5 deletions views/sidebar.tt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4> Categories </h4>
<ul class="simple-list">
[% FOREACH category in categories %]
<li><a href="[% session.app_url %]/posts/category/[% category.slug %]"> [% category.name %] </a></li>
<li><a href="[% category.uri %]"> [% category.name %] </a></li>
[% END %]
</ul>
</div>
Expand All @@ -16,14 +16,14 @@
<div class="tab-pane fade in active" id="recent">
<ul class="simple-list">
[% FOREACH post in recent %]
<li><a href="[% session.app_url %]/posts/[% post.slug %][% settings.static && '.html' %]">[% post.title %]</a></li>
<li><a href="[% post.uri %]">[% post.title %]</a></li>
[% END %]
</ul>
</div>
<div class="tab-pane fade" id="popular">
<ul class="simple-list">
[% FOREACH post in popular %]
<li><a href="[% session.app_url %]/posts/[% post.slug %][% settings.static && '.html' %]">[% post.title %]</a></li>
<li><a href="[% post.uri %]">[% post.title %]</a></li>
[% END %]
</ul>
</div>
Expand All @@ -32,8 +32,8 @@
<h4 class="widget-head">Tags</h4>
<ul id="tag-list" class="cf">
[% FOREACH tag in tags %]
<li><a href="[% session.app_url %]/posts/tag/[% tag.slug %][% settings.static && '.html' %]">[% tag.name %]</a></li>
<li><a href="[% tag.uri %]">[% tag.name %]</a></li>
[% END %]
</ul>
</div>
</div>
</div>

0 comments on commit cc7095d

Please # to comment.