Commit 77ccf688 by Diana Huang

Merge pull request #3386 from edx/hotfix/2014-04-17

Show full body when expanding inline forum thread
parents 3a7c3e7c 862a16ca
...@@ -5,6 +5,7 @@ describe "DiscussionThreadInlineView", -> ...@@ -5,6 +5,7 @@ describe "DiscussionThreadInlineView", ->
<script type="text/template" id="_inline_thread"> <script type="text/template" id="_inline_thread">
<article class="discussion-article"> <article class="discussion-article">
<div class="non-cohorted-indicator"/> <div class="non-cohorted-indicator"/>
<div class="post-body"/>
<div class="post-extended-content"> <div class="post-extended-content">
<div class="response-count"/> <div class="response-count"/>
<ol class="responses"/> <ol class="responses"/>
...@@ -19,6 +20,7 @@ describe "DiscussionThreadInlineView", -> ...@@ -19,6 +20,7 @@ describe "DiscussionThreadInlineView", ->
<script type="text/template" id="_inline_thread_cohorted"> <script type="text/template" id="_inline_thread_cohorted">
<article class="discussion-article"> <article class="discussion-article">
<div class="cohorted-indicator"/> <div class="cohorted-indicator"/>
<div class="post-body"/>
<div class="post-extended-content"> <div class="post-extended-content">
<div class="response-count"/> <div class="response-count"/>
<ol class="responses"/> <ol class="responses"/>
...@@ -87,3 +89,14 @@ describe "DiscussionThreadInlineView", -> ...@@ -87,3 +89,14 @@ describe "DiscussionThreadInlineView", ->
assertExpandedContentVisible(@view, true) assertExpandedContentVisible(@view, true)
@view.collapsePost() @view.collapsePost()
assertExpandedContentVisible(@view, false) assertExpandedContentVisible(@view, false)
it "switches between the abbreviated and full body", ->
DiscussionViewSpecHelper.setNextResponseContent({resp_total: 0, children: []})
@thread.set("body", new Array(100).join("test "))
@view.abbreviateBody()
expect(@thread.get("body")).not.toEqual(@thread.get("abbreviatedBody"))
@view.render()
@view.expandPost()
expect(@view.$el.find(".post-body").text()).toEqual(@thread.get("body"))
@view.collapsePost()
expect(@view.$el.find(".post-body").text()).toEqual(@thread.get("abbreviatedBody"))
...@@ -45,6 +45,7 @@ if Backbone? ...@@ -45,6 +45,7 @@ if Backbone?
expandPost: (event) => expandPost: (event) =>
@$el.addClass('expanded') @$el.addClass('expanded')
@$el.find('.post-body').html(@model.get('body'))
@$el.find('.expand-post').css('display', 'none') @$el.find('.expand-post').css('display', 'none')
@$el.find('.collapse-post').css('display', 'block') @$el.find('.collapse-post').css('display', 'block')
@$el.find('.post-extended-content').show() @$el.find('.post-extended-content').show()
...@@ -58,6 +59,7 @@ if Backbone? ...@@ -58,6 +59,7 @@ if Backbone?
if postTop < curScroll if postTop < curScroll
$('html, body').animate({scrollTop: postTop}) $('html, body').animate({scrollTop: postTop})
@$el.removeClass('expanded') @$el.removeClass('expanded')
@$el.find('.post-body').html(@model.get('abbreviatedBody'))
@$el.find('.expand-post').css('display', 'block') @$el.find('.expand-post').css('display', 'block')
@$el.find('.collapse-post').css('display', 'none') @$el.find('.collapse-post').css('display', 'none')
@$el.find('.post-extended-content').hide() @$el.find('.post-extended-content').hide()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment