Show More
@@ -79,3 +79,13 b' textarea, input {' | |||
|
79 | 79 | height: 100px; |
|
80 | 80 | width: 100%; |
|
81 | 81 | } |
|
82 | ||
|
83 | .post-button-form { | |
|
84 | display: inline; | |
|
85 | } | |
|
86 | ||
|
87 | .post-button-form > input[type="submit"] { | |
|
88 | border: none; | |
|
89 | margin: 0; | |
|
90 | padding: 0; | |
|
91 | } |
@@ -81,6 +81,21 b' function translate_time(node) {' | |||
|
81 | 81 | }); |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | /** | |
|
85 | * We use buttons viewed as a form with link and hidden inputs to ensure | |
|
86 | * the search crawlers don't index or click them. | |
|
87 | * | |
|
88 | * But we need to submit the form by clicking the links. That's why these | |
|
89 | * handlers are here. | |
|
90 | */ | |
|
91 | function addPostButtonActions() { | |
|
92 | $('.post-button-form > a').each(function() { | |
|
93 | $(this).click(function() { | |
|
94 | $(this).parent().submit(); | |
|
95 | }); | |
|
96 | }); | |
|
97 | } | |
|
98 | ||
|
84 | 99 | $( document ).ready(function() { |
|
85 | 100 | hideEmailFromForm(); |
|
86 | 101 | |
@@ -96,4 +111,6 b' function translate_time(node) {' | |||
|
96 | 111 | highlightCode($(document)); |
|
97 | 112 | |
|
98 | 113 | translate_time(null); |
|
114 | ||
|
115 | addPostButtonActions(); | |
|
99 | 116 | }); |
@@ -40,22 +40,25 b'' | |||
|
40 | 40 | {% if tag %} |
|
41 | 41 | <div class="tag_info"> |
|
42 | 42 | <h2> |
|
43 | <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form"> | |
|
44 | <input type="hidden" name="method" | |
|
43 | 45 | {% if is_favorite %} |
|
44 | <a href="{% url 'tag' tag.name %}?method=unsubscribe&next={{ request.path }}" | |
|
45 |
class="fav" |
|
|
46 | <input type="hidden" name="method" value="unsubscribe" /> | |
|
47 | <a class="fav" href="#">★</a> | |
|
46 | 48 | {% else %} |
|
47 | <a href="{% url 'tag' tag.name %}?method=subscribe&next={{ request.path }}" | |
|
48 |
class="not_fav" |
|
|
49 | <input type="hidden" name="method" value="subscribe" /> | |
|
50 | <a class="not_fav" href="#">★</a> | |
|
49 | 51 | {% endif %} |
|
52 | </form> | |
|
53 | <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form"> | |
|
50 | 54 | {% if is_hidden %} |
|
51 | <a href="{% url 'tag' tag.name %}?method=unhide&next={{ request.path }}" | |
|
52 | title="{% trans 'Show tag' %}" | |
|
53 | class="fav" rel="nofollow">H</a> | |
|
55 | <input type="hidden" name="method" value="unhide" /> | |
|
56 | <a class="fav" href="#">H</a> | |
|
54 | 57 | {% else %} |
|
55 | <a href="{% url 'tag' tag.name %}?method=hide&next={{ request.path }}" | |
|
56 | title="{% trans 'Hide tag' %}" | |
|
57 | class="not_fav" rel="nofollow">H</a> | |
|
58 | <input type="hidden" name="method" value="hide" /> | |
|
59 | <a class="not_fav" href="#">H</a> | |
|
58 | 60 | {% endif %} |
|
61 | </form> | |
|
59 | 62 | {% autoescape off %} |
|
60 | 63 | {{ tag.get_view }} |
|
61 | 64 | {% endautoescape %} |
@@ -43,13 +43,16 b' class TagView(AllThreadsView, Dispatcher' | |||
|
43 | 43 | def get(self, request, tag_name, page=DEFAULT_PAGE, form=None): |
|
44 | 44 | self.tag_name = tag_name |
|
45 | 45 | |
|
46 | dispatch_result = self.dispatch_method(request) | |
|
47 | if dispatch_result: | |
|
48 | return dispatch_result | |
|
49 | else: | |
|
50 | 46 |
|
|
51 | 47 | |
|
48 | ||
|
52 | 49 | def post(self, request, tag_name, page=DEFAULT_PAGE): |
|
50 | self.tag_name = tag_name | |
|
51 | ||
|
52 | if 'method' in request.POST: | |
|
53 | self.dispatch_method(request) | |
|
54 | form = None | |
|
55 | else: | |
|
53 | 56 | form = ThreadForm(request.POST, request.FILES, |
|
54 | 57 | error_class=PlainErrorList) |
|
55 | 58 | form.session = request.session |
@@ -68,16 +71,12 b' class TagView(AllThreadsView, Dispatcher' | |||
|
68 | 71 | settings_manager = get_settings_manager(request) |
|
69 | 72 | settings_manager.add_fav_tag(tag) |
|
70 | 73 | |
|
71 | return self.redirect_to_next(request) | |
|
72 | ||
|
73 | 74 | def unsubscribe(self, request): |
|
74 | 75 | tag = get_object_or_404(Tag, name=self.tag_name) |
|
75 | 76 | |
|
76 | 77 | settings_manager = get_settings_manager(request) |
|
77 | 78 | settings_manager.del_fav_tag(tag) |
|
78 | 79 | |
|
79 | return self.redirect_to_next(request) | |
|
80 | ||
|
81 | 80 | def hide(self, request): |
|
82 | 81 | """ |
|
83 | 82 | Adds tag to user's hidden tags. Threads with this tag will not be |
General Comments 0
You need to be logged in to leave comments.
Login now