Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
スターテンプレートの修正と Persona.get_absolute_url の修正
Browse files Browse the repository at this point in the history
Close #315 な修正を行った。これで高速化してるはず?また
Issue #316 を処理するまでは Persona.get_absolute_url は間違いなので
目についた部分は直した
  • Loading branch information
lambdalisue committed Oct 19, 2014
1 parent 40d6a3c commit 5c38b2e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/templates/activities/blogs/entry_created.html
Expand Up @@ -3,7 +3,7 @@
<img src="{{ object.author.get_middle_avatar }}" class="avatar avatar-middle">
{% endblock %}
{% block body %}
<a href="{{ object.author.get_absolute_url }}">{{ object.author.nickname }}</a>さんが
<a href="{{ object.author.profile.get_absolute_url }}">{{ object.author.nickname }}</a>さんが
{% if object.get_absolute_url %}
<a href="{{ object.get_absolute_url }}">{{ object.title }}</a>」を
{% else %}
Expand Down
8 changes: 5 additions & 3 deletions src/templates/components/star.html
@@ -1,10 +1,12 @@
<li class="star" star-id="{{ star.pk }}" star-quote="{{ star.quote }}" rel="tooltip" data-toggle="tooltip" title="{{ star.tooltip_text }}">
<div class="star-user">
<a href="{{ star.author.get_absolute_url }}">
<a href="{{ star.author.profile.get_absolute_url }}">
<img class="avatar avatar-small" src="{{ star.author.get_small_avatar }}">
{% if user has 'stars.star_delete' of star %}
{# allowed_to_delete_starはstar_container.htmlから渡され、このスター郡が付加されているオブジェクトの編集権限をユーザが持っている場合にTrueとなる #}
{# また SQL や メソッドの呼び出しを極力少なくするためにまずスターの所有者をチェックしてからパーミッションチェックを行なっている #}
{% if allowed_to_delete_star or star.author == user and user has 'stars.delete_star' of star %}
<a href="#" class="star-remove" style="display: none;"><span class="glyphicon glyphicon-remove"></span></a>
{% endif %}
</a>
</div>
</li>
</li>
8 changes: 7 additions & 1 deletion src/templates/components/star_container.html
Expand Up @@ -10,9 +10,15 @@
<div class="star-body-col">
{% get_stars object as stars %}
<ul>
{% if user has 'stars.delete_star' of object %}
{% for star in stars %}
{% include "components/star.html" %}
{% include "components/star.html" with allowed_to_delete_star=True %}
{% endfor %}
{% else %}
{% for star in stars %}
{% include "components/star.html" with allowed_to_delete_star=False %}
{% endfor %}
{% endif %}
<li class="star-read-more"><span class="glyphicon glyphicon-chevron-down"></span><span class="text">10</span></li>
</ul>
</div>
Expand Down

0 comments on commit 5c38b2e

Please sign in to comment.