summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-07-30 19:09:48 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-07-30 19:09:48 -0400
commit6a9cf8ed5c943035e0385d8e8f0c250180e4e17e (patch)
tree5a8fb353044289a9cad810e0d334395bdd134a2a
parentd5936d1145cd2e86793148c6500ae7c87ae96aba (diff)
downloadaskbot-6a9cf8ed5c943035e0385d8e8f0c250180e4e17e.tar.gz
askbot-6a9cf8ed5c943035e0385d8e8f0c250180e4e17e.tar.bz2
askbot-6a9cf8ed5c943035e0385d8e8f0c250180e4e17e.zip
reverted the printable view feature
-rwxr-xr-xaskbot/skins/default/media/style/style.css11
-rw-r--r--askbot/skins/default/templates/question.html12
-rw-r--r--askbot/skins/default/templates/question_print.html256
-rw-r--r--askbot/urls.py5
-rw-r--r--askbot/views/readers.py79
5 files changed, 1 insertions, 362 deletions
diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css
index c1be85e5..9db63070 100755
--- a/askbot/skins/default/media/style/style.css
+++ b/askbot/skins/default/media/style/style.css
@@ -889,17 +889,6 @@ a:hover.medal {
margin-bottom: 10px;
font-size: 100%;
}
-.question-title {
- width:100%;
-}
-.print {
- width:24px;
- height:24px;
- background: url(../images/print.png);
-}
-.print:hover {
- cursor: pointer;
-}
.question-status {
margin-top: 10px;
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html
index 0d304cd2..22b66f46 100644
--- a/askbot/skins/default/templates/question.html
+++ b/askbot/skins/default/templates/question.html
@@ -11,17 +11,7 @@
<link rel="stylesheet" type="text/css" href="{{'/js/wmd/wmd.css'|media}}" />
{% endblock %}
{% block content %}
-<table class="question-title">
- <tr>
- <td>
- <h1><a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a></h1>
- </td>
- <td width="24">
- <div class="print pointer" onclick="window.open('{% url questions %}{{ question.id }}/print/');" title="{% trans %}print page{% endtrans %}"></div>
- </td>
- </tr>
-</table>
-
+<h1><a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a></h1>
<table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}>
<tr>
<td style="width:30px;vertical-align:top">
diff --git a/askbot/skins/default/templates/question_print.html b/askbot/skins/default/templates/question_print.html
deleted file mode 100644
index ce66b2a9..00000000
--- a/askbot/skins/default/templates/question_print.html
+++ /dev/null
@@ -1,256 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- question_print.html -->
-<html xmlns="http://www.w3.org/1999/xhtml">
- {% spaceless %}
- <head>
- <title>{% block title %}{% spaceless %}{{ question.get_question_title() }}{% endspaceless %}{% endblock %}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- {% block meta_description %}
- <meta name="description" content="{{question.summary|striptags|escape}}" />
- {% endblock %}
- <meta name="keywords" content="{{question.tagname_meta_generator()}},{{settings.APP_KEYWORDS|escape}}" />
- <link href="{{'/style/style.css'|media }}" rel="stylesheet" type="text/css" />
- {{ skin.get_extra_css_link() }}
- {% if settings.USE_CUSTOM_CSS %}
- <link
- href="{% url 'custom_css' %}?v={{settings.MEDIA_RESOURCE_REVISION}}"
- rel="stylesheet"
- type="text/css"
- />
- {% endif %}
- {% block forestyle %}
- <link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url()}}" />
- <link rel="stylesheet" type="text/css" href="{{'/js/wmd/wmd.css'|media}}" />
- {% endblock %}
- {% if settings.USE_CUSTOM_HTML_HEAD %}
- {{ settings.CUSTOM_HTML_HEAD }}
- {% endif %}
- <script type="text/javascript">
- var askbot = {};
- askbot['data'] = {};
- askbot['urls'] = {};
- askbot['settings'] = {};
- askbot['messages'] = {};
- </script>
- {% block forejs %}
- {% endblock %}
- {# avoid adding javascript here so that pages load faster #}
- </head>
- {% endspaceless %}
- <body onload="window.print()" class="question-page">
- {% import "macros.html" as macros %}
- {% block content %}
- <h1><a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a></h1>
- <table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}>
- <tr>
- <td style="width:30px;vertical-align:top">
- <div class="vote-buttons">
- <div id="question-vote-number-{{ question.id }}" class="vote-number"
- title="{% trans %}current number of votes{% endtrans %}">
- {{ question.score }}
- </div>
- </div>
- </td>
- <td>
- <div class="question-body-print">
- {{question.html}}
- </div>
- <ul id="question-tags" class="post-tags tags">
- {% for tag in question.get_tag_names() %}
- {{ macros.tag_widget(
- tag,
- css_class = 'post-tag',
- html_tag = 'li'
- )
- }}
- {% endfor %}
- </ul>
- <div class="post-update-info-container">
- {{
- macros.post_contributor_info(
- question,
- "original_author",
- question.wiki,
- settings.MIN_REP_TO_EDIT_WIKI
- )
- }}
- {{
- macros.post_contributor_info(
- question,
- "last_updater",
- question.wiki,
- settings.MIN_REP_TO_EDIT_WIKI,
- )
- }}
- </div>
- <div class="comments">
- {% set comments = question.get_comments(visitor = user)[:comment_order_number] %}
- {% if comments|count > 0 %}
- {% for comment in comments %}
- <div class="comment">
- <div class="comment-body">
- {{comment.html}} &ndash;
- <a
- class="author"
- href="{{comment.user.get_profile_url()}}"
- >{{comment.user.username}}</a>
- <span class="age">&nbsp;({{comment.added_at|diff_date}})</span>
- </div>
- </div>
- {% endfor %}
- {% endif %}
- </div>
- <!--/div-->
- </td>
- </tr>
- </table>
- {% if question.closed %}
- <div class="question-status" style="margin-bottom:15px">
- <h3>{% trans close_reason=question.get_close_reason_display() %}The question has been closed for the following reason "{{ close_reason }}" by{% endtrans %}
- <a href="{{ question.closed_by.get_profile_url() }}">{{ question.closed_by.username }}</a>
- {% trans closed_at=question.closed_at %}close date {{closed_at}}{% endtrans %}</h3>
- </div>
- {% endif %}
- {% if answers %}
- <div class="tabBar">
- <h2 id="sort-top">
- {% trans counter=answers|length %}
- {{counter}} Answer:
- {% pluralize %}
- {{counter}} Answers:
- {% endtrans %}
- </h2>
- </div>
- {% for answer in answers %}
- <a name="{{ answer.id }}"></a>
- <div id="answer-container-{{ answer.id }}" class="answer {% if answer.accepted %}accepted-answer{% endif %} {% if answer.author_id==question.author_id %} answered-by-owner{% endif %} {% if answer.deleted %}deleted{% endif %}">
- <table style="width:100%;" class="answer-table">
- <tr>
- <td style="width:30px;vertical-align:top">
- <div class="vote-buttons">
- <div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="{% trans %}current number of votes{% endtrans %}">
- {{ answer.score }}
- </div>
- </div>
- </td>
- <td>
- <div class="item-right">
- <div class="answer-body-print">
- {{ answer.html }}
- </div>
- <div class="post-update-info-container">
- {{
- macros.post_contributor_info(
- answer,
- "original_author",
- answer.wiki,
- settings.MIN_REP_TO_EDIT_WIKI
- )
- }}
- {{
- macros.post_contributor_info(
- answer,
- "last_updater",
- answer.wiki,
- settings.MIN_REP_TO_EDIT_WIKI
- )
- }}
- </div>
- <div class="comments">
- {% set comments = answer.get_comments(visitor = user)[:comment_order_number] %}
- {% if comments|count > 0 %}
- {% for comment in comments %}
- <div class="comment">
- <div class="comment-body">
- {{comment.html}} &ndash;
- <a
- class="author"
- href="{{comment.user.get_profile_url()}}"
- >{{comment.user.username}}</a>
- <span class="age">&nbsp;({{comment.added_at|diff_date}})</span>
- </div>
- </div>
- {% endfor %}
- {% endif %}
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
- {% endfor %}
- {% endif %}
- {% endblock %}
- {% include "blocks/bottom_scripts.html" %}
- {% block endjs %}
- {% if not question.closed %}
- <script type='text/javascript' src='{{"/js/editor.js"|media}}'></script>
- <script type='text/javascript'>
- {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %}
- var codeFriendlyMarkdown = true;
- {% else %}
- var codeFriendlyMarkdown = false;
- {% endif %}
- var maxCommentLength = {{settings.MAX_COMMENT_LENGTH}};
- askbot['urls']['postComments'] = '{% url post_comments %}';
- askbot['urls']['editComment'] = '{% url edit_comment %}';
- askbot['urls']['deleteComment'] = '{% url delete_comment %}';
- askbot['urls']['getComment'] = '{% url get_comment %}';
- askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #}
- askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}';
- askbot['urls']['vote_url_template'] = scriptUrl + '{% trans %}questions/{% endtrans %}{{ "{{QuestionID}}/" }}{% trans %}vote/{% endtrans %}';
- askbot['urls']['swap_question_with_answer'] = '{% url swap_question_with_answer %}';
- askbot['urls']['upvote_comment'] = '{% url upvote_comment %}';
- askbot['messages']['addComment'] = '{% trans %}add comment{% endtrans %}';
- {% if settings.SAVE_COMMENT_ON_ENTER %}
- askbot['settings']['saveCommentOnEnter'] = true;
- {% else %}
- askbot['settings']['saveCommentOnEnter'] = false;
- {% endif %}
- </script>
- <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script>
- <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script>
- {% endif %}
- <script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script>
- <script type='text/javascript' src='{{"/js/post.js"|media}}'></script>
- <script type="text/javascript">
- // define reputation needs for comments
- var repNeededForComments = 50;
- $().ready(function(){
- $("#nav_questions").attr('className',"on");
- var answer_sort_tab = "{{ tab_id }}";
- $("#" + answer_sort_tab).attr('className',"on");
-
- Vote.init({{ question.id }}, '{{ question.title|slugify }}', '{{ question.author.id }}','{{ request.user.id }}');
-
- {% if not question.closed and request.user.is_authenticated %}initEditor();{% endif %}
-
- lanai.highlightSyntax();
- $('#btLogin').bind('click', function(){window.location.href='{{ settings.LOGIN_URL }}'; } )
- if (window.location.hash === 'fmanswer'){
- $('#fmanswer textarea').focus();
- }
- });
-
- function initEditor(){
- $('#editor').TextAreaResizer();
- //highlight code synctax when editor has new text
- $("#editor").typeWatch({highlight: false, wait: 3000,
- captureLength: 5, callback: lanai.highlightSyntax});
-
- var display = true;
- var txt = "[{% trans %}hide preview{% endtrans %}]";
- $('#pre-collapse').text(txt);
- $('#pre-collapse').bind('click', function(){
- txt = display ? "[{% trans %}show preview{% endtrans %}]" : "[{% trans %}hide preview{% endtrans %}]";
- display = !display;
- $('#previewer').toggle();
- $('#pre-collapse').text(txt);
- });
- setupFormValidation($("#fmanswer"), CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
- }
- </script>
- {% include "blocks/editor_data.html" %}
- {% endblock %}
- </body>
-</html>
diff --git a/askbot/urls.py b/askbot/urls.py
index 8dff3ae1..c6d79492 100644
--- a/askbot/urls.py
+++ b/askbot/urls.py
@@ -55,11 +55,6 @@ urlpatterns = patterns('',
kwargs = {'object_name': 'Answer'},
name='answer_revisions'
),
- url(
- r'^%s(?P<id>\d+)/%s$' % (_('questions/'), _('print/')),
- views.readers.question_print,
- name='question_print'
- ),
url(#this url works both normally and through ajax
r'^%s$' % _('questions/'),
views.readers.questions,
diff --git a/askbot/views/readers.py b/askbot/views/readers.py
index 804d38a2..20d13adc 100644
--- a/askbot/views/readers.py
+++ b/askbot/views/readers.py
@@ -600,85 +600,6 @@ def question(request, id):#refactor - long subroutine. display question body, an
}
return render_into_skin('question.html', data, request)
-@csrf.csrf_protect
-def question_print(request, id):#refactor - long subroutine. print question body, answers and comments
- """view that displays body of the question and
- all answers to it in print format
- """
- #todo: fix inheritance of sort method from questions
- default_sort_method = request.session.get('questions_sort_method', 'votes')
- form = ShowQuestionForm(request.GET, default_sort_method)
- form.full_clean()#always valid
- show_answer = form.cleaned_data['show_answer']
- show_comment = form.cleaned_data['show_comment']
- show_page = form.cleaned_data['show_page']
- is_permalink = form.cleaned_data['is_permalink']
- answer_sort_method = form.cleaned_data['answer_sort_method']
-
- #load question and maybe refuse showing deleted question
- try:
- question = get_object_or_404(models.Question, id=id)
- question.assert_is_visible_to(request.user)
- except exceptions.QuestionHidden, error:
- request.user.message_set.create(message = unicode(error))
- return HttpResponseRedirect(reverse('index'))
-
- logging.debug('answer_sort_method=' + unicode(answer_sort_method))
- #load answers
- answers = question.get_answers(user = request.user)
- answers = answers.select_related(depth=1)
-
- user_answer_votes = {}
- for answer in answers:
- vote = answer.get_user_vote(request.user)
- if vote is not None and not user_answer_votes.has_key(answer.id):
- vote_value = -1
- if vote.is_upvote():
- vote_value = 1
- user_answer_votes[answer.id] = vote_value
-
- view_dic = {"latest":"-added_at", "oldest":"added_at", "votes":"-score" }
- orderby = view_dic[answer_sort_method]
- if answers is not None:
- answers = answers.order_by("-accepted", orderby)
-
- filtered_answers = []
- for answer in answers:
- if answer.deleted == True:
- if answer.author_id == request.user.id:
- filtered_answers.append(answer)
- else:
- filtered_answers.append(answer)
-
- #resolve page number and comment number for permalinks
- comment_order_number = None
-
- favorited = question.has_favorite_by_user(request.user)
- if request.user.is_authenticated():
- question_vote = question.votes.select_related().filter(user=request.user)
- else:
- question_vote = None #is this correct?
- if question_vote is not None and question_vote.count() > 0:
- question_vote = question_vote[0]
-
- data = {
- 'page_class': 'question-page',
- 'active_tab': 'questions',
- 'question' : question,
- 'question_vote' : question_vote,
- 'question_comment_count':question.comments.count(),
- 'answer' : AnswerForm(question,request.user),
- 'answers' : filtered_answers,
- 'user_answer_votes': user_answer_votes,
- 'tags' : question.tags.all(),
- 'tab_id' : answer_sort_method,
- 'favorited' : favorited,
- 'similar_questions' : question.get_similar_questions(),
- 'language_code': translation.get_language(),
- 'comment_order_number': comment_order_number
- }
- return render_into_skin('question_print.html', data, request)
-
def revisions(request, id, object_name=None):
assert(object_name in ('Question', 'Answer'))
post = get_object_or_404(models.get_model(object_name), id=id)