##// END OF EJS Templates
Removed tag popularity ratings, they are too slow. Added API to get tag...
neko259 -
r651:582b2d85 default
parent child Browse files
Show More
@@ -1,6 +1,5 b''
1 from django.core.urlresolvers import reverse
2 1 import markdown
3 from markdown.inlinepatterns import Pattern
2 from markdown.inlinepatterns import Pattern, SubstituteTagPattern
4 3 from markdown.util import etree
5 4 import boards
6 5
@@ -179,7 +178,8 b' neboard_extension = make_extension()'
179 178
180 179
181 180 def markdown_extended(markup):
182 return markdown.markdown(markup, [neboard_extension], safe_mode=True)
181 return markdown.markdown(markup, [neboard_extension, 'nl2br'],
182 safe_mode=True)
183 183
184 184 formatters = [
185 185 QuotePattern,
@@ -13,7 +13,7 b''
13 13 <div class="post">
14 14 {% if all_tags %}
15 15 {% for tag in all_tags %}
16 <div class="tag_item" style="opacity: {{ tag.get_font_value }}">
16 <div class="tag_item">
17 17 <a class="tag" href="{% url 'tag' tag.name %}">
18 18 #{{ tag.name }}</a>
19 19 </div>
@@ -79,5 +79,7 b" urlpatterns = patterns('',"
79 79 name='get_thread'),
80 80 url(r'^api/add_post/(?P<opening_post_id>\w+)/$', api.api_add_post,
81 81 name='add_post'),
82 url(r'api/get_tag_popularity/(?P<tag_name>\w+)$', api.get_tag_popularity,
83 name='get_tag_popularity'),
82 84
83 85 )
@@ -218,6 +218,15 b' def api_get_post(request, post_id):'
218 218 return HttpResponse(content=json)
219 219
220 220
221 def get_tag_popularity(request, tag_name):
222 tag = get_object_or_404(Tag, name=tag_name)
223
224 json_data = []
225 json_data['popularity'] = tag.get_popularity()
226
227 return HttpResponse(content=json.dumps(json_data))
228
229
221 230 # TODO Add pub time and replies
222 231 def _get_post_data(post_id, format_type=DIFF_TYPE_JSON, request=None,
223 232 include_last_update=False):
General Comments 0
You need to be logged in to leave comments. Login now