FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Revert "Merge branch 'oja-discussion-optional-relative-dates'" · devhttps/frontend@7d38131 · GitHub

Commit 7d38131

Browse files
committed
Revert "Merge branch 'oja-discussion-optional-relative-dates'"
This reverts commit facc6a5, reversing changes made to eff4898.
1 parent 04d5e13 commit 7d38131

7 files changed

Lines changed: 20 additions & 99 deletions

File tree

‎applications/app/views/fragments/crosswords/crosswordFooter.scala.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@(crosswordPage: crosswords.CrosswordPage)(implicit request: RequestHeader)
22
<div class="content-footer">
33

4-
@fragments.discussionFooter(crosswordPage, crosswordPage.isCommentable, crosswordPage.isClosedForComments, crosswordPage.shortUrlId)
4+
@fragments.discussionFooter(crosswordPage.isCommentable, crosswordPage.isClosedForComments, crosswordPage.shortUrlId)
55

66
@if(crosswordPage.isCommentable) {
77
<div class="js-repositioned-comments content__repositioned-comments"></div>

‎common/app/conf/switches.scala‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,6 @@ object Switches {
615615
)
616616

617617
// Features
618-
val DiscussionCrosswordsOptionalRelativeTimestampSwitch = Switch(
619-
"Feature",
620-
"discussion-crosswords-optional-relative-timestamp-switch",
621-
"Discussion optional relative timestamp in the crossword section",
622-
safeState = Off,
623-
sellByDate = new LocalDate(2015, 9, 28),
624-
exposeClientSide = true
625-
)
626-
627618
val InternationalEditionSwitch = Switch(
628619
"Feature",
629620
"international-edition",

‎common/app/views/fragments/contentFooter.scala.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<div class="content-footer @if(cssClass){content-footer--@cssClass}">
55

6-
@fragments.discussionFooter(content, content.isCommentable, content.isClosedForComments, content.shortUrlId)
6+
@fragments.discussionFooter(content.isCommentable, content.isClosedForComments, content.shortUrlId)
77

88
@ContentFooterContainersLayout(content, related, content.isAdvertisementFeature) {
99
@fragments.storyPackagePlaceholder(content, related)

‎common/app/views/fragments/discussionFooter.scala.html‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@(content: model.Content, isCommentable: Boolean, discussionClosed: Boolean, discussionId: String)(implicit request: RequestHeader)
1+
@(isCommentable: Boolean, discussionClosed: Boolean, discussionId: String)(implicit request: RequestHeader)
22
@import conf.Switches._
33

44
@sectionHeading = {
@@ -28,7 +28,7 @@ <h2 class="container__meta__title">comments <span class="discussion__comment-cou
2828
@toolbar = {
2929
<div class="discussion__toolbar js-discussion-toolbar u-cf">
3030

31-
<div class="discussion__toolbar-item js-comment-order-dropdown">
31+
<div class="discussion__toolbar-dropdown js-comment-order-dropdown">
3232
<button class="u-button-reset popup__toggle" data-toggle="popup--comments-order"
3333
aria-haspopup="true" aria-controls="comments-order-popup">Order by <span class="js-comment-order"></span></button>
3434

@@ -42,7 +42,7 @@ <h2 class="container__meta__title">comments <span class="discussion__comment-cou
4242
</div>
4343

4444
@if(DiscussionPageSizeSwitch.isSwitchedOn) {
45-
<div class="discussion__toolbar-item hide-until-tablet js-comment-pagesize-dropdown sign-in-required">
45+
<div class="discussion__toolbar-dropdown hide-until-tablet js-comment-pagesize-dropdown sign-in-required">
4646
<button class="u-button-reset popup__toggle" data-toggle="popup--comments-pagesize"
4747
aria-haspopup="true" aria-controls="comments-pagesize-popup">Show <span class="js-comment-pagesize">25</span></button>
4848

@@ -53,7 +53,7 @@ <h2 class="container__meta__title">comments <span class="discussion__comment-cou
5353
}
5454

5555

56-
<div class="discussion__toolbar-item js-comment-threading-dropdown">
56+
<div class="discussion__toolbar-dropdown js-comment-threading-dropdown">
5757
<button class="u-button-reset popup__toggle" data-toggle="popup--comments-threading"
5858
aria-haspopup="true" aria-controls="comments-order-threading">Threads <span class="js-comment-threading"></span></button>
5959

@@ -66,22 +66,6 @@ <h2 class="container__meta__title">comments <span class="discussion__comment-cou
6666
</ul>
6767
</div>
6868

69-
@if(DiscussionCrosswordsOptionalRelativeTimestampSwitch.isSwitchedOn
70-
&& content.section == "crosswords") {
71-
<div class="discussion__toolbar-item js-timestamps-dropdown hide-until-tablet">
72-
<button class="u-button-reset popup__toggle" data-toggle="popup--timestamp"
73-
aria-haspopup="true" aria-controls="timestamp-popup">Timestamps <span class="js-timestamps"></span></button>
74-
75-
<ul id="timestamp-popup" class="popup popup__group popup--timestamp is-off">
76-
@List("relative", "absolute").map { value =>
77-
<li class="popup__item">
78-
<button class="u-button-reset popup__action" data-timestamp="@value" data-link-name="comments-@value">@value</button>
79-
</li>
80-
}
81-
</ul>
82-
</div>
83-
}
84-
8569
<div class="discussion__pagination discussion__pagination--top js-discussion-pagination"></div>
8670

8771
</div>

‎static/src/javascripts/projects/common/modules/discussion/comments.js‎

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ define([
1313
'common/modules/discussion/api',
1414
'common/modules/discussion/comment-box',
1515
'common/modules/discussion/whole-discussion',
16-
'common/modules/ui/relativedates',
17-
'common/modules/user-prefs'
16+
'common/modules/ui/relativedates'
1817
], function(
1918
bean,
2019
bonzo,
@@ -30,19 +29,10 @@ define([
3029
DiscussionApi,
3130
CommentBox,
3231
WholeDiscussion,
33-
relativedates,
34-
userPrefs
32+
relativedates
3533
) {
3634
'use strict';
3735

38-
var PREF_RELATIVE_TIMESTAMPS = 'discussion.enableRelativeTimestamps';
39-
var shouldMakeTimestampsRelative = function () {
40-
return !config.switches.discussionCrosswordsOptionalRelativeTimestampSwitch
41-
|| (config.switches.discussionCrosswordsOptionalRelativeTimestampSwitch
42-
&& config.page.section === 'crosswords'
43-
&& userPrefs.get(PREF_RELATIVE_TIMESTAMPS));
44-
};
45-
4636
var Comments = function(options) {
4737
this.setOptions(options);
4838
};
@@ -88,18 +78,15 @@ Comments.prototype.ready = function() {
8878
this.on('click', this.getClass('showRepliesButton'), this.getMoreReplies);
8979
this.on('click', this.getClass('commentReport'), this.reportComment);
9080

91-
if (shouldMakeTimestampsRelative()) {
92-
window.setInterval(
93-
function () {
94-
this.relativeDates();
95-
}.bind(this),
96-
60000
97-
);
98-
99-
this.relativeDates();
100-
}
81+
window.setInterval(
82+
function () {
83+
this.relativeDates();
84+
}.bind(this),
85+
60000
86+
);
10187

10288
this.emit('ready');
89+
this.relativeDates();
10390

10491
this.on('click', '.js-report-comment-close', function() {
10592
$('.js-report-comment-form').addClass('u-h');
@@ -215,9 +202,7 @@ Comments.prototype.renderComments = function(resp) {
215202

216203
this.postedCommentEl = resp.postedCommentHtml;
217204

218-
if (shouldMakeTimestampsRelative()) {
219-
this.relativeDates();
220-
}
205+
this.relativeDates();
221206
this.emit('rendered', resp.paginationHtml);
222207

223208
mediator.emit('modules:comments:renderComments:rendered');
@@ -226,9 +211,7 @@ Comments.prototype.renderComments = function(resp) {
226211
Comments.prototype.showHiddenComments = function(e) {
227212
if (e) { e.preventDefault(); }
228213
this.emit('first-load');
229-
if (shouldMakeTimestampsRelative()) {
230-
this.relativeDates();
231-
}
214+
this.relativeDates();
232215
};
233216

234217
Comments.prototype.addMoreRepliesButtons = function (comments) {
@@ -281,9 +264,7 @@ Comments.prototype.getMoreReplies = function(event) {
281264
bonzo(li).addClass('u-h');
282265
this.emit('untruncate-thread');
283266

284-
if (shouldMakeTimestampsRelative()) {
285-
this.relativeDates();
286-
}
267+
this.relativeDates();
287268
}.bind(this));
288269
};
289270

@@ -461,9 +442,7 @@ Comments.prototype.addUser = function(user) {
461442
};
462443

463444
Comments.prototype.relativeDates = function() {
464-
if (shouldMakeTimestampsRelative()) {
465-
relativedates.init();
466-
}
445+
relativedates.init();
467446
};
468447

469448
Comments.prototype.isAllPageSizeActive = function() {

‎static/src/javascripts/projects/common/modules/discussion/loader.js‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -214,33 +214,6 @@ Loader.prototype.initToolbar = function() {
214214
userPrefs.set('discussion.threading', this.comments.options.threading);
215215
this.loadComments();
216216
});
217-
218-
if (config.switches.discussionCrosswordsOptionalRelativeTimestampSwitch
219-
&& config.page.section === 'crosswords') {
220-
var $timestampsLabel = $('.js-timestamps');
221-
var updateLabelText = function (prefValue) {
222-
$timestampsLabel.text(prefValue ? 'Relative' : 'Absolute');
223-
};
224-
updateLabelText(prefValue);
225-
226-
var PREF_RELATIVE_TIMESTAMPS = 'discussion.enableRelativeTimestamps';
227-
// Default to true
228-
var prefValue = typeof userPrefs.get(PREF_RELATIVE_TIMESTAMPS) !== 'undefined'
229-
? userPrefs.get(PREF_RELATIVE_TIMESTAMPS)
230-
: true;
231-
updateLabelText(prefValue);
232-
// Set the default
233-
userPrefs.set(PREF_RELATIVE_TIMESTAMPS, prefValue);
234-
235-
this.on('click', '.js-timestamps-dropdown .popup__action', function(e) {
236-
bean.fire(qwery('.js-timestamps-dropdown [data-toggle]')[0], 'click');
237-
var format = bonzo(e.currentTarget).data('timestamp');
238-
var prefValue = format === 'relative';
239-
updateLabelText(prefValue);
240-
userPrefs.set(PREF_RELATIVE_TIMESTAMPS, prefValue);
241-
this.loadComments();
242-
});
243-
}
244217
};
245218

246219
Loader.prototype.isOpenForRecommendations = function() {

‎static/src/stylesheets/module/_discussion.scss‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ $avatarPadding: $gs-gutter / 2;
254254
}
255255
}
256256

257-
.discussion__toolbar-item {
257+
.discussion__toolbar-dropdown {
258258
position: relative;
259259
top: 1px;
260260
float: left;
@@ -296,12 +296,6 @@ $avatarPadding: $gs-gutter / 2;
296296
}
297297
}
298298

299-
.discussion__toolbar-item__checkbox {
300-
// Unset global styles
301-
float: none;
302-
margin-left: 0;
303-
}
304-
305299
/* All comments (top level and reply)
306300
========================================================================== */
307301

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL