Allow a default url to be set per trophy codename.

This commit is contained in:
Max Goodman
2013-04-15 17:44:15 -07:00
parent 587abe5808
commit dd5f750bad
2 changed files with 8 additions and 3 deletions

View File

@@ -203,3 +203,7 @@ class Trophy(Relation(Account, Award)):
user.set_trophy_id(uid, trophy._id)
user._commit()
return trophy, preexisting
@property
def trophy_url(self):
return getattr(self, "url", getattr(self._thing2, "url", None))

View File

@@ -29,8 +29,9 @@
%endif
>
<div>
%if hasattr(trophy, "url"):
<a href="${trophy.url}">
<% trophy_url = trophy.trophy_url %>
%if trophy_url:
<a href="${trophy_url}">
%endif
<img class="trophy-icon" src="${trophy._thing2.imgurl % 40}" />
<br/>
@@ -40,7 +41,7 @@
<span class="trophy-description">${trophy.description}</span>
<br/>
%endif
%if hasattr(trophy, "url"):
%if trophy_url:
</a>
%endif
%if c.user_is_admin: