mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 03:09:43 +00:00
Split out common functions into discourse-common
module
This commit is contained in:
parent
3a4615c205
commit
be1d74d207
@ -1,3 +1,3 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
export default htmlHelper(size => I18n.toHumanSize(size));
|
export default htmlHelper(size => I18n.toHumanSize(size));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
import { escapeExpression } from 'discourse/lib/utilities';
|
import { escapeExpression } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
export default htmlHelper(str => escapeExpression(str).replace(/\n/g, "<br>"));
|
export default htmlHelper(str => escapeExpression(str).replace(/\n/g, "<br>"));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('value-at-tl', function(data, params) {
|
registerUnbound('value-at-tl', function(data, params) {
|
||||||
var tl = parseInt(params.level, 10);
|
var tl = parseInt(params.level, 10);
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { h } from 'virtual-dom';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
|
||||||
|
|
||||||
function iconClasses(icon, params) {
|
export function iconClasses(icon, params) {
|
||||||
var classes = "fa fa-" + icon;
|
let classes = "fa fa-" + icon;
|
||||||
if (params.modifier) { classes += " fa-" + params.modifier; }
|
if (params.modifier) { classes += " fa-" + params.modifier; }
|
||||||
if (params['class']) { classes += ' ' + params['class']; }
|
if (params['class']) { classes += ' ' + params['class']; }
|
||||||
return classes;
|
return classes;
|
||||||
@ -21,23 +20,6 @@ export function iconHTML(icon, params) {
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function iconNode(icon, params) {
|
|
||||||
params = params || {};
|
|
||||||
|
|
||||||
const properties = {
|
|
||||||
className: iconClasses(icon, params),
|
|
||||||
attributes: { "aria-hidden": true }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (params.title) { properties.attributes.title = params.title; }
|
|
||||||
|
|
||||||
if (params.label) {
|
|
||||||
return h('i', properties, h('span.sr-only', I18n.t(params.label)));
|
|
||||||
} else {
|
|
||||||
return h('i', properties);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
registerUnbound('fa-icon', function(icon, params) {
|
registerUnbound('fa-icon', function(icon, params) {
|
||||||
return new Handlebars.SafeString(iconHTML(icon, params));
|
return new Handlebars.SafeString(iconHTML(icon, params));
|
||||||
});
|
});
|
@ -1,3 +1,3 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('i18n', (key, params) => I18n.t(key, params));
|
registerUnbound('i18n', (key, params) => I18n.t(key, params));
|
@ -1,4 +1,4 @@
|
|||||||
import { get } from 'discourse/lib/raw-handlebars';
|
import { get } from 'discourse-common/lib/raw-handlebars';
|
||||||
|
|
||||||
// `Ember.Helper` is only available in versions after 1.12
|
// `Ember.Helper` is only available in versions after 1.12
|
||||||
export function htmlHelper(fn) {
|
export function htmlHelper(fn) {
|
218
app/assets/javascripts/discourse-common/resolver.js.es6
Normal file
218
app/assets/javascripts/discourse-common/resolver.js.es6
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/* global requirejs, require */
|
||||||
|
|
||||||
|
var classify = Ember.String.classify;
|
||||||
|
var get = Ember.get;
|
||||||
|
|
||||||
|
var LOADING_WHITELIST = ['badges', 'userActivity', 'userPrivateMessages', 'admin', 'adminFlags',
|
||||||
|
'user', 'preferences', 'adminEmail', 'adminUsersList'];
|
||||||
|
var _dummyRoute;
|
||||||
|
var _loadingView;
|
||||||
|
|
||||||
|
function loadingResolver(cb) {
|
||||||
|
return function(parsedName) {
|
||||||
|
var fullNameWithoutType = parsedName.fullNameWithoutType;
|
||||||
|
|
||||||
|
if (fullNameWithoutType.indexOf('Loading') >= 0) {
|
||||||
|
fullNameWithoutType = fullNameWithoutType.replace('Loading', '');
|
||||||
|
if (LOADING_WHITELIST.indexOf(fullNameWithoutType) !== -1) {
|
||||||
|
return cb(fullNameWithoutType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseName(fullName) {
|
||||||
|
const nameParts = fullName.split(":"),
|
||||||
|
type = nameParts[0], fullNameWithoutType = nameParts[1],
|
||||||
|
name = fullNameWithoutType,
|
||||||
|
namespace = get(this, 'namespace'),
|
||||||
|
root = namespace;
|
||||||
|
|
||||||
|
return {
|
||||||
|
fullName: fullName,
|
||||||
|
type: type,
|
||||||
|
fullNameWithoutType: fullNameWithoutType,
|
||||||
|
name: name,
|
||||||
|
root: root,
|
||||||
|
resolveMethodName: "resolve" + classify(type)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildResolver(baseName) {
|
||||||
|
return Ember.DefaultResolver.extend({
|
||||||
|
parseName,
|
||||||
|
|
||||||
|
resolveRouter(parsedName) {
|
||||||
|
const routerPath = `${baseName}/router`;
|
||||||
|
if (requirejs.entries[routerPath]) {
|
||||||
|
const module = require(routerPath, null, null, true);
|
||||||
|
return module.default;
|
||||||
|
}
|
||||||
|
return this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
normalize(fullName) {
|
||||||
|
const split = fullName.split(':');
|
||||||
|
if (split.length > 1) {
|
||||||
|
const appBase = `${baseName}/${split[0]}s/`;
|
||||||
|
const adminBase = 'admin/' + split[0] + 's/';
|
||||||
|
|
||||||
|
// Allow render 'admin/templates/xyz' too
|
||||||
|
split[1] = split[1].replace('.templates', '').replace('/templates', '');
|
||||||
|
|
||||||
|
// Try slashes
|
||||||
|
let dashed = Ember.String.dasherize(split[1].replace(/\./g, '/'));
|
||||||
|
if (requirejs.entries[appBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
||||||
|
return split[0] + ":" + dashed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try with dashes instead of slashes
|
||||||
|
dashed = Ember.String.dasherize(split[1].replace(/\./g, '-'));
|
||||||
|
if (requirejs.entries[appBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
||||||
|
return split[0] + ":" + dashed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this._super(fullName);
|
||||||
|
},
|
||||||
|
|
||||||
|
customResolve(parsedName) {
|
||||||
|
// If we end with the name we want, use it. This allows us to define components within plugins.
|
||||||
|
const suffix = parsedName.type + 's/' + parsedName.fullNameWithoutType,
|
||||||
|
dashed = Ember.String.dasherize(suffix),
|
||||||
|
moduleName = Object.keys(requirejs.entries).find(function(e) {
|
||||||
|
return (e.indexOf(suffix, e.length - suffix.length) !== -1) ||
|
||||||
|
(e.indexOf(dashed, e.length - dashed.length) !== -1);
|
||||||
|
});
|
||||||
|
|
||||||
|
var module;
|
||||||
|
if (moduleName) {
|
||||||
|
module = require(moduleName, null, null, true /* force sync */);
|
||||||
|
if (module && module['default']) { module = module['default']; }
|
||||||
|
}
|
||||||
|
return module;
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveWidget(parsedName) {
|
||||||
|
return this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveAdapter(parsedName) {
|
||||||
|
return this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveModel(parsedName) {
|
||||||
|
return this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveView(parsedName) {
|
||||||
|
return this.findLoadingView(parsedName) || this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveHelper(parsedName) {
|
||||||
|
return this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveController(parsedName) {
|
||||||
|
return this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveComponent(parsedName) {
|
||||||
|
return this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveRoute(parsedName) {
|
||||||
|
return this.findLoadingRoute(parsedName) || this.customResolve(parsedName) || this._super(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
resolveTemplate(parsedName) {
|
||||||
|
return this.findPluginMobileTemplate(parsedName) ||
|
||||||
|
this.findPluginTemplate(parsedName) ||
|
||||||
|
this.findMobileTemplate(parsedName) ||
|
||||||
|
this.findTemplate(parsedName) ||
|
||||||
|
Ember.TEMPLATES.not_found;
|
||||||
|
},
|
||||||
|
|
||||||
|
findLoadingRoute: loadingResolver(function() {
|
||||||
|
_dummyRoute = _dummyRoute || Ember.Route.extend();
|
||||||
|
return _dummyRoute;
|
||||||
|
}),
|
||||||
|
|
||||||
|
findLoadingView: loadingResolver(function() {
|
||||||
|
if (!_loadingView) {
|
||||||
|
_loadingView = require('discourse/views/loading', null, null, true /* force sync */);
|
||||||
|
if (_loadingView && _loadingView['default']) { _loadingView = _loadingView['default']; }
|
||||||
|
}
|
||||||
|
return _loadingView;
|
||||||
|
}),
|
||||||
|
|
||||||
|
findPluginTemplate(parsedName) {
|
||||||
|
var pluginParsedName = this.parseName(parsedName.fullName.replace("template:", "template:javascripts/"));
|
||||||
|
return this.findTemplate(pluginParsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
findPluginMobileTemplate(parsedName) {
|
||||||
|
if (this.mobileView) {
|
||||||
|
var pluginParsedName = this.parseName(parsedName.fullName.replace("template:", "template:javascripts/mobile/"));
|
||||||
|
return this.findTemplate(pluginParsedName);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
findMobileTemplate(parsedName) {
|
||||||
|
if (this.mobileView) {
|
||||||
|
var mobileParsedName = this.parseName(parsedName.fullName.replace("template:", "template:mobile/"));
|
||||||
|
return this.findTemplate(mobileParsedName);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
findTemplate(parsedName) {
|
||||||
|
const withoutType = parsedName.fullNameWithoutType,
|
||||||
|
slashedType = withoutType.replace(/\./g, '/'),
|
||||||
|
decamelized = withoutType.decamelize(),
|
||||||
|
dashed = decamelized.replace(/\./g, '-').replace(/\_/g, '-'),
|
||||||
|
templates = Ember.TEMPLATES;
|
||||||
|
|
||||||
|
return this._super(parsedName) ||
|
||||||
|
templates[slashedType] ||
|
||||||
|
templates[withoutType] ||
|
||||||
|
templates[dashed] ||
|
||||||
|
templates[decamelized.replace(/\./, '/')] ||
|
||||||
|
templates[decamelized.replace(/\_/, '/')] ||
|
||||||
|
templates[`${baseName}/templates/${withoutType}`] ||
|
||||||
|
this.findAdminTemplate(parsedName) ||
|
||||||
|
this.findUnderscoredTemplate(parsedName);
|
||||||
|
},
|
||||||
|
|
||||||
|
findUnderscoredTemplate(parsedName) {
|
||||||
|
var decamelized = parsedName.fullNameWithoutType.decamelize();
|
||||||
|
var underscored = decamelized.replace(/\-/g, "_");
|
||||||
|
return Ember.TEMPLATES[underscored];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Try to find a template within a special admin namespace, e.g. adminEmail => admin/templates/email
|
||||||
|
// (similar to how discourse lays out templates)
|
||||||
|
findAdminTemplate(parsedName) {
|
||||||
|
var decamelized = parsedName.fullNameWithoutType.decamelize();
|
||||||
|
|
||||||
|
if (decamelized.indexOf('components') === 0) {
|
||||||
|
const compTemplate = Ember.TEMPLATES['admin/templates/' + decamelized];
|
||||||
|
if (compTemplate) { return compTemplate; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decamelized === "javascripts/admin") {
|
||||||
|
return Ember.TEMPLATES['admin/templates/admin'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decamelized.indexOf('admin') === 0 || decamelized.indexOf('javascripts/admin') === 0) {
|
||||||
|
decamelized = decamelized.replace(/^admin\_/, 'admin/templates/');
|
||||||
|
decamelized = decamelized.replace(/^admin\./, 'admin/templates/');
|
||||||
|
decamelized = decamelized.replace(/\./g, '_');
|
||||||
|
|
||||||
|
const dashed = decamelized.replace(/_/g, '-');
|
||||||
|
return Ember.TEMPLATES[decamelized] ||
|
||||||
|
Ember.TEMPLATES[dashed] ||
|
||||||
|
Ember.TEMPLATES[dashed.replace('admin-', 'admin/')];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import DiscourseResolver from 'discourse/ember/resolver';
|
import { buildResolver } from 'discourse-common/resolver';
|
||||||
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
const _pluginCallbacks = [];
|
const _pluginCallbacks = [];
|
||||||
@ -31,7 +31,7 @@ const Discourse = Ember.Application.extend({
|
|||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
|
|
||||||
Resolver: DiscourseResolver,
|
Resolver: buildResolver('discourse'),
|
||||||
|
|
||||||
@observes('_docTitle', 'hasFocus', 'notifyCount')
|
@observes('_docTitle', 'hasFocus', 'notifyCount')
|
||||||
_titleChanged() {
|
_titleChanged() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import DropdownButton from 'discourse/components/dropdown-button';
|
import DropdownButton from 'discourse/components/dropdown-button';
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import computed from 'ember-addons/ember-computed-decorators';
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import interceptClick from 'discourse/lib/intercept-click';
|
import interceptClick from 'discourse/lib/intercept-click';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import StringBuffer from 'discourse/mixins/string-buffer';
|
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
export default Ember.Component.extend(StringBuffer, {
|
export default Ember.Component.extend(StringBuffer, {
|
||||||
tagName: 'th',
|
tagName: 'th',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { on } from 'ember-addons/ember-computed-decorators';
|
import { on } from 'ember-addons/ember-computed-decorators';
|
||||||
import StringBuffer from 'discourse/mixins/string-buffer';
|
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import LogsNotice from 'discourse/services/logs-notice';
|
import LogsNotice from 'discourse/services/logs-notice';
|
||||||
|
|
||||||
export default Ember.Component.extend(StringBuffer, {
|
export default Ember.Component.extend(StringBuffer, {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import StringBuffer from 'discourse/mixins/string-buffer';
|
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
export default Ember.Component.extend(StringBuffer, {
|
export default Ember.Component.extend(StringBuffer, {
|
||||||
classNameBindings: [':tip', 'good', 'bad'],
|
classNameBindings: [':tip', 'good', 'bad'],
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import DropdownButton from 'discourse/components/dropdown-button';
|
import DropdownButton from 'discourse/components/dropdown-button';
|
||||||
import { allLevels, buttonDetails } from 'discourse/lib/notification-levels';
|
import { allLevels, buttonDetails } from 'discourse/lib/notification-levels';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import computed from 'ember-addons/ember-computed-decorators';
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default DropdownButton.extend({
|
export default DropdownButton.extend({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import StringBuffer from 'discourse/mixins/string-buffer';
|
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default Ember.Component.extend(StringBuffer, {
|
export default Ember.Component.extend(StringBuffer, {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import DropdownButton from 'discourse/components/dropdown-button';
|
import DropdownButton from 'discourse/components/dropdown-button';
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import Combobox from 'discourse/components/combo-box';
|
import Combobox from 'discourse/components/combo-box';
|
||||||
import { on, observes } from 'ember-addons/ember-computed-decorators';
|
import { on, observes } from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import StringBuffer from 'discourse/mixins/string-buffer';
|
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||||
import { escapeExpression } from 'discourse/lib/utilities';
|
import { escapeExpression } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
|
@ -1,206 +0,0 @@
|
|||||||
/* global requirejs, require */
|
|
||||||
|
|
||||||
var classify = Ember.String.classify;
|
|
||||||
var get = Ember.get;
|
|
||||||
|
|
||||||
var LOADING_WHITELIST = ['badges', 'userActivity', 'userPrivateMessages', 'admin', 'adminFlags',
|
|
||||||
'user', 'preferences', 'adminEmail', 'adminUsersList'];
|
|
||||||
var _dummyRoute;
|
|
||||||
var _loadingView;
|
|
||||||
|
|
||||||
function loadingResolver(cb) {
|
|
||||||
return function(parsedName) {
|
|
||||||
var fullNameWithoutType = parsedName.fullNameWithoutType;
|
|
||||||
|
|
||||||
if (fullNameWithoutType.indexOf('Loading') >= 0) {
|
|
||||||
fullNameWithoutType = fullNameWithoutType.replace('Loading', '');
|
|
||||||
if (LOADING_WHITELIST.indexOf(fullNameWithoutType) !== -1) {
|
|
||||||
return cb(fullNameWithoutType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseName(fullName) {
|
|
||||||
const nameParts = fullName.split(":"),
|
|
||||||
type = nameParts[0], fullNameWithoutType = nameParts[1],
|
|
||||||
name = fullNameWithoutType,
|
|
||||||
namespace = get(this, 'namespace'),
|
|
||||||
root = namespace;
|
|
||||||
|
|
||||||
return {
|
|
||||||
fullName: fullName,
|
|
||||||
type: type,
|
|
||||||
fullNameWithoutType: fullNameWithoutType,
|
|
||||||
name: name,
|
|
||||||
root: root,
|
|
||||||
resolveMethodName: "resolve" + classify(type)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Ember.DefaultResolver.extend({
|
|
||||||
parseName: parseName,
|
|
||||||
|
|
||||||
normalize(fullName) {
|
|
||||||
var split = fullName.split(':');
|
|
||||||
if (split.length > 1) {
|
|
||||||
var discourseBase = 'discourse/' + split[0] + 's/';
|
|
||||||
var adminBase = 'admin/' + split[0] + 's/';
|
|
||||||
|
|
||||||
// Allow render 'admin/templates/xyz' too
|
|
||||||
split[1] = split[1].replace('.templates', '').replace('/templates', '');
|
|
||||||
|
|
||||||
// Try slashes
|
|
||||||
var dashed = Ember.String.dasherize(split[1].replace(/\./g, '/'));
|
|
||||||
if (requirejs.entries[discourseBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
|
||||||
return split[0] + ":" + dashed;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try with dashes instead of slashes
|
|
||||||
dashed = Ember.String.dasherize(split[1].replace(/\./g, '-'));
|
|
||||||
if (requirejs.entries[discourseBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
|
||||||
return split[0] + ":" + dashed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this._super(fullName);
|
|
||||||
},
|
|
||||||
|
|
||||||
customResolve(parsedName) {
|
|
||||||
// If we end with the name we want, use it. This allows us to define components within plugins.
|
|
||||||
const suffix = parsedName.type + 's/' + parsedName.fullNameWithoutType,
|
|
||||||
dashed = Ember.String.dasherize(suffix),
|
|
||||||
moduleName = Object.keys(requirejs.entries).find(function(e) {
|
|
||||||
return (e.indexOf(suffix, e.length - suffix.length) !== -1) ||
|
|
||||||
(e.indexOf(dashed, e.length - dashed.length) !== -1);
|
|
||||||
});
|
|
||||||
|
|
||||||
var module;
|
|
||||||
if (moduleName) {
|
|
||||||
module = require(moduleName, null, null, true /* force sync */);
|
|
||||||
if (module && module['default']) { module = module['default']; }
|
|
||||||
}
|
|
||||||
return module;
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveWidget(parsedName) {
|
|
||||||
return this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveAdapter(parsedName) {
|
|
||||||
return this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveModel(parsedName) {
|
|
||||||
return this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveView(parsedName) {
|
|
||||||
return this.findLoadingView(parsedName) || this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveHelper(parsedName) {
|
|
||||||
return this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveController(parsedName) {
|
|
||||||
return this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveComponent(parsedName) {
|
|
||||||
return this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveRoute(parsedName) {
|
|
||||||
return this.findLoadingRoute(parsedName) || this.customResolve(parsedName) || this._super(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
resolveTemplate(parsedName) {
|
|
||||||
return this.findPluginMobileTemplate(parsedName) ||
|
|
||||||
this.findPluginTemplate(parsedName) ||
|
|
||||||
this.findMobileTemplate(parsedName) ||
|
|
||||||
this.findTemplate(parsedName) ||
|
|
||||||
Ember.TEMPLATES.not_found;
|
|
||||||
},
|
|
||||||
|
|
||||||
findLoadingRoute: loadingResolver(function() {
|
|
||||||
_dummyRoute = _dummyRoute || Ember.Route.extend();
|
|
||||||
return _dummyRoute;
|
|
||||||
}),
|
|
||||||
|
|
||||||
findLoadingView: loadingResolver(function() {
|
|
||||||
if (!_loadingView) {
|
|
||||||
_loadingView = require('discourse/views/loading', null, null, true /* force sync */);
|
|
||||||
if (_loadingView && _loadingView['default']) { _loadingView = _loadingView['default']; }
|
|
||||||
}
|
|
||||||
return _loadingView;
|
|
||||||
}),
|
|
||||||
|
|
||||||
findPluginTemplate(parsedName) {
|
|
||||||
var pluginParsedName = this.parseName(parsedName.fullName.replace("template:", "template:javascripts/"));
|
|
||||||
return this.findTemplate(pluginParsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
findPluginMobileTemplate(parsedName) {
|
|
||||||
if (this.mobileView) {
|
|
||||||
var pluginParsedName = this.parseName(parsedName.fullName.replace("template:", "template:javascripts/mobile/"));
|
|
||||||
return this.findTemplate(pluginParsedName);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
findMobileTemplate(parsedName) {
|
|
||||||
if (this.mobileView) {
|
|
||||||
var mobileParsedName = this.parseName(parsedName.fullName.replace("template:", "template:mobile/"));
|
|
||||||
return this.findTemplate(mobileParsedName);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
findTemplate(parsedName) {
|
|
||||||
const withoutType = parsedName.fullNameWithoutType,
|
|
||||||
slashedType = withoutType.replace(/\./g, '/'),
|
|
||||||
decamelized = withoutType.decamelize(),
|
|
||||||
dashed = decamelized.replace(/\./g, '-').replace(/\_/g, '-'),
|
|
||||||
templates = Ember.TEMPLATES;
|
|
||||||
|
|
||||||
return this._super(parsedName) ||
|
|
||||||
templates[slashedType] ||
|
|
||||||
templates[withoutType] ||
|
|
||||||
templates[dashed] ||
|
|
||||||
templates[decamelized.replace(/\./, '/')] ||
|
|
||||||
templates[decamelized.replace(/\_/, '/')] ||
|
|
||||||
this.findAdminTemplate(parsedName) ||
|
|
||||||
this.findUnderscoredTemplate(parsedName);
|
|
||||||
},
|
|
||||||
|
|
||||||
findUnderscoredTemplate(parsedName) {
|
|
||||||
var decamelized = parsedName.fullNameWithoutType.decamelize();
|
|
||||||
var underscored = decamelized.replace(/\-/g, "_");
|
|
||||||
return Ember.TEMPLATES[underscored];
|
|
||||||
},
|
|
||||||
|
|
||||||
// Try to find a template within a special admin namespace, e.g. adminEmail => admin/templates/email
|
|
||||||
// (similar to how discourse lays out templates)
|
|
||||||
findAdminTemplate(parsedName) {
|
|
||||||
var decamelized = parsedName.fullNameWithoutType.decamelize();
|
|
||||||
|
|
||||||
if (decamelized.indexOf('components') === 0) {
|
|
||||||
const compTemplate = Ember.TEMPLATES['admin/templates/' + decamelized];
|
|
||||||
if (compTemplate) { return compTemplate; }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (decamelized === "javascripts/admin") {
|
|
||||||
return Ember.TEMPLATES['admin/templates/admin'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (decamelized.indexOf('admin') === 0 || decamelized.indexOf('javascripts/admin') === 0) {
|
|
||||||
decamelized = decamelized.replace(/^admin\_/, 'admin/templates/');
|
|
||||||
decamelized = decamelized.replace(/^admin\./, 'admin/templates/');
|
|
||||||
decamelized = decamelized.replace(/\./g, '_');
|
|
||||||
|
|
||||||
const dashed = decamelized.replace(/_/g, '-');
|
|
||||||
return Ember.TEMPLATES[decamelized] ||
|
|
||||||
Ember.TEMPLATES[dashed] ||
|
|
||||||
Ember.TEMPLATES[dashed.replace('admin-', 'admin/')];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
import { longDate, autoUpdatingRelativeAge, number } from 'discourse/lib/formatter';
|
import { longDate, autoUpdatingRelativeAge, number } from 'discourse/lib/formatter';
|
||||||
|
|
||||||
const safe = Handlebars.SafeString;
|
const safe = Handlebars.SafeString;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
export default htmlHelper(color => `border-color: #${color}`);
|
export default htmlHelper(color => `border-color: #${color}`);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
import { avatarImg } from 'discourse/lib/utilities';
|
import { avatarImg } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
export default htmlHelper((avatarTemplate, size) => avatarImg({ size, avatarTemplate }));
|
export default htmlHelper((avatarTemplate, size) => avatarImg({ size, avatarTemplate }));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
import { avatarImg } from 'discourse/lib/utilities';
|
import { avatarImg } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
export default htmlHelper((user, size) => {
|
export default htmlHelper((user, size) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
||||||
|
|
||||||
export default htmlHelper(categoryLinkHTML);
|
export default htmlHelper(categoryLinkHTML);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { autoUpdatingRelativeAge } from 'discourse/lib/formatter';
|
import { autoUpdatingRelativeAge } from 'discourse/lib/formatter';
|
||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
export default htmlHelper(dt => autoUpdatingRelativeAge(new Date(dt), {format: 'medium', title: true }));
|
export default htmlHelper(dt => autoUpdatingRelativeAge(new Date(dt), {format: 'medium', title: true }));
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
export default htmlHelper(str => str[0].toUpperCase() + str.slice(1));
|
export default htmlHelper(str => str[0].toUpperCase() + str.slice(1));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('category-badge', function(cat, options) {
|
registerUnbound('category-badge', function(cat, options) {
|
||||||
options.link = false;
|
options.link = false;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
var get = Em.get,
|
var get = Em.get,
|
||||||
escapeExpression = Handlebars.Utils.escapeExpression;
|
escapeExpression = Handlebars.Utils.escapeExpression;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
function daysSinceEpoch(dt) {
|
function daysSinceEpoch(dt) {
|
||||||
// 1000 * 60 * 60 * 24 = days since epoch
|
// 1000 * 60 * 60 * 24 = days since epoch
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { cook } from 'discourse/lib/text';
|
import { cook } from 'discourse/lib/text';
|
||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('cook-text', cook);
|
registerUnbound('cook-text', cook);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerHelper } from 'discourse/lib/helpers';
|
import { registerHelper } from 'discourse-common/lib/helpers';
|
||||||
import PreloadStore from 'preload-store';
|
import PreloadStore from 'preload-store';
|
||||||
|
|
||||||
const _customizations = {};
|
const _customizations = {};
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
export default htmlHelper(str => Ember.isEmpty(str) ? '—' : str);
|
export default htmlHelper(str => Ember.isEmpty(str) ? '—' : str);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
import renderTag from 'discourse/lib/render-tag';
|
import renderTag from 'discourse/lib/render-tag';
|
||||||
|
|
||||||
export default registerUnbound('discourse-tag', function(name, params) {
|
export default registerUnbound('discourse-tag', function(name, params) {
|
||||||
|
20
app/assets/javascripts/discourse/helpers/fa-icon-node.js.es6
Normal file
20
app/assets/javascripts/discourse/helpers/fa-icon-node.js.es6
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { h } from 'virtual-dom';
|
||||||
|
import { iconClasses } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
|
export function iconNode(icon, params) {
|
||||||
|
params = params || {};
|
||||||
|
|
||||||
|
const properties = {
|
||||||
|
className: iconClasses(icon, params),
|
||||||
|
attributes: { "aria-hidden": true }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.title) { properties.attributes.title = params.title; }
|
||||||
|
|
||||||
|
if (params.label) {
|
||||||
|
return h('i', properties, h('span.sr-only', I18n.t(params.label)));
|
||||||
|
} else {
|
||||||
|
return h('i', properties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
import { autoUpdatingRelativeAge } from 'discourse/lib/formatter';
|
import { autoUpdatingRelativeAge } from 'discourse/lib/formatter';
|
||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('format-age', function(dt) {
|
registerUnbound('format-age', function(dt) {
|
||||||
dt = new Date(dt);
|
dt = new Date(dt);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
import { autoUpdatingRelativeAge } from 'discourse/lib/formatter';
|
import { autoUpdatingRelativeAge } from 'discourse/lib/formatter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
export default htmlHelper(function(str) {
|
export default htmlHelper(function(str) {
|
||||||
if (Ember.isEmpty(str)) { return ""; }
|
if (Ember.isEmpty(str)) { return ""; }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
function renderSpinner(cssClass) {
|
function renderSpinner(cssClass) {
|
||||||
var html = "<div class='spinner";
|
var html = "<div class='spinner";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('max-usernames', function(usernames, params) {
|
registerUnbound('max-usernames', function(usernames, params) {
|
||||||
var maxLength = parseInt(params.max) || 3;
|
var maxLength = parseInt(params.max) || 3;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
const TITLE_SUBS = {
|
const TITLE_SUBS = {
|
||||||
all: 'all_time',
|
all: 'all_time',
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
The list of disabled plugins is returned via the `Site` singleton.
|
The list of disabled plugins is returned via the `Site` singleton.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
import { registerHelper } from 'discourse/lib/helpers';
|
import { registerHelper } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
let _connectorCache, _rawCache;
|
let _connectorCache, _rawCache;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
// see: https://github.com/emberjs/ember.js/issues/12634
|
// see: https://github.com/emberjs/ember.js/issues/12634
|
||||||
var missingViews = {};
|
var missingViews = {};
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
import { emojiUnescape } from 'discourse/lib/text';
|
import { emojiUnescape } from 'discourse/lib/text';
|
||||||
|
|
||||||
registerUnbound('i18n', (key, params) => I18n.t(key, params));
|
|
||||||
registerUnbound('replace-emoji', text => new Handlebars.SafeString(emojiUnescape(text)));
|
registerUnbound('replace-emoji', text => new Handlebars.SafeString(emojiUnescape(text)));
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('shorten-url', function(url) {
|
registerUnbound('shorten-url', function(url) {
|
||||||
var matches = url.match(/\//g);
|
var matches = url.match(/\//g);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
|
|
||||||
registerUnbound('topic-link', function(topic) {
|
registerUnbound('topic-link', function(topic) {
|
||||||
var title = topic.get('fancyTitle');
|
var title = topic.get('fancyTitle');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { registerUnbound } from 'discourse/lib/helpers';
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||||
import { avatarImg } from 'discourse/lib/utilities';
|
import { avatarImg } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
function renderAvatar(user, options) {
|
function renderAvatar(user, options) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
import { htmlHelper } from 'discourse/lib/helpers';
|
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||||
import { escapeExpression } from 'discourse/lib/utilities';
|
import { escapeExpression } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
export default htmlHelper((user, args) => {
|
export default htmlHelper((user, args) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { addDecorator } from 'discourse/widgets/post-cooked';
|
import { addDecorator } from 'discourse/widgets/post-cooked';
|
||||||
import ComposerEditor from 'discourse/components/composer-editor';
|
import ComposerEditor from 'discourse/components/composer-editor';
|
||||||
import { addButton } from 'discourse/widgets/post-menu';
|
import { addButton } from 'discourse/widgets/post-menu';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { mapRoutes } from 'discourse/router';
|
import { mapRoutes } from 'discourse/mapping-router';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "map-routes",
|
name: "map-routes",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import ButtonView from 'discourse/views/button';
|
import ButtonView from 'discourse/views/button';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
export default ButtonView.extend({
|
export default ButtonView.extend({
|
||||||
classNames: ['bookmark'],
|
classNames: ['bookmark'],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import ButtonView from 'discourse/views/button';
|
import ButtonView from 'discourse/views/button';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
export default ButtonView.extend({
|
export default ButtonView.extend({
|
||||||
classNames: ['flag-topic'],
|
classNames: ['flag-topic'],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import ButtonView from 'discourse/views/button';
|
import ButtonView from 'discourse/views/button';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
export default ButtonView.extend({
|
export default ButtonView.extend({
|
||||||
classNames: ['invite-topic'],
|
classNames: ['invite-topic'],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import ButtonView from 'discourse/views/button';
|
import ButtonView from 'discourse/views/button';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
export default ButtonView.extend({
|
export default ButtonView.extend({
|
||||||
classNames: ['share'],
|
classNames: ['share'],
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { avatarFor } from 'discourse/widgets/post';
|
import { avatarFor } from 'discourse/widgets/post';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { dateNode } from 'discourse/helpers/node';
|
import { dateNode } from 'discourse/helpers/node';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
|
|
||||||
export default createWidget('button', {
|
export default createWidget('button', {
|
||||||
tagName: 'button.widget-button',
|
tagName: 'button.widget-button',
|
||||||
|
@ -2,7 +2,7 @@ import PostCooked from 'discourse/widgets/post-cooked';
|
|||||||
import DecoratorHelper from 'discourse/widgets/decorator-helper';
|
import DecoratorHelper from 'discourse/widgets/decorator-helper';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
|
|
||||||
createWidget('post-link-arrow', {
|
createWidget('post-link-arrow', {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
import RawHtml from 'discourse/widgets/raw-html';
|
import RawHtml from 'discourse/widgets/raw-html';
|
||||||
import { tagNode } from 'discourse/lib/render-tag';
|
import { tagNode } from 'discourse/lib/render-tag';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { avatarImg } from 'discourse/widgets/post';
|
import { avatarImg } from 'discourse/widgets/post';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { longDate } from 'discourse/lib/formatter';
|
import { longDate } from 'discourse/lib/formatter';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { replaceEmoji } from 'discourse/widgets/emoji';
|
import { replaceEmoji } from 'discourse/widgets/emoji';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import RawHtml from 'discourse/widgets/raw-html';
|
import RawHtml from 'discourse/widgets/raw-html';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { actionDescriptionHtml } from 'discourse/components/small-action';
|
import { actionDescriptionHtml } from 'discourse/components/small-action';
|
||||||
import { avatarFor } from 'discourse/widgets/post';
|
import { avatarFor } from 'discourse/widgets/post';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import PostCooked from 'discourse/widgets/post-cooked';
|
import PostCooked from 'discourse/widgets/post-cooked';
|
||||||
import DecoratorHelper from 'discourse/widgets/decorator-helper';
|
import DecoratorHelper from 'discourse/widgets/decorator-helper';
|
||||||
import { createWidget, applyDecorators } from 'discourse/widgets/widget';
|
import { createWidget, applyDecorators } from 'discourse/widgets/widget';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { transformBasicPost } from 'discourse/lib/transform-post';
|
import { transformBasicPost } from 'discourse/lib/transform-post';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { avatarFor } from 'discourse/widgets/post';
|
import { avatarFor } from 'discourse/widgets/post';
|
||||||
|
@ -3,7 +3,7 @@ import { dateNode } from 'discourse/helpers/node';
|
|||||||
import RawHtml from 'discourse/widgets/raw-html';
|
import RawHtml from 'discourse/widgets/raw-html';
|
||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
|
|
||||||
class Highlighted extends RawHtml {
|
class Highlighted extends RawHtml {
|
||||||
constructor(html, term) {
|
constructor(html, term) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
|
|
||||||
function description(attrs) {
|
function description(attrs) {
|
||||||
const daysSince = attrs.daysSince;
|
const daysSince = attrs.daysSince;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { escapeExpression } from 'discourse/lib/utilities';
|
import { escapeExpression } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
import { relativeAge } from 'discourse/lib/formatter';
|
import { relativeAge } from 'discourse/lib/formatter';
|
||||||
import { iconNode } from 'discourse/helpers/fa-icon';
|
import { iconNode } from 'discourse/helpers/fa-icon-node';
|
||||||
|
|
||||||
const SCROLLAREA_HEIGHT = 300;
|
const SCROLLAREA_HEIGHT = 300;
|
||||||
const SCROLLER_HEIGHT = 50;
|
const SCROLLER_HEIGHT = 50;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//= require ./ember-addons/decorator-alias
|
//= require ./ember-addons/decorator-alias
|
||||||
//= require ./ember-addons/macro-alias
|
//= require ./ember-addons/macro-alias
|
||||||
//= require ./ember-addons/ember-computed-decorators
|
//= require ./ember-addons/ember-computed-decorators
|
||||||
|
//= require_tree ./discourse-common
|
||||||
//= require ./discourse
|
//= require ./discourse
|
||||||
//= require ./deprecated
|
//= require ./deprecated
|
||||||
|
|
||||||
@ -19,11 +20,6 @@
|
|||||||
//= require ./discourse/lib/debounce
|
//= require ./discourse/lib/debounce
|
||||||
//= require ./discourse/lib/quote
|
//= require ./discourse/lib/quote
|
||||||
//= require ./discourse/lib/key-value-store
|
//= require ./discourse/lib/key-value-store
|
||||||
//= require ./discourse/lib/helpers
|
|
||||||
//= require ./discourse/helpers/i18n
|
|
||||||
//= require ./discourse/helpers/fa-icon
|
|
||||||
//= require ./discourse/lib/raw-handlebars
|
|
||||||
//= require ./discourse/lib/helpers
|
|
||||||
//= require ./discourse/lib/computed
|
//= require ./discourse/lib/computed
|
||||||
//= require ./discourse/lib/formatter
|
//= require ./discourse/lib/formatter
|
||||||
//= require ./discourse/lib/eyeline
|
//= require ./discourse/lib/eyeline
|
||||||
@ -92,7 +88,7 @@
|
|||||||
//= require ./discourse/helpers/category-link
|
//= require ./discourse/helpers/category-link
|
||||||
//= require ./discourse/lib/export-result
|
//= require ./discourse/lib/export-result
|
||||||
//= require_tree ./discourse/lib
|
//= require_tree ./discourse/lib
|
||||||
//= require ./discourse/router
|
//= require ./discourse/mapping-router
|
||||||
|
|
||||||
//= require_tree ./discourse/controllers
|
//= require_tree ./discourse/controllers
|
||||||
//= require_tree ./discourse/models
|
//= require_tree ./discourse/models
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
//= require ./ember-addons/decorator-alias
|
//= require ./ember-addons/decorator-alias
|
||||||
//= require ./ember-addons/macro-alias
|
//= require ./ember-addons/macro-alias
|
||||||
//= require ./ember-addons/ember-computed-decorators
|
//= require ./ember-addons/ember-computed-decorators
|
||||||
//= require discourse/lib/raw-handlebars
|
//= require_tree ./discourse-common
|
||||||
//= require discourse/lib/helpers
|
|
||||||
//= require wizard/resolver
|
|
||||||
//= require wizard/router
|
//= require wizard/router
|
||||||
//= require wizard/wizard
|
//= require wizard/wizard
|
||||||
//= require_tree ./wizard/templates
|
//= require_tree ./wizard/templates
|
||||||
@ -14,5 +12,4 @@
|
|||||||
//= require_tree ./wizard/controllers
|
//= require_tree ./wizard/controllers
|
||||||
//= require_tree ./wizard/lib
|
//= require_tree ./wizard/lib
|
||||||
//= require_tree ./wizard/mixins
|
//= require_tree ./wizard/mixins
|
||||||
//= require_tree ./wizard/helpers
|
|
||||||
//= require_tree ./wizard/initializers
|
//= require_tree ./wizard/initializers
|
||||||
|
@ -20,4 +20,3 @@ export function findWizard() {
|
|||||||
return Wizard.create(wizard);
|
return Wizard.create(wizard);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
function resolveType(parsedName) {
|
|
||||||
const entries = requirejs.entries;
|
|
||||||
|
|
||||||
const named = `wizard/${parsedName.type}s/${parsedName.fullNameWithoutType}`;
|
|
||||||
if (entries[named]) {
|
|
||||||
const module = require(named, null, null, true /* force sync */);
|
|
||||||
return module.default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function customResolve(parsedName) {
|
|
||||||
return resolveType(parsedName) || this._super(parsedName);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Ember.DefaultResolver.extend({
|
|
||||||
|
|
||||||
resolveRoute: customResolve,
|
|
||||||
resolveController: customResolve,
|
|
||||||
resolveComponent: customResolve,
|
|
||||||
|
|
||||||
resolveTemplate(parsedName) {
|
|
||||||
const templates = Ember.TEMPLATES;
|
|
||||||
const withoutType = parsedName.fullNameWithoutType;
|
|
||||||
return templates[`wizard/templates/${withoutType}`] || this._super(parsedName);
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,4 +1,6 @@
|
|||||||
const Router = Ember.Router.extend();
|
const Router = Ember.Router.extend({
|
||||||
|
location: Ember.testing ? 'none': 'hash'
|
||||||
|
});
|
||||||
|
|
||||||
Router.map(function () {
|
Router.map(function () {
|
||||||
this.route('step', { path: '/step/:step_id' });
|
this.route('step', { path: '/step/:step_id' });
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
{{#if showBackButton}}
|
{{#if showBackButton}}
|
||||||
<button class='wizard-btn back' {{action "backStep"}} disabled={{saving}}>
|
<button class='wizard-btn back' {{action "backStep"}} disabled={{saving}}>
|
||||||
<i class='fa fa-chevron-left'></i>
|
{{fa-icon "chevron-left"}}
|
||||||
{{i18n "wizard.back"}}
|
{{i18n "wizard.back"}}
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@ -30,7 +30,7 @@
|
|||||||
{{#if showNextButton}}
|
{{#if showNextButton}}
|
||||||
<button class='wizard-btn next' {{action "nextStep"}} disabled={{saving}}>
|
<button class='wizard-btn next' {{action "nextStep"}} disabled={{saving}}>
|
||||||
{{i18n "wizard.next"}}
|
{{i18n "wizard.next"}}
|
||||||
<i class='fa fa-chevron-right'></i>
|
{{fa-icon "chevron-right"}}
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ QUnit.testDone(function() {
|
|||||||
var wizard = require('wizard/wizard').default.create({
|
var wizard = require('wizard/wizard').default.create({
|
||||||
rootElement: '#ember-testing'
|
rootElement: '#ember-testing'
|
||||||
});
|
});
|
||||||
|
|
||||||
wizard.setupForTesting();
|
wizard.setupForTesting();
|
||||||
wizard.injectTestHelpers();
|
wizard.injectTestHelpers();
|
||||||
wizard.start();
|
wizard.start();
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import Resolver from 'wizard/resolver';
|
import { buildResolver } from 'discourse-common/resolver';
|
||||||
import Router from 'wizard/router';
|
|
||||||
|
|
||||||
export default Ember.Application.extend({
|
export default Ember.Application.extend({
|
||||||
rootElement: '#wizard-main',
|
rootElement: '#wizard-main',
|
||||||
Resolver,
|
Resolver: buildResolver('wizard'),
|
||||||
Router,
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
Object.keys(requirejs._eak_seen).forEach(key => {
|
Object.keys(requirejs._eak_seen).forEach(key => {
|
||||||
|
@ -47,7 +47,7 @@ PLUGIN_API_JS
|
|||||||
name = node["name"] || node["data-template-name"] || "broken"
|
name = node["name"] || node["data-template-name"] || "broken"
|
||||||
precompiled =
|
precompiled =
|
||||||
if name =~ /\.raw$/
|
if name =~ /\.raw$/
|
||||||
"require('discourse/lib/raw-handlebars').template(#{Barber::Precompiler.compile(node.inner_html)})"
|
"require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(node.inner_html)})"
|
||||||
else
|
else
|
||||||
"Ember.HTMLBars.template(#{Barber::Ember::Precompiler.compile(node.inner_html)})"
|
"Ember.HTMLBars.template(#{Barber::Ember::Precompiler.compile(node.inner_html)})"
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ class Barber::Precompiler
|
|||||||
def precompiler
|
def precompiler
|
||||||
if !@precompiler
|
if !@precompiler
|
||||||
|
|
||||||
source = File.read("#{Rails.root}/app/assets/javascripts/discourse/lib/raw-handlebars.js.es6")
|
source = File.read("#{Rails.root}/app/assets/javascripts/discourse-common/lib/raw-handlebars.js.es6")
|
||||||
template = Tilt::ES6ModuleTranspilerTemplate.new {}
|
template = Tilt::ES6ModuleTranspilerTemplate.new {}
|
||||||
transpiled = template.babel_transpile(source)
|
transpiled = template.babel_transpile(source)
|
||||||
|
|
||||||
@ -40,11 +40,11 @@ module Discourse
|
|||||||
module Handlebars
|
module Handlebars
|
||||||
module Helper
|
module Helper
|
||||||
def precompile_handlebars(string)
|
def precompile_handlebars(string)
|
||||||
"require('discourse/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
|
"require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
|
||||||
end
|
end
|
||||||
|
|
||||||
def compile_handlebars(string)
|
def compile_handlebars(string)
|
||||||
"require('discourse/lib/raw-handlebars').compile(#{indent(string).inspect});"
|
"require('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import computed from 'ember-addons/ember-computed-decorators';
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse-common/helpers/fa-icon';
|
||||||
|
|
||||||
export default Em.Component.extend({
|
export default Em.Component.extend({
|
||||||
tagName: "li",
|
tagName: "li",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import DiscourseResolver from 'discourse/ember/resolver';
|
import { buildResolver } from 'discourse-common/resolver';
|
||||||
|
|
||||||
let originalTemplates;
|
let originalTemplates;
|
||||||
let resolver;
|
let resolver;
|
||||||
@ -15,6 +15,8 @@ function setTemplates(lookupTemplateStrings) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DiscourseResolver = buildResolver('discourse');
|
||||||
|
|
||||||
module("lib:resolver", {
|
module("lib:resolver", {
|
||||||
setup: function() {
|
setup: function() {
|
||||||
originalTemplates = Ember.TEMPLATES;
|
originalTemplates = Ember.TEMPLATES;
|
||||||
|
@ -2,10 +2,10 @@ import Store from "discourse/models/store";
|
|||||||
import RestAdapter from 'discourse/adapters/rest';
|
import RestAdapter from 'discourse/adapters/rest';
|
||||||
import KeyValueStore from 'discourse/lib/key-value-store';
|
import KeyValueStore from 'discourse/lib/key-value-store';
|
||||||
import TopicTrackingState from 'discourse/models/topic-tracking-state';
|
import TopicTrackingState from 'discourse/models/topic-tracking-state';
|
||||||
import Resolver from 'discourse/ember/resolver';
|
import { buildResolver } from 'discourse-common/resolver';
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
const resolver = Resolver.create();
|
const resolver = buildResolver('discourse').create();
|
||||||
return Store.create({
|
return Store.create({
|
||||||
container: {
|
container: {
|
||||||
lookup(type) {
|
lookup(type) {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
var resolver = require('discourse/ember/resolver').default;
|
var buildResolver = require('discourse-common/resolver').buildResolver;
|
||||||
window.setResolver(resolver.create({ namespace: Discourse }));
|
window.setResolver(buildResolver('discourse').create({ namespace: Discourse }));
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
//= require helpers/qunit-helpers
|
//= require helpers/qunit-helpers
|
||||||
//= require helpers/assertions
|
//= require helpers/assertions
|
||||||
|
|
||||||
//= require helpers/init-ember-qunit
|
|
||||||
//= require_tree ./fixtures
|
//= require_tree ./fixtures
|
||||||
//= require_tree ./lib
|
//= require_tree ./lib
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user