Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #224 from Wikia/XW-4134
Browse files Browse the repository at this point in the history
XW-4134 | Upgrade Ember to 2.16
  • Loading branch information
hakubo authored Nov 7, 2017
2 parents 2dc1e57 + 589d440 commit 0d4c15a
Show file tree
Hide file tree
Showing 217 changed files with 2,324 additions and 1,440 deletions.
6 changes: 2 additions & 4 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import Ember from 'ember';
import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

let App;

App = Ember.Application.extend({
const App = Application.extend({
// We specify a rootElement, otherwise Ember appends to the <body> element and Google PageSpeed thinks we are
// putting blocking scripts before our content
rootElement: '#ember-container',
Expand Down
4 changes: 2 additions & 2 deletions app/components/ab-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import Component from '@ember/component';
import {getGroup} from '../modules/abtest';

export default Ember.Component.extend({
export default Component.extend({
didReceiveAttrs() {
this._super(...arguments);
const experiment = this.get('experiment'),
Expand Down
22 changes: 9 additions & 13 deletions app/components/ad-slot.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import Ember from 'ember';
import {inject as service} from '@ember/service';
import {readOnly} from '@ember/object/computed';
import Component from '@ember/component';
import {dasherize} from '@ember/string';
import {on} from '@ember/object/evented';
import {setProperties, computed} from '@ember/object';
import InViewportMixin from 'ember-in-viewport';

const {
Component,
String: {dasherize},
computed,
inject,
on,
setProperties
} = Ember;

export default Component.extend(
InViewportMixin,
{
classNames: ['ad-slot-wrapper'],
classNameBindings: ['nameLowerCase', 'noAds'],
// This component is created dynamically, and this won't work without it
layoutName: 'components/ad-slot',
ads: inject.service(),
logger: inject.service(),
noAds: computed.readOnly('ads.noAds'),
ads: service(),
logger: service(),
noAds: readOnly('ads.noAds'),
disableManualInsert: false,
isAboveTheFold: false,
name: null,
Expand Down
18 changes: 10 additions & 8 deletions app/components/ads/invisible-high-impact-2.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import Ember from 'ember';

const {Component, inject, computed} = Ember;
import {inject as service} from '@ember/service';
import {readOnly} from '@ember/object/computed';
import {dasherize} from '@ember/string';
import Component from '@ember/component';
import {computed, get} from '@ember/object';

export default Component.extend({
ads: inject.service(),
ads: service(),

highImpactCountries: Ember.get(Wikia, 'InstantGlobals.wgAdDriverHighImpact2SlotCountries'),
noAds: computed.readOnly('ads.noAds'),
highImpactCountries: get(Wikia, 'InstantGlobals.wgAdDriverHighImpact2SlotCountries'),
noAds: readOnly('ads.noAds'),
isVisible: false,

name: 'INVISIBLE_HIGH_IMPACT_2',
nameLowerCase: computed('name', function () {
return Ember.String.dasherize(this.get('name').toLowerCase());
return dasherize(this.get('name').toLowerCase());
}),

didInsertElement() {
Expand All @@ -30,7 +32,7 @@ export default Component.extend({
},

isProperGeo(param) {
const isProperGeo = Ember.get(Wikia, 'geo.isProperGeo');
const isProperGeo = get(Wikia, 'geo.isProperGeo');
return typeof isProperGeo === 'function' && isProperGeo(param);
},

Expand Down
9 changes: 5 additions & 4 deletions app/components/alert-notification.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import {later, cancel} from '@ember/runloop';
import Component from '@ember/component';

export default Ember.Component.extend({
export default Component.extend({
classNames: ['alert-notification', 'alert-box'],
classNameBindings: ['alert.type'],

Expand Down Expand Up @@ -30,7 +31,7 @@ export default Ember.Component.extend({
onInsertElement = this.get('alert.callbacks.onInsertElement');

if (expiry > 0) {
this.set('timeout', Ember.run.later(this, this.dismissNotification, expiry));
this.set('timeout', later(this, this.dismissNotification, expiry));
}

if (typeof onInsertElement === 'function') {
Expand All @@ -42,7 +43,7 @@ export default Ember.Component.extend({
* @returns {void}
*/
willDestroyElement() {
Ember.run.cancel(this.get('timeout'));
cancel(this.get('timeout'));
},

/**
Expand Down
4 changes: 2 additions & 2 deletions app/components/alert-notifications.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import Component from '@ember/component';

/**
* AlertNotification
Expand All @@ -11,7 +11,7 @@ import Ember from 'ember';
* @property {boolean} [persistent]
*/

export default Ember.Component.extend({
export default Component.extend({
classNames: ['alert-notifications'],

alerts: null,
Expand Down
34 changes: 15 additions & 19 deletions app/components/application-wrapper.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import Ember from 'ember';
import {inject as service} from '@ember/service';
import {reads, bool, equal, and} from '@ember/object/computed';
import Component from '@ember/component';
import {computed} from '@ember/object';
import $ from 'jquery';
import {isHashLink} from '../utils/article-link';
import {trackPerf} from '../utils/track-perf';
import {system} from '../utils/browser';

const {
Component,
computed,
inject,
$
} = Ember;

/**
* HTMLMouseEvent
Expand Down Expand Up @@ -44,15 +40,15 @@ export default Component.extend({
smartBannerVisible: false,
firstRender: true,

ads: inject.service(),
currentUser: inject.service(),
fastboot: inject.service(),
logger: inject.service(),
wikiVariables: inject.service(),
ads: service(),
currentUser: service(),
fastboot: service(),
logger: service(),
wikiVariables: service(),

dir: computed.reads('wikiVariables.language.contentDir'),
dir: reads('wikiVariables.language.contentDir'),

bfaaTemplate: computed.bool('ads.siteHeadOffset'),
bfaaTemplate: bool('ads.siteHeadOffset'),

drawerContentComponent: computed('activeDrawerContent', function () {
return `wikia-${this.get('activeDrawerContent')}`;
Expand All @@ -67,9 +63,9 @@ export default Component.extend({
/**
* @returns {boolean}
*/
isUserLangEn: computed.equal('currentUser.language', 'en'),
shouldShowFandomAppSmartBanner: computed.and('isUserLangEn', 'wikiVariables.enableFandomAppSmartBanner'),
isFandomAppSmartBannerVisible: computed.and('shouldShowFandomAppSmartBanner', 'smartBannerVisible'),
isUserLangEn: equal('currentUser.language', 'en'),
shouldShowFandomAppSmartBanner: and('isUserLangEn', 'wikiVariables.enableFandomAppSmartBanner'),
isFandomAppSmartBannerVisible: and('shouldShowFandomAppSmartBanner', 'smartBannerVisible'),

/**
* @returns {void}
Expand Down
16 changes: 6 additions & 10 deletions app/components/article-comment.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import Ember from 'ember';
import {inject as service} from '@ember/service';
import $ from 'jquery';
import Component from '@ember/component';
import {computed} from '@ember/object';
import Thumbnailer from '../modules/thumbnailer';

const {
$,
Component,
computed,
inject
} = Ember;

/**
* @typedef {Object} ArticleCommentThumbnailData
* @property {string} name
Expand All @@ -17,8 +13,8 @@ const {
*/

export default Component.extend({
i18n: inject.service(),
wikiVariables: inject.service(),
i18n: service(),
wikiVariables: service(),
tagName: 'li',
classNames: ['article-comment'],

Expand Down
20 changes: 8 additions & 12 deletions app/components/article-comments.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import Ember from 'ember';
import {inject as service} from '@ember/service';
import {bool} from '@ember/object/computed';
import Component from '@ember/component';
import {observer} from '@ember/object';
import {run} from '@ember/runloop';
import {getOwner} from '@ember/application';
import ArticleCommentsModel from '../models/article-comments';
import {track, trackActions} from '../utils/track';

const {
Component,
computed,
inject,
observer,
run,
getOwner
} = Ember;

/**
* Component that displays article comments
*
Expand All @@ -20,7 +16,7 @@ const {
*/
export default Component.extend(
{
wikiVariables: inject.service(),
wikiVariables: service(),
page: null,
articleId: null,
commentsCount: null,
Expand All @@ -30,7 +26,7 @@ export default Component.extend(

nextButtonShown: false,
prevButtonShown: false,
showComments: computed.bool('page'),
showComments: bool('page'),

/**
* observes changes to page property, applies limit `1 <= page <= model.pagesCount`
Expand Down
27 changes: 12 additions & 15 deletions app/components/article-content.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import Ember from 'ember';
import {inject as service} from '@ember/service';
import {reads} from '@ember/object/computed';
import Component from '@ember/component';
import $ from 'jquery';
import {isBlank} from '@ember/utils';
import {observer} from '@ember/object';
import {on} from '@ember/object/evented';
import {run} from '@ember/runloop';
import AdsMixin from '../mixins/ads';
import {getRenderComponentFor, queryPlaceholders} from '../utils/render-component';
import getAttributesForMedia from '../utils/article-media';
import {track, trackActions} from '../utils/track';

const {
Component,
$,
isBlank,
observer,
on,
run,
inject
} = Ember;

/**
* HTMLElement
* @typedef {Object} HTMLElement
Expand All @@ -26,10 +23,10 @@ export default Component.extend(
tagName: 'article',
classNames: ['article-content', 'mw-content'],

fastboot: inject.service(),
i18n: inject.service(),
logger: inject.service(),
isFastBoot: Ember.computed.reads('fastboot.isFastBoot'),
fastboot: service(),
i18n: service(),
logger: service(),
isFastBoot: reads('fastboot.isFastBoot'),

adsContext: null,
content: null,
Expand Down
4 changes: 2 additions & 2 deletions app/components/article-contribution.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Ember from 'ember';
import Component from '@ember/component';
import LanguagesMixin from '../mixins/languages';
import {track, trackActions} from '../utils/track';

export default Ember.Component.extend(
export default Component.extend(
LanguagesMixin,
{
classNames: ['contribution-container'],
Expand Down
13 changes: 8 additions & 5 deletions app/components/article-edit.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import Ember from 'ember';
import $ from 'jquery';
import {on} from '@ember/object/evented';
import {observer} from '@ember/object';
import Component from '@ember/component';
import ViewportMixin from '../mixins/viewport';

export default Ember.Component.extend(
export default Component.extend(
ViewportMixin,
{
classNames: ['article-edit'],

viewportHeightObserver: Ember.observer('viewportDimensions.height', function () {
viewportHeightObserver: observer('viewportDimensions.height', function () {
this.adjustTextareaHeight();
}),

adjustTextareaHeight: Ember.on('didInsertElement', () => {
Ember.$('textarea').css('height', Ember.$(window).height() - Ember.$('.sub-head').outerHeight());
adjustTextareaHeight: on('didInsertElement', () => {
$('textarea').css('height', $(window).height() - $('.sub-head').outerHeight());
}),

actions: {
Expand Down
14 changes: 5 additions & 9 deletions app/components/article-featured-video-jwplayer.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import Ember from 'ember';
import {inject as service} from '@ember/service';
import Component from '@ember/component';
import {on} from '@ember/object/evented';
import {observer} from '@ember/object';
import VideoLoader from '../modules/video-loader';
import extend from '../utils/extend';
import config from '../config/environment';

const {
Component,
inject,
on,
observer,
} = Ember;

export default Component.extend({
ads: inject.service(),
ads: service(),

autoplayCookieName: 'featuredVideoAutoplay',
autoplayCookieExpireDays: 14,
Expand Down
Loading

0 comments on commit 0d4c15a

Please sign in to comment.