Skip to content

Commit

Permalink
feat(pacer): Show pricing on docket page
Browse files Browse the repository at this point in the history
Fixes: #1347
  • Loading branch information
mlissner committed Jul 30, 2020
1 parent ad8524d commit 92074fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 14 additions & 0 deletions cl/custom_filters/templatetags/pacer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django import template

register = template.Library()


@register.filter
def price(rd):
if rd.is_free_on_pacer:
return "free"

if rd.page_count:
cost = rd.page_count * 0.10
return "{:.2f}".format(min(3, cost))
return ""
11 changes: 6 additions & 5 deletions cl/opinion_page/templates/includes/de_list.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% load pacer %}
{% load tz %}


Expand Down Expand Up @@ -94,7 +95,7 @@
<a href="{{ rd.pacer_url }}"
target="_blank"
rel="nofollow">Buy on
PACER</a>
PACER {% if rd.page_count %}(${{ rd|price }}){% endif %}</a>
</li>
{% endif %}
</ul>
Expand All @@ -107,7 +108,7 @@
<a href="{{ rd.pacer_url }}"
class="btn btn-default btn-xs"
target="_blank"
rel="nofollow">Buy on PACER</a>
rel="nofollow">Buy on PACER {% if rd.page_count %}(${{ rd|price }}){% endif %}</a>
{% endif %}
{% endif %}
{% endif %}
Expand All @@ -122,17 +123,17 @@
{% else %}
{# We don't have it #}
{% if rd.is_sealed %}
<span class="btn btn-primary btn-xs disabled"
<span class="btn btn-default btn-xs disabled"
title="Sealed on PACER">
<i class="fa fa-ban"></i>
</span>
{% else %}
{% if rd.pacer_url %}
<a href="{{ rd.pacer_url }}"
class="btn btn-primary btn-xs"
class="btn btn-default btn-xs"
target="_blank"
rel="nofollow"
title="Buy on PACER"><i class="fa fa-download"></i></a>
title="Buy on PACER {% if rd.page_count %}(${{ rd|price }}){% endif %}"><i class="fa fa-download"></i></a>
{% endif %}
{% endif %}
{% endif %}
Expand Down

0 comments on commit 92074fd

Please sign in to comment.