summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRosandra Cuello <rosandra.cuello@gmail.com>2011-11-17 11:22:26 -0400
committerRosandra Cuello <rosandra.cuello@gmail.com>2011-11-17 11:22:26 -0400
commitd7ead064414efec0e0d049842459e1a4d8a99edd (patch)
treeb3345fe079b8d4717b5c6ccb1b5569631d86d2b6
parentc9c18692410dc993cc85aefeac4163e3e4557b6d (diff)
downloadaskbot-d7ead064414efec0e0d049842459e1a4d8a99edd.tar.gz
askbot-d7ead064414efec0e0d049842459e1a4d8a99edd.tar.bz2
askbot-d7ead064414efec0e0d049842459e1a4d8a99edd.zip
most urls working except for the ones including page or page_size
-rw-r--r--askbot/skins/default/media/js/live_search.js61
-rw-r--r--askbot/skins/default/media/js/utils.js14
-rw-r--r--askbot/skins/default/templates/blocks/header.html2
-rw-r--r--askbot/skins/default/templates/blocks/input_bar.html2
-rw-r--r--askbot/skins/default/templates/macros.html2
-rw-r--r--askbot/skins/default/templates/main_page/headline.html8
-rw-r--r--askbot/skins/default/templates/main_page/nothing_found.html8
-rw-r--r--askbot/skins/default/templates/main_page/tab_bar.html4
-rw-r--r--askbot/skins/default/templates/question.html4
-rw-r--r--askbot/skins/default/templates/tags.html1
-rw-r--r--askbot/skins/default/templates/user_profile/user_stats.html2
-rw-r--r--askbot/skins/default/templates/user_profile/users_questions.html2
-rw-r--r--askbot/templatetags/extra_filters.py63
-rw-r--r--askbot/urls.py201
-rw-r--r--askbot/views/readers.py2
15 files changed, 309 insertions, 67 deletions
diff --git a/askbot/skins/default/media/js/live_search.js b/askbot/skins/default/media/js/live_search.js
index 919722dd..0682631d 100644
--- a/askbot/skins/default/media/js/live_search.js
+++ b/askbot/skins/default/media/js/live_search.js
@@ -23,6 +23,7 @@ var liveSearch = function(){
sortMethod = prevSortMethod;
}
refresh_x_button();
+ search_url = askbot['urls']['questions'] + 'reset_query:true/';
reset_query(sortMethod);
}
);
@@ -318,12 +319,61 @@ var liveSearch = function(){
var create_relevance_tab = function(query_string){
relevance_tab = $('<a></a>');
- relevance_tab.attr('href', '?sort=relevance-desc');
+ href = '/questions/' + replace_in_url(query_string, 'sort:relevance-desc')
+ relevance_tab.attr('href', href);
relevance_tab.attr('id', 'by_relevance');
relevance_tab.html('<span>' + sortButtonData['relevance']['label'] + '</span>');
return relevance_tab;
}
+ var replace_in_url = function (query_string, param){
+ values = param.split(':')
+ type = values[0]
+ value = values[1]
+ params = query_string.split('/')
+ url=""
+
+ for (var i = 0; i < params.length; i++){
+ if (params[i] !== ''){
+ if (params[i].substring(0, type.length) == type){
+ url += param + '/'
+ }
+ else{
+ url += params[i] + '/'
+ }
+ }
+ }
+
+ return url
+
+ }
+
+ var remove_from_url = function (query_string, type){
+ params = query_string.split('/')
+ url=""
+ for (var i = 0; i < params.length; i++){
+ if (params[i] !== ''){
+ if (params[i].substring(0, type.length) !== type){
+ url += params[i] + '/'
+ }
+ }
+ }
+ return url
+ }
+
+ var set_section_tabs = function(query_string){
+ var tabs = $('#section_tabs>a');
+ tabs.each(function(index, element){
+ var tab = $(element);
+ var tab_name = tab.attr('id').replace(/^by_/,'');
+ href = '/questions/' + replace_in_url(query_string, 'section:'+tab_name)
+ tab.attr(
+ 'href',
+ href
+ );
+ });
+ };
+
var set_active_sort_tab = function(sort_method, query_string){
var tabs = $('#sort_tabs>a');
tabs.attr('class', 'off');
@@ -331,9 +381,10 @@ var liveSearch = function(){
var tab = $(element);
var tab_name = tab.attr('id').replace(/^by_/,'');
if (tab_name in sortButtonData){
+ href = '/questions/' + replace_in_url(query_string, 'sort:'+tab_name+'-desc')
tab.attr(
'href',
- '?sort=' + tab_name + '-desc'
+ href
);
tab.attr(
'title',
@@ -444,6 +495,7 @@ var liveSearch = function(){
render_related_tags(data['related_tags'], data['query_string']);
render_relevance_sort_tab(data['query_string']);
set_active_sort_tab(sortMethod, data['query_string']);
+ set_section_tabs(data['query_string']);
query.focus();
//show new div with a fadeIn effect
@@ -475,7 +527,7 @@ var liveSearch = function(){
var reset_query = function(sort_method){
$.ajax({
url: search_url,
- data: {reset_query: true, sort: sort_method},
+ //data: {reset_query: true, sort: sort_method},
dataType: 'json',
success: render_result,
complete: try_again
@@ -511,6 +563,7 @@ var liveSearch = function(){
sortMethod = 'relevance-desc';
}
}
+ search_url = askbot['urls']['questions']; //resetting search_url every times
params = query_string.split('/')
for (var i = 0; i < params.length; i++){
if (params[i] !== ''){
@@ -523,11 +576,13 @@ var liveSearch = function(){
}
}
}
+ //search_url = '/questions/'+search_url
send_query(cur_text, sortMethod);
};
restart_query = function() {
reset_sort_method();
refresh_x_button();
+ search_url = askbot['urls']['questions'] + 'reset_query:true/';
reset_query(sortMethod);
running = true;
};
diff --git a/askbot/skins/default/media/js/utils.js b/askbot/skins/default/media/js/utils.js
index 764d6770..fd67c9c0 100644
--- a/askbot/skins/default/media/js/utils.js
+++ b/askbot/skins/default/media/js/utils.js
@@ -356,6 +356,8 @@ Tag.prototype.createDom = function(){
this._inner_element = this.makeElement(this._inner_html_tag);
if (this.isLinkable()){
var url = askbot['urls']['questions'];
+ var flag = false
+ var author = ''
if (this._url_params !== null){
params = this._url_params.split('/')
for (var i = 0; i < params.length; i++){
@@ -370,18 +372,26 @@ Tag.prototype.createDom = function(){
}
new_tags += escape(this.getName())
url += 'tags:'+new_tags+'/'
+ flag = true
+ }
+ else if (params[i].substring(0, 7) == "author:"){
+ author = params[i];
}
else{
url += params[i] + '/';
}
}
}
+ if (flag == false) {
+ url += 'tags:'+escape(this.getName())+'/'
+ }
+ if (author !== '') {
+ url += author+'/'
+ }
}
else{
url += 'tags:' + escape(this.getName()) + '/';
}
-
-
this._inner_element.attr('href', url);
}
this._inner_element.addClass('tag tag-right');
diff --git a/askbot/skins/default/templates/blocks/header.html b/askbot/skins/default/templates/blocks/header.html
index f480d3c7..c4a09043 100644
--- a/askbot/skins/default/templates/blocks/header.html
+++ b/askbot/skins/default/templates/blocks/header.html
@@ -3,7 +3,7 @@
<div id="ab-header">
<div class="content-wrapper">
{% if settings.SHOW_LOGO %}
- <a id="ab-logo" href="{% url questions %}start_over:true/"><img
+ <a id="ab-logo" href="{% url questions %}"><img
src="{{ settings.SITE_LOGO_URL|media }}"
title="{% trans %}back to home page{% endtrans %}"
alt="{% trans site=settings.APP_SHORT_NAME %}{{site}} logo{% endtrans %}"/></a>
diff --git a/askbot/skins/default/templates/blocks/input_bar.html b/askbot/skins/default/templates/blocks/input_bar.html
index 58849ca5..050fbb3b 100644
--- a/askbot/skins/default/templates/blocks/input_bar.html
+++ b/askbot/skins/default/templates/blocks/input_bar.html
@@ -28,7 +28,7 @@
value="x"
name="reset_query"
{# todo - make sure it works on Enter keypress #}
- onclick="window.location.href='{% url questions %}reset_query:true/'"
+ onclick="window.location.href='{% url questions %}{{ query_string|remove_from_url('query') }}'"
class="cancelSearchBtn"/>
{% endif %}
<input type="submit" value="{% trans %}search{% endtrans %}" name="search" class="searchBtn" id='searchButton'/>
diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html
index fd1bcf57..0ee6f7e9 100644
--- a/askbot/skins/default/templates/macros.html
+++ b/askbot/skins/default/templates/macros.html
@@ -370,7 +370,7 @@ poor design of the data or methods on data objects #}
<{% if not is_link or tag[-1] == '*' %}span{% else %}a{% endif %}
class="tag tag-right{% if css_class %} {{ css_class }}{% endif %}"
{% if is_link %}
- href="{% url questions %}{{url_params|add_tag_to_url(tag|urlencode)}}"
+ href="{% url questions %}{% if url_params %}{{url_params|add_tag_to_url(tag|urlencode)}}{% else %}tags:{{ tag }}/{% endif %}"
title="{% trans %}see questions tagged '{{ tag }}'{% endtrans %}"
{% endif %}
rel="tag"
diff --git a/askbot/skins/default/templates/main_page/headline.html b/askbot/skins/default/templates/main_page/headline.html
index 4b92ba35..a2132df3 100644
--- a/askbot/skins/default/templates/main_page/headline.html
+++ b/askbot/skins/default/templates/main_page/headline.html
@@ -28,16 +28,16 @@
<p class="search-tips">{% trans %}Search tips:{% endtrans %}
{% if reset_method_count > 1 %}
{% if author_name %}
- <a href="{% url questions %}reset_author:true/">{% trans %}reset author{% endtrans %}</a>
+ <a href="{% url questions %}{{ query_string|remove_from_url('author') }}">{% trans %}reset author{% endtrans %}</a>
{% endif %}
{% if search_tags %}{% if author_name and query %}, {% elif author_name %}{% trans %} or {% endtrans %}{% endif %}
- <a href="{% url questions %}reset_tags:true/">{% trans %}reset tags{% endtrans %}</a>
+ <a href="{% url questions %}{{ query_string|remove_from_url('tags') }}">{% trans %}reset tags{% endtrans %}</a>
{% endif %}
{% if query %}{% trans %} or {% endtrans %}
- <a href="{% url questions %}start_over:true/">{% trans %}start over{% endtrans %}</a>
+ <a href="{% url questions %}">{% trans %}start over{% endtrans %}</a>
{% endif %}
{% else %}
- <a href="{% url questions %}start_over:true/">{% trans %}start over{% endtrans %}</a>
+ <a href="{% url questions %}">{% trans %}start over{% endtrans %}</a>
{% endif %}
{% trans %} - to expand, or dig in by adding more tags and revising the query.{% endtrans %}
</p>
diff --git a/askbot/skins/default/templates/main_page/nothing_found.html b/askbot/skins/default/templates/main_page/nothing_found.html
index 1f590709..6a5b744a 100644
--- a/askbot/skins/default/templates/main_page/nothing_found.html
+++ b/askbot/skins/default/templates/main_page/nothing_found.html
@@ -13,16 +13,16 @@
{% trans %}You can expand your search by {% endtrans %}
{% if reset_method_count > 1 %}
{% if author_name %}
- <a href="{% url questions %}reset_author:true/">{% trans %}resetting author{% endtrans %}</a>
+ <a href="{% url questions %}{{ query_string|remove_from_url('author') }}">{% trans %}resetting author{% endtrans %}</a>
{% endif %}
{% if search_tags %}{% if author_name and query %}, {% elif author_name %}{% trans %} or {% endtrans %}{% endif %}
- <a href="{% url questions %}reset_tags:true/">{% trans %}resetting tags{% endtrans %}</a>
+ <a href="{% url questions %}{{ query_string|remove_from_url('tags') }}">{% trans %}resetting tags{% endtrans %}</a>
{% endif %}
{% if query %}{% trans %} or {% endtrans %}
- <a href="{% url questions %}start_over:true/">{% trans %}starting over{% endtrans %}</a>
+ <a href="{% url questions %}">{% trans %}starting over{% endtrans %}</a>
{% endif %}
{% else %}
- <a href="{% url questions %}start_over:true/">{% trans %}starting over{% endtrans %}</a>
+ <a href="{% url questions %}">{% trans %}starting over{% endtrans %}</a>
{% endif %}
</p>
{% endif %}
diff --git a/askbot/skins/default/templates/main_page/tab_bar.html b/askbot/skins/default/templates/main_page/tab_bar.html
index 03146171..cb00bcab 100644
--- a/askbot/skins/default/templates/main_page/tab_bar.html
+++ b/askbot/skins/default/templates/main_page/tab_bar.html
@@ -2,11 +2,11 @@
{% load extra_filters %}
{# cache 600 "scope_sort_tabs" search_tags request.user scope sort query context.page context.page_size language_code #}
<div class="tabBar">
- <div class="tabsC">
+ <div id="section_tabs" class="tabsC">
<span class="label">{% trans %}In:{% endtrans %}</span>
<a id="all"
class="{% if scope == 'all' %}on{% else %}off{% endif %}"
- href="{% url questions %}{{ query_string|replace_in_url("section:all") }}"
+ href="{% url questions %}{{ query_string|replace_in_url("section:all")|replace_in_url("sort:activity-desc") }}"
title="{% trans %}see all questions{% endtrans %}"
><span>{% trans %}all{% endtrans %}</span></a>
<a id="unanswered"
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html
index f46faa2f..819f5000 100644
--- a/askbot/skins/default/templates/question.html
+++ b/askbot/skins/default/templates/question.html
@@ -69,7 +69,7 @@
tag,
css_class = 'post-tag',
html_tag = 'li',
- url_params = 'start_over:true',
+ url_params = '',
)
}}
{% endfor %}
@@ -444,7 +444,7 @@
{{ macros.tag_widget(
tag,
html_tag = 'div',
- url_params = 'start_over:true',
+ url_params = '',
extra_content = '<span class="tag-number">&#215; ' ~
tag.used_count|intcomma ~ '</span>'
)
diff --git a/askbot/skins/default/templates/tags.html b/askbot/skins/default/templates/tags.html
index 19383bb8..99eb5bf7 100644
--- a/askbot/skins/default/templates/tags.html
+++ b/askbot/skins/default/templates/tags.html
@@ -37,7 +37,6 @@
<li>
{{ macros.tag_widget(
tag = tag.name,
- url_params = 'start_over:true',
html_tag = 'div',
extra_content = '<span class="tag-number">&#215; ' ~
tag.used_count|intcomma ~ '</span>'
diff --git a/askbot/skins/default/templates/user_profile/user_stats.html b/askbot/skins/default/templates/user_profile/user_stats.html
index 6e882199..2fd26f82 100644
--- a/askbot/skins/default/templates/user_profile/user_stats.html
+++ b/askbot/skins/default/templates/user_profile/user_stats.html
@@ -73,7 +73,7 @@
tag.name,
html_tag = 'div',
url_params =
- "/start_over:true/author:" ~ view_user.id,
+ "author:" ~ view_user.id,
extra_content =
'<span class="tag-number">&#215; ' ~
tag.user_tag_usage_count|intcomma ~
diff --git a/askbot/skins/default/templates/user_profile/users_questions.html b/askbot/skins/default/templates/user_profile/users_questions.html
index fc7bda60..41809a62 100644
--- a/askbot/skins/default/templates/user_profile/users_questions.html
+++ b/askbot/skins/default/templates/user_profile/users_questions.html
@@ -2,7 +2,7 @@
{% import "macros.html" as macros %}
<div class="user-stats-table">
{% for question in questions %}
- {{macros.question_summary(question, extra_class='narrow', query_string="start_over:true/")}}
+ {{macros.question_summary(question, extra_class='narrow')}}
{% endfor %}
</div>
<!-- end users_questions.html -->
diff --git a/askbot/templatetags/extra_filters.py b/askbot/templatetags/extra_filters.py
index b6dee686..47825dee 100644
--- a/askbot/templatetags/extra_filters.py
+++ b/askbot/templatetags/extra_filters.py
@@ -160,24 +160,14 @@ def absolute_value(number):
@register.filter
def replace_in_url(query_string, param):
- try:
- type, value = param.split(':')
- params = query_string.rstrip('/').split('/')
+ type, value = param.split(':')
+ params = query_string.rstrip('/').split('/')
- for p in params:
- if type in p:
- params[params.index(p)] = param
+ for p in params:
+ if type in p:
+ params[params.index(p)] = param
- query_string = '/'.join(params)+'/'
- except:
- type, value = param.split('=')
- params = query_string.lstrip('?').split('&')
-
- for p in params:
- if type in p:
- params[params.index(p)] = param
-
- query_string = '?'+'&'.join(params)
+ query_string = '/'.join(params)+'/'
return query_string
@register.filter
@@ -185,19 +175,36 @@ def add_tag_to_url(query_string, param):
if query_string:
params = query_string.rstrip('/').split('/')
flag = False
- for p in params:
- if p.startswith('tags:'):
- flag = True
- type, value = p.split(':')
- values = value.split('+')
- if param in values:
- return query_string
- else:
- values.append(param)
- params[params.index(p)] = 'tags:'+'+'.join(values)
+
+ tags = [s for s in params if "tags:" in s]
+ if tags:
+ tags = tags[0]
+ flag = True
+ type, value = tags.split(':')
+ values = value.split('+')
+ if param in values:
+ return query_string
+ else:
+ values.append(param)
+ params[params.index(tags)] = 'tags:'+'+'.join(values)
+
if not flag:
- params.append('tags:'+param)
+ author = [s for s in params if "author:" in s]
+ if author:
+ author = author[0]
+ params.insert(params.index(author), 'tags:'+param)
+ else:
+ params.append('tags:'+param)
query_string = '/'.join(params)+'/'
return query_string
-
+@register.filter
+def remove_from_url(query_string, param_type):
+ if query_string:
+ params = query_string.rstrip('/').split('/')
+ new_params = []
+ for p in params:
+ if not p.startswith(param_type):
+ new_params.append(p)
+ query_string = '/'.join(new_params)+'/'
+ return query_string
diff --git a/askbot/urls.py b/askbot/urls.py
index 0cf36412..eba051c5 100644
--- a/askbot/urls.py
+++ b/askbot/urls.py
@@ -64,46 +64,217 @@ urlpatterns = patterns('',
kwargs = {'object_name': 'Answer'},
name='answer_revisions'
),
- url(#this url works both normally and through ajax
+
+ # BEGIN Questions (main page) urls. All this urls work both normally and through ajax
+
+ url( # section/sort/query/search/tags/author
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/search:search/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/tags/author/page_size Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/tags/author/page Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/tags/author for use with ajax
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/author/page_size Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/author/page Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/author for use with ajax
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/search/author
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/search:search/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/tags/page_size Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/tags:(?P<tags>[\w\d\-\+\#]+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/tags/page Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/tags:(?P<tags>[\w\d\-\+\#]+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/search/tags
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/search:search/tags:(?P<tags>[\w\d\-\+\#]+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/tags for use with ajax
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/tags:(?P<tags>[\w\d\-\+\#]+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+
+ url( # section/sort/query/search
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/search:search/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/page_size Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query/page Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/query for use with ajax
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/query:(?P<query>[\w\d\-\+\#]+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/tags/author/page_size Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/tags/author/page Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/tags/author for use with ajax
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/author/page_size Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/author:(?P<author>\d+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/author/page Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/author:(?P<author>\d+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/author for use with ajax
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/tags/page_size Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/tags:(?P<tags>[\w\d\-\+\#]+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # section/sort/tags/page Note:issues with default start_over
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/tags:(?P<tags>[\w\d\-\+\#]+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # include section/sort/tags
r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/tags:(?P<tags>[\w\d\-\+\#]+)/$' % _('questions'),
views.readers.questions,
name='questions'
),
- url(#this url works both normally and through ajax
- r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/$' % _('questions'),
+ url( # tags/author/page_size Note:issues with default start_over
+ r'^%s/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
views.readers.questions,
name='questions'
),
- url(
- r'^%s/remove_tag:(?P<remove_tag>[\w\d\-\#]+)/$' % _('questions'),
+ url( # tags/author/page Note:issues with default start_over
+ r'^%s/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # include tags/author
+ r'^%s/tags:(?P<tags>[\w\d\-\+\#]+)/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+
+ url( # author/page_size Note:issues with default start_over
+ r'^%s/author:(?P<author>\d+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
views.readers.questions,
name='questions'
),
- url(
- r'^%s/reset_tags:(?P<reset_tags>\w+)/$' % _('questions'),
+ url( # author/page Note:issues with default start_over
+ r'^%s/author:(?P<author>\d+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # include author
+ r'^%s/author:(?P<author>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+
+ url( # tags/page_size Note:issues with default start_over
+ r'^%s/tags:(?P<tags>[\w\d\-\+\#]+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
views.readers.questions,
name='questions'
),
- url(
- r'^%s/reset_author:(?P<reset_author>\w+)/$' % _('questions'),
+ url( # tags/page Note:issues with default start_over
+ r'^%s/tags:(?P<tags>[\w\d\-\+\#]+)/page:(?P<page>\d+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # include tags
+ r'^%s/tags:(?P<tags>[\w\d\-\+\#]+)/$' % _('questions'),
+ views.readers.questions,
+ name='questions'
+ ),
+ url( # include section/sort/page_size
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/page_size:(?P<page_size>\d+)/$' % _('questions'),
views.readers.questions,
name='questions'
),
- url(
- r'^%s/reset_query:(?P<reset_query>\w+)/$' % _('questions'),
+ url( # include section/sort/page
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/page:(?P<page>\d+)/$' % _('questions'),
views.readers.questions,
name='questions'
),
- url(
- r'^%s/start_over:(?P<start_over>\w+)/$' % _('questions'), #Nota: hay start over con mas parametros
+ url( # include section/sort
+ r'^%s/section:(?P<scope>\w+)/sort:(?P<sort>[\w\-]+)/$' % _('questions'),
views.readers.questions,
name='questions'
),
+ url( # removes tag, this is used only with ajax and this parameters is always used alone
+ r'^%s/remove_tag:(?P<remove_tag>[\w\d\-\#]+)/$' % _('questions'),
+ views.readers.questions,
+ {'start_over': (None)}, # this parameter is true by default, so we are making it false here
+ name='questions'
+ ),
+ url( # reset_query, for ajax use
+ r'^%s/reset_query:(?P<reset_query>\w+)/$' % _('questions'),
+ views.readers.questions,
+ {'start_over': (None)}, # this parameter is true by default, so we are making it false here
+ name='questions'
+ ),
url(
- r'^%s$' % _('questions/'),
- views.readers.questions,
+ r'^%s$' % _('questions/'),
+ views.readers.questions,
name='questions'
),
+
+ # END main page urls
+
url(
r'^api/get_questions/',
views.commands.api_get_questions,
diff --git a/askbot/views/readers.py b/askbot/views/readers.py
index 3163ce61..f35a4e8b 100644
--- a/askbot/views/readers.py
+++ b/askbot/views/readers.py
@@ -64,7 +64,7 @@ def index(request):#generates front page - shows listing of questions sorted in
def questions(request, scope=const.DEFAULT_POST_SCOPE, sort=const.DEFAULT_POST_SORT_METHOD, query=None, \
search=None, tags=None, author=None, page=None, reset_tags=None, \
- reset_author=None, reset_query=None, start_over=None, \
+ reset_author=None, reset_query=None, start_over=True, \
remove_tag=None, page_size=None):
"""
List of Questions, Tagged questions, and Unanswered questions.