Commit 5f0b68df by alisan617 Committed by GitHub

Merge pull request #14228 from edx/alisan/response-btn-TNL-6175

Discussion hide Add a Response button response count if zero other responses in an answered question
parents d9a65a96 229f1122
...@@ -280,6 +280,9 @@ ...@@ -280,6 +280,9 @@
responseCountFormat = ngettext( responseCountFormat = ngettext(
'{numResponses} other response', '{numResponses} other responses', responseTotal '{numResponses} other response', '{numResponses} other responses', responseTotal
); );
if (responseTotal === 0) {
this.$el.find('.response-count').hide();
}
} else { } else {
responseCountFormat = ngettext( responseCountFormat = ngettext(
'{numResponses} response', '{numResponses} responses', responseTotal '{numResponses} response', '{numResponses} responses', responseTotal
...@@ -288,6 +291,7 @@ ...@@ -288,6 +291,7 @@
this.$el.find('.response-count').text( this.$el.find('.response-count').text(
edx.StringUtils.interpolate(responseCountFormat, {numResponses: responseTotal}, true) edx.StringUtils.interpolate(responseCountFormat, {numResponses: responseTotal}, true)
); );
responsePagination = this.$el.find('.response-pagination'); responsePagination = this.$el.find('.response-pagination');
responsePagination.empty(); responsePagination.empty();
if (responseTotal > 0) { if (responseTotal > 0) {
...@@ -327,6 +331,8 @@ ...@@ -327,6 +331,8 @@
}); });
return responsePagination.append($loadMoreButton); return responsePagination.append($loadMoreButton);
} }
} else {
this.$el.find('.add-response').hide();
} }
}; };
...@@ -345,9 +351,9 @@ ...@@ -345,9 +351,9 @@
DiscussionThreadView.prototype.renderAddResponseButton = function() { DiscussionThreadView.prototype.renderAddResponseButton = function() {
if (this.model.hasResponses() && this.model.can('can_reply') && !this.model.get('closed')) { if (this.model.hasResponses() && this.model.can('can_reply') && !this.model.get('closed')) {
return this.$el.find('div.add-response').show(); return this.$el.find('.add-response').show();
} else { } else {
return this.$el.find('div.add-response').hide(); return this.$el.find('.add-response').hide();
} }
}; };
......
<div class="discussion-post"> <div class="discussion-post">
<header class="post-header"> <header class="post-header">
<% if (!readOnly) { %> <% if (!readOnly) { %>
<div class="post-header-actions post-extended-content"> <div class="post-header-actions">
<%= <%=
_.template( _.template(
$('#forum-actions').html())( $('#forum-actions').html())(
......
...@@ -7,16 +7,18 @@ ...@@ -7,16 +7,18 @@
</div> </div>
</div> </div>
<div class="post-extended-content thread-responses-wrapper"> <div class="post-extended-content thread-responses-wrapper">
<% if (!readOnly) { %> <div class="response-btn-count-wrapper">
<% if (!readOnly) { %>
<div class="add-response"> <div class="add-response">
<button class="btn btn-small add-response-btn"> <button class="btn btn-small add-response-btn">
<%- gettext("Add a Response") %> <%- gettext("Add a Response") %>
</button> </button>
</div> </div>
<% } %> <% } %>
<div class="response-count"/> <div class="response-count"></div>
<ol class="responses js-response-list"/> </div>
<div class="response-pagination"/> <ol class="responses js-response-list"></ol>
<div class="response-pagination"></div>
<div class="post-status-closed bottom-post-status" style="display: none"> <div class="post-status-closed bottom-post-status" style="display: none">
<%- gettext("This thread is closed.") %> <%- gettext("This thread is closed.") %>
</div> </div>
......
...@@ -182,13 +182,14 @@ ...@@ -182,13 +182,14 @@
.response-count { .response-count {
@include float(right); @include float(right);
@include margin-right($baseline / 2);
color: $forum-color-response-count; color: $forum-color-response-count;
font-size: $forum-base-font-size; font-size: $forum-base-font-size;
} }
.response-pagination { .response-pagination {
visibility: visible; visibility: visible;
padding: 0 ($baseline/2); margin: ($baseline / 2) 0;
&:empty { &:empty {
visibility: hidden; visibility: hidden;
......
...@@ -45,7 +45,8 @@ ...@@ -45,7 +45,8 @@
font-weight: 600; font-weight: 600;
} }
.thread-responses-wrapper { .thread-responses-wrapper,
.post-extended-content {
padding: 0 ($baseline/2); padding: 0 ($baseline/2);
} }
...@@ -96,8 +97,8 @@ ...@@ -96,8 +97,8 @@
// +thread - wrapper styling // +thread - wrapper styling
.thread-wrapper { .thread-wrapper {
.thread-main-wrapper { .response-btn-count-wrapper {
padding-bottom: $baseline; margin: $baseline 0;
} }
} }
......
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