init: function(){\r
collectPickedTags();\r
setupHideIgnoredQuestionsControl();\r
- $("#interestingTagInput, #ignoredTagInput").autocomplete(tags, {\r
+ $("#interestingTagInput, #ignoredTagInput").autocomplete("/matching_tags", {\r
minChars: 1,\r
matchContains: true,\r
max: 20,\r
- multiple: true,\r
- multipleSeparator: " ",\r
- formatItem: function(row, i, max) {\r
- return row.n + " ("+ row.c +")";\r
+ /*multiple: false, - the favorite tags and ignore tags don't let you do multiple tags\r
+ multipleSeparator: " "*/\r
+\r
+ formatItem: function(row, i, max, value) {\r
+ return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";\r
},\r
- formatResult: function(row, i, max){\r
- return row.n;\r
+\r
+ formatResult: function(row, i, max, value){\r
+ return row[0];\r
}\r
\r
});\r
}\r
\r
$(document).ready( function(){\r
- if (window.tags != undefined)\r
+ //if (window.tags != undefined)\r
pickedTags().init();\r
});\r
\r
$('#pre-collapse').text(txt);
});
- //Tags autocomplete action
- var tags = {{ tags|safe }};
- $("#id_tags").autocomplete(tags, {
+ // Tags autocomplete action
+ $("#id_tags").autocomplete("/matching_tags", {
minChars: 1,
matchContains: true,
max: 20,
multiple: true,
multipleSeparator: " ",
- formatItem: function(row, i, max) {
+ /*formatItem: function(row, i, max) {
return row.n + " ("+ row.c +")";
},
formatResult: function(row, i, max){
return row.n;
+ }*/
+ formatItem: function(row, i, max, value) {
+ return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
+ },
+
+ formatResult: function(row, i, max, value){
+ return row[0];
}
});
$().ready(function(){
$("#nav_questions").attr('className',"on");
//Tags autocomplete action
- var tags = {{ tags|safe }};
- $("#id_tags").autocomplete(tags, {
+ $("#id_tags").autocomplete("/matching_tags", {
minChars: 1,
matchContains: true,
max: 20,
multiple: true,
multipleSeparator: " ",
- formatItem: function(row, i, max) {
+ /*formatItem: function(row, i, max) {
return row.n + " ("+ row.c +")";
},
formatResult: function(row, i, max){
return row.n;
+ } */
+ formatItem: function(row, i, max, value) {
+ return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
+ },
+
+ formatResult: function(row, i, max, value){
+ return row[0];
}
});
url(r'^%s(?P<id>\d+)/' % _('flag/'), app.commands.flag_post, name='flag_post'),
url(r'^%s(?P<id>\d+)/' % _('delete/'), app.commands.delete_post, name='delete_post'),
url(r'^%s(?P<id>\d+)/$' % _('subscribe/'), app.commands.subscribe, name="subscribe"),
-
+ url(r'^%s' % _('matching_tags/'), app.commands.matching_tags, name='matching_tags'),
+
url(r'^%s(?P<id>\d+)/%s$' % (_('questions/'), _('revisions/')), app.readers.revisions, name='question_revisions'),
url(r'^%s$' % _('command/'), app.commands.ajax_command, name='call_ajax'),
ts.update(reason=reason)
return HttpResponse(simplejson.dumps(''), mimetype="application/json")
+def matching_tags(request):
+ if len(request.GET['q']) == 0:
+ raise Exception(_("Invalid request"))
+
+ possible_tags = Tag.objects.filter(name__istartswith = request.GET['q'])
+ tag_output = ''
+ for tag in possible_tags:
+ tag_output += (tag.name + "|" + tag.name + "." + tag.used_count.__str__() + "\n")
+
+ return HttpResponse(tag_output, mimetype="text/plain")
+
@ajax_login_required
def ajax_toggle_ignored_questions(request):#ajax tagging and tag-filtering system
if request.user.hide_ignored_questions:
return {
"questions" : questions,
"questions_count" : questions.count(),
- "tags_autocomplete" : _get_tags_cache_json(),
+ #"tags_autocomplete" : _get_tags_cache_json(),
"list_description": list_description,
"base_path" : base_path,
}
else:
form = AskForm()
- tags = _get_tags_cache_json()
+ #tags = _get_tags_cache_json()
return render_to_response('ask.html', {
'form' : form,
- 'tags' : tags,
+ #'tags' : tags,
'email_validation_faq_url':reverse('faq') + '#validate',
}, context_instance=RequestContext(request))
return render_to_response('question_retag.html', {
'question': question,
'form' : form,
- 'tags' : _get_tags_cache_json(),
+ #'tags' : _get_tags_cache_json(),
}, context_instance=RequestContext(request))
def _edit_question(request, question):
'question': question,
'revision_form': revision_form,
'form' : form,
- 'tags' : _get_tags_cache_json()
+ #'tags' : _get_tags_cache_json()
}, context_instance=RequestContext(request))
@login_required