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

Merge branch 'master' of github.com:guardian/frontend into parameters · devhttps/frontend@d631f7c · GitHub

Commit d631f7c

Browse files
committed
Merge branch 'master' of github.com:guardian/frontend into parameters
2 parents d828125 + 4afc269 commit d631f7c

60 files changed

Lines changed: 3186 additions & 152 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎article/app/views/fragments/articleBody.scala.html‎

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@(article: Article, storyPackage: List[Trail])(implicit request: RequestHeader)
2+
@import CommonSwitches.DiscussionSwitch
23

34
<h2 class="article-zone type-1">
45
<a class="zone-color" data-link-name="article section" href="/@article.section">@Html(article.sectionName)</a>
@@ -19,37 +20,50 @@ <h2 class="article-zone type-1">
1920

2021
<div class="after-header"></div>
2122

22-
@if(!article.isLive && !article.hasVideoAtTop) {
23-
@article.mainPicture.map{ mainPicture =>
24-
@article.mainPicture(width=220).map{ smallCrop =>
25-
@fragments.img(mainPicture, smallCrop)
26-
}
27-
}
28-
}
23+
@if(!article.isLive && !article.hasVideoAtTop) {
24+
@article.mainPicture.map{ mainPicture =>
25+
@article.mainPicture(width=220).map{ smallCrop =>
26+
@fragments.img(mainPicture, smallCrop)
27+
}
28+
}
29+
}
2930

30-
@fragments.byline(article.byline, article)
31+
@fragments.byline(article.byline, article)
3132

32-
@if(article.isLive) {
33-
@fragments.autoUpdate()
34-
}
33+
<div class="article__container">
34+
@if(article.isLive) {
35+
@fragments.autoUpdate()
36+
}
3537

36-
<div class="article-body from-content-api @if(article.isLive) {live-blog}"
37-
itemprop="@if(article.isReview){reviewBody} else {articleBody}">
38-
@* <!-- ordering of cleaners is important --> *@
39-
@withJsoup(BulletCleaner(article.body))(
40-
PictureCleaner(article),
41-
InBodyLinkCleaner("in body link"),
42-
BlockNumberCleaner,
43-
TweetCleaner,
44-
WitnessCleaner,
45-
VideoPosterCleaner(article.videoAssets)
46-
)
38+
<div class="article-body from-content-api @if(article.isLive) {live-blog}"
39+
itemprop="@if(article.isReview){reviewBody} else {articleBody}">
40+
@withJsoup(BulletCleaner(article.body))(
41+
PictureCleaner(article),
42+
InBodyLinkCleaner("in body link"),
43+
BlockNumberCleaner,
44+
TweetCleaner,
45+
WitnessCleaner,
46+
VideoPosterCleaner(article.videoAssets)
47+
)
48+
</div>
4749
</div>
48-
50+
51+
@if(DiscussionSwitch.isSwitchedOn && article.isCommentable) {
52+
<div class="article__discussion"></div>
53+
}
54+
4955
</article>
5056

5157
@fragments.social(article)
5258

59+
@if(DiscussionSwitch.isSwitchedOn && article.isCommentable) {
60+
<div class="article__discussion"></div>
61+
<a class="d-show-cta js-show-discussion js-top" href="/discussion/@article.shortUrlId"
62+
data-is-ajax data-link-name="View all comments">
63+
View all comments <span class="d-commentcount speech-bubble"></span>
64+
</a>
65+
}
66+
5367
@if(storyPackage.nonEmpty) {
5468
<aside role="complementary">
5569
@fragments.relatedTrails(storyPackage, heading = "More on this story", visibleTrails = 5)
Lines changed: 1 addition & 0 deletions
LoadingViewer requires iframe.
Lines changed: 1 addition & 0 deletions
LoadingViewer requires iframe.
1.86 KB
LoadingViewer requires iframe.

‎common/app/assets/javascripts/bootstraps/app.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ define('bootstraps/app', [
122122
go: routes
123123
};
124124

125-
});
125+
});

‎common/app/assets/javascripts/bootstraps/article.js‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ define([
33

44
"modules/autoupdate",
55
"modules/matchnav",
6-
"modules/analytics/reading"
6+
"modules/analytics/reading",
7+
"modules/discussion"
78
], function (
89
common,
910
AutoUpdate,
1011
MatchNav,
11-
Reading
12+
Reading,
13+
Discussion
1214
) {
1315

1416
var modules = {
@@ -46,11 +48,23 @@ define([
4648
});
4749
},
4850

51+
initDiscussion: function() {
52+
common.mediator.on('page:article:ready', function(config, context) {
53+
if (config.page.commentable) {
54+
var discussionArticle = new Discussion({
55+
id: config.page.shortUrl,
56+
context: context,
57+
config: config
58+
}).init();
59+
}
60+
});
61+
},
62+
4963
logReading: function(context) {
5064
common.mediator.on('page:article:ready', function(config, context) {
5165
var wordCount = config.page.wordCount;
5266
if(wordCount !== "") {
53-
67+
5468
var reader = new Reading({
5569
id: config.page.pageId,
5670
wordCount: parseInt(config.page.wordCount, 10),
@@ -70,6 +84,8 @@ define([
7084
modules.matchNav();
7185
modules.initLiveBlogging();
7286
modules.logReading(context);
87+
88+
modules.initDiscussion();
7389
}
7490
common.mediator.emit("page:article:ready", config, context);
7591
};

‎common/app/assets/javascripts/modules/analytics/clickstream.js‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ define(['common', 'modules/detect', 'bean'], function (common, detect, bean) {
3232
return !urlHost || (urlHost === host && urlProtocol === protocol);
3333
};
3434

35-
var getClickSpec = function (spec) {
35+
var getClickSpec = function (spec, forceValid) {
3636
var el = spec.el,
3737
elName = el.tagName.toLowerCase(),
3838
dataLinkName = el.getAttribute('data-link-name'),
@@ -59,7 +59,7 @@ define(['common', 'modules/detect', 'bean'], function (common, detect, bean) {
5959
}
6060

6161
if(!spec.validTarget) {
62-
spec.validTarget = filterSource(el.tagName.toLowerCase()).length > 0;
62+
spec.validTarget = filterSource(el.tagName.toLowerCase()).length > 0 || forceValid;
6363
if(spec.validTarget) {
6464
spec.target = el;
6565
href = el.getAttribute('href');
@@ -77,16 +77,21 @@ define(['common', 'modules/detect', 'bean'], function (common, detect, bean) {
7777
};
7878

7979
// delegate, emit the derived tag
80-
bean.add(document.body, 'click', function (event) {
81-
var clickSpec = getClickSpec({el: event.target});
82-
if (clickSpec) {
83-
common.mediator.emit('module:clickstream:click', clickSpec);
84-
}
85-
});
80+
if (opts.addListener !== false) {
81+
bean.add(document.body, 'click', function (event) {
82+
var clickSpec = getClickSpec({el: event.target});
83+
if (clickSpec) {
84+
common.mediator.emit('module:clickstream:click', clickSpec);
85+
}
86+
});
87+
}
8688

89+
return {
90+
getClickSpec: getClickSpec
91+
};
8792
};
8893

89-
return (Clickstream);
94+
return Clickstream;
9095

9196
});
9297

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL