Skip to content

Commit

Permalink
Merge pull request #2616 from Automattic/update/reader-set-page-title
Browse files Browse the repository at this point in the history
Reader: Replace `pageTitleSetter( context )` with `setPageTitle( title)`
  • Loading branch information
blowery committed Jan 20, 2016
2 parents d51f86c + 0832789 commit b79432d
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions client/reader/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ function ensureStoreLoading( store, context ) {
return store;
}

function pageTitleSetter() {
return function( title ) {
titleActions.setTitle( i18n.translate( '%s ‹ Reader', { args: title } ) );
};
function setPageTitle( title ) {
titleActions.setTitle( i18n.translate( '%s ‹ Reader', { args: title } ) );
}

module.exports = {
Expand Down Expand Up @@ -128,7 +126,7 @@ module.exports = {

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );

pageTitleSetter()( i18n.translate( 'Following' ) );
setPageTitle( i18n.translate( 'Following' ) );

ReactDom.render(
React.createElement( FollowingComponent, {
Expand All @@ -153,7 +151,6 @@ module.exports = {
basePath = route.sectionify( context.path ),
fullAnalyticsPageTitle = analyticsPageTitle + ' > Feed > ' + context.params.feed_id,
feedStore = feedStreamFactory( 'feed:' + context.params.feed_id ),
setPageTitle = pageTitleSetter( context ),
mcKey = 'blog';

ensureStoreLoading( feedStore, context );
Expand Down Expand Up @@ -188,7 +185,6 @@ module.exports = {
basePath = route.sectionify( context.path ),
fullAnalyticsPageTitle = analyticsPageTitle + ' > Site > ' + context.params.blog_id,
feedStore = feedStreamFactory( 'site:' + context.params.blog_id ),
setPageTitle = pageTitleSetter( context ),
mcKey = 'blog';

ensureStoreLoading( feedStore, context );
Expand Down Expand Up @@ -223,8 +219,7 @@ module.exports = {
feedId = context.params.feed,
postId = context.params.post,
basePath = route.sectionify( context.path ),
fullPageTitle = analyticsPageTitle + ' > Feed Post > ' + feedId + ' > ' + postId,
setPageTitle = pageTitleSetter( context );
fullPageTitle = analyticsPageTitle + ' > Feed Post > ' + feedId + ' > ' + postId;

__lastTitle = TitleStore.getState().title;

Expand Down Expand Up @@ -260,8 +255,7 @@ module.exports = {
blogId = context.params.blog,
postId = context.params.post,
basePath = route.sectionify( context.path ),
fullPageTitle = analyticsPageTitle + ' > Blog Post > ' + blogId + ' > ' + postId,
setPageTitle = pageTitleSetter( context );
fullPageTitle = analyticsPageTitle + ' > Blog Post > ' + blogId + ' > ' + postId;

__lastTitle = TitleStore.getState().title;

Expand Down Expand Up @@ -304,7 +298,6 @@ module.exports = {
.replace( /-{2,}/g, '-' ),
encodedTag = encodeURIComponent( tagSlug ).toLowerCase(),
tagStore = feedStreamFactory( 'tag:' + tagSlug ),
setPageTitle = pageTitleSetter( context ),
mcKey = 'topic';

ensureStoreLoading( tagStore, context );
Expand Down Expand Up @@ -338,7 +331,6 @@ module.exports = {
basePath = route.sectionify( context.path ),
fullAnalyticsPageTitle = analyticsPageTitle + ' > List > ' + context.params.user + ' - ' + context.params.list,
listStore = feedStreamFactory( 'list:' + context.params.user + '-' + context.params.list ),
setPageTitle = pageTitleSetter( context ),
mcKey = 'list';

ensureStoreLoading( listStore, context );
Expand Down Expand Up @@ -382,7 +374,7 @@ module.exports = {

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );

pageTitleSetter( context )( 'Automattic' );
setPageTitle( 'Automattic' );

ReactDom.render(
React.createElement( FollowingComponent, {
Expand All @@ -407,7 +399,6 @@ module.exports = {
basePath = route.sectionify( context.path ),
fullAnalyticsPageTitle = analyticsPageTitle + ' > My Likes',
likedPostsStore = feedStreamFactory( 'likes' ),
setPageTitle = pageTitleSetter( context ),
mcKey = 'postlike';

ensureStoreLoading( likedPostsStore, context );
Expand Down Expand Up @@ -439,7 +430,7 @@ module.exports = {
mcKey = 'following_edit',
search = context.query.s;

pageTitleSetter( context )( i18n.translate( 'Manage Followed Sites' ) );
setPageTitle( i18n.translate( 'Manage Followed Sites' ) );

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );

Expand All @@ -454,7 +445,7 @@ module.exports = {
);
},

recommendedForYou: function( context ) {
recommendedForYou: function() {
const RecommendedForYou = require( 'reader/recommendations/for-you' ),
basePath = '/recommendations',
fullAnalyticsPageTitle = analyticsPageTitle + ' > Recommended Sites For You',
Expand All @@ -474,7 +465,7 @@ module.exports = {
);

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );
pageTitleSetter( context )( i18n.translate( 'Recommended Sites For You' ) );
setPageTitle( i18n.translate( 'Recommended Sites For You' ) );
},

listManagementSites: function( context ) {
Expand All @@ -483,7 +474,7 @@ module.exports = {
fullAnalyticsPageTitle = analyticsPageTitle + ' > Manage List',
mcKey = 'list_sites';

pageTitleSetter( context )( i18n.translate( 'Manage List' ) );
setPageTitle( i18n.translate( 'Manage List' ) );

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );

Expand Down Expand Up @@ -513,7 +504,7 @@ module.exports = {
fullAnalyticsPageTitle = analyticsPageTitle + ' > Manage List',
mcKey = 'list_tags';

pageTitleSetter( context )( i18n.translate( 'Manage List' ) );
setPageTitle( i18n.translate( 'Manage List' ) );

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );

Expand Down Expand Up @@ -543,7 +534,7 @@ module.exports = {
fullAnalyticsPageTitle = analyticsPageTitle + ' > Manage List Description',
mcKey = 'list_edit';

pageTitleSetter( context )( i18n.translate( 'Manage List Description' ) );
setPageTitle( i18n.translate( 'Manage List Description' ) );

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );

Expand Down

0 comments on commit b79432d

Please sign in to comment.