Standardize on var-less export default across ember app

no issue
- drops the `var Foo = Ember.Thing.extend({}); export default Foo;` syntax in favour of exporting directly, eg: `export default Ember.Thing.extend({})`
- discussion on this change [here](https://github.com/TryGhost/Ghost/pull/5340#issuecomment-105828423) and [here](https://github.com/TryGhost/Ghost/pull/5694#discussion-diff-37511606)
This commit is contained in:
Kevin Ansfield 2015-08-19 12:55:40 +01:00
parent 587c08979a
commit 5c9a824d53
86 changed files with 115 additions and 272 deletions

View File

@ -1,5 +1,3 @@
import EmbeddedRelationAdapter from 'ghost/adapters/embedded-relation-adapter';
var ApplicationAdapter = EmbeddedRelationAdapter.extend();
export default ApplicationAdapter;
export default EmbeddedRelationAdapter.extend();

View File

@ -1,7 +1,7 @@
import DS from 'ember-data';
import ghostPaths from 'ghost/utils/ghost-paths';
var BaseAdapter = DS.RESTAdapter.extend({
export default DS.RESTAdapter.extend({
host: window.location.origin,
namespace: ghostPaths().apiRoot.slice(1),
@ -41,5 +41,3 @@ var BaseAdapter = DS.RESTAdapter.extend({
});
}
});
export default BaseAdapter;

View File

@ -11,7 +11,7 @@ import BaseAdapter from 'ghost/adapters/base';
// If a model has an embedded hasMany relation, the related type will be included:
// roles: DS.hasMany('role', { embedded: 'always' }) => ?include=roles
var EmbeddedRelationAdapter = BaseAdapter.extend({
export default BaseAdapter.extend({
find: function (store, type, id) {
return this.ajax(this.buildIncludeURL(store, type, id), 'GET');
},
@ -119,5 +119,3 @@ var EmbeddedRelationAdapter = BaseAdapter.extend({
return ret;
}
});
export default EmbeddedRelationAdapter;

View File

@ -1,6 +1,6 @@
import ApplicationAdapter from 'ghost/adapters/application';
var SettingAdapter = ApplicationAdapter.extend({
export default ApplicationAdapter.extend({
updateRecord: function (store, type, record) {
var data = {},
serializer = store.serializerFor(type.modelName);
@ -17,5 +17,3 @@ var SettingAdapter = ApplicationAdapter.extend({
return this.ajax(this.buildURL(type.modelName), 'PUT', {data: data});
}
});
export default SettingAdapter;

View File

@ -1,9 +1,7 @@
import ApplicationAdapter from 'ghost/adapters/application';
var UserAdapter = ApplicationAdapter.extend({
export default ApplicationAdapter.extend({
find: function (store, type, id) {
return this.findQuery(store, type, {id: id, status: 'all'});
}
});
export default UserAdapter;

View File

@ -1,7 +1,6 @@
import ghostPaths from 'ghost/utils/ghost-paths';
var UploadUi,
upload,
Ghost = ghostPaths();
UploadUi = function ($dropzone, settings) {
@ -248,7 +247,7 @@ UploadUi = function ($dropzone, settings) {
});
};
upload = function (options) {
export default function (options) {
var settings = $.extend({
progressbar: true,
editor: false,
@ -263,6 +262,4 @@ upload = function (options) {
this.uploaderUi = ui;
ui.init();
});
};
export default upload;
}

View File

@ -1,8 +1,6 @@
import Ember from 'ember';
var blogUrl = Ember.Component.extend({
export default Ember.Component.extend({
tagName: '',
config: Ember.inject.service()
});
export default blogUrl;

View File

@ -1,7 +1,7 @@
/* global CodeMirror */
import Ember from 'ember';
var CodeMirrorEditor = Ember.Component.extend({
export default Ember.Component.extend({
// DOM stuff
classNameBindings: ['isFocused:focused'],
@ -44,5 +44,3 @@ var CodeMirrorEditor = Ember.Component.extend({
}
});
export default CodeMirrorEditor;

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import uploader from 'ghost/assets/lib/uploader';
var Preview = Ember.Component.extend({
export default Ember.Component.extend({
config: Ember.inject.service(),
didInsertElement: function () {
@ -41,5 +41,3 @@ var Preview = Ember.Component.extend({
Ember.run.scheduleOnce('afterRender', this, this.dropzoneHandler);
})
});
export default Preview;

View File

@ -1,8 +1,6 @@
import Ember from 'ember';
import TextInputMixin from 'ghost/mixins/text-input';
var Input = Ember.TextField.extend(TextInputMixin, {
export default Ember.TextField.extend(TextInputMixin, {
classNames: 'gh-input'
});
export default Input;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var ModalDialog = Ember.Component.extend({
export default Ember.Component.extend({
didInsertElement: function () {
this.$('.js-modal-container, .js-modal-background').addClass('fade-in open');
this.$('.js-modal').addClass('open');
@ -56,5 +57,3 @@ var ModalDialog = Ember.Component.extend({
return this.get('confirm.reject.buttonClass') ? this.get('confirm.reject.buttonClass') : 'btn btn-red';
})
});
export default ModalDialog;

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
// See gh-tabs-manager.js for use
var TabPane = Ember.Component.extend({
export default Ember.Component.extend({
classNameBindings: ['active'],
tabsManager: Ember.computed(function () {
@ -26,5 +27,3 @@ var TabPane = Ember.Component.extend({
this.get('tabsManager').unregisterTabPane(this);
}
});
export default TabPane;

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
// See gh-tabs-manager.js for use
var Tab = Ember.Component.extend({
export default Ember.Component.extend({
tabsManager: Ember.computed(function () {
return this.nearestWithProperty('isTabsManager');
}),
@ -28,5 +29,3 @@ var Tab = Ember.Component.extend({
this.get('tabsManager').unregisterTab(this);
}
});
export default Tab;

View File

@ -48,7 +48,7 @@ Both tab and tab-pane elements have an "active"
class applied when they are active.
*/
var TabsManager = Ember.Component.extend({
export default Ember.Component.extend({
activeTab: null,
tabs: [],
tabPanes: [],
@ -80,5 +80,3 @@ var TabsManager = Ember.Component.extend({
this.get('tabPanes').removeObject(tabPane);
}
});
export default TabsManager;

View File

@ -1,8 +1,6 @@
import Ember from 'ember';
import TextInputMixin from 'ghost/mixins/text-input';
var TextArea = Ember.TextArea.extend(TextInputMixin, {
export default Ember.TextArea.extend(TextInputMixin, {
classNames: 'gh-input'
});
export default TextArea;

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
/*global device*/
var TrimFocusInput = Ember.TextField.extend({
export default Ember.TextField.extend({
focus: true,
classNames: 'gh-input',
attributeBindings: ['autofocus'],
@ -26,5 +27,3 @@ var TrimFocusInput = Ember.TextField.extend({
this.$().val(text.trim());
})
});
export default TrimFocusInput;

View File

@ -3,7 +3,7 @@ import ModalDialog from 'ghost/components/gh-modal-dialog';
import upload from 'ghost/assets/lib/uploader';
import cajaSanitizers from 'ghost/utils/caja-sanitizers';
var UploadModal = ModalDialog.extend({
export default ModalDialog.extend({
layoutName: 'components/gh-modal-dialog',
config: Ember.inject.service(),
@ -73,5 +73,3 @@ var UploadModal = ModalDialog.extend({
}
}
});
export default UploadModal;

View File

@ -3,7 +3,7 @@ import Ember from 'ember';
Example usage:
{{gh-url-preview prefix="tag" slug=theSlugValue tagName="p" classNames="description"}}
*/
var urlPreview = Ember.Component.extend({
export default Ember.Component.extend({
classNames: 'ghost-url-preview',
prefix: null,
slug: null,
@ -25,5 +25,3 @@ var urlPreview = Ember.Component.extend({
return theUrl;
})
});
export default urlPreview;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var AboutController = Ember.Controller.extend({
export default Ember.Controller.extend({
updateNotificationCount: 0,
actions: {
@ -8,5 +9,3 @@ var AboutController = Ember.Controller.extend({
}
}
});
export default AboutController;

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
var EditorNewController = Ember.Controller.extend(EditorControllerMixin, {
export default Ember.Controller.extend(EditorControllerMixin, {
// Overriding autoSave on the base controller, as the new controller shouldn't be autosaving
autoSave: Ember.K,
actions: {
@ -18,5 +18,3 @@ var EditorNewController = Ember.Controller.extend(EditorControllerMixin, {
}
}
});
export default EditorNewController;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var ErrorController = Ember.Controller.extend({
export default Ember.Controller.extend({
code: Ember.computed('content.status', function () {
return this.get('content.status') > 200 ? this.get('content.status') : 500;
}),
@ -12,5 +13,3 @@ var ErrorController = Ember.Controller.extend({
}),
stack: false
});
export default ErrorController;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var FeatureController = Ember.Controller.extend(Ember.PromiseProxyMixin, {
export default Ember.Controller.extend(Ember.PromiseProxyMixin, {
init: function () {
var promise;
@ -26,5 +27,3 @@ var FeatureController = Ember.Controller.extend(Ember.PromiseProxyMixin, {
return value;
})
});
export default FeatureController;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var countCharacters = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
export default Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
var el = document.createElement('span'),
length,
content;
@ -23,5 +24,3 @@ var countCharacters = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams
return Ember.String.htmlSafe(el.outerHTML);
});
export default countCharacters;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var countDownCharacters = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
export default Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
var el = document.createElement('span'),
content,
maxCharacters,
@ -25,5 +26,3 @@ var countDownCharacters = Ember.HTMLBars.makeBoundHelper(function (arr /* hashPa
return Ember.String.htmlSafe(el.outerHTML);
});
export default countDownCharacters;

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import counter from 'ghost/utils/word-count';
var countWords = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
export default Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
if (!arr || !arr.length) {
return;
}
@ -19,5 +19,3 @@ var countWords = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */)
return count + (count === 1 ? ' word' : ' words');
});
export default countWords;

View File

@ -2,7 +2,7 @@ import Ember from 'ember';
/* global html_sanitize*/
import cajaSanitizers from 'ghost/utils/caja-sanitizers';
var formatHTML = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
export default Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
if (!arr || !arr.length) {
return;
}
@ -22,5 +22,3 @@ var formatHTML = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */)
return Ember.String.htmlSafe(escapedhtml);
});
export default formatHTML;

View File

@ -2,12 +2,9 @@ import Ember from 'ember';
/* global Showdown, html_sanitize*/
import cajaSanitizers from 'ghost/utils/caja-sanitizers';
var showdown,
formatMarkdown;
var showdown = new Showdown.converter({extensions: ['ghostimagepreview', 'ghostgfm', 'footnotes', 'highlight']});
showdown = new Showdown.converter({extensions: ['ghostimagepreview', 'ghostgfm', 'footnotes', 'highlight']});
formatMarkdown = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
export default Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
if (!arr || !arr.length) {
return;
}
@ -31,5 +28,3 @@ formatMarkdown = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */)
return Ember.String.htmlSafe(escapedhtml);
});
export default formatMarkdown;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var formatTimeago = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
export default Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
if (!arr || !arr.length) {
return;
}
@ -11,5 +12,3 @@ var formatTimeago = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams *
// For large numbers moment sucks => single Ember.Object based clock better
// https://github.com/manuelmitasch/ghost-admin-ember-demo/commit/fba3ab0a59238290c85d4fa0d7c6ed1be2a8a82e#commitcomment-5396524
});
export default formatTimeago;

View File

@ -1,10 +1,7 @@
import Ember from 'ember';
/*global Ember */
var trailingHistory,
registerTrailingLocationHistory;
trailingHistory = Ember.HistoryLocation.extend({
var trailingHistory = Ember.HistoryLocation.extend({
formatURL: function () {
// jscs: disable
return this._super.apply(this, arguments).replace(/\/?$/, '/');
@ -12,12 +9,10 @@ trailingHistory = Ember.HistoryLocation.extend({
}
});
registerTrailingLocationHistory = {
export default {
name: 'registerTrailingLocationHistory',
initialize: function (container, application) {
application.register('location:trailing-history', trailingHistory);
}
};
export default registerTrailingLocationHistory;

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
var AuthenticationInitializer = {
export default {
name: 'authentication',
initialize: function (instance) {
@ -14,5 +14,3 @@ var AuthenticationInitializer = {
});
}
};
export default AuthenticationInitializer;

View File

@ -3,7 +3,7 @@ import Ember from 'ember';
// Code modified from Addepar/ember-widgets
// https://github.com/Addepar/ember-widgets/blob/master/src/mixins.coffee#L39
var BodyEventListener = Ember.Mixin.create({
export default Ember.Mixin.create({
bodyElementSelector: 'html',
bodyClick: Ember.K,
@ -43,5 +43,3 @@ var BodyEventListener = Ember.Mixin.create({
return event.stopPropagation();
}
});
export default BodyEventListener;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var CurrentUserSettings = Ember.Mixin.create({
export default Ember.Mixin.create({
transitionAuthor: function () {
var self = this;
@ -24,5 +25,3 @@ var CurrentUserSettings = Ember.Mixin.create({
};
}
});
export default CurrentUserSettings;

View File

@ -2,7 +2,7 @@ import Ember from 'ember';
/*
Dropdowns and their buttons are evented and do not propagate clicks.
*/
var DropdownMixin = Ember.Mixin.create(Ember.Evented, {
export default Ember.Mixin.create(Ember.Evented, {
classNameBindings: ['isOpen:open:closed'],
isOpen: false,
@ -12,5 +12,3 @@ var DropdownMixin = Ember.Mixin.create(Ember.Evented, {
return event.stopPropagation();
}
});
export default DropdownMixin;

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
var EditorAPI = Ember.Mixin.create({
export default Ember.Mixin.create({
/**
* Get Value
*
@ -132,5 +132,3 @@ var EditorAPI = Ember.Mixin.create({
this.sendAction('onChange');
}
});
export default EditorAPI;

View File

@ -1,8 +1,7 @@
import Ember from 'ember';
import setScrollClassName from 'ghost/utils/set-scroll-classname';
var EditorScroll = Ember.Mixin.create({
export default Ember.Mixin.create({
/**
* Determine if the cursor is at the end of the textarea
*/
@ -102,5 +101,3 @@ var EditorScroll = Ember.Mixin.create({
this.detachScrollHandlers();
}
});
export default EditorScroll;

View File

@ -3,8 +3,7 @@ import Ember from 'ember';
import titleize from 'ghost/utils/titleize';
var simpleShortcutSyntax,
shortcuts,
EditorShortcuts;
shortcuts;
// Used for simple, noncomputational replace-and-go! shortcuts.
// See default case in shortcut function below.
@ -137,7 +136,7 @@ shortcuts = {
}
};
EditorShortcuts = Ember.Mixin.create({
export default Ember.Mixin.create({
shortcut: function (type) {
var selection = this.getSelection(),
replacement = {
@ -171,5 +170,3 @@ EditorShortcuts = Ember.Mixin.create({
}
}
});
export default EditorShortcuts;

View File

@ -3,7 +3,7 @@ import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
import styleBody from 'ghost/mixins/style-body';
import editorShortcuts from 'ghost/utils/editor-shortcuts';
var EditorBaseRoute = Ember.Mixin.create(styleBody, ShortcutsRoute, {
export default Ember.Mixin.create(styleBody, ShortcutsRoute, {
classNames: ['editor'],
actions: {
@ -135,5 +135,3 @@ var EditorBaseRoute = Ember.Mixin.create(styleBody, ShortcutsRoute, {
this.attachModelHooks(controller, model);
}
});
export default EditorBaseRoute;

View File

@ -1,13 +1,11 @@
import Ember from 'ember';
var defaultPaginationSettings,
PaginationRoute;
defaultPaginationSettings = {
var defaultPaginationSettings = {
page: 1,
limit: 15
};
PaginationRoute = Ember.Mixin.create({
export default Ember.Mixin.create({
/**
* Sets up pagination details
* @param {object} settings specifies additional pagination details
@ -26,5 +24,3 @@ PaginationRoute = Ember.Mixin.create({
this.controller.set('paginationSettings', settings);
}
});
export default PaginationRoute;

View File

@ -42,7 +42,7 @@ key.setScope('default');
* To have all your shortcut work in all scopes, give it the scope "all".
* Find out more at the keymaster docs
*/
var ShortcutsRoute = Ember.Mixin.create({
export default Ember.Mixin.create({
registerShortcuts: function () {
var self = this,
shortcuts = this.get('shortcuts');
@ -84,5 +84,3 @@ var ShortcutsRoute = Ember.Mixin.create({
this.removeShortcuts();
}
});
export default ShortcutsRoute;

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
// mixin used for routes that need to set a css className on the body tag
var styleBody = Ember.Mixin.create({
export default Ember.Mixin.create({
activate: function () {
this._super();
@ -28,5 +28,3 @@ var styleBody = Ember.Mixin.create({
});
}
});
export default styleBody;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var BlurField = Ember.Mixin.create({
export default Ember.Mixin.create({
selectOnClick: false,
stopEnterKeyDownPropagation: false,
@ -20,5 +21,3 @@ var BlurField = Ember.Mixin.create({
}
}
});
export default BlurField;

View File

@ -1,9 +1,8 @@
import DS from 'ember-data';
var Notification = DS.Model.extend({
export default DS.Model.extend({
dismissible: DS.attr('boolean'),
status: DS.attr('string'),
type: DS.attr('string'),
message: DS.attr('string')
});
export default Notification;

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
import DS from 'ember-data';
var Role = DS.Model.extend({
export default DS.Model.extend({
uuid: DS.attr('string'),
name: DS.attr('string'),
description: DS.attr('string'),
@ -13,5 +14,3 @@ var Role = DS.Model.extend({
return this.get('name').toLocaleLowerCase();
})
});
export default Role;

View File

@ -1,7 +1,7 @@
import DS from 'ember-data';
import ValidationEngine from 'ghost/mixins/validation-engine';
var Setting = DS.Model.extend(ValidationEngine, {
export default DS.Model.extend(ValidationEngine, {
validationType: 'setting',
title: DS.attr('string'),
@ -21,5 +21,3 @@ var Setting = DS.Model.extend(ValidationEngine, {
isPrivate: DS.attr('boolean'),
password: DS.attr('string')
});
export default Setting;

View File

@ -1,7 +1,7 @@
import DS from 'ember-data';
import ValidationEngine from 'ghost/mixins/validation-engine';
var Tag = DS.Model.extend(ValidationEngine, {
export default DS.Model.extend(ValidationEngine, {
validationType: 'tag',
uuid: DS.attr('string'),
@ -19,5 +19,3 @@ var Tag = DS.Model.extend(ValidationEngine, {
updated_by: DS.attr(),
post_count: DS.attr('number')
});
export default Tag;

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
var AuthenticatedRoute = Ember.Route.extend(AuthenticatedRouteMixin);
export default AuthenticatedRoute;
export default Ember.Route.extend(AuthenticatedRouteMixin);

View File

@ -3,7 +3,7 @@ import base from 'ghost/mixins/editor-base-route';
import isNumber from 'ghost/utils/isNumber';
import isFinite from 'ghost/utils/isFinite';
var EditorEditRoute = AuthenticatedRoute.extend(base, {
export default AuthenticatedRoute.extend(base, {
titleToken: 'Editor',
beforeModel: function (transition) {
@ -62,5 +62,3 @@ var EditorEditRoute = AuthenticatedRoute.extend(base, {
}
}
});
export default EditorEditRoute;

View File

@ -1,8 +1,7 @@
import Ember from 'ember';
var EditorRoute = Ember.Route.extend({
export default Ember.Route.extend({
beforeModel: function () {
this.transitionTo('editor.new');
}
});
export default EditorRoute;

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var Error404Route = Ember.Route.extend({
export default Ember.Route.extend({
controllerName: 'error',
templateName: 'error',
titleToken: 'Error',
@ -10,5 +11,3 @@ var Error404Route = Ember.Route.extend({
};
}
});
export default Error404Route;

View File

@ -4,7 +4,7 @@ import mobileQuery from 'ghost/utils/mobile';
// Routes that extend MobileIndexRoute need to implement
// desktopTransition, a function which is called when
// the user resizes to desktop levels.
var MobileIndexRoute = Ember.Route.extend({
export default Ember.Route.extend({
desktopTransition: Ember.K,
activate: function attachDesktopTransition() {
@ -26,5 +26,3 @@ var MobileIndexRoute = Ember.Route.extend({
});
})
});
export default MobileIndexRoute;

View File

@ -2,7 +2,7 @@ import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixi
import MobileIndexRoute from 'ghost/routes/mobile-index-route';
import mobileQuery from 'ghost/utils/mobile';
var PostsIndexRoute = MobileIndexRoute.extend(AuthenticatedRouteMixin, {
export default MobileIndexRoute.extend(AuthenticatedRouteMixin, {
noPosts: false,
// Transition to a specific post if we're not on mobile
@ -46,5 +46,3 @@ var PostsIndexRoute = MobileIndexRoute.extend(AuthenticatedRouteMixin, {
this.goToPost();
}
});
export default PostsIndexRoute;

View File

@ -3,7 +3,7 @@ import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
import isNumber from 'ghost/utils/isNumber';
import isFinite from 'ghost/utils/isFinite';
var PostsPostRoute = AuthenticatedRoute.extend(ShortcutsRoute, {
export default AuthenticatedRoute.extend(ShortcutsRoute, {
model: function (params) {
var self = this,
post,
@ -75,5 +75,3 @@ var PostsPostRoute = AuthenticatedRoute.extend(ShortcutsRoute, {
}
}
});
export default PostsPostRoute;

View File

@ -2,7 +2,7 @@ import AuthenticatedRoute from 'ghost/routes/authenticated';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
import styleBody from 'ghost/mixins/style-body';
var NavigationRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
titleToken: 'Settings - Navigation',
classNames: ['settings-view-navigation'],
@ -29,5 +29,3 @@ var NavigationRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings,
}
}
});
export default NavigationRoute;

View File

@ -2,8 +2,7 @@ import AuthenticatedRoute from 'ghost/routes/authenticated';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
var TagsRoute,
paginationSettings;
var paginationSettings;
paginationSettings = {
page: 1,
@ -11,7 +10,7 @@ paginationSettings = {
limit: 15
};
TagsRoute = AuthenticatedRoute.extend(CurrentUserSettings, PaginationRouteMixin, {
export default AuthenticatedRoute.extend(CurrentUserSettings, PaginationRouteMixin, {
titleToken: 'Settings - Tags',
beforeModel: function (transition) {
@ -45,5 +44,3 @@ TagsRoute = AuthenticatedRoute.extend(CurrentUserSettings, PaginationRouteMixin,
this.controller.send('resetPagination');
}
});
export default TagsRoute;

View File

@ -1,9 +1,7 @@
import Ember from 'ember';
var SetupRoute = Ember.Route.extend({
export default Ember.Route.extend({
beforeModel: function () {
this.transitionTo('setup.one');
}
});
export default SetupRoute;

View File

@ -3,7 +3,7 @@ import Configuration from 'simple-auth/configuration';
import styleBody from 'ghost/mixins/style-body';
import DS from 'ember-data';
var SigninRoute = Ember.Route.extend(styleBody, {
export default Ember.Route.extend(styleBody, {
titleToken: 'Sign In',
classNames: ['ghost-login'],
@ -33,5 +33,3 @@ var SigninRoute = Ember.Route.extend(styleBody, {
controller.set('model.password', '');
}
});
export default SigninRoute;

View File

@ -2,7 +2,7 @@ import AuthenticatedRoute from 'ghost/routes/authenticated';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
import styleBody from 'ghost/mixins/style-body';
var TeamUserRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
titleToken: 'Team - User',
classNames: ['team-view-user'],
@ -61,5 +61,3 @@ var TeamUserRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
}
}
});
export default TeamUserRoute;

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
import DS from 'ember-data';
var ApplicationSerializer = DS.RESTSerializer.extend({
export default DS.RESTSerializer.extend({
serializeIntoHash: function (hash, type, record, options) {
// Our API expects an id on the posted object
options = options || {};
@ -16,5 +17,3 @@ var ApplicationSerializer = DS.RESTSerializer.extend({
hash[root] = [data];
}
});
export default ApplicationSerializer;

View File

@ -2,7 +2,7 @@ import Ember from 'ember';
import DS from 'ember-data';
import ApplicationSerializer from 'ghost/serializers/application';
var PostSerializer = ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
export default ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
// settings for the EmbeddedRecordsMixin.
attrs: {
tags: {embedded: 'always'}
@ -52,5 +52,3 @@ var PostSerializer = ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
hash[root] = [data];
}
});
export default PostSerializer;

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import ApplicationSerializer from 'ghost/serializers/application';
var SettingSerializer = ApplicationSerializer.extend({
export default ApplicationSerializer.extend({
serializeIntoHash: function (hash, type, record, options) {
// Settings API does not want ids
options = options || {};
@ -36,5 +36,3 @@ var SettingSerializer = ApplicationSerializer.extend({
return this.extractArray(store, type, payload).pop();
}
});
export default SettingSerializer;

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import ApplicationSerializer from 'ghost/serializers/application';
var TagSerializer = ApplicationSerializer.extend({
export default ApplicationSerializer.extend({
serializeIntoHash: function (hash, type, record, options) {
options = options || {};
options.includeId = true;
@ -17,5 +17,3 @@ var TagSerializer = ApplicationSerializer.extend({
hash[root] = [data];
}
});
export default TagSerializer;

View File

@ -2,7 +2,7 @@ import Ember from 'ember';
import DS from 'ember-data';
import ApplicationSerializer from 'ghost/serializers/application';
var UserSerializer = ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
export default ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
roles: {embedded: 'always'}
},
@ -17,5 +17,3 @@ var UserSerializer = ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
return this._super.apply(this, arguments);
}
});
export default UserSerializer;

View File

@ -1,6 +1,7 @@
import DS from 'ember-data';
/* global moment */
var MomentDate = DS.Transform.extend({
export default DS.Transform.extend({
deserialize: function (serialized) {
if (serialized) {
return moment(serialized);
@ -14,4 +15,3 @@ var MomentDate = DS.Transform.extend({
return deserialized;
}
});
export default MomentDate;

View File

@ -1,6 +1,6 @@
var slice = Array.prototype.slice;
function bind(/* func, args, thisArg */) {
export default function (/* func, args, thisArg */) {
var args = slice.call(arguments),
func = args.shift(),
thisArg = args.pop();
@ -11,5 +11,3 @@ function bind(/* func, args, thisArg */) {
return bound;
}
export default bind;

View File

@ -9,7 +9,7 @@ import Ember from 'ember';
* @param {*} upstream
* @param {function} transform a function to transform the **upstream** value.
*/
var BoundOneWay = function (upstream, transform) {
export default function (upstream, transform) {
if (typeof transform !== 'function') {
// default to the identity function
transform = function (value) { return value; };
@ -23,6 +23,4 @@ var BoundOneWay = function (upstream, transform) {
return value;
}
});
};
export default BoundOneWay;
}

View File

@ -1,3 +1 @@
var ctrlOrCmd = navigator.userAgent.indexOf('Mac') !== -1 ? 'command' : 'ctrl';
export default ctrlOrCmd;
export default navigator.userAgent.indexOf('Mac') !== -1 ? 'command' : 'ctrl';

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
var documentTitle = function () {
export default function () {
Ember.Route.reopen({
// `titleToken` can either be a static string or a function
// that accepts a model object and returns a string (or array
@ -56,6 +57,4 @@ var documentTitle = function () {
}
}
});
};
export default documentTitle;
}

View File

@ -17,7 +17,7 @@ var makeRoute = function (root, args) {
return route += '/';
};
function ghostPaths() {
export default function () {
var path = window.location.pathname,
subdir = path.substr(0, path.search('/ghost/')),
adminRoot = subdir + '/ghost',
@ -57,5 +57,3 @@ function ghostPaths() {
count: 'https://ghost.org/count/'
};
}
export default ghostPaths;

View File

@ -2,8 +2,6 @@
// isFinite function from lodash
function isFinite(value) {
export default function (value) {
return window.isFinite(value) && !window.isNaN(parseFloat(value));
}
export default isFinite;

View File

@ -2,9 +2,7 @@
var toString = Object.prototype.toString;
function isNumber(value) {
export default function (value) {
return typeof value === 'number' ||
value && typeof value === 'object' && toString.call(value) === '[object Number]' || false;
}
export default isNumber;

View File

@ -1,3 +1 @@
var mobileQuery = matchMedia('(max-width: 800px)');
export default mobileQuery;
export default matchMedia('(max-width: 800px)');

View File

@ -1,10 +1,8 @@
/* global generatePassword */
function randomPassword() {
export default function () {
var word = generatePassword(6),
randomN = Math.floor(Math.random() * 1000);
return word + randomN;
}
export default randomPassword;

View File

@ -4,7 +4,7 @@
// **target:** The element in which the class is applied. Defaults to scrolled element.
// **class-name:** The class which is applied.
// **offset:** How far the user has to scroll before the class is applied.
var setScrollClassName = function (options) {
export default function (options) {
var $target = options.target || this,
offset = options.offset,
className = options.className || 'scrolling';
@ -14,6 +14,4 @@ var setScrollClassName = function (options) {
} else {
$target.removeClass(className);
}
};
export default setScrollClassName;
}

View File

@ -1,4 +1,5 @@
import Ember from 'ember';
Ember.TextField.reopen({
attributeBindings: ['autofocus']
});

View File

@ -3,7 +3,7 @@ var lowerWords = ['of', 'a', 'the', 'and', 'an', 'or', 'nor', 'but', 'is', 'if',
'then', 'else', 'when', 'at', 'from', 'by', 'on', 'off', 'for',
'in', 'out', 'over', 'to', 'into', 'with'];
function titleize(input) {
export default function (input) {
var words = input.split(' ').map(function (word, index) {
if (index === 0 || lowerWords.indexOf(word) === -1) {
word = Ember.String.capitalize(word);
@ -14,5 +14,3 @@ function titleize(input) {
return words.join(' ');
}
export default titleize;

View File

@ -1,4 +1,5 @@
import Ember from 'ember';
function init() {
// Provide a few custom validators
//

View File

@ -1,7 +1,7 @@
// jscs: disable
/* global XRegExp */
function wordCount(s) {
export default function (s) {
var nonANumLetters = new XRegExp("[^\\s\\d\\p{L}]", "g"); // all non-alphanumeric letters regexp
@ -14,5 +14,3 @@ function wordCount(s) {
return s.split(' ').length;
}
export default wordCount;

View File

@ -4,7 +4,7 @@ import Ember from 'ember';
* Base validator that all validators should extend
* Handles checking of individual properties or the entire model
*/
var BaseValidator = Ember.Object.extend({
export default Ember.Object.extend({
properties: [],
passed: false,
@ -36,5 +36,3 @@ var BaseValidator = Ember.Object.extend({
this.set('passed', false);
}
});
export default BaseValidator;

View File

@ -1,6 +1,6 @@
import BaseValidator from './base';
var NewUserValidator = BaseValidator.extend({
export default BaseValidator.extend({
properties: ['name', 'email', 'password'],
name: function (model) {
@ -31,5 +31,3 @@ var NewUserValidator = BaseValidator.extend({
}
}
});
export default NewUserValidator;

View File

@ -1,6 +1,6 @@
import BaseValidator from './base';
var PostValidator = BaseValidator.create({
export default BaseValidator.create({
properties: ['title', 'metaTitle', 'metaDescription'],
title: function (model) {
@ -35,5 +35,3 @@ var PostValidator = BaseValidator.create({
}
}
});
export default PostValidator;

View File

@ -1,5 +1,6 @@
import BaseValidator from './base';
var ResetValidator = BaseValidator.create({
export default BaseValidator.create({
properties: ['newPassword'],
newPassword: function (model) {
var p1 = model.get('newPassword'),
@ -17,5 +18,3 @@ var ResetValidator = BaseValidator.create({
}
}
});
export default ResetValidator;

View File

@ -1,6 +1,6 @@
import BaseValidator from './base';
var SettingValidator = BaseValidator.create({
export default BaseValidator.create({
properties: ['title', 'description', 'password', 'postsPerPage'],
title: function (model) {
var title = model.get('title');
@ -42,5 +42,3 @@ var SettingValidator = BaseValidator.create({
}
}
});
export default SettingValidator;

View File

@ -1,6 +1,6 @@
import NewUserValidator from 'ghost/validators/new-user';
var SetupValidator = NewUserValidator.create({
export default NewUserValidator.create({
properties: ['name', 'email', 'password', 'blogTitle'],
blogTitle: function (model) {
@ -12,5 +12,3 @@ var SetupValidator = NewUserValidator.create({
}
}
});
export default SetupValidator;

View File

@ -1,6 +1,6 @@
import BaseValidator from './base';
var SigninValidator = BaseValidator.create({
export default BaseValidator.create({
properties: ['identification', 'signin', 'forgotPassword'],
invalidMessage: 'Email address is not valid',
@ -46,5 +46,3 @@ var SigninValidator = BaseValidator.create({
}
}
});
export default SigninValidator;

View File

@ -1,6 +1,6 @@
import BaseValidator from './base';
var TagSettingsValidator = BaseValidator.create({
export default BaseValidator.create({
properties: ['name', 'metaTitle', 'metaDescription'],
name: function (model) {
var name = model.get('name');
@ -33,5 +33,3 @@ var TagSettingsValidator = BaseValidator.create({
}
}
});
export default TagSettingsValidator;

View File

@ -1,7 +1,7 @@
import BaseValidator from './base';
import Ember from 'ember';
var UserValidator = BaseValidator.create({
export default BaseValidator.create({
properties: ['name', 'bio', 'email', 'location', 'website', 'roles'],
isActive: function (model) {
return (model.get('status') === 'active');
@ -70,5 +70,3 @@ var UserValidator = BaseValidator.create({
}
}
});
export default UserValidator;