Skip to content

Commit

Permalink
Merge pull request #21 from mbeacom/new-detail-url
Browse files Browse the repository at this point in the history
Change url for kudos details for /id/name
  • Loading branch information
jasonrhaas authored Sep 26, 2018
2 parents d732e7c + bfcaf03 commit bf63b25
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
name='kudos_receive'
),
re_path(r'^kudos/search/$', kudos.views.search, name='kudos_search'),
re_path(r'^kudos/\d+', kudos.views.details, name='kudos_details'),
re_path(r'^kudos/(?P<id>\d+)/(?P<name>\w*)', kudos.views.details, name='kudos_details'),
re_path(r'^kudos/address/(?P<handle>.*)', kudos.views.kudos_preferred_wallet, name='kudos_preferred_wallet'),

# api views
Expand Down
2 changes: 1 addition & 1 deletion app/kudos/templates/shared/kudos_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% load i18n staticfiles %}
{% load kudos_extras %}
<div class="kd-card">
<a href="/kudos/{{ listing.id }}" class="">
<a href="/kudos/{{ listing.id }}/{{ listing.name }}" class="">
<img id="kudosImage" src="{% static listing.image %}" alt="{{ listing.name }}" class="img-thumbnail kd-shadow border-transparent" width="250">
</a>
<span class="kd-price">{{ listing.price_in_eth }} ETH</span>
Expand Down
6 changes: 3 additions & 3 deletions app/kudos/templates/shared/kudos_card_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{{ kudo.description|truncatechars:60 }}
</div>
<div class="content-hover">
<a class="kd-title" href="/kudos/{{ kudo.id }}">{{ kudo.name|humanize_name }}</a>
<a class="kd-title" href="/kudos/{{ kudo.id }}/{{ kudos.name }}">{{ kudo.name|humanize_name }}</a>
{% if kudo.kudos_transfer %}
<p>Sent from <a href="{% url 'profile' kudo.kudos_transfer.from_username %}">{{kudo.kudos_transfer.from_name}}</a></p>
<p>
Expand All @@ -48,15 +48,15 @@
{% for kudo in kudos|slice:":8" %}
<div class="col-xs-12 col-sm-6 col-lg-3 mb-3">
<div class="kd-card kd-extended" aria-haspopup="true" tabindex="0">
<a href="/kudos/{{ kudo.id }}" class="" title="{{ kudo.name|humanize_name }}" tabindex="0">
<a href="/kudos/{{ kudo.id }}/{{ kudo.name }}" class="" title="{{ kudo.name|humanize_name }}" tabindex="0">
<img src="{% static kudo.image %}" alt="{{ kudo.name|humanize_name }}" class="img-thumbnail border-transparent kd-shadow" width="250">
</a>
<div class="kd-content">
<div class="kd-title">{{ kudo.name|humanize_name }}</div>
{{ kudo.description|truncatechars:60 }}
</div>
<div class="content-hover">
<a class="kd-title" href="/kudos/{{ kudo.id }}">{{ kudo.name|humanize_name }}</a>
<a class="kd-title" href="/kudos/{{ kudo.id }}/{{ kudo.name }}">{{ kudo.name|humanize_name }}</a>
{% if kudo.kudos_transfer %}
<p>Sent from <a href="{% url 'profile' kudo.kudos_transfer.from_username %}">{{kudo.kudos_transfer.from_name}}</a></p>
<p>
Expand Down
5 changes: 3 additions & 2 deletions app/kudos/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ def search(request):
return TemplateResponse(request, 'kudos_marketplace.html', context)


def details(request):
def details(request, id, name):
"""Render the detail kudos response."""
kudos_id = request.path.split('/')[-1]
kudos_id = id
kudos_name = name
logger.info(f'kudos id: {kudos_id}')

if not re.match(r'\d+', kudos_id):
Expand Down

0 comments on commit bf63b25

Please sign in to comment.