mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
Revert Ember 2.10+ for a short while
This commit is contained in:
parent
f01f95d62d
commit
21682fd60b
3
Gemfile
3
Gemfile
|
@ -48,8 +48,7 @@ gem 'onebox'
|
|||
gem 'http_accept_language', '~>2.0.5', require: false
|
||||
|
||||
gem 'ember-rails', '0.18.5'
|
||||
gem 'ember-source', '2.10.0'
|
||||
gem 'ember-handlebars-template', '0.7.5'
|
||||
gem 'ember-source', '2.4.6'
|
||||
gem 'barber'
|
||||
gem 'babel-transpiler'
|
||||
|
||||
|
|
13
Gemfile.lock
13
Gemfile.lock
|
@ -52,7 +52,7 @@ GEM
|
|||
babel-transpiler (0.7.0)
|
||||
babel-source (>= 4.0, < 6)
|
||||
execjs (~> 2.0)
|
||||
barber (0.11.2)
|
||||
barber (0.11.1)
|
||||
ember-source (>= 1.0, < 3)
|
||||
execjs (>= 1.2, < 3)
|
||||
better_errors (2.1.1)
|
||||
|
@ -82,7 +82,7 @@ GEM
|
|||
email_reply_trimmer (0.1.6)
|
||||
ember-data-source (2.2.1)
|
||||
ember-source (>= 1.8, < 3.0)
|
||||
ember-handlebars-template (0.7.5)
|
||||
ember-handlebars-template (0.7.4)
|
||||
barber (>= 0.11.0)
|
||||
sprockets (>= 3.3, < 4)
|
||||
ember-rails (0.18.5)
|
||||
|
@ -92,7 +92,7 @@ GEM
|
|||
ember-source (>= 1.1.0)
|
||||
jquery-rails (>= 1.0.17)
|
||||
railties (>= 3.1)
|
||||
ember-source (2.10.0)
|
||||
ember-source (2.4.6)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.2.0.1)
|
||||
excon (0.53.0)
|
||||
|
@ -231,7 +231,7 @@ GEM
|
|||
pry (>= 0.9.10)
|
||||
puma (3.6.0)
|
||||
r2 (0.2.6)
|
||||
rack (1.6.5)
|
||||
rack (1.6.4)
|
||||
rack-mini-profiler (0.10.1)
|
||||
rack (>= 1.2.0)
|
||||
rack-openid (1.3.1)
|
||||
|
@ -355,7 +355,7 @@ GEM
|
|||
spork-rails (4.0.0)
|
||||
rails (>= 3.0.0, < 5)
|
||||
spork (>= 1.0rc0)
|
||||
sprockets (3.7.0)
|
||||
sprockets (3.6.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.1.1)
|
||||
|
@ -401,9 +401,8 @@ DEPENDENCIES
|
|||
discourse-qunit-rails
|
||||
discourse_fastimage (= 2.0.3)
|
||||
email_reply_trimmer (= 0.1.6)
|
||||
ember-handlebars-template (= 0.7.5)
|
||||
ember-rails (= 0.18.5)
|
||||
ember-source (= 2.10.0)
|
||||
ember-source (= 2.4.6)
|
||||
excon
|
||||
execjs
|
||||
fabrication (= 2.9.8)
|
||||
|
|
|
@ -36,7 +36,6 @@ export default Ember.Component.extend({
|
|||
|
||||
loadScript("/javascripts/ace/ace.js", { scriptTag: true }).then(() => {
|
||||
window.ace.require(['ace/ace'], loadedAce => {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) { return; }
|
||||
const editor = loadedAce.edit(this.$('.ace')[0]);
|
||||
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
|
|
|
@ -68,7 +68,7 @@ export default Ember.Controller.extend(BufferedContent, {
|
|||
this.get('model').save(data).then(() => {
|
||||
if (newBadge) {
|
||||
const adminBadges = this.get('adminBadges.model');
|
||||
if (!adminBadges.includes(model)) {
|
||||
if (!adminBadges.contains(model)) {
|
||||
adminBadges.pushObject(model);
|
||||
}
|
||||
this.transitionToRoute('adminBadges.show', model.get('id'));
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
{{nav-item route='admin.backups' label='admin.backups.title'}}
|
||||
{{/if}}
|
||||
{{nav-item route='adminPlugins' label='admin.plugins.title'}}
|
||||
{{plugin-outlet name="admin-menu" connectorTagName="li"}}
|
||||
{{plugin-outlet "admin-menu" tagName="li"}}
|
||||
</ul>
|
||||
|
||||
<div class='boxed white admin-content'>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{plugin-outlet name="admin-dashboard-top"}}
|
||||
{{plugin-outlet "admin-dashboard-top"}}
|
||||
|
||||
{{#conditional-loading-spinner condition=loading}}
|
||||
<div class="dashboard-left">
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
{{#if siteSettings.email_in}}
|
||||
<label for="incoming_email">{{i18n 'admin.groups.incoming_email'}}</label>
|
||||
{{text-field name="incoming_email" value=model.incoming_email placeholderKey="admin.groups.incoming_email_placeholder"}}
|
||||
{{plugin-outlet name="group-email-in" args=(hash model=model)}}
|
||||
{{plugin-outlet "group-email-in"}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="dashboard-stats version-check {{if versionCheck.critical_updates 'critical' 'normal'}}">
|
||||
<table class="table table-condensed table-hover">
|
||||
<thead>
|
||||
{{custom-html name="upgrade-header"}}
|
||||
{{custom-html 'upgrade-header'}}
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>{{i18n 'admin.dashboard.installed_version'}}</th>
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
//= require_tree ./discourse/models
|
||||
//= require_tree ./discourse/components
|
||||
//= require_tree ./discourse/raw-views
|
||||
//= require_tree ./discourse/views
|
||||
//= require_tree ./discourse/helpers
|
||||
//= require_tree ./discourse/templates
|
||||
//= require_tree ./discourse/routes
|
||||
|
|
|
@ -10,23 +10,19 @@ export function setResolverOption(name, value) {
|
|||
_options[name] = value;
|
||||
}
|
||||
|
||||
export function getResolverOption(name) {
|
||||
return _options[name];
|
||||
}
|
||||
|
||||
function parseName(fullName) {
|
||||
const nameParts = fullName.split(":");
|
||||
const type = nameParts[0];
|
||||
let fullNameWithoutType = nameParts[1];
|
||||
const namespace = get(this, 'namespace');
|
||||
const root = namespace;
|
||||
const nameParts = fullName.split(":"),
|
||||
type = nameParts[0], fullNameWithoutType = nameParts[1],
|
||||
name = fullNameWithoutType,
|
||||
namespace = get(this, 'namespace'),
|
||||
root = namespace;
|
||||
|
||||
return {
|
||||
fullName,
|
||||
type,
|
||||
fullNameWithoutType,
|
||||
name: fullNameWithoutType,
|
||||
root,
|
||||
fullName: fullName,
|
||||
type: type,
|
||||
fullNameWithoutType: fullNameWithoutType,
|
||||
name: name,
|
||||
root: root,
|
||||
resolveMethodName: "resolve" + classify(type)
|
||||
};
|
||||
}
|
||||
|
@ -129,21 +125,12 @@ export function buildResolver(baseName) {
|
|||
}
|
||||
},
|
||||
|
||||
findConnectorTemplate(parsedName) {
|
||||
const full = parsedName.fullNameWithoutType.replace('components/', '');
|
||||
if (full.indexOf('connectors') === 0) {
|
||||
return Ember.TEMPLATES[`javascripts/${full}`];
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
resolveTemplate(parsedName) {
|
||||
return this.findPluginMobileTemplate(parsedName) ||
|
||||
this.findPluginTemplate(parsedName) ||
|
||||
this.findMobileTemplate(parsedName) ||
|
||||
this.findTemplate(parsedName) ||
|
||||
this.findLoadingTemplate(parsedName) ||
|
||||
this.findConnectorTemplate(parsedName) ||
|
||||
Ember.TEMPLATES.not_found;
|
||||
},
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const _pluginCallbacks = [];
|
|||
const Discourse = Ember.Application.extend({
|
||||
rootElement: '#main',
|
||||
_docTitle: document.title,
|
||||
RAW_TEMPLATES: {},
|
||||
__TAGS_INCLUDED__: true,
|
||||
|
||||
getURL(url) {
|
||||
if (!url) return url;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { on, observes, default as computed } from 'ember-addons/ember-computed-decorators';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
@computed('placeholderKey')
|
||||
|
@ -18,6 +18,7 @@ export default Ember.Component.extend({
|
|||
var self = this;
|
||||
var selectedBadges;
|
||||
|
||||
var template = getOwner(this).lookup('template:badge-selector-autocomplete.raw');
|
||||
self.$('input').autocomplete({
|
||||
allowAny: false,
|
||||
items: _.isArray(this.get('badgeNames')) ? this.get('badgeNames') : [this.get('badgeNames')],
|
||||
|
@ -42,7 +43,7 @@ export default Ember.Component.extend({
|
|||
});
|
||||
});
|
||||
},
|
||||
template: findRawTemplate('badge-selector-autocomplete')
|
||||
template: template
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { categoryBadgeHTML } from 'discourse/helpers/category-link';
|
||||
import Category from 'discourse/models/category';
|
||||
import { on, observes } from 'ember-addons/ember-computed-decorators';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
@observes('categories')
|
||||
|
@ -13,6 +13,7 @@ export default Ember.Component.extend({
|
|||
@on('didInsertElement')
|
||||
_initializeAutocomplete(opts) {
|
||||
const self = this,
|
||||
template = getOwner(this).lookup('template:category-selector-autocomplete.raw'),
|
||||
regexp = new RegExp(`href=['\"]${Discourse.getURL('/c/')}([^'\"]+)`);
|
||||
|
||||
this.$('input').autocomplete({
|
||||
|
@ -40,7 +41,7 @@ export default Ember.Component.extend({
|
|||
self.set('categories', categories);
|
||||
});
|
||||
},
|
||||
template: findRawTemplate('category-selector-autocomplete'),
|
||||
template,
|
||||
transformComplete(category) {
|
||||
return categoryBadgeHTML(category, {allowUncategorized: true});
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { linkSeenTagHashtags, fetchUnseenTagHashtags } from 'discourse/lib/link-
|
|||
import { load } from 'pretty-text/oneboxer';
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
import InputValidation from 'discourse/models/input-validation';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
import { tinyAvatar,
|
||||
displayErrorForUpload,
|
||||
getUploadMarkdown,
|
||||
|
@ -62,9 +62,10 @@ export default Ember.Component.extend({
|
|||
@on('didInsertElement')
|
||||
_composerEditorInit() {
|
||||
const topicId = this.get('topic.id');
|
||||
const template = getOwner(this).lookup('template:user-selector-autocomplete.raw');
|
||||
const $input = this.$('.d-editor-input');
|
||||
$input.autocomplete({
|
||||
template: findRawTemplate('user-selector-autocomplete'),
|
||||
template,
|
||||
dataSource: term => userSearch({ term, topicId, includeGroups: true }),
|
||||
key: "@",
|
||||
transformComplete: v => v.username || v.name
|
||||
|
|
|
@ -51,8 +51,6 @@ export default Ember.Component.extend({
|
|||
},
|
||||
|
||||
_checkForUrl() {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) { return; }
|
||||
|
||||
if (this.get('isAbsoluteUrl') && (this.get('composer.reply')||"").length === 0) {
|
||||
// Try to onebox. If success, update post body and title.
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
import { getCustomHTML } from 'discourse/helpers/custom-html';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
init() {
|
||||
this._super();
|
||||
const name = this.get('name');
|
||||
const html = getCustomHTML(name);
|
||||
|
||||
if (html) {
|
||||
this.set('html', html);
|
||||
this.set('layoutName', 'components/custom-html-container');
|
||||
} else {
|
||||
const template = getOwner(this).lookup(`template:${name}`);
|
||||
if (template) {
|
||||
this.set('layoutName', name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
|
@ -11,7 +11,6 @@ import { translations } from 'pretty-text/emoji/data';
|
|||
import { emojiSearch } from 'pretty-text/emoji';
|
||||
import { emojiUrlFor } from 'discourse/lib/text';
|
||||
import { getRegister } from 'discourse-common/lib/get-owner';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
import deprecated from 'discourse-common/lib/deprecated';
|
||||
|
||||
// Our head can be a static string or a function that returns a string
|
||||
|
@ -298,10 +297,11 @@ export default Ember.Component.extend({
|
|||
},
|
||||
|
||||
_applyCategoryHashtagAutocomplete() {
|
||||
const template = this.register.lookup('template:category-tag-autocomplete.raw');
|
||||
const siteSettings = this.siteSettings;
|
||||
|
||||
this.$('.d-editor-input').autocomplete({
|
||||
template: findRawTemplate('category-tag-autocomplete'),
|
||||
template: template,
|
||||
key: '#',
|
||||
transformComplete(obj) {
|
||||
if (obj.model) {
|
||||
|
@ -323,10 +323,11 @@ export default Ember.Component.extend({
|
|||
if (!this.siteSettings.enable_emoji) { return; }
|
||||
|
||||
const register = this.register;
|
||||
const template = this.register.lookup('template:emoji-selector-autocomplete.raw');
|
||||
const self = this;
|
||||
|
||||
$editorInput.autocomplete({
|
||||
template: findRawTemplate('emoji-selector-autocomplete'),
|
||||
template: template,
|
||||
key: ":",
|
||||
afterComplete(text) {
|
||||
self.set('value', text);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { on, observes, default as computed } from 'ember-addons/ember-computed-decorators';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
@computed('placeholderKey')
|
||||
|
@ -19,6 +19,7 @@ export default Ember.Component.extend({
|
|||
var selectedGroups;
|
||||
var groupNames = this.get('groupNames');
|
||||
|
||||
var template = getOwner(this).lookup('template:group-selector-autocomplete.raw');
|
||||
self.$('input').autocomplete({
|
||||
allowAny: false,
|
||||
items: _.isArray(groupNames) ? groupNames : (Ember.isEmpty(groupNames)) ? [] : [groupNames],
|
||||
|
@ -43,7 +44,7 @@ export default Ember.Component.extend({
|
|||
});
|
||||
});
|
||||
},
|
||||
template: findRawTemplate('group-selector-autocomplete')
|
||||
template: template
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -23,6 +23,8 @@ export default Ember.Component.extend({
|
|||
this._super();
|
||||
const name = this.get('widget');
|
||||
|
||||
(this.get('delegated') || []).forEach(m => this.set(m, m));
|
||||
|
||||
this.register = getRegister(this);
|
||||
|
||||
this._widgetClass = queryRegistry(name) || this.register.lookupFactory(`widget:${name}`);
|
||||
|
@ -31,6 +33,7 @@ export default Ember.Component.extend({
|
|||
console.error(`Error: Could not find widget: ${name}`);
|
||||
}
|
||||
|
||||
|
||||
this._childEvents = [];
|
||||
this._connected = [];
|
||||
this._dispatched = [];
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
export default Ember.Component.extend({
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
|
||||
const connector = this.get('connector');
|
||||
this.set('layoutName', connector.templateName);
|
||||
|
||||
const args = this.get('args') || {};
|
||||
Object.keys(args).forEach(key => this.set(key, args[key]));
|
||||
|
||||
const connectorClass = this.get('connector.connectorClass');
|
||||
connectorClass.setupComponent.call(this, args, this);
|
||||
},
|
||||
|
||||
send(name, ...args) {
|
||||
const connectorClass = this.get('connector.connectorClass');
|
||||
const action = connectorClass.actions[name];
|
||||
return action ? action.call(this, ...args) : this._super(name, ...args);
|
||||
}
|
||||
|
||||
});
|
|
@ -1,51 +0,0 @@
|
|||
/**
|
||||
A plugin outlet is an extension point for templates where other templates can
|
||||
be inserted by plugins.
|
||||
|
||||
## Usage
|
||||
|
||||
If your handlebars template has:
|
||||
|
||||
```handlebars
|
||||
{{plugin-outlet name="evil-trout"}}
|
||||
```
|
||||
|
||||
Then any handlebars files you create in the `connectors/evil-trout` directory
|
||||
will automatically be appended. For example:
|
||||
|
||||
plugins/hello/assets/javascripts/discourse/templates/connectors/evil-trout/hello.hbs
|
||||
|
||||
With the contents:
|
||||
|
||||
```handlebars
|
||||
<b>Hello World</b>
|
||||
```
|
||||
|
||||
Will insert <b>Hello World</b> at that point in the template.
|
||||
|
||||
## Disabling
|
||||
|
||||
If a plugin returns a disabled status, the outlets will not be wired up for it.
|
||||
The list of disabled plugins is returned via the `Site` singleton.
|
||||
|
||||
**/
|
||||
import { connectorsFor } from 'discourse/lib/plugin-connectors';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'span',
|
||||
connectors: null,
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
const name = this.get('name');
|
||||
|
||||
if (name) {
|
||||
const args = this.get('args');
|
||||
const connectors = connectorsFor(name).filter(con => {
|
||||
return con.connectorClass.shouldRender(args, this);
|
||||
});
|
||||
|
||||
this.set('connectors', connectors);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -48,15 +48,12 @@ export default Em.Component.extend({
|
|||
|
||||
init() {
|
||||
this._super();
|
||||
Ember.run.scheduleOnce('afterRender', () => {
|
||||
this._init();
|
||||
this._update();
|
||||
});
|
||||
this._init();
|
||||
this._update();
|
||||
},
|
||||
|
||||
@observes('searchTerm')
|
||||
_updateOptions() {
|
||||
this._update();
|
||||
Ember.run.debounce(this, this._update, 250);
|
||||
},
|
||||
|
||||
|
|
|
@ -8,17 +8,10 @@ export default Ember.TextField.extend({
|
|||
classNameBindings: [':tag-chooser'],
|
||||
attributeBindings: ['tabIndex', 'placeholderKey', 'categoryId'],
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
_initValue: function() {
|
||||
const tags = this.get('tags') || [];
|
||||
this.set('value', tags.join(", "));
|
||||
|
||||
if (this.get('allowCreate') !== false) {
|
||||
this.set('allowCreate', this.site.get('can_create_tag'));
|
||||
}
|
||||
|
||||
this.set('termMatchesForbidden', false);
|
||||
},
|
||||
}.on('init'),
|
||||
|
||||
_valueChanged: function() {
|
||||
const tags = this.get('value').split(',').map(v => v.trim()).reject(v => v.length === 0).uniq();
|
||||
|
@ -39,13 +32,18 @@ export default Ember.TextField.extend({
|
|||
}
|
||||
}.observes('tags'),
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
_initializeTags: function() {
|
||||
const site = this.site,
|
||||
self = this,
|
||||
filterRegexp = new RegExp(this.site.tags_filter_regexp, "g");
|
||||
|
||||
const self = this;
|
||||
const filterRegexp = new RegExp(this.site.tags_filter_regexp, "g");
|
||||
var limit = this.siteSettings.max_tags_per_topic;
|
||||
|
||||
let limit = this.siteSettings.max_tags_per_topic;
|
||||
if (this.get('allowCreate') !== false) {
|
||||
this.set('allowCreate', site.get('can_create_tag'));
|
||||
}
|
||||
|
||||
this.set('termMatchesForbidden', false);
|
||||
|
||||
if (this.get('unlimitedTagCount')) {
|
||||
limit = null;
|
||||
|
@ -79,7 +77,7 @@ export default Ember.TextField.extend({
|
|||
|
||||
callback(data);
|
||||
},
|
||||
createSearchChoice(term, data) {
|
||||
createSearchChoice: function(term, data) {
|
||||
term = term.replace(filterRegexp, '').trim().toLowerCase();
|
||||
|
||||
// No empty terms, make sure the user has permission to create the tag
|
||||
|
@ -91,14 +89,14 @@ export default Ember.TextField.extend({
|
|||
return { id: term, text: term };
|
||||
}
|
||||
},
|
||||
createSearchChoicePosition(list, item) {
|
||||
createSearchChoicePosition: function(list, item) {
|
||||
// Search term goes on the bottom
|
||||
list.push(item);
|
||||
},
|
||||
formatSelection(data) {
|
||||
formatSelection: function (data) {
|
||||
return data ? renderTag(this.text(data)) : undefined;
|
||||
},
|
||||
formatSelectionCssClass() {
|
||||
formatSelectionCssClass: function(){
|
||||
return "discourse-tag-select2";
|
||||
},
|
||||
formatResult: formatTag,
|
||||
|
@ -129,11 +127,10 @@ export default Ember.TextField.extend({
|
|||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
}.on('didInsertElement'),
|
||||
|
||||
willDestroyElement() {
|
||||
this._super();
|
||||
_destroyTags: function() {
|
||||
this.$().select2('destroy');
|
||||
}
|
||||
}.on('willDestroyElement')
|
||||
|
||||
});
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import DelegatedActions from 'discourse/mixins/delegated-actions';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Ember.Component.extend(DelegatedActions, {
|
||||
elementId: 'topic-footer-buttons',
|
||||
|
||||
// Allow us to extend it
|
||||
layoutName: 'components/topic-footer-buttons',
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
this.delegateAll(this.get('topicDelegated'));
|
||||
},
|
||||
|
||||
@computed('topic.details.can_invite_to')
|
||||
canInviteTo(result) {
|
||||
return !this.site.mobileView && result;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import { bufferedRender } from 'discourse-common/lib/buffered-render';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export function showEntrance(e) {
|
||||
let target = $(e.target);
|
||||
|
@ -32,7 +32,7 @@ export default Ember.Component.extend(bufferedRender({
|
|||
},
|
||||
|
||||
buildBuffer(buffer) {
|
||||
const template = findRawTemplate('list/topic-list-item');
|
||||
const template = getOwner(this).lookup('template:list/topic-list-item.raw');
|
||||
if (template) {
|
||||
buffer.push(template(this));
|
||||
}
|
||||
|
|
|
@ -3,11 +3,17 @@ import { default as computed, observes } from 'ember-addons/ember-computed-decor
|
|||
export default Ember.Component.extend({
|
||||
elementId: 'topic-progress-wrapper',
|
||||
classNameBindings: ['docked'],
|
||||
expanded: false,
|
||||
docked: false,
|
||||
progressPosition: null,
|
||||
postStream: Ember.computed.alias('topic.postStream'),
|
||||
_streamPercentage: null,
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
(this.get('delegated') || []).forEach(m => this.set(m, m));
|
||||
},
|
||||
|
||||
@computed('progressPosition')
|
||||
jumpTopDisabled(progressPosition) {
|
||||
return progressPosition <= 3;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { observes } from 'ember-addons/ember-computed-decorators';
|
||||
import TextField from 'discourse/components/text-field';
|
||||
import userSearch from 'discourse/lib/user-search';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export default TextField.extend({
|
||||
@observes('usernames')
|
||||
|
@ -31,7 +31,7 @@ export default TextField.extend({
|
|||
}
|
||||
|
||||
this.$().val(this.get('usernames')).autocomplete({
|
||||
template: findRawTemplate('user-selector-autocomplete'),
|
||||
template: getOwner(this).lookup('template:user-selector-autocomplete.raw'),
|
||||
disabled: this.get('disabled'),
|
||||
single: this.get('single'),
|
||||
allowAny: this.get('allowAny'),
|
||||
|
|
|
@ -15,10 +15,4 @@ export default Ember.Controller.extend({
|
|||
loginRequired() {
|
||||
return Discourse.SiteSettings.login_required && !Discourse.User.current();
|
||||
},
|
||||
|
||||
actions: {
|
||||
appRouteAction(name) {
|
||||
return this.send(name);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -114,7 +114,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
|
||||
email = this.get("accountEmail");
|
||||
|
||||
if (this.get('rejectedEmails').includes(email)) {
|
||||
if (this.get('rejectedEmails').contains(email)) {
|
||||
return InputValidation.create({
|
||||
failed: true,
|
||||
reason: I18n.t('user.email.invalid')
|
||||
|
@ -314,7 +314,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
});
|
||||
}
|
||||
|
||||
if (this.get('rejectedPasswords').includes(password)) {
|
||||
if (this.get('rejectedPasswords').contains(password)) {
|
||||
return InputValidation.create({
|
||||
failed: true,
|
||||
reason: I18n.t('user.password.common')
|
||||
|
|
|
@ -16,7 +16,7 @@ if (customNavItemHref) {
|
|||
if (navItem.get('tagId')) {
|
||||
var name = navItem.get('name');
|
||||
|
||||
if ( !Discourse.Site.currentProp('filters').includes(name) ) {
|
||||
if ( !Discourse.Site.currentProp('filters').contains(name) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,30 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
filter: null,
|
||||
quoteState: null,
|
||||
|
||||
topicDelegated: [
|
||||
'toggleMultiSelect',
|
||||
'deleteTopic',
|
||||
'recoverTopic',
|
||||
'toggleClosed',
|
||||
'showAutoClose',
|
||||
'showFeatureTopic',
|
||||
'showChangeTimestamp',
|
||||
'toggleArchived',
|
||||
'toggleVisibility',
|
||||
'convertToPublicTopic',
|
||||
'convertToPrivateMessage',
|
||||
'jumpTop',
|
||||
'jumpToPost',
|
||||
'jumpToPostPrompt',
|
||||
'jumpToIndex',
|
||||
'jumpBottom',
|
||||
'replyToPost',
|
||||
'toggleArchiveMessage',
|
||||
'showInvite',
|
||||
'toggleBookmark',
|
||||
'showFlagTopic'
|
||||
],
|
||||
|
||||
updateQueryParams() {
|
||||
const postStream = this.get('model.postStream');
|
||||
this.setProperties(postStream.get('streamFilters'));
|
||||
|
@ -151,22 +175,6 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
|
||||
actions: {
|
||||
|
||||
showPostFlags(post) {
|
||||
return this.send('showFlags', post);
|
||||
},
|
||||
|
||||
topicRouteAction(name, model) {
|
||||
return this.send(name, model);
|
||||
},
|
||||
|
||||
openAutoClose() {
|
||||
this.send('showAutoClose');
|
||||
},
|
||||
|
||||
openFeatureTopic() {
|
||||
this.send('showFeatureTopic');
|
||||
},
|
||||
|
||||
deselectText() {
|
||||
this.get('quoteState').setProperties({ buffer: null, postId: null });
|
||||
},
|
||||
|
@ -810,7 +818,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
|
||||
postSelected(post) {
|
||||
if (this.get('allPostsSelected')) { return true; }
|
||||
if (this.get('selectedPosts').includes(post)) { return true; }
|
||||
if (this.get('selectedPosts').contains(post)) { return true; }
|
||||
if (this.get('selectedReplies').findBy('post_number', post.get('reply_to_post_number'))) { return true; }
|
||||
|
||||
return false;
|
||||
|
|
|
@ -2,9 +2,6 @@ import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
|||
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||
|
||||
registerUnbound('category-badge', function(cat, options) {
|
||||
return categoryLinkHTML(cat, {
|
||||
hideParent: options.hideParent,
|
||||
allowUncategorized: options.allowUncategorized,
|
||||
link: false
|
||||
});
|
||||
options.link = false;
|
||||
return categoryLinkHTML(cat, options);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const { registerKeyword } = Ember.__loader.require("ember-htmlbars/keywords");
|
||||
const { internal } = Ember.__loader.require('htmlbars-runtime');
|
||||
import PreloadStore from 'preload-store';
|
||||
|
||||
let _customizations = {};
|
||||
|
@ -22,3 +24,36 @@ export function clearHTMLCache() {
|
|||
export function setCustomHTML(key, html) {
|
||||
_customizations[key] = html;
|
||||
}
|
||||
|
||||
registerKeyword('custom-html', {
|
||||
setupState(state, env, scope, params) {
|
||||
return { htmlKey: env.hooks.getValue(params[0]) };
|
||||
},
|
||||
|
||||
render(renderNode, env, scope, params, hash, template, inverse, visitor) {
|
||||
let state = renderNode.getState();
|
||||
if (!state.htmlKey) { return true; }
|
||||
|
||||
const html = getCustomHTML(state.htmlKey);
|
||||
if (html) {
|
||||
const htmlHash = { html };
|
||||
env.hooks.component(renderNode,
|
||||
env,
|
||||
scope,
|
||||
'custom-html-container',
|
||||
params,
|
||||
htmlHash,
|
||||
{ default: template, inverse },
|
||||
visitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
template = env.owner.lookup(`template:${state.htmlKey}`);
|
||||
if (template) {
|
||||
internal.hostBlock(renderNode, env, scope, template.raw, null, null, visitor, function(options) {
|
||||
options.templates.template.yield();
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
138
app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6
Normal file
138
app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6
Normal file
|
@ -0,0 +1,138 @@
|
|||
/**
|
||||
A plugin outlet is an extension point for templates where other templates can
|
||||
be inserted by plugins.
|
||||
|
||||
## Usage
|
||||
|
||||
If your handlebars template has:
|
||||
|
||||
```handlebars
|
||||
{{plugin-outlet "evil-trout"}}
|
||||
```
|
||||
|
||||
Then any handlebars files you create in the `connectors/evil-trout` directory
|
||||
will automatically be appended. For example:
|
||||
|
||||
plugins/hello/assets/javascripts/discourse/templates/connectors/evil-trout/hello.hbs
|
||||
|
||||
With the contents:
|
||||
|
||||
```handlebars
|
||||
<b>Hello World</b>
|
||||
```
|
||||
|
||||
Will insert <b>Hello World</b> at that point in the template.
|
||||
|
||||
## Disabling
|
||||
|
||||
If a plugin returns a disabled status, the outlets will not be wired up for it.
|
||||
The list of disabled plugins is returned via the `Site` singleton.
|
||||
|
||||
**/
|
||||
let _connectorCache, _templateCache;
|
||||
|
||||
function findOutlets(collection, callback) {
|
||||
const disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || [];
|
||||
|
||||
Object.keys(collection).forEach(function(res) {
|
||||
if (res.indexOf("/connectors/") !== -1) {
|
||||
// Skip any disabled plugins
|
||||
for (let i=0; i<disabledPlugins.length; i++) {
|
||||
if (res.indexOf("/" + disabledPlugins[i] + "/") !== -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const segments = res.split("/");
|
||||
let outletName = segments[segments.length-2];
|
||||
const uniqueName = segments[segments.length-1];
|
||||
|
||||
callback(outletName, res, uniqueName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function clearCache() {
|
||||
_templateCache = null;
|
||||
_connectorCache = null;
|
||||
}
|
||||
|
||||
function buildConnectorCache() {
|
||||
_connectorCache = {};
|
||||
_templateCache = [];
|
||||
|
||||
findOutlets(Ember.TEMPLATES, function(outletName, resource, uniqueName) {
|
||||
_connectorCache[outletName] = _connectorCache[outletName] || [];
|
||||
|
||||
_connectorCache[outletName].push({
|
||||
templateName: resource.replace('javascripts/', ''),
|
||||
template: Ember.TEMPLATES[resource],
|
||||
classNames: `${outletName}-outlet ${uniqueName}`
|
||||
});
|
||||
});
|
||||
|
||||
Object.keys(_connectorCache).forEach(outletName => {
|
||||
const connector = _connectorCache[outletName];
|
||||
(connector || []).forEach(s => {
|
||||
_templateCache.push(s.template);
|
||||
s.templateId = parseInt(_templateCache.length - 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// unbound version of outlets, only has a template
|
||||
Handlebars.registerHelper('plugin-outlet', function(name) {
|
||||
if (!_connectorCache) { buildConnectorCache(); }
|
||||
|
||||
const connector = _connectorCache[name];
|
||||
if (connector && connector.length) {
|
||||
const output = connector.map(c => c.template({context: this}));
|
||||
return new Handlebars.SafeString(output.join(""));
|
||||
}
|
||||
});
|
||||
|
||||
const { registerKeyword } = Ember.__loader.require("ember-htmlbars/keywords");
|
||||
const { internal } = Ember.__loader.require('htmlbars-runtime');
|
||||
|
||||
registerKeyword('plugin-outlet', {
|
||||
setupState(state, env, scope, params) {
|
||||
if (!_connectorCache) { buildConnectorCache(); }
|
||||
return { outletName: env.hooks.getValue(params[0]) };
|
||||
},
|
||||
|
||||
render(renderNode, env, scope, params, hash, template, inverse, visitor) {
|
||||
let state = renderNode.getState();
|
||||
if (!state.outletName) { return true; }
|
||||
const connector = _connectorCache[state.outletName];
|
||||
if (!connector || connector.length === 0) { return true; }
|
||||
|
||||
const listTemplate = Ember.TEMPLATES['outlet-list'];
|
||||
listTemplate.raw.locals = ['templateId', 'outletClasses', 'tagName'];
|
||||
|
||||
internal.hostBlock(renderNode, env, scope, listTemplate.raw, null, null, visitor, function(options) {
|
||||
connector.forEach(source => {
|
||||
const tid = source.templateId;
|
||||
options.templates.template.yieldItem(`d-outlet-${tid}`, [
|
||||
tid,
|
||||
source.classNames,
|
||||
hash.tagName || 'div'
|
||||
]);
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
registerKeyword('connector', function(morph, env, scope, params, hash, template, inverse, visitor) {
|
||||
template = _templateCache[parseInt(env.hooks.getValue(hash.templateId))];
|
||||
|
||||
env.hooks.component(morph,
|
||||
env,
|
||||
scope,
|
||||
'connector-container',
|
||||
params,
|
||||
hash,
|
||||
{ default: template.raw, inverse },
|
||||
visitor);
|
||||
return true;
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
import { connectorsFor } from 'discourse/lib/plugin-connectors';
|
||||
|
||||
Handlebars.registerHelper('raw-plugin-outlet', function(args) {
|
||||
const connectors = connectorsFor(args.hash.name);
|
||||
if (connectors.length) {
|
||||
const output = connectors.map(c => c.template({context: this}));
|
||||
return new Handlebars.SafeString(output.join(""));
|
||||
}
|
||||
});
|
|
@ -1,10 +1,8 @@
|
|||
import { registerUnbound } from 'discourse-common/lib/helpers';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
|
||||
let _injections;
|
||||
|
||||
function renderRaw(ctx, container, template, templateName, params) {
|
||||
params = jQuery.extend({}, params);
|
||||
params.parent = params.parent || ctx;
|
||||
|
||||
if (!params.view) {
|
||||
|
@ -34,9 +32,9 @@ registerUnbound('raw', function(templateName, params) {
|
|||
templateName = templateName.replace('.', '/');
|
||||
|
||||
const container = Discourse.__container__;
|
||||
const template = findRawTemplate(templateName);
|
||||
var template = container.lookup('template:' + templateName + '.raw');
|
||||
if (!template) {
|
||||
console.warn('Could not find raw template: ' + templateName);
|
||||
Ember.warn('Could not find raw template: ' + templateName);
|
||||
return;
|
||||
}
|
||||
return renderRaw(this, container, template, templateName, params);
|
||||
|
|
|
@ -2,7 +2,6 @@ import groups from 'discourse/lib/emoji/groups';
|
|||
import KeyValueStore from "discourse/lib/key-value-store";
|
||||
import { emojiList } from 'pretty-text/emoji';
|
||||
import { emojiUrlFor } from 'discourse/lib/text';
|
||||
import { findRawTemplate } from 'discourse/lib/raw-templates';
|
||||
|
||||
const keyValueStore = new KeyValueStore("discourse_emojis_");
|
||||
const EMOJI_USAGE = "emojiUsage";
|
||||
|
@ -152,7 +151,7 @@ function render(page, offset, options) {
|
|||
};
|
||||
|
||||
$('.emoji-modal', options.appendTo).remove();
|
||||
const template = findRawTemplate('emoji-toolbar');
|
||||
const template = options.register.lookup('template:emoji-toolbar.raw');
|
||||
options.appendTo.append(template(model));
|
||||
|
||||
bindEvents(page, offset, options);
|
||||
|
|
|
@ -5,16 +5,13 @@ const _loading = {};
|
|||
function loadWithTag(path, cb) {
|
||||
const head = document.getElementsByTagName('head')[0];
|
||||
|
||||
let finished = false;
|
||||
let s = document.createElement('script');
|
||||
s.src = path;
|
||||
if (Ember.Test) {
|
||||
Ember.Test.registerWaiter(() => finished);
|
||||
}
|
||||
if (Ember.Test) { Ember.Test.pendingAjaxRequests++; }
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = s.onreadystatechange = function(_, abort) {
|
||||
finished = true;
|
||||
if (Ember.Test) { Ember.Test.pendingAjaxRequests--; }
|
||||
if (abort || !s.readyState || s.readyState === "loaded" || s.readyState === "complete") {
|
||||
s = s.onload = s.onreadystatechange = null;
|
||||
if (!abort) {
|
||||
|
|
|
@ -11,7 +11,6 @@ import { preventCloak } from 'discourse/widgets/post-stream';
|
|||
import { h } from 'virtual-dom';
|
||||
import { addFlagProperty } from 'discourse/components/site-header';
|
||||
import { addPopupMenuOptionsCallback } from 'discourse/controllers/composer';
|
||||
import { extraConnectorClass } from 'discourse/lib/plugin-connectors';
|
||||
|
||||
class PluginApi {
|
||||
constructor(version, container) {
|
||||
|
@ -331,33 +330,12 @@ class PluginApi {
|
|||
addStorePluralization(thing, plural) {
|
||||
this.container.lookup("store:main").addPluralization(thing, plural);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a Connector class for a particular outlet and connector.
|
||||
*
|
||||
* For example, if the outlet is `user-profile-primary` and your connector
|
||||
* template is called `my-connector.hbs`:
|
||||
*
|
||||
* ```javascript
|
||||
* api.registerConnectorClass('user-profile-primary', 'my-connector', {
|
||||
* shouldRender(args, component) {
|
||||
* return component.siteSettings.my_plugin_enabled;
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* For more information on connector classes, see:
|
||||
* https://meta.discourse.org/t/important-changes-to-plugin-outlets-for-ember-2-10/54136
|
||||
**/
|
||||
registerConnectorClass(outletName, connectorName, klass) {
|
||||
extraConnectorClass(`${outletName}/${connectorName}`, klass);
|
||||
}
|
||||
}
|
||||
|
||||
let _pluginv01;
|
||||
function getPluginApi(version) {
|
||||
version = parseFloat(version);
|
||||
if (version <= 0.6) {
|
||||
if (version <= 0.5) {
|
||||
if (!_pluginv01) {
|
||||
_pluginv01 = new PluginApi(version, Discourse.__container__);
|
||||
}
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
let _connectorCache;
|
||||
let _extraConnectorClasses = {};
|
||||
let _classPaths;
|
||||
|
||||
export function resetExtraClasses() {
|
||||
_extraConnectorClasses = {};
|
||||
_classPaths = undefined;
|
||||
}
|
||||
|
||||
// Note: In plugins, define a class by path and it will be wired up automatically
|
||||
// eg: discourse/connectors/<OUTLET NAME>/<CONNECTOR NAME>.js.es6
|
||||
export function extraConnectorClass(name, obj) {
|
||||
_extraConnectorClasses[name] = obj;
|
||||
}
|
||||
|
||||
const DefaultConnectorClass = {
|
||||
actions: {},
|
||||
shouldRender: () => true,
|
||||
setupComponent() { }
|
||||
};
|
||||
|
||||
function findOutlets(collection, callback) {
|
||||
const disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || [];
|
||||
|
||||
Object.keys(collection).forEach(function(res) {
|
||||
if (res.indexOf("/connectors/") !== -1) {
|
||||
// Skip any disabled plugins
|
||||
for (let i=0; i<disabledPlugins.length; i++) {
|
||||
if (res.indexOf("/" + disabledPlugins[i] + "/") !== -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const segments = res.split("/");
|
||||
let outletName = segments[segments.length-2];
|
||||
const uniqueName = segments[segments.length-1];
|
||||
|
||||
callback(outletName, res, uniqueName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function clearCache() {
|
||||
_connectorCache = null;
|
||||
}
|
||||
|
||||
function findClass(outletName, uniqueName) {
|
||||
if (!_classPaths) {
|
||||
_classPaths = {};
|
||||
findOutlets(require._eak_seen, (outlet, res, un) => {
|
||||
_classPaths[`${outlet}/${un}`] = require(res).default;
|
||||
});
|
||||
}
|
||||
|
||||
const id = `${outletName}/${uniqueName}`;
|
||||
let foundClass = _extraConnectorClasses[id] || _classPaths[id];
|
||||
|
||||
return foundClass ?
|
||||
jQuery.extend({}, DefaultConnectorClass, foundClass) :
|
||||
DefaultConnectorClass;
|
||||
}
|
||||
|
||||
function buildConnectorCache() {
|
||||
_connectorCache = {};
|
||||
|
||||
findOutlets(Ember.TEMPLATES, function(outletName, resource, uniqueName) {
|
||||
_connectorCache[outletName] = _connectorCache[outletName] || [];
|
||||
|
||||
_connectorCache[outletName].push({
|
||||
templateName: resource.replace('javascripts/', ''),
|
||||
template: Ember.TEMPLATES[resource],
|
||||
classNames: `${outletName}-outlet ${uniqueName}`,
|
||||
connectorClass: findClass(outletName, uniqueName)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function connectorsFor(outletName) {
|
||||
if (!_connectorCache) { buildConnectorCache(); }
|
||||
return _connectorCache[outletName] || [];
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
import { getResolverOption } from 'discourse-common/resolver';
|
||||
|
||||
export function findRawTemplate(name) {
|
||||
if (getResolverOption('mobileView')) {
|
||||
return Discourse.RAW_TEMPLATES[`mobile/${name}`] ||
|
||||
Discourse.RAW_TEMPLATES[name];
|
||||
}
|
||||
|
||||
return Discourse.RAW_TEMPLATES[name];
|
||||
}
|
|
@ -11,22 +11,26 @@ export default function(name, opts) {
|
|||
|
||||
const controllerName = opts.admin ? `modals/${name}` : name;
|
||||
|
||||
const viewClass = container.lookupFactory('view:' + name);
|
||||
const controller = container.lookup('controller:' + controllerName);
|
||||
const templateName = opts.templateName || Ember.String.dasherize(name);
|
||||
if (viewClass) {
|
||||
route.render(name, { into: 'modal', outlet: 'modalBody' });
|
||||
} else {
|
||||
const templateName = opts.templateName || Ember.String.dasherize(name);
|
||||
|
||||
const renderArgs = { into: 'modal', outlet: 'modalBody'};
|
||||
if (controller) { renderArgs.controller = controllerName; }
|
||||
const renderArgs = { into: 'modal', outlet: 'modalBody'};
|
||||
if (controller) { renderArgs.controller = controllerName; }
|
||||
|
||||
if (opts.addModalBodyView) {
|
||||
renderArgs.view = 'modal-body';
|
||||
}
|
||||
if (opts.addModalBodyView) {
|
||||
renderArgs.view = 'modal-body';
|
||||
}
|
||||
|
||||
|
||||
const modalName = `modal/${templateName}`;
|
||||
const fullName = opts.admin ? `admin/templates/${modalName}` : modalName;
|
||||
route.render(fullName, renderArgs);
|
||||
if (opts.title) {
|
||||
modalController.set('title', I18n.t(opts.title));
|
||||
const modalName = `modal/${templateName}`;
|
||||
const fullName = opts.admin ? `admin/templates/${modalName}` : modalName;
|
||||
route.render(fullName, renderArgs);
|
||||
if (opts.title) {
|
||||
modalController.set('title', I18n.t(opts.title));
|
||||
}
|
||||
}
|
||||
|
||||
if (controller) {
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
import { defaultHomepage } from 'discourse/lib/utilities';
|
||||
const rootURL = Discourse.BaseUri;
|
||||
|
||||
const BareRouter = Ember.Router.extend({
|
||||
rootURL,
|
||||
location: Ember.testing ? 'none': 'discourse-location',
|
||||
|
||||
handleURL(url) {
|
||||
if (url === "/") { url = defaultHomepage(); }
|
||||
return this._super(url);
|
||||
}
|
||||
location: Ember.testing ? 'none': 'discourse-location'
|
||||
});
|
||||
|
||||
// Ember's router can't be extended. We need to allow plugins to add routes to routes that were defined
|
||||
|
@ -73,8 +67,7 @@ class RouteNode {
|
|||
if (paths.length > 1) {
|
||||
paths.filter(p => p !== this.opts.path).forEach(path => {
|
||||
const newOpts = jQuery.extend({}, this.opts, { path });
|
||||
console.log(`warning: we can't have duplicate route names anymore`, newOpts);
|
||||
// router.route(this.name, newOpts, builder);
|
||||
router.route(this.name, newOpts, builder);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export default Ember.Mixin.create({
|
||||
init() {
|
||||
this._super();
|
||||
(this.get('delegated') || []).forEach(m => this.set(m, m));
|
||||
},
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
export default Ember.Mixin.create({
|
||||
delegateAll(actionNames) {
|
||||
actionNames = actionNames || [];
|
||||
|
||||
this.actions = this.actions || {};
|
||||
|
||||
actionNames.forEach(m => {
|
||||
this.actions[m] = function() { this.sendAction(m); };
|
||||
this.set(m, m);
|
||||
});
|
||||
}
|
||||
});
|
|
@ -86,9 +86,9 @@ NavItem.reopenClass({
|
|||
testName = name.split("/")[0],
|
||||
anonymous = !Discourse.User.current();
|
||||
|
||||
if (anonymous && !Discourse.Site.currentProp('anonymous_top_menu_items').includes(testName)) return null;
|
||||
if (anonymous && !Discourse.Site.currentProp('anonymous_top_menu_items').contains(testName)) return null;
|
||||
if (!Discourse.Category.list() && testName === "categories") return null;
|
||||
if (!Discourse.Site.currentProp('top_menu_items').includes(testName)) return null;
|
||||
if (!Discourse.Site.currentProp('top_menu_items').contains(testName)) return null;
|
||||
|
||||
var args = { name: name, hasIcon: name === "unread" }, extra = null, self = this;
|
||||
if (opts.category) { args.category = opts.category; }
|
||||
|
|
|
@ -168,7 +168,7 @@ export default RestModel.extend({
|
|||
this.set('summary', false);
|
||||
|
||||
let jump = false;
|
||||
if (userFilters.includes(username)) {
|
||||
if (userFilters.contains(username)) {
|
||||
userFilters.removeObject(username);
|
||||
} else {
|
||||
userFilters.addObject(username);
|
||||
|
@ -256,7 +256,7 @@ export default RestModel.extend({
|
|||
return this.findPostsByIds(gap).then(posts => {
|
||||
posts.forEach(p => {
|
||||
const stored = this.storePost(p);
|
||||
if (!currentPosts.includes(stored)) {
|
||||
if (!currentPosts.contains(stored)) {
|
||||
currentPosts.insertAt(postIdx++, stored);
|
||||
}
|
||||
});
|
||||
|
@ -410,7 +410,7 @@ export default RestModel.extend({
|
|||
if (stored) {
|
||||
const posts = this.get('posts');
|
||||
|
||||
if (!posts.includes(stored)) {
|
||||
if (!posts.contains(stored)) {
|
||||
if (!this.get('loadingBelow')) {
|
||||
this.get('postsWithPlaceholders').appendPost(() => posts.pushObject(stored));
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@ function inject() {
|
|||
}
|
||||
|
||||
function injectAll(app, name) {
|
||||
inject(app, name, 'controller', 'component', 'route', 'model', 'adapter');
|
||||
inject(app, name, 'controller', 'component', 'route', 'view', 'model', 'adapter');
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { defaultHomepage } from 'discourse/lib/utilities';
|
||||
|
||||
export default function() {
|
||||
// Error page
|
||||
this.route('exception', { path: '/exception' });
|
||||
|
@ -43,6 +45,9 @@ export default function() {
|
|||
this.route('categoryNone', { path: '/c/:slug/none' });
|
||||
this.route('category', { path: '/c/:parentSlug/:slug' });
|
||||
this.route('categoryWithID', { path: '/c/:parentSlug/:slug/:id' });
|
||||
|
||||
// homepage
|
||||
this.route(defaultHomepage(), { path: '/' });
|
||||
});
|
||||
|
||||
this.route('groups', { resetNamespace: true });
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{{!-- THIS IS AN EMPTY TEMPLATE THAT NEEDS TO BE OVERWRITTEN --}}
|
|
@ -1,17 +1,17 @@
|
|||
{{plugin-outlet name="above-site-header"}}
|
||||
{{plugin-outlet "above-site-header"}}
|
||||
{{site-header canSignUp=canSignUp
|
||||
showCreateAccount=(action "appRouteAction" "showCreateAccount")
|
||||
showLogin=(action "appRouteAction" "showLogin")
|
||||
showKeyboard=(action "appRouteAction" "showKeyboardShortcutsHelp")
|
||||
toggleMobileView=(action "appRouteAction" "toggleMobileView")
|
||||
toggleAnonymous=(action "appRouteAction" "toggleAnonymous")
|
||||
logout=(action "appRouteAction" "logout")}}
|
||||
{{plugin-outlet name="below-site-header"}}
|
||||
showCreateAccount="showCreateAccount"
|
||||
showLogin="showLogin"
|
||||
showKeyboard="showKeyboardShortcutsHelp"
|
||||
toggleMobileView="toggleMobileView"
|
||||
toggleAnonymous="toggleAnonymous"
|
||||
logout="logout"}}
|
||||
{{plugin-outlet "below-site-header"}}
|
||||
|
||||
<div id="main-outlet" class="wrap">
|
||||
<div class="container">
|
||||
{{#if showTop}}
|
||||
{{custom-html name="top"}}
|
||||
{{custom-html "top"}}
|
||||
{{/if}}
|
||||
{{global-notice}}
|
||||
{{create-topics-notice}}
|
||||
|
@ -20,11 +20,11 @@
|
|||
{{outlet "user-card"}}
|
||||
</div>
|
||||
|
||||
{{plugin-outlet name="above-footer"}}
|
||||
{{plugin-outlet "above-footer"}}
|
||||
{{#if showFooter}}
|
||||
{{custom-html name="footer"}}
|
||||
{{custom-html "footer"}}
|
||||
{{/if}}
|
||||
{{plugin-outlet name="below-footer"}}
|
||||
{{plugin-outlet "below-footer"}}
|
||||
|
||||
{{outlet "modal"}}
|
||||
{{topic-entrance}}
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
{{tag-drop firstCategory=firstCategory secondCategory=secondCategory tagId=tagId}}
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="bread-crumbs-right" connectorTagName="li"}}
|
||||
{{plugin-outlet "bread-crumbs-right" tagName="li"}}
|
||||
|
||||
<div class='clear'></div>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
</label>
|
||||
</section>
|
||||
|
||||
{{plugin-outlet name="category-email-in" args=(hash category=category)}}
|
||||
{{plugin-outlet "category-email-in"}}
|
||||
{{/if}}
|
||||
|
||||
{{#if showPositionInput}}
|
||||
|
@ -82,4 +82,4 @@
|
|||
</section>
|
||||
{{/unless}}
|
||||
|
||||
{{plugin-outlet name="category-custom-settings" args=(hash category=category)}}
|
||||
{{plugin-outlet "category-custom-settings"}}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{#each navItems as |navItem|}}
|
||||
{{navigation-item content=navItem filterMode=filterMode}}
|
||||
{{/each}}
|
||||
{{custom-html name="extraNavItem"}}
|
||||
{{plugin-outlet name="extra-nav-item" connectorTagName="li"}}
|
||||
{{custom-html "extraNavItem"}}
|
||||
{{plugin-outlet "extra-nav-item" tagName="li"}}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{{#each connectors as |c|}}
|
||||
{{plugin-connector connector=c args=args class=c.classNames tagName=connectorTagName}}
|
||||
{{/each}}
|
|
@ -6,7 +6,7 @@
|
|||
<a href={{item.postUrl}}>{{{item.title}}}</a>
|
||||
</span>
|
||||
<div class="category">{{category-link item.category}}</div>
|
||||
{{plugin-outlet name="user-stream-item-header" args=(hash item=item)}}
|
||||
{{plugin-outlet "user-stream-item-header"}}
|
||||
</div>
|
||||
|
||||
{{#if actionDescription}}
|
||||
|
|
|
@ -14,4 +14,4 @@
|
|||
{{topic-featured-link topic}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{plugin-outlet name="topic-category" args=(hash topic=topic category=topic.category)}}
|
||||
{{plugin-outlet "topic-category"}}
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
{{#if showAdminButton}}
|
||||
{{topic-admin-menu-button
|
||||
topic=topic
|
||||
openUpwards="true"
|
||||
toggleMultiSelect=toggleMultiSelect
|
||||
deleteTopic=deleteTopic
|
||||
recoverTopic=recoverTopic
|
||||
toggleClosed=toggleClosed
|
||||
toggleArchived=toggleArchived
|
||||
toggleVisibility=toggleVisibility
|
||||
showAutoClose=showAutoClose
|
||||
showFeatureTopic=showFeatureTopic
|
||||
showChangeTimestamp=showChangeTimestamp
|
||||
convertToPublicTopic=convertToPublicTopic
|
||||
convertToPrivateMessage=convertToPrivateMessage}}
|
||||
{{topic-admin-menu-button topic=topic delegated=topicDelegated openUpwards="true"}}
|
||||
{{/if}}
|
||||
|
||||
{{#unless topic.isPrivateMessage}}
|
||||
|
@ -23,7 +10,7 @@
|
|||
title=bookmarkTitle
|
||||
label=bookmarkLabel
|
||||
icon="bookmark"
|
||||
action=toggleBookmark}}
|
||||
action="toggleBookmark"}}
|
||||
|
||||
<button class="btn share" data-share-url={{topic.shareUrl}} title={{i18n "topic.share.help"}}>
|
||||
{{fa-icon "link"}}
|
||||
|
@ -35,7 +22,7 @@
|
|||
title="topic.flag_topic.help"
|
||||
label="topic.flag_topic.title"
|
||||
icon="flag"
|
||||
action=showFlagTopic}}
|
||||
action="showFlagTopic"}}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
|
@ -46,7 +33,7 @@
|
|||
title="topic.invite_reply.help"
|
||||
label="topic.invite_reply.title"
|
||||
icon="users"
|
||||
action=showInvite
|
||||
action="showInvite"
|
||||
disabled=inviteDisabled}}
|
||||
{{/if}}
|
||||
|
||||
|
@ -55,23 +42,19 @@
|
|||
title=archiveTitle
|
||||
label=archiveLabel
|
||||
icon=archiveIcon
|
||||
action=toggleArchiveMessage}}
|
||||
action="toggleArchiveMessage"}}
|
||||
{{/if}}
|
||||
|
||||
{{#if topic.details.can_create_post}}
|
||||
{{d-button class="btn-primary create"
|
||||
icon="reply"
|
||||
action=replyToPost
|
||||
action="replyToPost"
|
||||
label="topic.reply.title"
|
||||
title="topic.reply.help"}}
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="after-topic-footer-main-buttons"
|
||||
args=(hash topic=topic)
|
||||
connectorTagName="span"}}
|
||||
{{plugin-outlet "after-topic-footer-main-buttons" tagName="span"}}
|
||||
|
||||
{{pinned-button topic=topic}}
|
||||
{{topic-notifications-button topic=topic}}
|
||||
{{plugin-outlet name="after-topic-footer-buttons"
|
||||
args=(hash topic=topic)
|
||||
connectorTagName="span"}}
|
||||
{{pinned-button topic=topic topicDelegated=topicDelegated}}
|
||||
{{topic-notifications-button topic=topic topicDelegated=topicDelegated}}
|
||||
{{plugin-outlet "after-topic-footer-buttons" tagName="span"}}
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
<span>/</span>
|
||||
<h4>{{postStream.filteredPostsCount}}</h4></span>
|
||||
</div>
|
||||
<i class="fa {{unless expanded 'fa-sort'}}"></i>
|
||||
</nav>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<h2>{{user.title}}</h2>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="user-card-post-names" args=(hash user=user)}}
|
||||
{{plugin-outlet "user-card-post-names"}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
</span>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="user-card-location-and-website" args=(hash user=user)}}
|
||||
{{plugin-outlet "user-card-location-and-website"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
|||
<h3><span class='desc'>{{i18n 'last_post'}}</span> {{format-date user.last_posted_at leaveAgo="true"}}</h3>
|
||||
{{/if}}
|
||||
<h3><span class='desc'>{{i18n 'joined'}}</span> {{format-date user.created_at leaveAgo="true"}}</h3>
|
||||
{{plugin-outlet name="user-card-metadata" args=(hash user=user)}}
|
||||
{{plugin-outlet "user-card-metadata"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
{{#if model.viewOpen}}
|
||||
<div class='control-row reply-area'>
|
||||
<div class='composer-fields'>
|
||||
{{plugin-outlet name="composer-open" args=(hash model=model)}}
|
||||
{{plugin-outlet "composer-open"}}
|
||||
|
||||
<div class='reply-to'>
|
||||
{{{model.actionTitle}}}
|
||||
|
@ -78,10 +78,11 @@
|
|||
{{#if model.archetype.hasOptions}}
|
||||
<button class='btn' {{action "showOptions"}}>{{i18n 'topic.options'}}</button>
|
||||
{{/if}}
|
||||
{{render "additional-composer-buttons" model}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{plugin-outlet name="composer-fields" args=(hash model=model)}}
|
||||
{{plugin-outlet "composer-fields"}}
|
||||
</div>
|
||||
|
||||
{{composer-editor topic=topic
|
||||
|
@ -103,7 +104,7 @@
|
|||
|
||||
{{#if currentUser}}
|
||||
<div class='submit-panel'>
|
||||
{{plugin-outlet name="composer-fields-below" args=(hash model=model)}}
|
||||
{{plugin-outlet "composer-fields-below"}}
|
||||
{{#if canEditTags}}
|
||||
{{tag-chooser tags=model.tags tabIndex="4" categoryId=model.categoryId}}
|
||||
{{/if}}
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
<div class="row">
|
||||
<div class="full-width">
|
||||
<div id="list-area">
|
||||
{{plugin-outlet name="discovery-list-container-top"}}
|
||||
{{plugin-outlet "discovery-list-container-top"}}
|
||||
{{outlet "list-container"}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{plugin-outlet name="discovery-below"}}
|
||||
{{plugin-outlet "discovery-below"}}
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
{{#each result.topic.tags as |tag|}}
|
||||
{{discourse-tag tag}}
|
||||
{{/each}}
|
||||
{{plugin-outlet name="full-page-search-category" args=(hash result=result)}}
|
||||
{{plugin-outlet "full-page-search-category"}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{#if topic.featured_link}}
|
||||
{{topic-featured-link topic}}
|
||||
{{/if}}
|
||||
{{raw-plugin-outlet name="topic-list-after-title"}}
|
||||
{{plugin-outlet "topic-list-after-title"}}
|
||||
{{#if showTopicPostBadges}}
|
||||
{{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}}
|
||||
{{/if}}
|
||||
|
@ -21,7 +21,7 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{raw-plugin-outlet name="topic-list-tags"}}
|
||||
{{plugin-outlet "topic-list-tags"}}
|
||||
{{#if expandPinned}}
|
||||
{{raw "list/topic-excerpt" topic=topic}}
|
||||
{{/if}}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{raw-plugin-outlet name="topic-list-tags"}}
|
||||
{{plugin-outlet "topic-list-tags"}}
|
||||
|
||||
<div class="pull-right">
|
||||
<div class='num activity last'>
|
||||
|
|
|
@ -52,11 +52,7 @@
|
|||
</tr>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="create-account-before-password"
|
||||
args=(hash accountName=accountName
|
||||
accountUsername=accountUsername
|
||||
accountPassword=accountPassword
|
||||
userFields=userFields)}}
|
||||
{{plugin-outlet "create-account-before-password"}}
|
||||
|
||||
{{#if passwordRequired}}
|
||||
<tr class="input">
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="post-revisions" args=(hash model=model)}}
|
||||
{{plugin-outlet "post-revisions"}}
|
||||
|
||||
{{#links-redirect class="row"}}
|
||||
{{{bodyDiff}}}
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
{{preference-checkbox labelKey="user.enable_quoting" checked=model.user_option.enable_quoting}}
|
||||
{{preference-checkbox labelKey="user.dynamic_favicon" checked=model.user_option.dynamic_favicon}}
|
||||
{{preference-checkbox labelKey="user.disable_jump_reply" checked=model.user_option.disable_jump_reply}}
|
||||
{{plugin-outlet name="user-custom-preferences" args=(hash model=model)}}
|
||||
{{plugin-outlet "user-custom-preferences"}}
|
||||
</div>
|
||||
|
||||
<div class="control-group category">
|
||||
|
@ -350,7 +350,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="user-custom-controls" args=(hash model=model)}}
|
||||
{{plugin-outlet "user-custom-controls"}}
|
||||
|
||||
<div class="control-group save-button">
|
||||
<div class="controls">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{#d-section bodyClass=bodyClass class="container"}}
|
||||
{{#watch-read action="markFaqRead" path=model.path}}
|
||||
<div class='contents clearfix body-page'>
|
||||
{{plugin-outlet name="above-static"}}
|
||||
{{plugin-outlet "above-static"}}
|
||||
{{{model.html}}}
|
||||
|
||||
{{#if showSignupButton}}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{{plugin-outlet name="discovery-list-container-top"}}
|
||||
{{plugin-outlet "discovery-list-container-top"}}
|
||||
|
||||
<footer class='topic-list-bottom'>
|
||||
{{conditional-loading-spinner condition=loading}}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="topic-above-post-stream" args=(hash model=model)}}
|
||||
{{plugin-outlet "topic-above-post-stream"}}
|
||||
|
||||
{{#if model.postStream.loaded}}
|
||||
{{#if model.postStream.firstPostPresent}}
|
||||
|
@ -30,7 +30,7 @@
|
|||
{{tag-chooser tags=buffered.tags categoryId=buffered.category_id}}
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="edit-topic" args=(hash model=model buffered=buffered)}}
|
||||
{{plugin-outlet "edit-topic"}}
|
||||
|
||||
{{d-button action="finishedEditingTopic" class="btn-primary btn-small submit-edit" icon="check"}}
|
||||
{{d-button action="cancelEditingTopic" class="btn-small cancel-edit" icon="times"}}
|
||||
|
@ -59,7 +59,7 @@
|
|||
{{/unless}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{plugin-outlet name="topic-title" args=(hash model=model)}}
|
||||
{{plugin-outlet "topic-title"}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
@ -70,53 +70,24 @@
|
|||
</div>
|
||||
|
||||
{{#topic-navigation jumpToIndex="jumpToIndex" as |info|}}
|
||||
|
||||
{{#if info.renderAdminMenuButton}}
|
||||
{{topic-admin-menu-button
|
||||
topic=model
|
||||
fixed="true"
|
||||
toggleMultiSelect=(action "toggleMultiSelect")
|
||||
deleteTopic=(action "deleteTopic")
|
||||
recoverTopic=(action "recoverTopic")
|
||||
toggleClosed=(action "toggleClosed")
|
||||
toggleArchived=(action "toggleArchived")
|
||||
toggleVisibility=(action "toggleVisibility")
|
||||
showAutoClose=(action "topicRouteAction" "showAutoClose")
|
||||
showFeatureTopic=(action "topicRouteAction" "showFeatureTopic")
|
||||
showChangeTimestamp=(action "topicRouteAction" "showChangeTimestamp")
|
||||
convertToPublicTopic=(action "convertToPublicTopic")
|
||||
convertToPrivateMessage=(action "convertToPrivateMessage")}}
|
||||
{{topic-admin-menu-button topic=model fixed="true" delegated=topicDelegated}}
|
||||
{{/if}}
|
||||
|
||||
{{#if info.renderTimeline}}
|
||||
{{topic-timeline
|
||||
topic=model
|
||||
prevEvent=info.prevEvent
|
||||
fullscreen=info.topicProgressExpanded
|
||||
enteredIndex=enteredIndex
|
||||
loading=model.postStream.loading
|
||||
jumpToPost=(action "jumpToPost")
|
||||
jumpTop=(action "jumpTop")
|
||||
jumpBottom=(action "jumpBottom")
|
||||
jumpToPostPrompt=(action "jumpToPostPrompt")
|
||||
jumpToIndex=(action "jumpToIndex")
|
||||
replyToPost=(action "replyToPost")
|
||||
toggleMultiSelect=(action "toggleMultiSelect")
|
||||
deleteTopic=(action "deleteTopic")
|
||||
recoverTopic=(action "recoverTopic")
|
||||
toggleClosed=(action "toggleClosed")
|
||||
toggleArchived=(action "toggleArchived")
|
||||
toggleVisibility=(action "toggleVisibility")
|
||||
showAutoClose=(action "topicRouteAction" "showAutoClose")
|
||||
showFeatureTopic=(action "topicRouteAction" "showFeatureTopic")
|
||||
showChangeTimestamp=(action "topicRouteAction" "showChangeTimestamp")
|
||||
convertToPublicTopic=(action "convertToPublicTopic")
|
||||
convertToPrivateMessage=(action "convertToPrivateMessage")}}
|
||||
{{topic-timeline topic=model
|
||||
prevEvent=info.prevEvent
|
||||
fullscreen=info.topicProgressExpanded
|
||||
enteredIndex=enteredIndex
|
||||
loading=model.postStream.loading
|
||||
delegated=topicDelegated}}
|
||||
|
||||
{{else}}
|
||||
{{topic-progress
|
||||
prevEvent=info.prevEvent
|
||||
topic=model
|
||||
expanded=info.topicProgressExpanded}}
|
||||
{{topic-progress prevEvent=info.prevEvent topic=model delegated=topicDelegated expanded=info.topicProgressExpanded}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{/topic-navigation}}
|
||||
|
||||
<div class="row">
|
||||
|
@ -125,7 +96,7 @@
|
|||
<div class="posts-wrapper">
|
||||
{{conditional-loading-spinner condition=model.postStream.loadingAbove}}
|
||||
|
||||
{{plugin-outlet name="topic-above-posts" args=(hash model=model)}}
|
||||
{{plugin-outlet "topic-above-posts"}}
|
||||
|
||||
{{#unless model.postStream.loadingFilter}}
|
||||
{{scrolling-post-stream
|
||||
|
@ -135,34 +106,35 @@
|
|||
selectedPostsCount=selectedPostsCount
|
||||
selectedQuery=selectedQuery
|
||||
gaps=model.postStream.gaps
|
||||
showFlags=(action "showPostFlags")
|
||||
editPost=(action "editPost")
|
||||
showHistory=(action "topicRouteAction" "showHistory")
|
||||
showLogin=(action "topicRouteAction" "showLogin")
|
||||
showRawEmail=(action "topicRouteAction" "showRawEmail")
|
||||
deletePost=(action "deletePost")
|
||||
recoverPost=(action "recoverPost")
|
||||
expandHidden=(action "expandHidden")
|
||||
newTopicAction=(action "replyAsNewTopic")
|
||||
toggleBookmark=(action "toggleBookmark")
|
||||
togglePostType=(action "togglePostType")
|
||||
rebakePost=(action "rebakePost")
|
||||
changePostOwner=(action "changePostOwner")
|
||||
unhidePost=(action "unhidePost")
|
||||
replyToPost=(action "replyToPost")
|
||||
toggleWiki=(action "toggleWiki")
|
||||
toggleSummary=(action "toggleSummary")
|
||||
removeAllowedUser=(action "removeAllowedUser")
|
||||
removeAllowedGroup=(action "removeAllowedGroup")
|
||||
showInvite=(action "topicRouteAction" "showInvite")
|
||||
topVisibleChanged=(action "topVisibleChanged")
|
||||
currentPostChanged=(action "currentPostChanged")
|
||||
currentPostScrolled=(action "currentPostScrolled")
|
||||
bottomVisibleChanged=(action "bottomVisibleChanged")
|
||||
selectPost=(action "toggledSelectedPost")
|
||||
selectReplies=(action "toggledSelectedPostReplies")
|
||||
fillGapBefore=(action "fillGapBefore")
|
||||
fillGapAfter=(action "fillGapAfter")}}
|
||||
showFlags="showFlags"
|
||||
editPost="editPost"
|
||||
showHistory="showHistory"
|
||||
showLogin="showLogin"
|
||||
showRawEmail="showRawEmail"
|
||||
deletePost="deletePost"
|
||||
recoverPost="recoverPost"
|
||||
expandHidden="expandHidden"
|
||||
newTopicAction="replyAsNewTopic"
|
||||
expandFirstPost="expandFirstPost"
|
||||
toggleBookmark="toggleBookmark"
|
||||
togglePostType="togglePostType"
|
||||
rebakePost="rebakePost"
|
||||
changePostOwner="changePostOwner"
|
||||
unhidePost="unhidePost"
|
||||
replyToPost="replyToPost"
|
||||
toggleWiki="toggleWiki"
|
||||
toggleSummary="toggleSummary"
|
||||
removeAllowedUser="removeAllowedUser"
|
||||
removeAllowedGroup="removeAllowedGroup"
|
||||
showInvite="showInvite"
|
||||
topVisibleChanged="topVisibleChanged"
|
||||
currentPostChanged="currentPostChanged"
|
||||
currentPostScrolled="currentPostScrolled"
|
||||
bottomVisibleChanged="bottomVisibleChanged"
|
||||
selectPost="toggledSelectedPost"
|
||||
selectReplies="toggledSelectedPostReplies"
|
||||
fillGapBefore="fillGapBefore"
|
||||
fillGapAfter="fillGapAfter"}}
|
||||
{{/unless}}
|
||||
|
||||
{{conditional-loading-spinner condition=model.postStream.loadingBelow}}
|
||||
|
@ -178,25 +150,7 @@
|
|||
{{signup-cta}}
|
||||
{{else}}
|
||||
{{#if currentUser}}
|
||||
{{topic-footer-buttons
|
||||
topic=model
|
||||
toggleMultiSelect=(action "toggleMultiSelect")
|
||||
deleteTopic=(action "deleteTopic")
|
||||
recoverTopic=(action "recoverTopic")
|
||||
toggleClosed=(action "toggleClosed")
|
||||
toggleArchived=(action "toggleArchived")
|
||||
toggleVisibility=(action "toggleVisibility")
|
||||
showAutoClose=(action "topicRouteAction" "showAutoClose")
|
||||
showFeatureTopic=(action "topicRouteAction" "showFeatureTopic")
|
||||
showChangeTimestamp=(action "topicRouteAction" "showChangeTimestamp")
|
||||
convertToPublicTopic=(action "convertToPublicTopic")
|
||||
convertToPrivateMessage=(action "convertToPrivateMessage")
|
||||
toggleBookmark=(action "toggleBookmark")
|
||||
showFlagTopic=(action "topicRouteAction" "showFlagTopic")
|
||||
showInvite=(action "topicRouteAction" "showInvite")
|
||||
toggleArchiveMessage=(action "toggleArchiveMessage")
|
||||
replyToPost=(action "replyToPost")
|
||||
}}
|
||||
{{topic-footer-buttons topic=model topicDelegated=topicDelegated}}
|
||||
{{else}}
|
||||
{{d-button icon="reply" class="btn-primary" action="showLogin" label="topic.reply.title"}}
|
||||
{{/if}}
|
||||
|
@ -221,7 +175,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="topic-above-suggested" args=(hash model=model)}}
|
||||
{{plugin-outlet "topic-above-suggested"}}
|
||||
|
||||
{{#if model.details.suggested_topics.length}}
|
||||
<div id="suggested-topics">
|
||||
|
|
|
@ -47,9 +47,7 @@
|
|||
{{#if currentUser.staff}}
|
||||
<li><a href={{model.adminPath}} class="btn">{{fa-icon "wrench"}}{{i18n 'admin.user.show_admin_profile'}}</a></li>
|
||||
{{/if}}
|
||||
{{plugin-outlet name="user-profile-controls"
|
||||
connectorTagName="li"
|
||||
args=(hash model=model)}}
|
||||
{{plugin-outlet "user-profile-controls" tagName="li"}}
|
||||
|
||||
{{#if collapsedInfo}}
|
||||
{{#if viewingSelf}}
|
||||
|
@ -66,7 +64,7 @@
|
|||
{{#if model.title}}
|
||||
<h3>{{model.title}}</h3>
|
||||
{{/if}}
|
||||
{{plugin-outlet name="user-post-names" args=(hash model=model)}}
|
||||
{{plugin-outlet "user-post-names"}}
|
||||
<h3>
|
||||
{{#if model.location}}{{fa-icon "map-marker"}} {{model.location}}{{/if}}
|
||||
{{#if model.website_name}}
|
||||
|
@ -77,7 +75,7 @@
|
|||
<span title={{model.website}}>{{model.website_name}}</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{plugin-outlet name="user-location-and-website" args=(hash model=model)}}
|
||||
{{plugin-outlet "user-location-and-website"}}
|
||||
</h3>
|
||||
|
||||
<div class='bio'>
|
||||
|
@ -104,13 +102,12 @@
|
|||
{{/if}}
|
||||
{{/each}}
|
||||
|
||||
{{plugin-outlet name="user-profile-public-fields"
|
||||
args=(hash publicUserFields=publicUserFields
|
||||
model=model)}}
|
||||
{{plugin-outlet "user-profile-public-fields"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="user-profile-primary" args=(hash model=model)}}
|
||||
{{plugin-outlet "user-profile-primary"}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style='clear: both'></div>
|
||||
|
@ -156,7 +153,7 @@
|
|||
{{d-button action="adminDelete" icon="exclamation-triangle" label="user.admin_delete" class="btn-danger"}}
|
||||
{{/if}}
|
||||
</dl>
|
||||
{{plugin-outlet name="user-profile-secondary" args=(hash model=model)}}
|
||||
{{plugin-outlet "user-profile-secondary"}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
</section>
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
{{/link-to}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{plugin-outlet name="user-activity-bottom"
|
||||
connectorTagName='li'
|
||||
args=(hash model=model)}}
|
||||
{{plugin-outlet "user-activity-bottom" tagName='li'}}
|
||||
{{/mobile-nav}}
|
||||
|
||||
{{#if viewingSelf}}
|
||||
|
|
|
@ -37,9 +37,7 @@
|
|||
<li>
|
||||
{{user-stat value=model.likes_received label="user.summary.likes_received"}}
|
||||
</li>
|
||||
{{plugin-outlet name="user-summary-stat"
|
||||
connectorTagName="li"
|
||||
args=(hash model=model)}}
|
||||
{{plugin-outlet "user-summary-stat" tagName="li"}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
40
app/assets/javascripts/discourse/views/modal-body.js.es6
Normal file
40
app/assets/javascripts/discourse/views/modal-body.js.es6
Normal file
|
@ -0,0 +1,40 @@
|
|||
import deprecated from 'discourse-common/lib/deprecated';
|
||||
|
||||
export default Ember.View.extend({
|
||||
focusInput: true,
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
|
||||
deprecated('ModalBodyView is deprecated. Use the `d-modal-body` component instead');
|
||||
|
||||
$('#modal-alert').hide();
|
||||
$('#discourse-modal').modal('show');
|
||||
Ember.run.scheduleOnce('afterRender', this, this._afterFirstRender);
|
||||
|
||||
this.appEvents.on('modal-body:flash', msg => this._flash(msg));
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super();
|
||||
this.appEvents.off('modal-body:flash');
|
||||
},
|
||||
|
||||
_afterFirstRender() {
|
||||
if (!this.site.mobileView && this.get('focusInput')) {
|
||||
this.$('input:first').focus();
|
||||
}
|
||||
|
||||
const title = this.get('title');
|
||||
if (title) {
|
||||
this.set('controller.modal.title', title);
|
||||
}
|
||||
},
|
||||
|
||||
_flash(msg) {
|
||||
$('#modal-alert').hide()
|
||||
.removeClass('alert-error', 'alert-success')
|
||||
.addClass(`alert alert-${msg.messageClass || 'success'}`).html(msg.text || '')
|
||||
.fadeIn();
|
||||
}
|
||||
});
|
|
@ -53,12 +53,9 @@ export default createWidget('header-topic-info', {
|
|||
}
|
||||
}
|
||||
if (this.siteSettings.topic_featured_link_enabled) {
|
||||
const featured = topicFeaturedLinkNode(attrs.topic);
|
||||
if (featured) {
|
||||
extra.push(featured);
|
||||
}
|
||||
extra.push(topicFeaturedLinkNode(attrs.topic));
|
||||
}
|
||||
if (extra.length) {
|
||||
if (extra) {
|
||||
title.push(h('div.topic-header-extra', extra));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ function renderParticipants(userFilters, participants) {
|
|||
|
||||
userFilters = userFilters || [];
|
||||
return participants.map(p => {
|
||||
return this.attach('topic-participant', p, { state: { toggled: userFilters.includes(p.username) } });
|
||||
return this.attach('topic-participant', p, { state: { toggled: userFilters.contains(p.username) } });
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -19,18 +19,16 @@ createWidget('timeline-last-read', {
|
|||
return { style: `height: 40px; top: ${attrs.top}px` };
|
||||
},
|
||||
|
||||
html(attrs) {
|
||||
const result = [ iconNode('minus', { class: 'progress' }) ];
|
||||
if (attrs.showButton) {
|
||||
result.push(this.attach('button', {
|
||||
html() {
|
||||
return [
|
||||
iconNode('circle', { class: 'progress' }),
|
||||
this.attach('button', {
|
||||
className: 'btn btn-primary btn-small',
|
||||
label: 'topic.timeline.back',
|
||||
title: 'topic.timeline.back_description',
|
||||
action: 'goBack'
|
||||
}));
|
||||
}
|
||||
|
||||
return result;
|
||||
})
|
||||
];
|
||||
},
|
||||
|
||||
goBack() {
|
||||
|
@ -161,12 +159,8 @@ createWidget('timeline-scrollarea', {
|
|||
|
||||
if (position.lastRead && position.lastRead !== position.total) {
|
||||
const lastReadTop = Math.round(position.lastReadPercentage * SCROLLAREA_HEIGHT);
|
||||
if (lastReadTop > (before + SCROLLER_HEIGHT * 0.5)) {
|
||||
result.push(this.attach('timeline-last-read', {
|
||||
top: lastReadTop,
|
||||
lastRead: position.lastRead,
|
||||
showButton: (lastReadTop > (before + SCROLLER_HEIGHT)) && (lastReadTop < (SCROLLAREA_HEIGHT - SCROLLER_HEIGHT))
|
||||
}));
|
||||
if ((lastReadTop > (before + SCROLLER_HEIGHT)) && (lastReadTop < (SCROLLAREA_HEIGHT - SCROLLER_HEIGHT))) {
|
||||
result.push(this.attach('timeline-last-read', { top: lastReadTop, lastRead: position.lastRead }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -256,24 +256,31 @@ export default class Widget {
|
|||
}
|
||||
|
||||
_sendComponentAction(name, param) {
|
||||
let promise;
|
||||
const view = this._findAncestorWithProperty('_emberView');
|
||||
|
||||
const view = this._findView();
|
||||
let promise;
|
||||
if (view) {
|
||||
const method = view.get(name);
|
||||
if (!method) {
|
||||
console.warn(`${name} not found`);
|
||||
// Peek into ember internals to allow us to return promises from actions
|
||||
const ev = view._emberView;
|
||||
const target = ev.get('targetObject');
|
||||
|
||||
const actionName = ev.get(name);
|
||||
if (!actionName) {
|
||||
Ember.warn(`${name} not found`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof method === "string") {
|
||||
view.sendAction(method, param);
|
||||
promise = Ember.RSVP.resolve();
|
||||
} else {
|
||||
const target = view.get('targetObject');
|
||||
promise = method.call(target, param);
|
||||
if (!promise || !promise.then) {
|
||||
promise = Ember.RSVP.resolve(promise);
|
||||
if (target) {
|
||||
// TODO: Use ember closure actions
|
||||
const actions = target.actions || target.actionHooks || {};
|
||||
const method = actions[actionName];
|
||||
if (method) {
|
||||
promise = method.call(target, param);
|
||||
if (!promise || !promise.then) {
|
||||
promise = Ember.RSVP.resolve(promise);
|
||||
}
|
||||
} else {
|
||||
return ev.sendAction(name, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
window.ENV = { };
|
||||
window.EmberENV = window.EmberENV || {};
|
||||
window.EmberENV.FORCE_JQUERY = true;
|
||||
window.EmberENV._ENABLE_LEGACY_VIEW_SUPPORT = true;
|
||||
|
|
|
@ -106,7 +106,8 @@
|
|||
right: 0px;
|
||||
margin-left: 0;
|
||||
i.progress {
|
||||
display: none
|
||||
margin-right: -3px;
|
||||
margin-left: 1em;
|
||||
}
|
||||
}
|
||||
.timeline-footer-controls {
|
||||
|
@ -261,15 +262,15 @@
|
|||
|
||||
.timeline-last-read {
|
||||
position: absolute;
|
||||
margin-left: -0.35em;
|
||||
margin-left: -0.19em;
|
||||
|
||||
.btn-small {
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
i.progress {
|
||||
font-size: 0.8em;
|
||||
color: $tertiary;
|
||||
font-size: 0.5em;
|
||||
color: dark-light-choose(scale-color($tertiary, $lightness: 80%), scale-color($tertiary, $lightness: 20%));
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
<table class="body" style="width:100%;background:#f3f3f3;padding:0;border-spacing:0;font-family:Helvetica,Arial,sans-serif;font-size:14px;font-weight:200;line-height:1.3;vertical-align:top;">
|
||||
<tr>
|
||||
<td class="side-spacer" style="width:5%;vertical-align:top;padding:0;">
|
||||
<div class="with-accent-colors">
|
||||
<div style="background-color:#2F70AC;">
|
||||
<table class="spacer" style="border-spacing:0;padding:0;width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -58,13 +58,13 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
</div>
|
||||
</td>
|
||||
<td style="vertical-align:top;padding:0;font-family:Helvetica,Arial,sans-serif;">
|
||||
<table align="center" class="with-accent-colors" style="border-spacing:0;margin:0;padding:0;text-align:inherit;vertical-align:top;width:100%">
|
||||
<table align="center" style="border-spacing:0;background:#fefefe;background-color:#2F70AC;margin:0;padding:0;text-align:inherit;vertical-align:top;width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border-collapse:collapse!important;color:#0a0a0a;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:normal">
|
||||
|
||||
<br/>
|
||||
<center class="with-accent-colors" style="font-size:22px;font-weight:400;"><%=t 'user_notifications.digest.since_last_visit' %></center>
|
||||
<center style="color:#fff;font-size:22px;font-weight:400;"><%=t 'user_notifications.digest.since_last_visit' %></center>
|
||||
|
||||
|
||||
|
||||
|
@ -72,22 +72,22 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
<tbody>
|
||||
<tr>
|
||||
<%- @counts.each do |count| -%>
|
||||
<td style="text-align:center;font-size:36px;font-weight:400;">
|
||||
<a class="with-accent-colors" href="<%= count[:href] -%>"><strong><%= count[:value] -%></strong></a>
|
||||
<td style="text-align:center;color:#fff;font-size:36px;font-weight:400;">
|
||||
<a style="color:#fff;" href="<%= count[:href] -%>"><strong><%= count[:value] -%></strong></a>
|
||||
</td>
|
||||
<%- end -%>
|
||||
</tr>
|
||||
<tr>
|
||||
<%- @counts.each do |count| -%>
|
||||
<td style="font-size:14px;font-weight:400;text-align:center;">
|
||||
<a class="with-accent-colors" href="<%= count[:href] -%>"><strong><%=t count[:label_key] -%></strong></a>
|
||||
<td style="color:#fff;font-size:14px;font-weight:400;text-align:center;">
|
||||
<a style="color:#fff;" href="<%= count[:href] -%>"><strong><%=t count[:label_key] -%></strong></a>
|
||||
</td>
|
||||
<%- end -%>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<center class="with-accent-colors" style="font-size:22px;font-weight:400;margin-bottom: 8px;"><%=t 'user_notifications.digest.popular_topics' %></center>
|
||||
<center style="color:#fff;font-size:22px;font-weight:400;margin-bottom: 8px;"><%=t 'user_notifications.digest.popular_topics' %></center>
|
||||
|
||||
|
||||
</td>
|
||||
|
@ -123,7 +123,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
<tr>
|
||||
<td style="padding: 0 8px 0 16px; text-align:left; width:100%;">
|
||||
<h2 style="font-size:18px;font-weight:400;line-height:1.3;margin:0;padding:0;word-wrap:normal">
|
||||
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="font-weight:400;line-height:1.3;margin:0;padding:0;text-decoration:none">
|
||||
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="color:#2F70AC;font-weight:400;line-height:1.3;margin:0;padding:0;text-decoration:none">
|
||||
<strong><%= t.title.truncate(60, separator: /\s/) -%></strong>
|
||||
</a>
|
||||
</h2>
|
||||
|
@ -143,10 +143,10 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
</td>
|
||||
<td style="color:#0a0a0a;padding:0 16px 0 8px;text-align:left;">
|
||||
<% if t.user %>
|
||||
<h6 style="color:inherit;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;word-wrap:normal;"><%= t.user.username -%></h6>
|
||||
<% if SiteSetting.enable_names? && t.user.name.present? && t.user.name.downcase != t.user.username.downcase %>
|
||||
<h6 style="color:inherit;line-height:1.3;margin:0;padding:0;font-weight: normal;font-size:16px;"><%= t.user.name -%></h6>
|
||||
<p style="color:#8f8f8f;line-height:1.3;margin:0 0 16px 0;padding:0;"><%= t.user.name -%></p>
|
||||
<% end %>
|
||||
<p style="color:inherit;font-size:14px;font-weight:400;line-height:1.3;margin:0 0 8px 0;padding:0;word-wrap:normal;"><%= t.user.username -%></p>
|
||||
<% end %>
|
||||
</td>
|
||||
<%- if show_image_with_url(t.image_url) -%>
|
||||
|
@ -189,7 +189,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
<% end %>
|
||||
</td>
|
||||
<td style="line-height:1.3;padding:0 16px 0 8px;text-align:right;white-space:nowrap;vertical-align:top;">
|
||||
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" class="with-accent-colors" style="width:100%;text-decoration:none;padding:8px 16px;white-space:nowrap;">
|
||||
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="width:100%;background-color:#2199e8;color:#fff;text-decoration:none;padding:8px 16px;white-space:nowrap;">
|
||||
<%=t 'user_notifications.digest.join_the_discussion' %>
|
||||
</a>
|
||||
</td>
|
||||
|
@ -215,8 +215,8 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
</table>
|
||||
</td>
|
||||
<td class="side-spacer" style="width:5%;vertical-align:top;padding:0;">
|
||||
<!-- Background that goes down part-way behind content -->
|
||||
<div class="with-accent-colors">
|
||||
<!-- Blue background that goes down part-way behind content -->
|
||||
<div style="background-color:#2F70AC;">
|
||||
<table class="spacer" style="border-spacing:0;padding:0;width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -277,18 +277,18 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
</td>
|
||||
<td style="color:#0a0a0a;line-height:1.3;padding:0 8px 8px 8px;vertical-align:top;">
|
||||
<% if post.user %>
|
||||
<h6 style="color:inherit;font-size:14px;font-weight:400;margin:0;padding:0;text-align:left;word-wrap:normal;"><%= post.user.username -%></h6>
|
||||
<% if SiteSetting.enable_names? && post.user.name && post.user.name.downcase != post.user.username.downcase %>
|
||||
<h6 style="color:inherit;line-height:1.3;margin:0;padding:0;font-weight: normal;font-size:16px;"><%= post.user.name -%></h6>
|
||||
<p style="color:#8f8f8f;font-size:14px;line-height:1.3;margin:0;padding:0;text-align:left;"><%= post.user.name -%></p>
|
||||
<% end %>
|
||||
<p style="color:inherit;font-size:14px;font-weight:400;line-height:1.3;margin:0 0 8px 0;padding:0;word-wrap:normal;"><%= post.user.username -%></p>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="color:#0a0a0a;line-height:1.3;padding:0 8px 8px 8px;text-align:right;">
|
||||
<p style="color:#8f8f8f;line-height:1.3;margin:0 0 10px 0;padding:0;text-align:right;">
|
||||
<%=t 'user_notifications.digest.from_topic_label' %>
|
||||
<a href="<%= post.full_url -%>" style="font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none"><%= post.topic.title.truncate(60, separator: /\s/) -%></a>
|
||||
<a href="<%= post.full_url -%>" style="color:#2199e8;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left;text-decoration:none"><%= post.topic.title.truncate(60, separator: /\s/) -%></a>
|
||||
</p>
|
||||
<a href="<%= post.full_url -%>" class="with-accent-colors" style="width:100%;text-decoration:none;padding:8px 16px;white-space: nowrap;">
|
||||
<a href="<%= post.full_url -%>" style="width:100%;background-color:#2199e8;color:#fff;text-decoration:none;padding:8px 16px;white-space: nowrap;">
|
||||
<%=t 'user_notifications.digest.join_the_discussion' %>
|
||||
</a>
|
||||
</td>
|
||||
|
@ -331,12 +331,12 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
|
|||
<!-- Begin new topic -->
|
||||
<tr style="vertical-align:top;">
|
||||
<td style="padding:8px;text-align:left;">
|
||||
<p class="with-accent-colors" style="border-radius:50%;height:30px;line-height:30px;margin:0 0 10px 0;padding:0;text-align:center;width:30px;">
|
||||
<p style="background:#2F70AC;border-radius:50%;color:#fff;height:30px;line-height:30px;margin:0 0 10px 0;padding:0;text-align:center;width:30px;">
|
||||
<%= t.user_data ? (t.highest_post_number - (t.user_data.last_read_post_number || 0)) : t.highest_post_number %>
|
||||
</p>
|
||||
</td>
|
||||
<td style="padding:8px;text-align:left;">
|
||||
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="font-weight:400;line-height:1.3;margin:0;padding:0;text-decoration:none">
|
||||
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="color:#2F70AC;font-weight:400;line-height:1.3;margin:0;padding:0;text-decoration:none">
|
||||
<strong><%= t.title.truncate(60, separator: /\s/) -%></strong>
|
||||
</a>
|
||||
<%- if SiteSetting.show_topic_featured_link_in_digest && t.featured_link %>
|
||||
|
|
|
@ -142,7 +142,7 @@ module Discourse
|
|||
|
||||
# Our templates shouldn't start with 'discourse/templates'
|
||||
config.handlebars.templates_root = 'discourse/templates'
|
||||
config.handlebars.raw_template_namespace = "Discourse.RAW_TEMPLATES"
|
||||
config.handlebars.raw_template_namespace = "Ember.TEMPLATES"
|
||||
|
||||
require 'discourse_redis'
|
||||
require 'logster/redis_store'
|
||||
|
|
|
@ -1306,9 +1306,6 @@ en:
|
|||
delete_digest_email_after_days: "Suppress summary emails for users not seen on the site for more than (n) days."
|
||||
digest_suppress_categories: "Suppress these categories from summary emails."
|
||||
disable_digest_emails: "Disable summary emails for all users."
|
||||
email_accent_bg_color: "The accent color to be used as the background of some elements in HTML emails. Enter a color name ('red') or hex value ('#FF000')."
|
||||
email_accent_fg_color: "The color of text rendered on the email bg color in HTML emails. Enter a color name ('white') or hex value ('#FFFFFF')."
|
||||
email_link_color: "The color of links in HTML emails. Enter a color name ('blue') or hex value ('#0000FF')."
|
||||
|
||||
detect_custom_avatars: "Whether or not to check that users have uploaded custom profile pictures."
|
||||
max_daily_gravatar_crawls: "Maximum number of times Discourse will check Gravatar for custom avatars in a day"
|
||||
|
|
|
@ -599,9 +599,6 @@ email:
|
|||
disable_digest_emails:
|
||||
default: false
|
||||
client: true
|
||||
email_accent_bg_color: "#2F70AC"
|
||||
email_accent_fg_color: "#FFFFFF"
|
||||
email_link_color: "#006699"
|
||||
show_topic_featured_link_in_digest: false
|
||||
email_custom_headers: 'Auto-Submitted: auto-generated'
|
||||
email_subject: '[%{site_name}] %{optional_pm}%{optional_cat}%{topic_title}'
|
||||
|
|
|
@ -152,19 +152,20 @@ module Email
|
|||
end
|
||||
|
||||
def format_html
|
||||
style('.with-accent-colors', "background-color: #{SiteSetting.email_accent_bg_color}; color: #{SiteSetting.email_accent_fg_color};")
|
||||
style('h4', 'color: #222;')
|
||||
style('h3', 'margin: 15px 0 20px 0;')
|
||||
style('hr', 'background-color: #ddd; height: 1px; border: 1px;')
|
||||
style('a', "text-decoration: none; font-weight: bold; color: #{SiteSetting.email_link_color};")
|
||||
style('a', 'text-decoration: none; font-weight: bold; color: #006699;')
|
||||
style('ul', 'margin: 0 0 0 10px; padding: 0 0 0 20px;')
|
||||
style('li', 'padding-bottom: 10px')
|
||||
style('div.digest-post', 'margin-left: 15px; margin-top: -5px; max-width: 694px;')
|
||||
style('div.digest-post h1', 'font-size: 20px;')
|
||||
style('div.footer', 'color:#666; font-size:95%; text-align:center; padding-top:15px;')
|
||||
style('span.post-count', 'margin: 0 5px; color: #777;')
|
||||
style('pre', 'word-wrap: break-word; max-width: 694px;')
|
||||
style('code', 'background-color: #f1f1ff; padding: 2px 5px;')
|
||||
style('pre code', 'display: block; background-color: #f1f1ff; padding: 5px;')
|
||||
style('.featured-topic a', "text-decoration: none; font-weight: bold; color: #{SiteSetting.email_link_color}; line-height:1.5em;")
|
||||
style('.featured-topic a', 'text-decoration: none; font-weight: bold; color: #006699; line-height:1.5em;')
|
||||
|
||||
onebox_styles
|
||||
plugin_styles
|
||||
|
|
|
@ -21,7 +21,6 @@ function initializeDetails(api) {
|
|||
"details_text",
|
||||
{ multiline: false }
|
||||
);
|
||||
this.set('optionsVisible', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -36,7 +36,7 @@ test('details button', () => {
|
|||
equal(
|
||||
find(".d-editor-input").val(),
|
||||
`[details=${I18n.t("composer.details_title")}]This is my title[/details]`,
|
||||
'it should contain the right selected output'
|
||||
'it should contain the right output'
|
||||
);
|
||||
|
||||
const textarea = findTextarea();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -139,7 +139,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("at least one topic shows up", function() {
|
||||
return $(".topic-list tbody tr").length;
|
||||
return document.querySelector(".topic-list tbody tr");
|
||||
});
|
||||
|
||||
execAsync("navigate to 1st topic", 500, function() {
|
||||
|
@ -147,7 +147,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("at least one post body", function() {
|
||||
return $(".topic-post").length;
|
||||
return document.querySelector(".topic-post");
|
||||
});
|
||||
|
||||
execAsync("click on the 1st user", 500, function() {
|
||||
|
@ -157,7 +157,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("user has details", function() {
|
||||
return $("#user-card .names").length;
|
||||
return document.querySelector("#user-card .names");
|
||||
});
|
||||
|
||||
exec("open login modal", function() {
|
||||
|
@ -165,7 +165,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("login modal is open", function() {
|
||||
return $(".login-modal").length;
|
||||
return document.querySelector(".login-modal");
|
||||
});
|
||||
|
||||
exec("type in credentials & log in", function() {
|
||||
|
@ -175,7 +175,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("is logged in", function() {
|
||||
return $(".current-user").length;
|
||||
return document.querySelector(".current-user");
|
||||
});
|
||||
|
||||
exec("go home", function() {
|
||||
|
@ -183,11 +183,11 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("it shows a topic list", function() {
|
||||
return $(".topic-list").length;
|
||||
return document.querySelector(".topic-list");
|
||||
});
|
||||
|
||||
test('we have a create topic button', function() {
|
||||
return $("#create-topic").length;
|
||||
return document.querySelector("#create-topic");
|
||||
});
|
||||
|
||||
exec("open composer", function() {
|
||||
|
@ -195,7 +195,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test('the editor is visible', function() {
|
||||
return $(".d-editor").length;
|
||||
return document.querySelector(".d-editor");
|
||||
});
|
||||
|
||||
exec("compose new topic", function() {
|
||||
|
@ -209,7 +209,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("updates preview", function() {
|
||||
return $(".d-editor-preview p").length;
|
||||
return document.querySelector(".d-editor-preview p");
|
||||
});
|
||||
|
||||
exec("open upload modal", function() {
|
||||
|
@ -217,7 +217,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("upload modal is open", function() {
|
||||
return $("#filename-input").length;
|
||||
return document.querySelector("#filename-input");
|
||||
});
|
||||
|
||||
// TODO: Looks like PhantomJS 2.0.0 has a bug with `uploadFile`
|
||||
|
@ -246,7 +246,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("topic is created", function() {
|
||||
return $(".fancy-title").length;
|
||||
return document.querySelector(".fancy-title");
|
||||
});
|
||||
|
||||
exec("click reply button", function() {
|
||||
|
@ -254,7 +254,7 @@ var runTests = function() {
|
|||
});
|
||||
|
||||
test("composer is open", function() {
|
||||
return $("#reply-control .d-editor-input").length;
|
||||
return document.querySelector("#reply-control .d-editor-input");
|
||||
});
|
||||
|
||||
exec("compose reply", function() {
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { extraConnectorClass } from 'discourse/lib/plugin-connectors';
|
||||
|
||||
const PREFIX = "javascripts/single-test/connectors";
|
||||
acceptance("Plugin Outlet - Connector Class", {
|
||||
setup() {
|
||||
extraConnectorClass('user-profile-primary/hello', {
|
||||
actions: {
|
||||
sayHello() {
|
||||
this.set('hello', 'hello!');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
extraConnectorClass('user-profile-primary/dont-render', {
|
||||
shouldRender(args) {
|
||||
return args.model.get('username') !== 'eviltrout';
|
||||
}
|
||||
});
|
||||
|
||||
Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`] = Ember.HTMLBars.compile(
|
||||
`<span class='hello-username'>{{model.username}}</span>
|
||||
<button class='say-hello' {{action "sayHello"}}></button>
|
||||
<span class='hello-result'>{{hello}}</span>`
|
||||
);
|
||||
Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`] = Ember.HTMLBars.compile(
|
||||
`I'm not rendered!`
|
||||
);
|
||||
},
|
||||
|
||||
teardown() {
|
||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`];
|
||||
delete Ember.TEMPLATES[`${PREFIX}/user-profile-primary/dont-render`];
|
||||
}
|
||||
});
|
||||
|
||||
test("Renders a template into the outlet", assert => {
|
||||
visit("/users/eviltrout");
|
||||
andThen(() => {
|
||||
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
|
||||
assert.ok(!find('.user-profile-primary-outlet.dont-render').length, "doesn't render");
|
||||
});
|
||||
click('.say-hello');
|
||||
andThen(() => {
|
||||
assert.equal(find('.hello-result').text(), 'hello!', 'actions delegate properly');
|
||||
});
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { clearCache } from 'discourse/lib/plugin-connectors';
|
||||
import { clearCache } from 'discourse/helpers/plugin-outlet';
|
||||
|
||||
const HELLO = 'javascripts/multi-test/connectors/user-profile-primary/hello';
|
||||
const GOODBYE = 'javascripts/multi-test/connectors/user-profile-primary/goodbye';
|
||||
|
|
|
@ -4,7 +4,9 @@ const CONNECTOR = 'javascripts/single-test/connectors/user-profile-primary/hello
|
|||
acceptance("Plugin Outlet - Single Template", {
|
||||
setup() {
|
||||
Ember.TEMPLATES[CONNECTOR] = Ember.HTMLBars.compile(
|
||||
`<span class='hello-username'>{{model.username}}</span>`
|
||||
`<span class='hello-username'>{{model.username}}</span>
|
||||
<button class='hello-check-email' {{action "checkEmail" model}}></button>
|
||||
<span class='hello-email'>{{model.email}}</span>`
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -19,4 +21,8 @@ test("Renders a template into the outlet", assert => {
|
|||
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
|
||||
assert.equal(find('.hello-username').text(), 'eviltrout', 'it renders into the outlet');
|
||||
});
|
||||
click('.hello-check-email');
|
||||
andThen(() => {
|
||||
assert.equal(find('.hello-email').text(), 'eviltrout@example.com', 'actions delegate properly');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -71,29 +71,27 @@ test("open advanced search", assert => {
|
|||
andThen(() => assert.ok(visible('.search-advanced .search-advanced-options'), '"search-advanced-options" is visible'));
|
||||
});
|
||||
|
||||
// these tests are screwy with the runloop
|
||||
test("validate population of advanced search", assert => {
|
||||
visit("/search");
|
||||
fillIn('.search input.full-page-search', 'test user:admin #bug group:moderators badge:Reader tags:monkey in:likes in:private in:wiki in:bookmarks status:open after:2016-10-05 min_post_count:10');
|
||||
click('.search-advanced-btn');
|
||||
|
||||
// test("validate population of advanced search", assert => {
|
||||
// visit("/search");
|
||||
// fillIn('.search input.full-page-search', 'test user:admin #bug group:moderators badge:Reader tags:monkey in:likes in:private in:wiki in:bookmarks status:open after:2016-10-05 min_post_count:10');
|
||||
// click('.search-advanced-btn');
|
||||
//
|
||||
// andThen(() => {
|
||||
// assert.ok(exists('.search-advanced-options span:contains("admin")'), 'has "admin" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .badge-category:contains("bug")'), 'has "bug" pre-populated');
|
||||
// //assert.ok(exists('.search-advanced-options span:contains("moderators")'), 'has "moderators" pre-populated');
|
||||
// //assert.ok(exists('.search-advanced-options span:contains("Reader")'), 'has "Reader" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .tag-chooser .tag-monkey'), 'has "monkey" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .in-likes:checked'), 'has "I liked" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .in-private:checked'), 'has "are in my messages" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .in-wiki:checked'), 'has "are wiki" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("I\'ve bookmarked")'), 'has "I\'ve bookmarked" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("are open")'), 'has "are open" pre-populated');
|
||||
// assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("after")'), 'has "after" pre-populated');
|
||||
// assert.equal(find('.search-advanced-options #search-post-date').val(), "2016-10-05", 'has "2016-10-05" pre-populated');
|
||||
// assert.equal(find('.search-advanced-options #search-min-post-count').val(), "10", 'has "10" pre-populated');
|
||||
// });
|
||||
// });
|
||||
andThen(() => {
|
||||
assert.ok(exists('.search-advanced-options span:contains("admin")'), 'has "admin" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .badge-category:contains("bug")'), 'has "bug" pre-populated');
|
||||
//assert.ok(exists('.search-advanced-options span:contains("moderators")'), 'has "moderators" pre-populated');
|
||||
//assert.ok(exists('.search-advanced-options span:contains("Reader")'), 'has "Reader" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .tag-chooser .tag-monkey'), 'has "monkey" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .in-likes:checked'), 'has "I liked" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .in-private:checked'), 'has "are in my messages" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .in-wiki:checked'), 'has "are wiki" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("I\'ve bookmarked")'), 'has "I\'ve bookmarked" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("are open")'), 'has "are open" pre-populated');
|
||||
assert.ok(exists('.search-advanced-options .combobox .select2-choice .select2-chosen:contains("after")'), 'has "after" pre-populated');
|
||||
assert.equal(find('.search-advanced-options #search-post-date').val(), "2016-10-05", 'has "2016-10-05" pre-populated');
|
||||
assert.equal(find('.search-advanced-options #search-min-post-count').val(), "10", 'has "10" pre-populated');
|
||||
});
|
||||
});
|
||||
|
||||
test("escape search term", (assert) => {
|
||||
visit("/search");
|
||||
|
|
|
@ -20,6 +20,6 @@ test("grantableBadges", function() {
|
|||
});
|
||||
|
||||
|
||||
not(badgeNames.includes(badgeDisabled), "excludes disabled badges");
|
||||
not(badgeNames.contains(badgeDisabled), "excludes disabled badges");
|
||||
deepEqual(badgeNames, sortedNames, "sorts badges by name");
|
||||
});
|
||||
|
|
|
@ -5,10 +5,8 @@ import siteFixtures from 'fixtures/site-fixtures';
|
|||
import HeaderComponent from 'discourse/components/site-header';
|
||||
import { forceMobile, resetMobile } from 'discourse/lib/mobile';
|
||||
import { resetPluginApi } from 'discourse/lib/plugin-api';
|
||||
import { clearCache as clearOutletCache, resetExtraClasses } from 'discourse/lib/plugin-connectors';
|
||||
import { clearCache as clearOutletCache } from 'discourse/helpers/plugin-outlet';
|
||||
import { clearHTMLCache } from 'discourse/helpers/custom-html';
|
||||
import { flushMap } from 'discourse/models/store';
|
||||
|
||||
|
||||
function currentUser() {
|
||||
return Discourse.User.create(sessionFixtures['/session/current.json'].current_user);
|
||||
|
@ -46,7 +44,6 @@ function acceptance(name, options) {
|
|||
// For now don't do scrolling stuff in Test Mode
|
||||
HeaderComponent.reopen({examineDockHeader: Ember.K});
|
||||
|
||||
resetExtraClasses();
|
||||
const siteJson = siteFixtures['site.json'].site;
|
||||
if (options) {
|
||||
if (options.setup) {
|
||||
|
@ -80,11 +77,9 @@ function acceptance(name, options) {
|
|||
if (options && options.teardown) {
|
||||
options.teardown.call(this);
|
||||
}
|
||||
flushMap();
|
||||
Discourse.User.resetCurrent();
|
||||
Discourse.Site.resetCurrent(Discourse.Site.create(jQuery.extend(true, {}, fixtures['site.json'].site)));
|
||||
|
||||
resetExtraClasses();
|
||||
clearOutletCache();
|
||||
clearHTMLCache();
|
||||
resetPluginApi();
|
||||
|
|
|
@ -170,7 +170,7 @@ test("toggleParticipant", function() {
|
|||
equal(postStream.get('userFilters.length'), 0, "by default no participants are toggled");
|
||||
|
||||
postStream.toggleParticipant(participant.username);
|
||||
ok(postStream.get('userFilters').includes('eviltrout'), 'eviltrout is in the filters');
|
||||
ok(postStream.get('userFilters').contains('eviltrout'), 'eviltrout is in the filters');
|
||||
|
||||
postStream.toggleParticipant(participant.username);
|
||||
blank(postStream.get('userFilters'), "toggling the participant again removes them");
|
||||
|
@ -283,7 +283,7 @@ test("identity map", function() {
|
|||
});
|
||||
|
||||
test("loadIntoIdentityMap with no data", () => {
|
||||
return buildStream(1234).loadIntoIdentityMap([]).then(result => {
|
||||
buildStream(1234).loadIntoIdentityMap([]).then(result => {
|
||||
equal(result.length, 0, 'requesting no posts produces no posts');
|
||||
});
|
||||
});
|
||||
|
@ -291,7 +291,7 @@ test("loadIntoIdentityMap with no data", () => {
|
|||
test("loadIntoIdentityMap with post ids", function() {
|
||||
const postStream = buildStream(1234);
|
||||
|
||||
return postStream.loadIntoIdentityMap([10]).then(function() {
|
||||
postStream.loadIntoIdentityMap([10]).then(function() {
|
||||
present(postStream.findLoadedPost(10), "it adds the returned post to the store");
|
||||
});
|
||||
});
|
||||
|
@ -327,7 +327,7 @@ test("staging and undoing a new post", function() {
|
|||
equal(stagedPost.get('topic'), topic, "it assigns the topic reference");
|
||||
equal(stagedPost.get('post_number'), 2, "it is assigned the probable post_number");
|
||||
present(stagedPost.get('created_at'), "it is assigned a created date");
|
||||
ok(postStream.get('posts').includes(stagedPost), "the post is added to the stream");
|
||||
ok(postStream.get('posts').contains(stagedPost), "the post is added to the stream");
|
||||
equal(stagedPost.get('id'), -1, "the post has a magical -1 id");
|
||||
|
||||
// Undoing a created post (there was an error)
|
||||
|
@ -337,7 +337,7 @@ test("staging and undoing a new post", function() {
|
|||
equal(topic.get('highest_post_number'), 1, "it reverts the highest_post_number");
|
||||
equal(topic.get('posts_count'), 1, "it reverts the post count");
|
||||
equal(postStream.get('filteredPostsCount'), 1, "it retains the filteredPostsCount");
|
||||
ok(!postStream.get('posts').includes(stagedPost), "the post is removed from the stream");
|
||||
ok(!postStream.get('posts').contains(stagedPost), "the post is removed from the stream");
|
||||
ok(postStream.get('lastAppended'), original, "it doesn't consider undid post lastAppended");
|
||||
});
|
||||
|
||||
|
@ -367,7 +367,7 @@ test("staging and committing a post", function() {
|
|||
ok(postStream.get('lastAppended'), original, "staging a post doesn't change the lastAppended");
|
||||
|
||||
postStream.commitPost(stagedPost);
|
||||
ok(postStream.get('posts').includes(stagedPost), "the post is still in the stream");
|
||||
ok(postStream.get('posts').contains(stagedPost), "the post is still in the stream");
|
||||
ok(!postStream.get('loading'), "it is no longer loading");
|
||||
|
||||
equal(postStream.get('filteredPostsCount'), 2, "it increases the filteredPostsCount");
|
||||
|
|
|
@ -15,7 +15,7 @@ test('defaults', function() {
|
|||
|
||||
test('pagination support', function() {
|
||||
const store = createStore();
|
||||
return store.findAll('widget').then(function(rs) {
|
||||
store.findAll('widget').then(function(rs) {
|
||||
equal(rs.get('length'), 2);
|
||||
equal(rs.get('totalRows'), 4);
|
||||
ok(rs.get('loadMoreUrl'), 'has a url to load more');
|
||||
|
@ -36,7 +36,7 @@ test('pagination support', function() {
|
|||
|
||||
test('refresh support', function() {
|
||||
const store = createStore();
|
||||
return store.findAll('widget').then(function(rs) {
|
||||
store.findAll('widget').then(function(rs) {
|
||||
equal(rs.get('refreshUrl'), '/widgets?refresh=true', 'it has the refresh url');
|
||||
|
||||
const promise = rs.refresh();
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
//= require sinon-1.7.1
|
||||
//= require sinon-qunit-1.0.0
|
||||
|
||||
//= require helpers/qunit-helpers
|
||||
//= require helpers/assertions
|
||||
|
||||
//= require helpers/qunit-helpers
|
||||
//= require_tree ./fixtures
|
||||
//= require_tree ./lib
|
||||
//= require_tree .
|
||||
|
|
|
@ -23,7 +23,7 @@ widgetTest('listing actions', {
|
|||
});
|
||||
|
||||
widgetTest('undo', {
|
||||
template: '{{mount-widget widget="actions-summary" args=args undoPostAction=undoPostAction}}',
|
||||
template: '{{mount-widget widget="actions-summary" args=args undoPostAction="undoPostAction"}}',
|
||||
setup() {
|
||||
this.set('args', {
|
||||
actionsSummary: [
|
||||
|
@ -31,7 +31,7 @@ widgetTest('undo', {
|
|||
]
|
||||
});
|
||||
|
||||
this.set('undoPostAction', () => this.undid = true);
|
||||
this.on('undoPostAction', () => this.undid = true);
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$('.post-actions .post-action').length, 1);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user