Show More
@@ -1,3 +1,11 b'' | |||||
|
1 | from django.urls import reverse | |||
|
2 | ||||
|
3 | TRIPCODE_VIEW = '<a href="{url}?tripcode={full_text}"' \ | |||
|
4 | 'class="tripcode" title="{full_text}"' \ | |||
|
5 | 'style="border: solid 2px #{color}; border-left: solid 1ex #{color};">' \ | |||
|
6 | '{short_text}</a>' | |||
|
7 | ||||
|
8 | ||||
1 | class Tripcode: |
|
9 | class Tripcode: | |
2 | def __init__(self, code_str): |
|
10 | def __init__(self, code_str): | |
3 | self.tripcode = code_str |
|
11 | self.tripcode = code_str | |
@@ -24,3 +32,8 b' class Tripcode:' | |||||
24 | def get_full_text(self): |
|
32 | def get_full_text(self): | |
25 | return self.tripcode |
|
33 | return self.tripcode | |
26 |
|
34 | |||
|
35 | def get_view(self): | |||
|
36 | return TRIPCODE_VIEW.format(url=reverse('feed'), | |||
|
37 | short_text=self.get_short_text(), | |||
|
38 | full_text=self.get_full_text(), | |||
|
39 | color=self.get_color()) |
@@ -24,12 +24,7 b'' | |||||
24 | {% if post.tripcode %} |
|
24 | {% if post.tripcode %} | |
25 | / |
|
25 | / | |
26 | {% with tripcode=post.get_tripcode %} |
|
26 | {% with tripcode=post.get_tripcode %} | |
27 |
{ |
|
27 | {{ tripcode.get_view|safe }} | |
28 | Move this to tripcode.get_url() and cache. |
|
|||
29 | {% endcomment %} |
|
|||
30 | <a href="{% url 'feed' %}?tripcode={{ tripcode.get_full_text }}" |
|
|||
31 | class="tripcode" title="{{ tripcode.get_full_text }}" |
|
|||
32 | style="border: solid 2px #{{ tripcode.get_color }}; border-left: solid 1ex #{{ tripcode.get_color }};">{{ tripcode.get_short_text }}</a> |
|
|||
33 | {% endwith %} |
|
28 | {% endwith %} | |
34 | {% endif %} |
|
29 | {% endif %} | |
35 | {% comment %} |
|
30 | {% comment %} |
General Comments 0
You need to be logged in to leave comments.
Login now