summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xaskbot/skins/default/media/style/style.css101
-rw-r--r--askbot/skins/default/templates/base.html2
-rw-r--r--askbot/skins/default/templates/blocks/header.html32
-rw-r--r--askbot/skins/default/templates/blocks/header_meta_links.html53
-rw-r--r--askbot/skins/default/templates/macros.html42
-rw-r--r--askbot/skins/default/templates/main_page.html24
-rw-r--r--askbot/skins/default/templates/main_page/content.html17
-rw-r--r--askbot/skins/default/templates/main_page/headline.html50
-rw-r--r--askbot/skins/default/templates/main_page/javascript.html27
-rw-r--r--askbot/skins/default/templates/main_page/nothing_found.html31
-rw-r--r--askbot/skins/default/templates/main_page/paginator.html7
-rw-r--r--askbot/skins/default/templates/main_page/sidebar.html35
-rw-r--r--askbot/skins/default/templates/main_page/tab_bar.html86
-rw-r--r--askbot/skins/default/templates/questions.html259
-rw-r--r--askbot/tests/page_load_tests.py31
-rw-r--r--askbot/views/readers.py2
16 files changed, 394 insertions, 405 deletions
diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css
index 67dbbe67..539dee57 100755
--- a/askbot/skins/default/media/style/style.css
+++ b/askbot/skins/default/media/style/style.css
@@ -123,17 +123,21 @@ blockquote {
background-color: #F5F5F5;
}
-#askbot-content {
+.content-wrapper {/* wrapper positioning class */
width: 960px;
margin: auto;
+ position:relative;
}
-#roof {
- position: relative;
+#ab-header {
margin-top: 0px;
background: #FFF;
}
+#ab-header .content-wrapper {
+ height: 90px;/* same as logo height */
+}
+
#CALeft {
width: 710px;
float: left;
@@ -162,61 +166,58 @@ blockquote {
background: #777;
}
-/* why is this called top? - this contains links like login, faq, etc */
-#top {
+#ab-logo {
+ padding: 0px 0px 0px 10px;
position: absolute;
+ bottom: 0;
+ left: 0;
+ height: 90px;
+ width: 70px;
+}
+
+#ab-meta-nav,
+#ab-main-nav {
+ position: absolute;
+ left: 100px;
+}
+
+#ab-meta-nav {
top: 0px;
- right: 250px;
height: 20px;
- text-align: right;
padding: 3px;
- background-color: #ffffff;
+ margin: 0;
}
-/*#header {width:960px;}*/
-#top a {
+#ab-meta-nav a {
height: 35px;
- text-align: right; /*letter-spacing:1px; */
+ text-align: right;
margin-left: 20px;
text-decoration: underline;
color: #555555;
}
-#top a.ab-responses-envelope {
+#ab-meta-nav a:first-child {
+ margin-left: 0;
+}
+
+#ab-meta-nav a#ab-responses {
margin-left: 3px;
}
-#top a img {
+#ab-meta-nav a img {
vertical-align:middle;
margin-bottom:2px;
}
-#logo {
- padding: 0px 0px 0px 10px;
- height: 90px;
- width: 70px;
-}
-
-#logoContainer {
-}
-#navTabContainer {
- width: 610px;
- padding-left: 10px;
- text-align: left;
-}
-
-/* navBar includes logo, main tabs and links like logout, about, faq */
-#navBar {
- float: clear;
- position: relative;
- display: block;
- width: 960px;
+#ab-meta-nav .user-info a {
+ margin: 0;
+ text-decoration: none;
}
-#navBar .nav {
- margin: 20px 0px 0px 0px; /*letter-spacing:1px; */
+#ab-main-nav {
+ bottom: 0;
}
-#navBar .nav a {
+#ab-main-nav a {
color: #333333;
background-color: #fff0e0;
border: 1px solid #888888;
@@ -224,7 +225,7 @@ blockquote {
padding: 0px 12px 3px 12px;
height: 25px;
line-height: 30px;
- margin-left: 10px;
+ margin-right: 10px;
font-size: 18px;
font-weight: 100;
text-decoration: none;
@@ -232,11 +233,11 @@ blockquote {
float: left;
}
-#navBar .nav a:hover {
- text-decoration: underline
+#ab-main-nav a:hover {
+ text-decoration: underline;
}
-#navBar .nav a.on {
+#ab-main-nav a.on {
height: 24px;
line-height: 28px;
border-bottom: 1px solid #a40000;
@@ -249,23 +250,17 @@ blockquote {
text-decoration: none
}
-#navBar .nav a.special {
+#ab-main-nav a.special {
font-size: 18px;
color: #B02B2C;
font-weight: bold;
text-decoration: none;
}
-#navBar .nav a.special:hover {
+#ab-main-nav a.special:hover {
text-decoration: underline;
}
-/* todo: this is probably not used any more */
-#navBar .nav div.focus {
- float: right;
- padding-right: 0px;
-}
-
#searchBar {
display:inline-block;
background-color: #cccccc;/*888a85; /*#e9b96e;*/
@@ -1297,11 +1292,6 @@ ins .post-tag {
text-decoration: none;
}
-#top a.user-micro-info {
- margin-left:0px;
- text-decoration:none;
-}
-
.narrow .tags {
float: left;
}
@@ -1930,11 +1920,6 @@ p.signup_p {
padding-right:5px;
}
-#top a.ab-nav-karma, #top a.ab-nav-badges {
- margin: 0;
- text-decoration: none;
-}
-
img.gravatar {
margin:2px;
}
diff --git a/askbot/skins/default/templates/base.html b/askbot/skins/default/templates/base.html
index f2ee98af..a1575646 100644
--- a/askbot/skins/default/templates/base.html
+++ b/askbot/skins/default/templates/base.html
@@ -46,7 +46,7 @@
{% include "blocks/system_messages.html" %}
{% include "custom_header.html" ignore missing %}
{% include "blocks/header.html" %}
- <div id="askbot-content">
+ <div class="content-wrapper">
{% block body %}
{% endblock %}
</div>
diff --git a/askbot/skins/default/templates/blocks/header.html b/askbot/skins/default/templates/blocks/header.html
index 917e3a4f..981168ea 100644
--- a/askbot/skins/default/templates/blocks/header.html
+++ b/askbot/skins/default/templates/blocks/header.html
@@ -1,24 +1,15 @@
<!-- template header.html -->
{% import "macros.html" as macros %}
-<div id="roof">
- <div id="navBar">
- <div id="top">
- {% include "blocks/header_meta_links.html" %}
- </div>
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- {% if settings.SHOW_LOGO %}
- <td id="logoContainer">
- <div id="logo">
- <a href="{% url questions %}?start_over=true"><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>
- </div>
- </td>
- {% endif %}
- <td id="navTabContainer" valign="bottom" align="left">
- <div class="nav">
+<div id="ab-header">
+ <div class="content-wrapper">
+ {% if settings.SHOW_LOGO %}
+ <a id="ab-logo" href="{% url questions %}?start_over=true"><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>
+ {% endif %}
+ <div id="ab-meta-nav">{% include "blocks/header_meta_links.html" %}</div>
+ <div id="ab-main-nav">
<a
id="nav_questions"
href="{% url questions %}"
@@ -45,9 +36,6 @@
class="{% if active_tab == 'ask' %}on{% else %}special{% endif %}"
>{% trans %}ask a question{% endtrans %}</a>
</div>
- </td>
- </tr>
- </table>
</div>
</div>
<!-- end template header.html -->
diff --git a/askbot/skins/default/templates/blocks/header_meta_links.html b/askbot/skins/default/templates/blocks/header_meta_links.html
index 93bba656..e5969416 100644
--- a/askbot/skins/default/templates/blocks/header_meta_links.html
+++ b/askbot/skins/default/templates/blocks/header_meta_links.html
@@ -1,55 +1,16 @@
{% if request.user.is_authenticated() %}
<a href="{{ request.user.get_absolute_url() }}">{{ request.user.username }}</a>
- {% spaceless %}
- {% if request.user.new_response_count > 0 or request.user.seen_response_count > 0 %}
- <a class='ab-responses-envelope' href="{{request.user.get_absolute_url()}}?sort=inbox&section=forum">
- <img
- alt="{% trans username=request.user.username %}responses for {{username}}{% endtrans %}"
- {% if request.user.new_response_count > 0 %}
- src="{{ "/images/mail-envelope-full.png"|media }}"
- title="{% trans response_count=request.user.new_response_count %}you have a new response{% pluralize %}you nave {{response_count}} new responses{% endtrans %}"
- {% elif request.user.seen_response_count > 0 %}
- src="{{ "/images/mail-envelope-empty.png"|media }}"
- title="{% trans %}no new responses yet{% endtrans %}"
- {% endif %}
- />
- </a>
- {% endif %}
- {% if moderation_items %}
- <a class="ab-responses-envelope"
- href="{{request.user.get_absolute_url()}}?sort=inbox&section=flags"
- >
- {% if moderation_items['new_count'] > 0 %}
- <img src="{{'/images/dialog-warning.png'|media}}"
- {% if moderation_items['seen_count'] > 0 %}
- alt="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}"
- title="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}"
- {% else %}
- alt="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}"
- title="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}"
- {% endif %}
- />
- {% elif moderation_items['seen_count'] > 0 %}
- <img src={{'/images/dialog-warning-off.png'|media}}
- alt="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}"
- title="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}"
- />
- {% endif %}
- </a>
- {% endif %}
- {#
- {% endif %}
- {% else if moderation_items['seen_count'] > 0 %}
- {% endif %}
- {% endif %#}
- {% endspaceless %}
+ <span class="user-info">
+ {{ macros.inbox_link(request.user) }}
+ {{ macros.moderation_items_link(request.user, moderation_items) }}
({{ macros.user_long_score_and_badge_summary(user) }})
+ </span>
<a href="{% url logout %}">{% trans %}logout{% endtrans %}</a>
{% else %}
<a href="{% url user_signin %}">{% trans %}login{% endtrans %}</a>
{% endif %}
-<a href="{% url about %}">{% trans %}about{% endtrans %}</a>
-<a href="{% url faq %}">{% trans %}faq{% endtrans %}</a>
+ <a href="{% url about %}">{% trans %}about{% endtrans %}</a>
+ <a href="{% url faq %}">{% trans %}faq{% endtrans %}</a>
{% if request.user.is_authenticated() and request.user.is_administrator() %}
-<a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a>
+ <a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a>
{% endif %}
diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html
index c93077f5..61cd8a07 100644
--- a/askbot/skins/default/templates/macros.html
+++ b/askbot/skins/default/templates/macros.html
@@ -446,3 +446,45 @@ poor design of the data or methods on data objects #}
</div>
<div id="previewer" class="wmd-preview"></div>
{%- endmacro -%}
+
+{%- macro inbox_link(user) -%}
+ {% if user.new_response_count > 0 or user.seen_response_count > 0 %}
+ <a id='ab-responses' href="{{user.get_absolute_url()}}?sort=inbox&section=forum">
+ <img
+ alt="{% trans username=user.username %}responses for {{username}}{% endtrans %}"
+ {% if user.new_response_count > 0 %}
+ src="{{ "/images/mail-envelope-full.png"|media }}"
+ title="{% trans response_count=user.new_response_count %}you have a new response{% pluralize %}you nave {{response_count}} new responses{% endtrans %}"
+ {% elif user.seen_response_count > 0 %}
+ src="{{ "/images/mail-envelope-empty.png"|media }}"
+ title="{% trans %}no new responses yet{% endtrans %}"
+ {% endif %}
+ />
+ </a>
+ {% endif %}
+{%- endmacro -%}
+
+{%- macro moderation_items_link(user, moderation_items) -%}
+ {% if moderation_items %}
+ <a id="ab-responses"
+ href="{{user.get_absolute_url()}}?sort=inbox&section=flags"
+ >
+ {% if moderation_items['new_count'] > 0 %}
+ <img src="{{'/images/dialog-warning.png'|media}}"
+ {% if moderation_items['seen_count'] > 0 %}
+ alt="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}"
+ title="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}"
+ {% else %}
+ alt="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}"
+ title="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}"
+ {% endif %}
+ />
+ {% elif moderation_items['seen_count'] > 0 %}
+ <img src={{'/images/dialog-warning-off.png'|media}}
+ alt="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}"
+ title="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}"
+ />
+ {% endif %}
+ </a>
+ {% endif %}
+{%- endmacro -%}
diff --git a/askbot/skins/default/templates/main_page.html b/askbot/skins/default/templates/main_page.html
new file mode 100644
index 00000000..d0cddc68
--- /dev/null
+++ b/askbot/skins/default/templates/main_page.html
@@ -0,0 +1,24 @@
+{% extends "two_column_body.html" %}
+{#
+ this template is split into several
+ blocks that are included here
+ the blocks are within directory templates/main_page
+ relative to the skin directory
+
+ there is no html markup in this file
+#}
+<!-- questions.html -->
+{% block title %}{% spaceless %}{% trans %}Questions{% endtrans %}{% endspaceless %}{% endblock %}
+{% block content %}
+ {% include "main_page/tab_bar.html" %}
+ {% include "main_page/headline.html" %}
+ {% include "main_page/content.html" %}
+ {% include "main_page/paginator.html" %}
+{% endblock %}
+{% block sidebar %}
+ {% include "main_page/sidebar.html" %}
+{% endblock %}
+{% block endjs %}
+ {% include "main_page/javascript.html" %}
+{% endblock %}
+<!-- end questions.html -->
diff --git a/askbot/skins/default/templates/main_page/content.html b/askbot/skins/default/templates/main_page/content.html
new file mode 100644
index 00000000..72128cdc
--- /dev/null
+++ b/askbot/skins/default/templates/main_page/content.html
@@ -0,0 +1,17 @@
+{% import "macros.html" as macros %}
+<div id="question-list">
+{% cache 0 "questions" questions search_tags scope sort query context.page context.page_size language_code %}
+ {% for question in questions.object_list %}
+ {{macros.question_summary(question)}}
+ {% endfor %}
+{% endcache %}
+{# comment todo: fix css here #}
+{% if questions_count == 0 %}
+ {% include "main_page/nothing_found.html" %}
+{% else %}
+ <p class="evenMore" style="padding-left:9px">
+ {% trans %}Did not find what you were looking for?{% endtrans %}
+ <a href="{% url ask %}">{% trans %}Please, post your question!{% endtrans %}</a>
+ </p>
+{% endif %}
+</div>
diff --git a/askbot/skins/default/templates/main_page/headline.html b/askbot/skins/default/templates/main_page/headline.html
new file mode 100644
index 00000000..ec6944d6
--- /dev/null
+++ b/askbot/skins/default/templates/main_page/headline.html
@@ -0,0 +1,50 @@
+{% if questions_count > 0 %}
+ <div style="clear:both">
+ <p class="rss">
+ (<a
+ href="{{settings.APP_URL}}/feeds/rss/"
+ title="{% trans %}subscribe to the questions feed{% endtrans %}"
+ >{% trans %}rss feed{% endtrans %}</a>)
+ </p>
+ <h1 id="question-count" class="search-result-summary">
+ {% if search_tags %}
+ {% trans cnt=questions_count, q_num=questions_count|intcomma %}{{q_num}} question, tagged{% pluralize %}{{q_num}} questions, tagged{% endtrans %}
+ {% else %}
+ {% trans cnt=questions_count, q_num=questions_count|intcomma %}{{q_num}} question{% pluralize %}{{q_num}} questions{% endtrans %}
+ {% endif %}
+ {% if author_name %}
+ {% trans %}with {{author_name}}'s contributions{% endtrans %}
+ {% endif %}
+ </h1>
+ {% spaceless %}
+ <div id="search-tags" class="tags">
+ {% if search_tags %}
+ {% for tag in search_tags %}
+ <span class="tag">{{tag}}</span>
+ <span class="delete-icon"></span>
+ {% endfor %}
+ {% endif %}
+ </div>
+ {% endspaceless %}
+ {% if author_name or search_tags or query %}
+ <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>
+ {% 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>
+ {% endif %}
+ {% if query %}{% trans %} or {% endtrans %}
+ <a href="{% url questions %}?start_over=true">{% trans %}start over{% endtrans %}</a>
+ {% endif %}
+ {% else %}
+ <a href="{% url questions %}?start_over=true">{% trans %}start over{% endtrans %}</a>
+ {% endif %}
+ {% trans %} - to expand, or dig in by adding more tags and revising the query.{% endtrans %}
+ </p>
+ {% else %}
+ <p class="search-tips">{% trans %}Search tip:{% endtrans %} {% trans %}add tags and a query to focus your search{% endtrans %}</p>
+ {% endif %}
+ </div>
+{% endif %}
diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html
new file mode 100644
index 00000000..4f123004
--- /dev/null
+++ b/askbot/skins/default/templates/main_page/javascript.html
@@ -0,0 +1,27 @@
+<script type="text/javascript">
+ {% if request.user.is_authenticated() %}
+ var tags = {{ tags_autocomplete|safe }};
+ {% endif %}
+ var sortMethod = '{{sort}}';
+ var showSortByRelevance = {% if show_sort_by_relevance %}true{% else %}false{% endif %};
+ var minSearchWordLength = {{settings.MIN_SEARCH_WORD_LENGTH}};
+ $(document).ready(function(){
+ /*var on_tab = '#nav_questions';
+ $(on_tab).attr('className','on');*/
+ Hilite.exact = false;
+ Hilite.elementid = "question-list";
+ Hilite.debug_referrer = location.href;
+ });
+ askbot['urls']['mark_interesting_tag'] = scriptUrl + '{% trans %}mark-tag/{% endtrans %}{% trans %}interesting/{% endtrans %}';
+ askbot['urls']['mark_ignored_tag'] = scriptUrl + '{% trans %}mark-tag/{% endtrans %}{% trans %}ignored/{% endtrans %}';
+ askbot['urls']['unmark_tag'] = scriptUrl + '{% trans %}unmark-tag/{% endtrans %}';
+ askbot['urls']['command'] = '{% url "call_ajax" %}';
+ askbot['urls']['questions'] = '{% url "questions" %}';
+ askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/" }}';
+ askbot['urls']['user_url_template'] = scriptUrl + '{% trans %}users/{% endtrans %}{{ "{{user_id}}" }}/{{ "{{slug}}" }}/';
+</script>
+<script type='text/javascript' src='{{"/js/editor.js"|media}}'></script>
+{% if request.user.is_authenticated() %}
+<script type='text/javascript' src='{{"/js/tag_selector.js"|media}}'></script>
+{% endif %}
+<script type="text/javascript" src="{{"/js/live_search.js"|media}}"></script>
diff --git a/askbot/skins/default/templates/main_page/nothing_found.html b/askbot/skins/default/templates/main_page/nothing_found.html
new file mode 100644
index 00000000..bc58fc27
--- /dev/null
+++ b/askbot/skins/default/templates/main_page/nothing_found.html
@@ -0,0 +1,31 @@
+{# todo: add tips to widen selection #}
+<p class="evenMore" style="padding-top:30px;text-align:center;">
+{% if scope == "unanswered" %}
+ {% trans %}There are no unanswered questions here{% endtrans %}
+{% endif %}
+{% if scope == "favorite" %}
+ {% trans %}No favorite questions here. {% endtrans %}
+ {% trans %}Please start (bookmark) some questions when you visit them{% endtrans %}
+{% endif %}
+</p>
+{% if query or search_tags or author_name %}
+<p class="evenMore" style="text-align:center">
+ {% 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>
+ {% 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>
+ {% endif %}
+ {% if query %}{% trans %} or {% endtrans %}
+ <a href="{% url questions %}?start_over=true">{% trans %}starting over{% endtrans %}</a>
+ {% endif %}
+ {% else %}
+ <a href="{% url questions %}?start_over=true">{% trans %}starting over{% endtrans %}</a>
+ {% endif %}
+</p>
+{% endif %}
+<p class="evenMore" style="text-align:center">
+<a href="{% url ask %}">{% trans %}Please always feel free to ask your question!{% endtrans %}</a>
+</p>
diff --git a/askbot/skins/default/templates/main_page/paginator.html b/askbot/skins/default/templates/main_page/paginator.html
new file mode 100644
index 00000000..4a77060f
--- /dev/null
+++ b/askbot/skins/default/templates/main_page/paginator.html
@@ -0,0 +1,7 @@
+{% import "macros.html" as macros %}
+{% if questions_count > 10 %}{# todo: remove magic number #}
+ <div id="pager" class="pager">
+ {{ macros.paginator(context|setup_paginator, position='left') }}
+ {{ macros.pagesize_switch(context, position='right') }}
+ </div>
+{% endif %}
diff --git a/askbot/skins/default/templates/main_page/sidebar.html b/askbot/skins/default/templates/main_page/sidebar.html
new file mode 100644
index 00000000..5ea9af4f
--- /dev/null
+++ b/askbot/skins/default/templates/main_page/sidebar.html
@@ -0,0 +1,35 @@
+{% import "macros.html" as macros %}
+{% if contributors %}
+ {% cache 600 "contributors" contributors search_tags scope sort query context.page context.page_size language_code %}
+ <div id="contrib-users" class="boxC">
+ <h2>{% trans %}Contributors{% endtrans %}</h2>
+ {% spaceless %}
+ {% for person in contributors %}
+ {{ macros.gravatar(person,48) }}
+ {% endfor %}
+ {% endspaceless %}
+ </div>
+ {% endcache %}
+{% endif %}
+
+{% if request.user.is_authenticated() %}
+ {% include "blocks/tag_selector.html" %}
+{% endif %}
+
+{% if tags %}
+ {% cache 0 "tags" tags search_tags scope sort query context.page context.page_size language_code %}
+ <div class="boxC">
+ <h2>{% trans %}Related tags{% endtrans %}</h2>
+ <div id="related-tags" class="tags">
+ {% for tag in tags %}
+ <a
+ rel="tag"
+ title="{% trans tag_name=tag.name %}see questions tagged '{{ tag_name }}'{% endtrans %}"
+ href="{% url questions %}?tags={{tag.name|urlencode}}">{{ tag.name }}</a>
+ <span class="tag-number">&#215; {{ tag.local_used_count|intcomma }}</span>
+ <br />
+ {% endfor %}
+ </div>
+ </div>
+ {% endcache %}
+{% endif %}
diff --git a/askbot/skins/default/templates/main_page/tab_bar.html b/askbot/skins/default/templates/main_page/tab_bar.html
new file mode 100644
index 00000000..2921da88
--- /dev/null
+++ b/askbot/skins/default/templates/main_page/tab_bar.html
@@ -0,0 +1,86 @@
+{% import "macros.html" as macros %}
+{% 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">
+ <span class="label">{% trans %}In:{% endtrans %}</span>
+ <a id="all"
+ class="{% if scope == 'all' %}on{% else %}off{% endif %}"
+ href="?scope=all"
+ title="{% trans %}see all questions{% endtrans %}"
+ >{% trans %}all{% endtrans %}</a>
+ <a id="unanswered"
+ class="{% if scope == 'unanswered' %}on{% else %}off{% endif %}"
+ href="?scope=unanswered&amp;sort=answers-asc"
+ title="{% trans %}see unanswered questions{% endtrans %}"
+ >{% trans %}unanswered{% endtrans %}</a>
+ {% if request.user.is_authenticated() %}
+ <a id="favorite"
+ class="{% if scope == 'favorite' %}on{% else %}off{% endif %}"
+ href="?scope=favorite"
+ title="{% trans %}see your favorite questions{% endtrans %}"
+ >{% trans %}favorite{% endtrans %}</a>
+ {% endif %}
+ </div>
+ <div id="sort_tabs" class="tabsA">
+ <span class="label">{% trans %}Sort by:{% endtrans %}</span>
+ {% if show_sort_by_relevance %}
+ {% set asc_relevance_tooltip = _('most relevant questions') %}
+ {% set desc_relevance_tooltip = _('click to see most relevant questions') %}
+ {% set relevance_label = _('relevance') %}
+ {% if query %}
+ <a id="by_relevance"
+ {% if sort == "relevance-desc" %}
+ href="?sort=relevance-desc"
+ class="on"
+ title="{{asc_relevance_tooltip}}">{{relevance_label}} &#9660;
+ {% else %}
+ href="?sort=relevance-desc"
+ class="off"
+ title="{{desc_relevance_tooltip}}">{{relevance_label}}
+ {% endif %}
+ </a>
+ {% endif %}
+ <script type="text/javascript">
+ var sortButtonData = sortButtonData || {};
+ sortButtonData['relevance'] = {
+ asc_tooltip: "{{asc_relevance_tooltip}}",
+ desc_tooltip: "{{desc_relevance_tooltip}}",
+ label: "{{relevance_label}}",
+ };
+ </script>
+ {% endif %}
+ {{macros.reversible_sort_button(
+ button_sort_criterium = 'age',
+ label = _('by date'),
+ asc_tooltip = _('click to see the oldest questions'),
+ desc_tooltip = _('click to see the newest questions'),
+ current_sort_method = sort
+ )
+ }}
+ {{macros.reversible_sort_button(
+ button_sort_criterium = 'activity',
+ label = _('by activity'),
+ asc_tooltip = _('click to see the least recently updated questions'),
+ desc_tooltip = _('click to see the most recently updated questions'),
+ current_sort_method = sort
+ )
+ }}
+ {{macros.reversible_sort_button(
+ button_sort_criterium = 'answers',
+ label = _('by answers'),
+ asc_tooltip = _('click to see the least answered questions'),
+ desc_tooltip = _('click to see the most answered questions'),
+ current_sort_method = sort
+ )
+ }}
+ {{macros.reversible_sort_button(
+ button_sort_criterium = 'votes',
+ label = _('by votes'),
+ asc_tooltip = _('click to see least voted questions'),
+ desc_tooltip = _('click to see most voted questions'),
+ current_sort_method = sort
+ )
+ }}
+ </div>
+</div>
+{% endcache %}
diff --git a/askbot/skins/default/templates/questions.html b/askbot/skins/default/templates/questions.html
deleted file mode 100644
index 138b30c8..00000000
--- a/askbot/skins/default/templates/questions.html
+++ /dev/null
@@ -1,259 +0,0 @@
-{% extends "two_column_body.html" %}
-<!-- questions.html -->
-{% import "macros.html" as macros %}
-{% block title %}{% spaceless %}{% trans %}Questions{% endtrans %}{% endspaceless %}{% endblock %}
-{% block content %}
-{% 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">
- <span class="label">{% trans %}In:{% endtrans %}</span>
- <a id="all"
- class="{% if scope == 'all' %}on{% else %}off{% endif %}"
- href="?scope=all"
- title="{% trans %}see all questions{% endtrans %}"
- >{% trans %}all{% endtrans %}</a>
- <a id="unanswered"
- class="{% if scope == 'unanswered' %}on{% else %}off{% endif %}"
- href="?scope=unanswered&amp;sort=answers-asc"
- title="{% trans %}see unanswered questions{% endtrans %}"
- >{% trans %}unanswered{% endtrans %}</a>
- {% if request.user.is_authenticated() %}
- <a id="favorite"
- class="{% if scope == 'favorite' %}on{% else %}off{% endif %}"
- href="?scope=favorite"
- title="{% trans %}see your favorite questions{% endtrans %}"
- >{% trans %}favorite{% endtrans %}</a>
- {% endif %}
- </div>
- <div id="sort_tabs" class="tabsA">
- <span class="label">{% trans %}Sort by:{% endtrans %}</span>
- {% if show_sort_by_relevance %}
- {% set asc_relevance_tooltip = _('most relevant questions') %}
- {% set desc_relevance_tooltip = _('click to see most relevant questions') %}
- {% set relevance_label = _('relevance') %}
- {% if query %}
- <a id="by_relevance"
- {% if sort == "relevance-desc" %}
- href="?sort=relevance-desc"
- class="on"
- title="{{asc_relevance_tooltip}}">{{relevance_label}} &#9660;
- {% else %}
- href="?sort=relevance-desc"
- class="off"
- title="{{desc_relevance_tooltip}}">{{relevance_label}}
- {% endif %}
- </a>
- {% endif %}
- <script type="text/javascript">
- var sortButtonData = sortButtonData || {};
- sortButtonData['relevance'] = {
- asc_tooltip: "{{asc_relevance_tooltip}}",
- desc_tooltip: "{{desc_relevance_tooltip}}",
- label: "{{relevance_label}}",
- };
- </script>
- {% endif %}
- {{macros.reversible_sort_button(
- button_sort_criterium = 'age',
- label = _('by date'),
- asc_tooltip = _('click to see the oldest questions'),
- desc_tooltip = _('click to see the newest questions'),
- current_sort_method = sort
- )
- }}
- {{macros.reversible_sort_button(
- button_sort_criterium = 'activity',
- label = _('by activity'),
- asc_tooltip = _('click to see the least recently updated questions'),
- desc_tooltip = _('click to see the most recently updated questions'),
- current_sort_method = sort
- )
- }}
- {{macros.reversible_sort_button(
- button_sort_criterium = 'answers',
- label = _('by answers'),
- asc_tooltip = _('click to see the least answered questions'),
- desc_tooltip = _('click to see the most answered questions'),
- current_sort_method = sort
- )
- }}
- {{macros.reversible_sort_button(
- button_sort_criterium = 'votes',
- label = _('by votes'),
- asc_tooltip = _('click to see least voted questions'),
- desc_tooltip = _('click to see most voted questions'),
- current_sort_method = sort
- )
- }}
- </div>
-</div>
-{% endcache %}
-{% if questions_count > 0 %}
- <div style="clear:both">
- <p class="rss">
- (<a
- href="{{settings.APP_URL}}/feeds/rss/"
- title="{% trans %}subscribe to the questions feed{% endtrans %}"
- >{% trans %}rss feed{% endtrans %}</a>)
- </p>
- <h1 id="question-count" class="search-result-summary">
- {% if search_tags %}
- {% trans cnt=questions_count, q_num=questions_count|intcomma %}{{q_num}} question, tagged{% pluralize %}{{q_num}} questions, tagged{% endtrans %}
- {% else %}
- {% trans cnt=questions_count, q_num=questions_count|intcomma %}{{q_num}} question{% pluralize %}{{q_num}} questions{% endtrans %}
- {% endif %}
- {% if author_name %}
- {% trans %}with {{author_name}}'s contributions{% endtrans %}
- {% endif %}
- </h1>
- {% spaceless %}
- <div id="search-tags" class="tags">
- {% if search_tags %}
- {% for tag in search_tags %}
- <span class="tag">{{tag}}</span>
- <span class="delete-icon"></span>
- {% endfor %}
- {% endif %}
- </div>
- {% endspaceless %}
- {% if author_name or search_tags or query %}
- <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>
- {% 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>
- {% endif %}
- {% if query %}{% trans %} or {% endtrans %}
- <a href="{% url questions %}?start_over=true">{% trans %}start over{% endtrans %}</a>
- {% endif %}
- {% else %}
- <a href="{% url questions %}?start_over=true">{% trans %}start over{% endtrans %}</a>
- {% endif %}
- {% trans %} - to expand, or dig in by adding more tags and revising the query.{% endtrans %}
- </p>
- {% else %}
- <p class="search-tips">{% trans %}Search tip:{% endtrans %} {% trans %}add tags and a query to focus your search{% endtrans %}</p>
- {% endif %}
- </div>
-{% endif %}
-<div id="question-list">
-{% cache 0 "questions" questions search_tags scope sort query context.page context.page_size language_code %}
- {% for question in questions.object_list %}
- {{macros.question_summary(question)}}
- {% endfor %}
-{% endcache %}
- {# comment todo: fix css here #}
- {% if questions_count == 0 %}
- {# todo: add tips to widen selection #}
- <p class="evenMore" style="padding-top:30px;text-align:center;">
- {% if scope == "unanswered" %}
- {% trans %}There are no unanswered questions here{% endtrans %}
- {% endif %}
- {% if scope == "favorite" %}
- {% trans %}No favorite questions here. {% endtrans %}
- {% trans %}Please start (bookmark) some questions when you visit them{% endtrans %}
- {% endif %}
- </p>
- {% if query or search_tags or author_name %}
- <p class="evenMore" style="text-align:center">
- {% 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>
- {% 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>
- {% endif %}
- {% if query %}{% trans %} or {% endtrans %}
- <a href="{% url questions %}?start_over=true">{% trans %}starting over{% endtrans %}</a>
- {% endif %}
- {% else %}
- <a href="{% url questions %}?start_over=true">{% trans %}starting over{% endtrans %}</a>
- {% endif %}
- </p>
- {% endif %}
- <p class="evenMore" style="text-align:center">
- <a href="{% url ask %}">{% trans %}Please always feel free to ask your question!{% endtrans %}</a>
- </p>
- {% else %}
- <p class="evenMore" style="padding-left:9px">
- {% trans %}Did not find what you were looking for?{% endtrans %}
- <a href="{% url ask %}">{% trans %}Please, post your question!{% endtrans %}</a>
- </p>
- {% endif %}
-</div>
-{% if questions_count > 10 %}{# todo: remove magic number #}
- <div id="pager" class="pager">
- {{ macros.paginator(context|setup_paginator, position='left') }}
- {{ macros.pagesize_switch(context, position='right') }}
- </div>
-{% endif %}
-{% endblock %}
-{% block sidebar %}
- {% if contributors %}
- {% cache 600 "contributors" contributors search_tags scope sort query context.page context.page_size language_code %}
- <div id="contrib-users" class="boxC">
- <h2>{% trans %}Contributors{% endtrans %}</h2>
- {% spaceless %}
- {% for person in contributors %}
- {{ macros.gravatar(person,48) }}
- {% endfor %}
- {% endspaceless %}
- </div>
- {% endcache %}
- {% endif %}
-
- {% if request.user.is_authenticated() %}
- {% include "blocks/tag_selector.html" %}
- {% endif %}
-
- {% if tags %}
- {% cache 0 "tags" tags search_tags scope sort query context.page context.page_size language_code %}
- <div class="boxC">
- <h2>{% trans %}Related tags{% endtrans %}</h2>
- <div id="related-tags" class="tags">
- {% for tag in tags %}
- <a
- rel="tag"
- title="{% trans tag_name=tag.name %}see questions tagged '{{ tag_name }}'{% endtrans %}"
- href="{% url questions %}?tags={{tag.name|urlencode}}">{{ tag.name }}</a>
- <span class="tag-number">&#215; {{ tag.local_used_count|intcomma }}</span>
- <br />
- {% endfor %}
- </div>
- </div>
- {% endcache %}
- {% endif %}
-{% endblock %}
-{% block endjs %}
- <script type="text/javascript">
- {% if request.user.is_authenticated() %}
- var tags = {{ tags_autocomplete|safe }};
- {% endif %}
- var sortMethod = '{{sort}}';
- var showSortByRelevance = {% if show_sort_by_relevance %}true{% else %}false{% endif %};
- var minSearchWordLength = {{settings.MIN_SEARCH_WORD_LENGTH}};
- $(document).ready(function(){
- /*var on_tab = '#nav_questions';
- $(on_tab).attr('className','on');*/
- Hilite.exact = false;
- Hilite.elementid = "question-list";
- Hilite.debug_referrer = location.href;
- });
- askbot['urls']['mark_interesting_tag'] = scriptUrl + '{% trans %}mark-tag/{% endtrans %}{% trans %}interesting/{% endtrans %}';
- askbot['urls']['mark_ignored_tag'] = scriptUrl + '{% trans %}mark-tag/{% endtrans %}{% trans %}ignored/{% endtrans %}';
- askbot['urls']['unmark_tag'] = scriptUrl + '{% trans %}unmark-tag/{% endtrans %}';
- askbot['urls']['command'] = '{% url "call_ajax" %}';
- askbot['urls']['questions'] = '{% url "questions" %}';
- askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/" }}';
- askbot['urls']['user_url_template'] = scriptUrl + '{% trans %}users/{% endtrans %}{{ "{{user_id}}" }}/{{ "{{slug}}" }}/';
- </script>
- <script type='text/javascript' src='{{"/js/editor.js"|media}}'></script>
- {% if request.user.is_authenticated() %}
- <script type='text/javascript' src='{{"/js/tag_selector.js"|media}}'></script>
- {% endif %}
- <script type="text/javascript" src="{{"/js/live_search.js"|media}}"></script>
-{% endblock %}
-<!-- end questions.html -->
diff --git a/askbot/tests/page_load_tests.py b/askbot/tests/page_load_tests.py
index 7d9fdc26..28e1ea6b 100644
--- a/askbot/tests/page_load_tests.py
+++ b/askbot/tests/page_load_tests.py
@@ -56,7 +56,7 @@ class PageLoadTests(PageLoadTestCase):
self.assertEqual(response.status_code, 200)
self.failUnless(len(response.redirect_chain) == 1)
self.failUnless(response.redirect_chain[0][0].endswith('/questions/'))
- self.assertEquals(response.template.name, 'questions.html')
+ self.assertEquals(response.template.name, 'main_page.html')
def proto_test_non_user_urls(self):
"""test all reader views thoroughly
@@ -82,67 +82,62 @@ class PageLoadTests(PageLoadTestCase):
#todo: test different sort methods and scopes
self.try_url(
'questions',
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'start_over':'true'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'scope':'unanswered'},
- template='questions.html'
- )
- self.try_url(
- 'questions',
- data={'scope':'all'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'scope':'favorite'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'scope':'unanswered', 'sort':'age-desc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'scope':'unanswered', 'sort':'age-asc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'scope':'unanswered', 'sort':'activity-desc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'scope':'unanswered', 'sort':'activity-asc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'sort':'answers-desc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'sort':'answers-asc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'sort':'votes-desc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'questions',
data={'sort':'votes-asc'},
- template='questions.html'
+ template='main_page.html'
)
self.try_url(
'question',
diff --git a/askbot/views/readers.py b/askbot/views/readers.py
index 236a7485..06786714 100644
--- a/askbot/views/readers.py
+++ b/askbot/views/readers.py
@@ -302,7 +302,7 @@ def questions(request):
#ajax request is handled in a separate branch above
#before = datetime.datetime.now()
- response = render_into_skin('questions.html', template_data, request)
+ response = render_into_skin('main_page.html', template_data, request)
#after = datetime.datetime.now()
#print after - before
return response