diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-04-19 02:55:19 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-04-19 02:55:19 -0400 |
commit | ddaff077f60d879010ea85c5cfe02570a744ef28 (patch) | |
tree | ef59df28a9e4cbb80f54d40a20020cd92c9af98f /askbot/media/js/post.js | |
parent | 0f8e7139b1b417cceb9450022aba2f4cd5497d70 (diff) | |
download | askbot-ddaff077f60d879010ea85c5cfe02570a744ef28.tar.gz askbot-ddaff077f60d879010ea85c5cfe02570a744ef28.tar.bz2 askbot-ddaff077f60d879010ea85c5cfe02570a744ef28.zip |
responsive design on question page sort of works
Diffstat (limited to 'askbot/media/js/post.js')
-rw-r--r-- | askbot/media/js/post.js | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/askbot/media/js/post.js b/askbot/media/js/post.js index a4f74359..2af9a15d 100644 --- a/askbot/media/js/post.js +++ b/askbot/media/js/post.js @@ -617,17 +617,17 @@ var Vote = function(){ }; var getOffensiveQuestionFlag = function(){ - var offensiveQuestionFlag = '#question-table span[id^="'+ offensiveIdPrefixQuestionFlag +'"]'; + var offensiveQuestionFlag = '.question-card span[id^="'+ offensiveIdPrefixQuestionFlag +'"]'; return $(offensiveQuestionFlag); }; var getRemoveOffensiveQuestionFlag = function(){ - var removeOffensiveQuestionFlag = '#question-table span[id^="'+ removeOffensiveIdPrefixQuestionFlag +'"]'; + var removeOffensiveQuestionFlag = '.question-card span[id^="'+ removeOffensiveIdPrefixQuestionFlag +'"]'; return $(removeOffensiveQuestionFlag); }; var getRemoveAllOffensiveQuestionFlag = function(){ - var removeAllOffensiveQuestionFlag = '#question-table span[id^="'+ removeAllOffensiveIdPrefixQuestionFlag +'"]'; + var removeAllOffensiveQuestionFlag = '.question-card span[id^="'+ removeAllOffensiveIdPrefixQuestionFlag +'"]'; return $(removeAllOffensiveQuestionFlag); }; @@ -1144,11 +1144,7 @@ var Vote = function(){ postType = bits.shift(); var do_proceed = false; - if (postType == 'answer'){ - postNode = $('#post-id-' + postId); - } else if (postType == 'question') { - postNode = $('#question-table'); - } + postNode = $('#post-id-' + postId); postRemoveLink = object; if (postNode.hasClass('deleted')) { removeActionType = 'undelete'; @@ -1883,6 +1879,7 @@ EditCommentForm.prototype.getSaveHandler = function(){ var commentData = me._comment.getData(); var timestamp = commentData['comment_added_at'] || gettext('just now'); var userName = commentData['user_display_name'] || askbot['data']['userName']; + me._comment.setContent({ 'html': editor.getHtml(), 'text': text, @@ -1984,6 +1981,8 @@ Comment.prototype.decorate = function(element){ var comment_id = this._element.attr('id').replace('comment-',''); this._data = {id: comment_id}; + this._contentBox = this._element.find('.comment-content'); + var timestamp = this._element.find('abbr.timeago'); this._data['comment_added_at'] = timestamp.attr('title'); var userLink = this._element.find('a.author'); @@ -2077,6 +2076,8 @@ Comment.prototype.getParentId = function(){ Comment.prototype.setContent = function(data){ this._data = $.extend(this._data, data); this._element.addClass('comment'); + this._element.css('display', 'table');//@warning: hardcoded + //display is set to "block" if .show() is called, but we need table. this._element.attr('id', 'comment-' + this._data['id']); // 1) create the votes element if it is not there @@ -2096,6 +2097,14 @@ Comment.prototype.setContent = function(data){ votesBox.append(vote.getElement()); } + // 2) create the comment content container + if (this._contentBox === undefined) { + var contentBox = this.makeElement('div'); + contentBox.addClass('comment-content'); + this._contentBox = contentBox; + this._element.append(contentBox); + } + // 2) create the comment deleter if it is not there if (this._comment_delete === undefined) { this._comment_delete = $('<div class="comment-delete"></div>'); @@ -2104,13 +2113,13 @@ Comment.prototype.setContent = function(data){ this._delete_icon.setHandler(this.getDeleteHandler()); this._comment_delete.append(this._delete_icon.getElement()); } - this._element.append(this._comment_delete); + this._contentBox.append(this._comment_delete); } // 3) create or replace the comment body if (this._comment_body === undefined) { this._comment_body = $('<div class="comment-body"></div>'); - this._element.append(this._comment_body); + this._contentBox.append(this._comment_body); } if (askbot['settings']['editorType'] === 'tinymce') { var theComment = $('<div/>'); @@ -4476,7 +4485,7 @@ CategorySelectorLoader.prototype.getCancelHandler = function() { CategorySelectorLoader.prototype.decorate = function(element) { this._element = element; this._display_tags_container = $('#question-tags'); - this._question_body = $('.question-body'); + this._question_body = $('.question .post-body'); this._question_controls = $('#question-controls'); this._editor_buttons = this.makeElement('div'); |