DEV: upgrades from Ember 2.13 to Ember 3.5.1 (#6808)

Co-Authored-By: Bianca Nenciu <nbianca@users.noreply.github.com>
Co-Authored-By: David Taylor <david@taylorhq.com>
This commit is contained in:
Joffrey JAFFEUX 2019-01-10 11:06:01 +01:00 committed by GitHub
parent 7896c74c2b
commit f9648de897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
318 changed files with 1684 additions and 1462 deletions

View File

@ -41,8 +41,8 @@ gem 'onebox', '1.8.76'
gem 'http_accept_language', '~>2.0.5', require: false
gem 'ember-rails', '0.18.5'
gem 'ember-source', '2.13.3'
gem 'ember-handlebars-template', '0.7.5'
gem 'discourse-ember-source', '~> 3.5.1'
gem 'ember-handlebars-template', '0.8.0'
gem 'barber'
# message bus 2.2.0 should be very stable

View File

@ -83,7 +83,7 @@ GEM
open4 (~> 1.3)
coderay (1.1.2)
colored2 (3.1.2)
concurrent-ruby (1.1.3)
concurrent-ruby (1.1.4)
connection_pool (2.2.2)
cork (0.3.0)
colored2 (~> 3.1)
@ -105,6 +105,7 @@ GEM
terminal-table (~> 1)
debug_inspector (0.0.3)
diff-lcs (1.3)
discourse-ember-source (3.5.1.3)
discourse_image_optim (0.26.2)
exifr (~> 1.2, >= 1.2.2)
fspath (~> 3.0)
@ -114,9 +115,9 @@ GEM
email_reply_trimmer (0.1.12)
ember-data-source (3.0.2)
ember-source (>= 2, < 3.0)
ember-handlebars-template (0.7.5)
ember-handlebars-template (0.8.0)
barber (>= 0.11.0)
sprockets (>= 3.3, < 4)
sprockets (>= 3.3, < 4.1)
ember-rails (0.18.5)
active_model_serializers
ember-data-source (>= 1.0.0.beta.5)
@ -124,7 +125,7 @@ GEM
ember-source (>= 1.1.0)
jquery-rails (>= 1.0.17)
railties (>= 3.1)
ember-source (2.13.3)
ember-source (2.18.2)
erubi (1.7.1)
excon (0.62.0)
execjs (2.7.0)
@ -462,11 +463,11 @@ DEPENDENCIES
colored2
cppjieba_rb
danger
discourse-ember-source (~> 3.5.1)
discourse_image_optim
email_reply_trimmer (~> 0.1)
ember-handlebars-template (= 0.7.5)
ember-handlebars-template (= 0.8.0)
ember-rails (= 0.18.5)
ember-source (= 2.13.3)
excon
execjs
fabrication

View File

@ -83,26 +83,14 @@ export default Ember.Component.extend(bufferedProperty("userField"), {
.catch(popupAjaxError);
},
moveUp() {
this.sendAction("moveUpAction", this.get("userField"));
},
moveDown() {
this.sendAction("moveDownAction", this.get("userField"));
},
edit() {
this.set("editing", true);
},
destroy() {
this.sendAction("destroyAction", this.get("userField"));
},
cancel() {
const id = this.get("userField.id");
if (Ember.isEmpty(id)) {
this.sendAction("destroyAction", this.get("userField"));
this.destroyAction(this.get("userField"));
} else {
this.rollbackBuffer();
this.set("editing", false);

View File

@ -14,7 +14,7 @@ export default Ember.Component.extend(
this.get("word")
.destroy()
.then(() => {
this.sendAction("action", this.get("word"));
this.action(this.get("word"));
})
.catch(e => {
bootbox.alert(

View File

@ -61,7 +61,7 @@ export default Ember.Component.extend(bufferedProperty("host"), {
this.get("host")
.destroyRecord()
.then(() => {
this.sendAction("deleteHost", this.get("host"));
this.deleteHost(this.get("host"));
});
}
});
@ -70,7 +70,7 @@ export default Ember.Component.extend(bufferedProperty("host"), {
cancel() {
const host = this.get("host");
if (host.get("isNew")) {
this.sendAction("deleteHost", host);
this.deleteHost(host);
} else {
this.rollbackBuffer();
this.set("editToggled", false);

View File

@ -4,13 +4,17 @@ import {
} from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
classNames: ["inline-edit"],
checked: null,
checkedInternal: null,
init() {
this._super();
this._super(...arguments);
this.set("checkedInternal", this.get("checked"));
},
classNames: ["inline-edit"],
@observes("checked")
checkedChanged() {
this.set("checkedInternal", this.get("checked"));
@ -33,7 +37,7 @@ export default Ember.Component.extend({
finished() {
this.set("checked", this.get("checkedInternal"));
this.sendAction();
this.action();
}
}
});

View File

@ -33,7 +33,7 @@ export default Ember.Component.extend({
self.set("url", "");
self.set("permalink_type_value", "");
self.set("formSubmitted", false);
self.sendAction("action", Permalink.create(result.permalink));
self.action(Permalink.create(result.permalink));
Em.run.schedule("afterRender", function() {
self.$(".permalink-url").focus();
});

View File

@ -8,8 +8,8 @@ import { bufferedRender } from "discourse-common/lib/buffered-render";
{{resumable-upload
target="/admin/backups/upload"
success="successAction"
error="errorAction"
success=(action "successAction")
error=(action "errorAction")
uploadText="UPLOAD"
}}
**/
@ -100,7 +100,7 @@ export default Ember.Component.extend(
// mark as not uploading anymore
self._reset();
// fire an event to allow the parent route to reload its model
self.sendAction("success", file.fileName);
self.success(file.fileName);
});
});
@ -109,7 +109,7 @@ export default Ember.Component.extend(
// mark as not uploading anymore
self._reset();
// fire an event to allow the parent route to display the error message
self.sendAction("error", file.fileName, message);
self.error(file.fileName, message);
});
});
}.on("init"),

View File

@ -8,11 +8,5 @@ export default Ember.Component.extend({
@computed("model.isSaving")
savingText(saving) {
return saving ? "saving" : "save";
},
actions: {
saveChanges() {
this.sendAction();
}
}
});

View File

@ -2,7 +2,7 @@
A form to create an IP address that will be blocked or whitelisted.
Example usage:
{{screened-ip-address-form action="recordAdded"}}
{{screened-ip-address-form action=(action "recordAdded")}}
where action is a callback on the controller or route that will get called after
the new record is successfully saved. It is called with the new ScreenedIpAddress record
@ -60,10 +60,7 @@ export default Ember.Component.extend({
.save()
.then(result => {
this.setProperties({ ip_address: "", formSubmitted: false });
this.sendAction(
"action",
ScreenedIpAddress.create(result.screened_ip_address)
);
this.action(ScreenedIpAddress.create(result.screened_ip_address));
Ember.run.schedule("afterRender", () =>
this.$(".ip-address-input").focus()
);

View File

@ -30,11 +30,5 @@ export default Ember.Component.extend({
}
return this.get("term");
},
actions: {
edit() {
this.sendAction("editAction", this.get("siteText"));
}
}
});

View File

@ -12,8 +12,8 @@ export default Em.Component.extend(UploadMixin, {
uploadDone() {
bootbox.alert(I18n.t("tagging.upload_successful"), () => {
this.sendAction("refresh");
this.sendAction("closeModal");
this.refresh();
this.closeModal();
});
}
});

View File

@ -64,7 +64,7 @@ export default Ember.Component.extend({
showMessage: true,
message: I18n.t("admin.watched_words.form.success")
});
this.sendAction("action", WatchedWord.create(result));
this.action(WatchedWord.create(result));
Ember.run.schedule("afterRender", () =>
this.$(".watched-word-input").focus()
);

View File

@ -19,7 +19,7 @@ export default Em.Component.extend(UploadMixin, {
uploadDone() {
if (this) {
bootbox.alert(I18n.t("admin.watched_words.form.upload_successful"));
this.sendAction("done");
this.done();
}
}
});

View File

@ -48,7 +48,7 @@ export default Ember.Controller.extend({
return colorSchemeId !== existingId;
},
@computed("availableChildThemes", "model.childThemes.@each", "model")
@computed("availableChildThemes", "model.childThemes.[]", "model")
selectableChildThemes(available, childThemes) {
if (available) {
const themes = !childThemes

View File

@ -62,9 +62,21 @@ export default Ember.Controller.extend({
}
},
@computed("model.isSaving", "secretValidation", "eventTypeValidation")
saveButtonDisabled(isSaving, secretValidation, eventTypeValidation) {
return isSaving ? false : secretValidation || eventTypeValidation;
@computed(
"model.isSaving",
"secretValidation",
"eventTypeValidation",
"model.payload_url"
)
saveButtonDisabled(
isSaving,
secretValidation,
eventTypeValidation,
payloadUrl
) {
return isSaving
? false
: secretValidation || eventTypeValidation || Ember.isEmpty(payloadUrl);
},
actions: {

View File

@ -30,7 +30,7 @@ const Theme = RestModel.extend({
return hash;
},
@computed("theme_fields", "theme_fields.@each")
@computed("theme_fields", "theme_fields.[]")
uploads(fields) {
if (!fields) {
return [];
@ -47,7 +47,7 @@ const Theme = RestModel.extend({
);
},
@computed("theme_fields.@each")
@computed("theme_fields.[]")
editedFields(fields) {
return fields.filter(
field => !Em.isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID
@ -130,7 +130,7 @@ const Theme = RestModel.extend({
}
},
@computed("childThemes.@each")
@computed("childThemes.[]")
child_theme_ids(childThemes) {
if (childThemes) {
return childThemes.map(theme => Ember.get(theme, "id"));

View File

@ -21,7 +21,7 @@ const WatchedWord = Discourse.Model.extend({
WatchedWord.reopenClass({
findAll() {
return ajax("/admin/logs/watched_words").then(list => {
return ajax("/admin/logs/watched_words.json").then(list => {
const actions = {};
list.words.forEach(s => {
if (!actions[s.action]) {

View File

@ -19,8 +19,8 @@
{{/if}}
</td>
<td class="key-controls">
{{d-button class="btn-default" action="regenerateKey" actionParam=k icon="undo" label='admin.api.regenerate'}}
{{d-button class="btn-default" action="revokeKey" actionParam=k icon="times" label='admin.api.revoke'}}
{{d-button class="btn-default" action=(action "regenerateKey") actionParam=k icon="undo" label='admin.api.regenerate'}}
{{d-button class="btn-default" action=(action "revokeKey") actionParam=k icon="times" label='admin.api.revoke'}}
</td>
</tr>
{{/each}}

View File

@ -1,14 +1,14 @@
<div class="backup-options">
{{#if localBackupStorage}}
{{resumable-upload target="/admin/backups/upload" success="uploadSuccess" error="uploadError" uploadText=uploadLabel title="admin.backups.upload.title" class="btn-default"}}
{{resumable-upload target="/admin/backups/upload" success=(route-action "uploadSuccess") error=(route-action "uploadError") uploadText=uploadLabel title="admin.backups.upload.title" class="btn-default"}}
{{else}}
{{backup-uploader done="remoteUploadSuccess"}}
{{backup-uploader done=(route-action "remoteUploadSuccess")}}
{{/if}}
{{#if site.isReadOnly}}
{{d-button class="btn-default" icon="far-eye" action="toggleReadOnlyMode" disabled=status.isOperationRunning title="admin.backups.read_only.disable.title" label="admin.backups.read_only.disable.label"}}
{{d-button class="btn-default" icon="far-eye" action=(action "toggleReadOnlyMode") disabled=status.isOperationRunning title="admin.backups.read_only.disable.title" label="admin.backups.read_only.disable.label"}}
{{else}}
{{d-button class="btn-default" icon="far-eye" action="toggleReadOnlyMode" disabled=status.isOperationRunning title="admin.backups.read_only.enable.title" label="admin.backups.read_only.enable.label"}}
{{d-button class="btn-default" icon="far-eye" action=(action "toggleReadOnlyMode") disabled=status.isOperationRunning title="admin.backups.read_only.enable.title" label="admin.backups.read_only.enable.label"}}
{{/if}}
</div>
<table class="grid">
@ -25,17 +25,17 @@
<td class="backup-controls">
<div>
{{d-button class="btn-default download"
action="download"
action=(action "download")
actionParam=backup
icon="download"
title="admin.backups.operations.download.title"
label="admin.backups.operations.download.label"}}
{{#if status.isOperationRunning}}
{{d-button icon="far-trash-alt" action="destroyBackup" actionParam=backup class="btn-danger" disabled="true" title="admin.backups.operations.is_running"}}
{{d-button icon="play" action="startRestore" actionParam=backup disabled=status.restoreDisabled class="btn-default" title=restoreTitle label="admin.backups.operations.restore.label"}}
{{d-button icon="far-trash-alt" action=(route-action "destroyBackup") actionParam=backup class="btn-danger" disabled="true" title="admin.backups.operations.is_running"}}
{{d-button icon="play" action=(route-action "startRestore") actionParam=backup disabled=status.restoreDisabled class="btn-default" title=restoreTitle label="admin.backups.operations.restore.label"}}
{{else}}
{{d-button icon="far-trash-alt" action="destroyBackup" actionParam=backup class="btn-danger" title="admin.backups.operations.destroy.title"}}
{{d-button icon="play" action="startRestore" actionParam=backup disabled=status.restoreDisabled class="btn-default" title=restoreTitle label="admin.backups.operations.restore.label"}}
{{d-button icon="far-trash-alt" action=(route-action "destroyBackup") actionParam=backup class="btn-danger" title="admin.backups.operations.destroy.title"}}
{{d-button icon="play" action=(route-action "startRestore") actionParam=backup disabled=status.restoreDisabled class="btn-default" title=restoreTitle label="admin.backups.operations.restore.label"}}
{{/if}}
</div>
</td>

View File

@ -7,7 +7,7 @@
{{plugin-outlet name="downloader" tagName=""}}
<div class="admin-actions">
{{#if model.canRollback}}
{{d-button action="rollback"
{{d-button action=(route-action "rollback")
class="btn-default btn-rollback"
label="admin.backups.operations.rollback.label"
title="admin.backups.operations.rollback.title"
@ -15,13 +15,13 @@
disabled=rollbackDisabled}}
{{/if}}
{{#if model.isOperationRunning}}
{{d-button action="cancelOperation"
{{d-button action=(route-action "cancelOperation")
class="btn-danger"
title="admin.backups.operations.cancel.title"
label="admin.backups.operations.cancel.label"
icon="times"}}
{{else}}
{{d-button action="showStartBackupModal"
{{d-button action=(route-action "showStartBackupModal")
class="btn-primary"
title="admin.backups.operations.backup.title"
label="admin.backups.operations.backup.label"

View File

@ -55,7 +55,7 @@
{{#each pages as |pageState|}}
{{d-button
translatedLabel=pageState.page
action="changePage"
action=(action "changePage")
actionParam=pageState.index
class=pageState.class}}
{{/each}}

View File

@ -115,7 +115,7 @@
<div class="modes">
{{#each displayedModes as |displayedMode|}}
{{d-button
action="changeMode"
action=(action "changeMode")
actionParam=displayedMode.mode
class=displayedMode.cssClass
icon=displayedMode.icon}}
@ -178,7 +178,7 @@
<div class="input">
{{d-button
class="btn-default export-csv-btn"
action="exportCsv"
action=(action "exportCsv")
label="admin.export_csv.button_text"
icon="download"}}
</div>
@ -190,7 +190,7 @@
<div class="input">
{{d-button
class="refresh-report-btn btn-primary"
action="refreshReport"
action=(action "refreshReport")
label="admin.dashboard.reports.refresh_report"
icon="refresh"}}
</div>

View File

@ -34,8 +34,8 @@
{{/admin-form-row}}
{{#admin-form-row}}
{{d-button action="save" class="btn-primary" icon="check" label="admin.user_fields.save"}}
{{d-button action="cancel" class="btn-danger" icon="times" label="admin.user_fields.cancel"}}
{{d-button action=(action "save") class="btn-primary" icon="check" label="admin.user_fields.save"}}
{{d-button action=(action "cancel") class="btn-danger" icon="times" label="admin.user_fields.cancel"}}
{{/admin-form-row}}
{{else}}
<div class="row">
@ -46,10 +46,11 @@
</div>
<div class='form-display'>{{fieldName}}</div>
<div class='form-element controls'>
{{d-button action="edit" class="btn-default" icon="pencil" label="admin.user_fields.edit"}}
{{d-button action="destroy" class="btn-danger" icon="trash-o" label="admin.user_fields.delete"}}
{{d-button action="moveUp" class="btn-default" icon="arrow-up" disabled=cantMoveUp}}
{{d-button action="moveDown" class="btn-default" icon="arrow-down" disabled=cantMoveDown}}
{{d-button action=(action "edit") class="btn-default" icon="pencil" label="admin.user_fields.edit"}}
{{d-button action=destroyAction actionParam=userField class="btn-danger" icon="trash-o" label="admin.user_fields.delete"}}
{{d-button action=moveUpAction actionParam=userField class="btn-default" icon="arrow-up" disabled=cantMoveUp}}
{{d-button action=moveDownAction actionParam=userField class="btn-default" icon="arrow-down" disabled=cantMoveDown}}
</div>
</div>
<div class="row">{{flags}}</div>

View File

@ -5,13 +5,13 @@
<div class="col timestamp">{{createdAt}}</div>
<div class="col completion">{{completion}}</div>
<div class="col actions">
{{d-button icon='ellipsis-v' action='toggleRequest' label='admin.web_hooks.events.request'}}
{{d-button icon='ellipsis-v' action='toggleResponse' label='admin.web_hooks.events.response'}}
{{d-button icon='refresh' action='redeliver' label='admin.web_hooks.events.redeliver'}}
{{d-button icon="ellipsis-v" action=(action "toggleRequest") label="admin.web_hooks.events.request"}}
{{d-button icon="ellipsis-v" action=(action "toggleResponse") label="admin.web_hooks.events.response"}}
{{d-button icon="refresh" action=(action "redeliver") label="admin.web_hooks.events.redeliver"}}
</div>
{{#if expandDetails}}
<div class="details">
<h3>{{i18n 'admin.web_hooks.events.headers'}}</h3>
<h3>{{i18n "admin.web_hooks.events.headers"}}</h3>
<pre><code>{{headers}}</code></pre>
<h3>{{bodyLabel}}</h3>
<pre><code>{{body}}</code></pre>

View File

@ -1,23 +1,23 @@
{{#if editing}}
<td class="editing-input">
<div class="label">{{i18n "admin.embedding.host"}}</div>
{{input value=buffered.host placeholder="example.com" enter="save" class="host-name"}}
{{input value=buffered.host placeholder="example.com" enter=(action "save") class="host-name"}}
</td>
<td class="editing-input">
<div class="label">{{i18n "admin.embedding.class_name"}}</div>
{{input value=buffered.class_name placeholder="class" enter="save" class="class-name"}}
{{input value=buffered.class_name placeholder="class" enter=(action "save") class="class-name"}}
</td>
<td class="editing-input">
<div class="label">{{i18n "admin.embedding.path_whitelist"}}</div>
{{input value=buffered.path_whitelist placeholder="/blog/.*" enter="save" class="path-whitelist"}}
{{input value=buffered.path_whitelist placeholder="/blog/.*" enter=(action "save") class="path-whitelist"}}
</td>
<td class="editing-input">
<div class="label">{{i18n "admin.embedding.category"}}</div>
{{category-chooser value=categoryId class="small"}}
</td>
<td class="editing-controls">
{{d-button icon="check" action="save" class="btn-primary" disabled=cantSave}}
{{d-button icon="times" action="cancel" class="btn-danger" disabled=host.isSaving}}
{{d-button icon="check" action=(action "save") class="btn-primary" disabled=cantSave}}
{{d-button icon="times" action=(action "cancel") class="btn-danger" disabled=host.isSaving}}
</td>
{{else}}
<td><div class="label">{{i18n "admin.embedding.host"}}</div>{{host.host}}</td>
@ -25,7 +25,7 @@
<td><div class="label">{{i18n "admin.embedding.path_whitelist"}}</div>{{host.path_whitelist}}</td>
<td><div class="label">{{i18n "admin.embedding.category"}}</div>{{category-badge host.category}}</td>
<td class="controls">
{{d-button icon="pencil" action="edit"}}
{{d-button icon="trash-o" action="delete" class='btn-danger'}}
{{d-button icon="pencil" action=(action "edit")}}
{{d-button icon="trash-o" action=(action "delete") class='btn-danger'}}
</td>
{{/if}}
{{/if}}

View File

@ -78,14 +78,14 @@
{{d-button
title="admin.flags.disagree_flag_unhide_post_title"
class="btn-default disagree-flag"
action="disagree"
action=(action "disagree")
icon="thumbs-o-down"
label="admin.flags.disagree_flag_unhide_post"}}
{{else}}
{{d-button
title="admin.flags.disagree_flag_title"
class="btn-default disagree-flag"
action="disagree"
action=(action "disagree")
icon="thumbs-o-down"
label="admin.flags.disagree_flag"}}
{{/if}}
@ -93,7 +93,7 @@
{{d-button
class="btn-default defer-flag"
title="admin.flags.ignore_flag_title"
action="defer"
action=(action "defer")
icon="external-link"
label="admin.flags.ignore_flag"}}

View File

@ -3,6 +3,6 @@
{{label}}
</label>
{{#if changed}}
{{d-button action="finished" class="btn-primary btn-small submit-edit" icon="check"}}
{{d-button action="cancelled" class="btn-small cancel-edit" icon="times"}}
{{d-button action=(action "finished") class="btn-primary btn-small submit-edit" icon="check"}}
{{d-button action=(action "cancelled") class="btn-small cancel-edit" icon="times"}}
{{/if}}

View File

@ -2,4 +2,4 @@
{{text-field value=url disabled=formSubmitted class="permalink-url" placeholderKey="admin.permalink.url" autocorrect="off" autocapitalize="off"}}
{{combo-box content=permalinkTypes value=permalinkType}}
{{text-field value=permalink_type_value disabled=formSubmitted class="external-url" placeholderKey=permalinkTypePlaceholder autocorrect="off" autocapitalize="off"}}
{{d-button class="btn-default" action="submit" disabled=formSubmitted label="admin.permalink.form.add"}}
{{d-button class="btn-default" action=(action "submit") disabled=formSubmitted label="admin.permalink.form.add"}}

View File

@ -1,4 +1,4 @@
{{d-button action="saveChanges" disabled=buttonDisabled label=savingText class="btn-primary save-changes"}}
{{d-button action=action disabled=buttonDisabled label=savingText class="btn-primary save-changes"}}
{{yield}}
<div class='save-messages'>
{{#if saved}}

View File

@ -1,4 +1,4 @@
<b>{{i18n 'admin.logs.screened_ips.form.label'}}</b>
{{text-field value=ip_address disabled=formSubmitted class="ip-address-input" placeholderKey="admin.logs.screened_ips.form.ip_address" autocorrect="off" autocapitalize="off"}}
{{combo-box content=actionNames value=actionName}}
{{d-button class="btn-default" action="submit" disabled=formSubmitted label="admin.logs.screened_ips.form.add"}}
{{d-button class="btn-default" action=(action "submit") disabled=formSubmitted label="admin.logs.screened_ips.form.add"}}

View File

@ -2,7 +2,7 @@
<div class="values">
{{#each collection as |value index|}}
<div class="value" data-index={{index}}>
{{d-button action="removeValue"
{{d-button action=(action "removeValue")
actionParam=value
icon="times"
class="remove-value-btn btn-small"}}
@ -16,7 +16,7 @@
<div class="value">
{{text-field value=newKey class="new-value-input key" placeholder=setting.placeholder.key}}
{{input type="password" value=newSecret class="new-value-input secret" placeholder=setting.placeholder.value}}
{{d-button action="addValue"
{{d-button action=(action "addValue")
icon="plus"
class="add-value-btn btn-small"}}
</div>

View File

@ -6,12 +6,12 @@
</div>
{{#if dirty}}
<div class='setting-controls'>
{{d-button class="ok" action="save" icon="check"}}
{{d-button class="cancel" action="cancel" icon="times"}}
{{d-button class="ok" action=(action "save") icon="check"}}
{{d-button class="cancel" action=(action "cancel") icon="times"}}
</div>
{{else if setting.overridden}}
{{#if setting.secret}}
{{d-button action="toggleSecret" icon="eye-slash"}}
{{d-button action=(action "toggleSecret") icon="eye-slash"}}
{{/if}}
{{d-button class="btn-default undo" action="resetDefault" icon="undo" label="admin.settings.reset"}}
{{d-button class="btn-default undo" action=(action "resetDefault") icon="undo" label="admin.settings.reset"}}
{{/if}}

View File

@ -1,2 +1,2 @@
{{d-button label="admin.site_settings.uploaded_image_list.label" action="showUploadModal" actionParam=(hash value=value setting=setting)}}
{{d-button label="admin.site_settings.uploaded_image_list.label" action=(action "showUploadModal") actionParam=(hash value=value setting=setting)}}
<div class='desc'>{{{unbound setting.description}}}</div>

View File

@ -1,4 +1,4 @@
{{d-button label="admin.site_text.edit" class='btn-default edit' action="edit"}}
{{d-button label="admin.site_text.edit" class='btn-default edit' action=editAction actionParam=siteText}}
<h3 class='site-text-id'>{{siteText.id}}</h3>
<div class='site-text-value'>{{siteText.value}}</div>

View File

@ -1,6 +1,6 @@
<label class="btn {{if addDisabled 'disabled'}}">
{{d-icon "upload"}}
{{i18n 'admin.watched_words.form.upload'}}
<input class="hidden-upload-field" disabled={{addDisabled}} type="file" accept="text/plain,text/csv" />
</label>
<span class="instructions">{{i18n 'tagging.upload_instructions'}}</span>
<label class="btn {{if addDisabled 'disabled'}}">
{{d-icon "upload"}}
{{i18n 'admin.watched_words.form.upload'}}
<input class="hidden-upload-field" disabled={{addDisabled}} type="file" accept="text/plain,text/csv" />
</label>
<span class="instructions">{{i18n 'tagging.upload_instructions'}}</span>

View File

@ -2,7 +2,7 @@
<div class='values'>
{{#each collection as |value index|}}
<div class='value' data-index={{index}}>
{{d-button action="removeValue"
{{d-button action=(action "removeValue")
actionParam=value
icon="times"
class="btn-default remove-value-btn btn-small"}}

View File

@ -1,6 +1,6 @@
<b>{{i18n 'admin.watched_words.form.label'}}</b>
{{text-field value=word disabled=formSubmitted class="watched-word-input" autocorrect="off" autocapitalize="off" placeholderKey=placeholderKey}}
{{d-button class="btn-default" action="submit" disabled=formSubmitted label="admin.watched_words.form.add"}}
{{d-button class="btn-default" action=(action "submit") disabled=formSubmitted label="admin.watched_words.form.add"}}
{{#if showMessage}}
<span class="success-message">{{message}}</span>

View File

@ -10,9 +10,9 @@
<label>{{i18n "admin.customize.email_templates.body"}}</label>
{{d-editor value=buffered.body}}
{{#save-controls model=emailTemplate action="saveChanges" saved=saved}}
{{#save-controls model=emailTemplate action=(action "saveChanges") saved=saved}}
{{#if emailTemplate.can_revert}}
{{d-button action="revertChanges" label="admin.customize.email_templates.revert"}}
{{d-button action=(action "revertChanges") label="admin.customize.email_templates.revert"}}
{{/if}}
{{/save-controls}}
</div>

View File

@ -69,7 +69,7 @@
</div>
<div class='buttons'>
{{#d-button action="save" disabled=saveDisabled class='btn-primary'}}
{{#d-button action=(action "save") disabled=saveDisabled class='btn-primary'}}
{{saveButtonText}}
{{/d-button}}
</div>

View File

@ -2,8 +2,8 @@
<div class="title">
{{#if editingName}}
{{text-field value=model.name autofocus="true"}}
{{d-button action="finishedEditingName" class="btn-primary btn-small submit-edit" icon="check"}}
{{d-button action="cancelEditingName" class="btn-small cancel-edit" icon="times"}}
{{d-button action=(action "finishedEditingName") class="btn-primary btn-small submit-edit" icon="check"}}
{{d-button action=(action "cancelEditingName") class="btn-small cancel-edit" icon="times"}}
{{else}}
{{model.name}} <a {{action "startEditingName"}}>{{d-icon "pencil"}}</a>
{{/if}}
@ -36,8 +36,8 @@
{{#unless model.component}}
<div class="control-unit">
{{inline-edit-checkbox action="applyDefault" labelKey="admin.customize.theme.is_default" checked=model.default}}
{{inline-edit-checkbox action="applyUserSelectable" labelKey="admin.customize.theme.user_selectable" checked=model.user_selectable}}
{{inline-edit-checkbox action=(action "applyDefault") labelKey="admin.customize.theme.is_default" checked=model.default}}
{{inline-edit-checkbox action=(action "applyUserSelectable") labelKey="admin.customize.theme.user_selectable" checked=model.user_selectable}}
</div>
<div class="control-unit">
@ -49,8 +49,8 @@
value=colorSchemeId
icon="paint-brush"}}
{{#if colorSchemeChanged}}
{{d-button action="changeScheme" class="btn-primary btn-small submit-edit" icon="check"}}
{{d-button action="cancelChangeScheme" class="btn-default btn-small cancel-edit" icon="times"}}
{{d-button action=(action "changeScheme") class="btn-primary btn-small submit-edit" icon="check"}}
{{d-button action=(action "cancelChangeScheme") class="btn-default btn-small cancel-edit" icon="times"}}
{{/if}}
</div>
{{#link-to 'adminCustomize.colors' class="btn btn-default edit"}}{{i18n 'admin.customize.colors.edit'}}{{/link-to}}
@ -74,13 +74,13 @@
{{#if model.remote_theme}}
{{#if model.remote_theme.commits_behind}}
{{#d-button action="updateToLatest" icon="download" class='btn-primary'}}{{i18n "admin.customize.theme.update_to_latest"}}{{/d-button}}
{{#d-button action=(action "updateToLatest") icon="download" class='btn-primary'}}{{i18n "admin.customize.theme.update_to_latest"}}{{/d-button}}
{{else}}
{{#d-button action="checkForThemeUpdates" icon="refresh" class="btn-default"}}{{i18n "admin.customize.theme.check_for_updates"}}{{/d-button}}
{{#d-button action=(action "checkForThemeUpdates") icon="refresh" class="btn-default"}}{{i18n "admin.customize.theme.check_for_updates"}}{{/d-button}}
{{/if}}
{{/if}}
{{#d-button action="editTheme" class="btn btn-default edit"}}{{i18n 'admin.customize.theme.edit_css_html'}}{{/d-button}}
{{#d-button action=(action "editTheme") class="btn btn-default edit"}}{{i18n 'admin.customize.theme.edit_css_html'}}{{/d-button}}
{{#if model.remote_theme}}
<span class='status-message'>
{{#if updatingRemote}}
@ -119,7 +119,7 @@
<li>
<span class='col'>${{upload.name}}: <a href={{upload.url}} target='_blank'>{{upload.filename}}</a></span>
<span class='col'>
{{d-button action="removeUpload" actionParam=upload class="second btn-default btn-small cancel-edit" icon="times"}}
{{d-button action=(action "removeUpload") actionParam=upload class="second btn-default btn-small cancel-edit" icon="times"}}
</span>
</li>
{{/each}}
@ -127,7 +127,7 @@
{{else}}
<div class="description">{{i18n "admin.customize.theme.no_uploads"}}</div>
{{/if}}
{{#d-button action="addUploadModal" class="btn-default" icon="plus"}}{{i18n "admin.customize.theme.add"}}{{/d-button}}
{{#d-button action=(action "addUploadModal") class="btn-default" icon="plus"}}{{i18n "admin.customize.theme.add"}}{{/d-button}}
</div>
{{#if hasSettings}}
@ -147,14 +147,14 @@
{{#if model.childThemes.length}}
<ul class='removable-list'>
{{#each model.childThemes as |child|}}
<li>{{#link-to 'adminCustomizeThemes.show' child replace=true class='col'}}{{child.name}}{{/link-to}} {{d-button action="removeChildTheme" actionParam=child class="btn-default btn-small cancel-edit col" icon="times"}}</li>
<li>{{#link-to 'adminCustomizeThemes.show' child replace=true class='col'}}{{child.name}}{{/link-to}} {{d-button action=(action "removeChildTheme") actionParam=child class="btn-default btn-small cancel-edit col" icon="times"}}</li>
{{/each}}
</ul>
{{/if}}
{{#if selectableChildThemes}}
<div class="description">
{{combo-box forceEscape=true filterable=true content=selectableChildThemes value=selectedChildThemeId none="admin.customize.theme.select_component"}}
{{#d-button action="addChildTheme" icon="plus" disabled=addButtonDisabled class="btn-default add-component-button"}}{{i18n "admin.customize.theme.add"}}{{/d-button}}
{{#d-button action=(action "addChildTheme") icon="plus" disabled=addButtonDisabled class="btn-default add-component-button"}}{{i18n "admin.customize.theme.add"}}{{/d-button}}
</div>
{{/if}}
</div>
@ -163,6 +163,6 @@
<a href='{{previewUrl}}' title="{{i18n 'admin.customize.explain_preview'}}" target='_blank' class='btn btn-default'>{{d-icon 'desktop'}}{{i18n 'admin.customize.theme.preview'}}</a>
<a class="btn btn-default export" target="_blank" href={{downloadUrl}}>{{d-icon "download"}} {{i18n 'admin.export_json.button_text'}}</a>
{{d-button action="switchType" label="admin.customize.theme.convert" icon=convertIcon class="btn-default btn-normal" title=convertTooltip}}
{{d-button action="destroy" label="admin.customize.delete" icon="trash" class="btn-danger"}}
{{d-button action=(action "switchType") label="admin.customize.theme.convert" icon=convertIcon class="btn-default btn-normal" title=convertTooltip}}
{{d-button action=(action "destroy") label="admin.customize.delete" icon="trash" class="btn-danger"}}
</div>

View File

@ -3,8 +3,8 @@
<div class="create-actions">
{{d-button label="admin.customize.new" icon="plus" action="showCreateModal" class="btn-primary"}}
{{d-button action="importModal" icon="upload" label="admin.customize.import" class="btn-default"}}
{{d-button label="admin.customize.new" icon="plus" action=(route-action "showCreateModal") class="btn-primary"}}
{{d-button action=(route-action "importModal") icon="upload" label="admin.customize.import" class="btn-default"}}
</div>
</div>
{{themes-list themes=fullThemes components=childThemes currentTab=currentTab}}

View File

@ -19,7 +19,7 @@
<p class="actions">
<small>{{i18n 'admin.dashboard.last_checked'}}: {{problemsTimestamp}}</small>
{{d-button action="refreshProblems" class="btn-default btn-small" icon="refresh" label="admin.dashboard.refresh_problems"}}
{{d-button action=(action "refreshProblems") class="btn-default btn-small" icon="refresh" label="admin.dashboard.refresh_problems"}}
</p>
{{/conditional-loading-section}}
</div>

View File

@ -9,7 +9,7 @@
{{i18n "admin.dashboard.community_health"}}
</a>
</h2>
{{period-chooser period=period action="changePeriod" content=availablePeriods fullDay=true}}
{{period-chooser period=period action=(action "changePeriod") content=availablePeriods fullDay=true}}
</div>
<div class="section-body">

View File

@ -10,7 +10,7 @@
</h2>
{{period-chooser
period=period
action="changePeriod"
action=(action "changePeriod")
content=availablePeriods
fullDay=true}}
</div>

View File

@ -1,4 +1,4 @@
{{#load-more selector=".email-list tr" action="loadMore"}}
{{#load-more selector=".email-list tr" action=(action "loadMore")}}
<table class='table email-list'>
<thead>
<tr>

View File

@ -1,4 +1,4 @@
{{#load-more selector=".email-list tr" action="loadMore"}}
{{#load-more selector=".email-list tr" action=(action "loadMore")}}
<table class='table email-list'>
<thead>
<tr>

View File

@ -1,4 +1,4 @@
{{#load-more selector=".email-list tr" action="loadMore"}}
{{#load-more selector=".email-list tr" action=(action "loadMore")}}
<table class='table email-list'>
<thead>
<tr>

View File

@ -1,4 +1,4 @@
{{#load-more selector=".email-list tr" action="loadMore"}}
{{#load-more selector=".email-list tr" action=(action "loadMore")}}
<table class='table email-list'>
<thead>
<tr>

View File

@ -1,4 +1,4 @@
{{#load-more selector=".email-list tr" action="loadMore"}}
{{#load-more selector=".email-list tr" action=(action "loadMore")}}
<table class='table email-list'>
<thead>
<tr>

View File

@ -10,7 +10,7 @@
</thead>
<tbody>
{{#each embedding.embeddable_hosts as |host|}}
{{embeddable-host host=host deleteHost="deleteHost"}}
{{embeddable-host host=host deleteHost=(action "deleteHost")}}
{{/each}}
</tbody>
</table>
@ -18,7 +18,7 @@
<p>{{i18n "admin.embedding.get_started"}}</p>
{{/if}}
{{d-button label="admin.embedding.add_host" action="addHost" icon="plus" class="btn-primary add-host"}}
{{d-button label="admin.embedding.add_host" action=(action "addHost") icon="plus" class="btn-primary add-host"}}
</div>
{{#if showSecondary}}
@ -69,7 +69,7 @@
<div class='embedding-secondary'>
{{d-button label="admin.embedding.save"
action="saveChanges"
action=(action "saveChanges")
class="btn-primary embed-save"
disabled=embedding.isSaving}}

View File

@ -3,7 +3,7 @@
<p class="desc">{{i18n 'admin.emoji.help'}}</p>
<p>{{emoji-uploader done="emojiUploaded"}}</p>
<p>{{emoji-uploader done=(action "emojiUploaded")}}</p>
{{#if sortedEmojis}}
<div>

View File

@ -30,7 +30,7 @@
<td class="created_at"><div class="label">{{i18n 'admin.logs.created_at'}}</div>{{age-with-tooltip item.created_at}}</td>
<td class="ip_address">{{item.ip_address}}</td>
<td class="action">
{{d-button action="clearBlock" actionParam=item icon="check" label="admin.logs.screened_emails.actions.allow"}}
{{d-button action=(action "clearBlock") actionParam=item icon="check" label="admin.logs.screened_emails.actions.allow"}}
</td>
</tr>
{{/each}}

View File

@ -3,10 +3,10 @@
<div class="screened-ip-controls">
<div class="filter-screened-ip-address">
{{text-field value=filter class="ip-address-input" placeholderKey="admin.logs.screened_ips.form.filter" autocorrect="off" autocapitalize="off"}}
{{d-button class="btn-default" action="rollUp" title="admin.logs.screened_ips.roll_up.title" label="admin.logs.screened_ips.roll_up.text"}}
{{d-button class="btn-default" action="exportScreenedIpList" icon="download" title="admin.export_csv.button_title.screened_ip" label="admin.export_csv.button_text"}}
{{d-button class="btn-default" action=(action "rollUp") title="admin.logs.screened_ips.roll_up.title" label="admin.logs.screened_ips.roll_up.text"}}
{{d-button class="btn-default" action=(action "exportScreenedIpList") icon="download" title="admin.export_csv.button_title.screened_ip" label="admin.export_csv.button_text"}}
</div>
{{screened-ip-address-form action="recordAdded"}}
{{screened-ip-address-form action=(action "recordAdded")}}
</div>
@ -57,15 +57,15 @@
</td>
<td class="col actions">
{{#unless item.editing}}
{{d-button class="btn-default" action="destroy" actionParam=item icon="trash-o" class="btn-danger"}}
{{d-button class="btn-default"action="edit" actionParam=item icon="pencil"}}
{{d-button class="btn-default" action=(action "destroy") actionParam=item icon="trash-o" class="btn-danger"}}
{{d-button class="btn-default"action=(action "edit") actionParam=item icon="pencil"}}
{{#if item.isBlocked}}
{{d-button class="btn-default" action="allow" actionParam=item icon="check" label="admin.logs.screened_ips.actions.do_nothing"}}
{{d-button class="btn-default" action=(action "allow") actionParam=item icon="check" label="admin.logs.screened_ips.actions.do_nothing"}}
{{else}}
{{d-button class="btn-default" action="block" actionParam=item icon="ban" label="admin.logs.screened_ips.actions.block"}}
{{d-button class="btn-default" action=(action "block") actionParam=item icon="ban" label="admin.logs.screened_ips.actions.block"}}
{{/if}}
{{else}}
{{d-button class="btn-default" action="save" actionParam=item label="admin.logs.save"}}
{{d-button class="btn-default" action=(action "save") actionParam=item label="admin.logs.save"}}
<a {{action "cancel" item}}>{{i18n 'cancel'}}</a>
{{/unless}}
</td>

View File

@ -33,7 +33,7 @@
{{i18n "admin.logs.staff_actions.filter"}} {{combo-box content=userHistoryActions value=filterActionId none="admin.logs.staff_actions.all"}}
{{/if}}
{{d-button class="btn-default" action="exportStaffActionLogs" label="admin.export_csv.button_text" icon="download"}}
{{d-button class="btn-default" action=(action "exportStaffActionLogs") label="admin.export_csv.button_text" icon="download"}}
</div>
<div class="clearfix"></div>

View File

@ -17,6 +17,6 @@
{{/d-modal-body}}
<div class="modal-footer">
{{d-button action="upload" disabled=disabled class='btn btn-primary' icon='upload' label='admin.customize.theme.upload'}}
{{d-modal-cancel close=(action "closeModal")}}
{{d-button action=(action "upload") disabled=disabled class='btn btn-primary' icon='upload' label='admin.customize.theme.upload'}}
{{d-modal-cancel close=(route-action "closeModal")}}
</div>

View File

@ -25,6 +25,6 @@
{{/d-modal-body}}
<div class="modal-footer">
{{d-button class="btn btn-primary" label="admin.customize.theme.create" action="createTheme" disabled=saving}}
{{d-modal-cancel close=(action "closeModal")}}
{{d-button class="btn btn-primary" label="admin.customize.theme.create" action=(action "createTheme") disabled=saving}}
{{d-modal-cancel close=(route-action "closeModal")}}
</div>

View File

@ -26,5 +26,5 @@
<div class="modal-footer">
<button class='btn btn-primary' {{action "saveAll"}} disabled={{submitDisabled}}>{{i18n 'admin.badges.save'}}</button>
{{d-modal-cancel close=(action "closeModal")}}
{{d-modal-cancel close=(route-action "closeModal")}}
</div>

View File

@ -44,6 +44,6 @@
{{/d-modal-body}}
<div class="modal-footer">
{{d-button action="importTheme" disabled=importDisabled class='btn btn-primary' icon='upload' label='admin.customize.import'}}
{{d-modal-cancel close=(action "closeModal")}}
{{d-button action=(action "importTheme") disabled=importDisabled class='btn btn-primary' icon='upload' label='admin.customize.import'}}
{{d-modal-cancel close=(route-action "closeModal")}}
</div>

View File

@ -19,5 +19,5 @@
{{/conditional-loading-spinner}}
{{/d-modal-body}}
<div class="modal-footer">
{{d-button action=(action "closeModal") label="close"}}
{{d-button action=(route-action "closeModal") label="close"}}
</div>

View File

@ -27,10 +27,10 @@
<div class="modal-footer">
{{d-button
class="btn-danger perform-silence"
action="silence"
action=(action "silence")
disabled=submitDisabled
icon="microphone-slash"
label="admin.user.silence"}}
{{d-modal-cancel close=(action "closeModal")}}
{{d-modal-cancel close=(route-action "closeModal")}}
{{conditional-loading-spinner condition=loading size="small"}}
</div>

View File

@ -2,5 +2,5 @@
<pre>{{model.details}}</pre>
{{/d-modal-body}}
<div class="modal-footer">
{{d-button action=(action "closeModal") label="close"}}
{{d-button action=(route-action "closeModal") label="close"}}
</div>

View File

@ -34,10 +34,10 @@
<div class="modal-footer">
{{d-button
class="btn-danger perform-suspend"
action="suspend"
action=(action "suspend")
disabled=submitDisabled
icon="ban"
label="admin.user.suspend"}}
{{d-modal-cancel close=(action "closeModal")}}
{{d-modal-cancel close=(route-action "closeModal")}}
{{conditional-loading-spinner condition=loading size="small"}}
</div>

View File

@ -3,6 +3,6 @@
{{{diff}}}
{{/d-modal-body}}
<div class="modal-footer">
<button class='btn btn-primary' {{action "closeModal"}}>{{i18n 'close'}}</button>
{{d-button class="btn btn-primary" action=(route-action "closeModal") label="close"}}
</div>
</div>

View File

@ -11,5 +11,5 @@
{{/d-modal-body}}
<div class="modal-footer">
{{d-button action=(action "close") label="close"}}
{{images-uploader uploading=uploading done="uploadDone" class="pull-right"}}
{{images-uploader uploading=uploading done=(action "uploadDone") class="pull-right"}}
</div>

View File

@ -4,7 +4,7 @@
<div class="permalink-search">
{{text-field value=filter class="url-input" placeholderKey="admin.permalink.form.filter" autocorrect="off" autocapitalize="off"}}
</div>
{{permalink-form action="recordAdded"}}
{{permalink-form action=(action "recordAdded")}}
<br/>
{{#conditional-loading-spinner condition=loading}}
@ -42,7 +42,7 @@
{{/if}}
</td>
<td class="col action">
{{d-button action="destroy" actionParam=pl icon="trash-o" class="btn-danger"}}
{{d-button action=(action "destroy") actionParam=pl icon="trash-o" class="btn-danger"}}
</td>
</tr>
{{/each}}

View File

@ -49,7 +49,7 @@
<td class="settings">
{{#if currentUser.admin}}
{{#if plugin.enabled_setting}}
{{d-button class="btn-default" action="showSettings" actionParam=plugin icon="gear" label="admin.plugins.change_settings_short"}}
{{d-button class="btn-default" action=(route-action "showSettings") actionParam=plugin icon="gear" label="admin.plugins.change_settings_short"}}
{{/if}}
{{/if}}
</td>

View File

@ -1,16 +1,16 @@
<div class='admin-controls'>
<div class='controls'>
{{d-button action="toggleMenu" class="menu-toggle" icon="bars"}}
{{d-button action=(action "toggleMenu") class="menu-toggle" icon="bars"}}
{{#if currentUser.admin}}
{{d-button label="admin.plugins.change_settings"
icon="gear"
class="btn-default settings-button"
action="showSettings"}}
action=(route-action "showSettings")}}
{{/if}}
</div>
</div>
<div class="admin-nav pull-left">

View File

@ -1,9 +1,9 @@
<div class='admin-controls'>
<div class='controls'>
{{d-button action="toggleMenu" class="menu-toggle" icon="bars"}}
{{d-button action=(action "toggleMenu") class="menu-toggle" icon="bars"}}
{{text-field id="setting-filter" value=filter placeholderKey="type_to_filter" class="no-blur"}}
{{d-button class="btn-default" id="clear-filter" action="clearFilter" label="admin.site_settings.clear_filter"}}
{{d-button class="btn-default" id="clear-filter" action=(action "clearFilter") label="admin.site_settings.clear_filter"}}
</div>
<div class='search controls'>
<label>

View File

@ -6,9 +6,9 @@
{{expanding-text-area value=buffered.value rows="1" class="site-text-value"}}
{{#save-controls model=siteText action="saveChanges" saved=saved}}
{{#save-controls model=siteText action=(action "saveChanges") saved=saved}}
{{#if siteText.can_revert}}
{{d-button action="revertChanges" label="admin.site_text.revert" class="revert-site-text"}}
{{d-button action=(action "revertChanges") label="admin.site_text.revert" class="revert-site-text"}}
{{/if}}
{{/save-controls}}

View File

@ -5,10 +5,10 @@
placeholderKey="admin.site_text.search"
class="no-blur site-text-search"
autofocus="true"
key-up="search"}}
key-up=(action "search")}}
<div class='extra-options'>
{{d-checkbox label="admin.site_text.show_overriden" checked=overridden change="search"}}
{{d-checkbox label="admin.site_text.show_overriden" checked=overridden change=(action "search")}}
</div>
</div>
@ -18,6 +18,6 @@
{{/if}}
{{#each siteTexts as |siteText|}}
{{site-text-summary siteText=siteText editAction="edit" term=q searchRegex=siteTexts.extras.regex}}
{{site-text-summary siteText=siteText editAction=(action "edit") term=q searchRegex=siteTexts.extras.regex}}
{{/each}}
{{/conditional-loading-spinner}}

View File

@ -9,15 +9,15 @@
fieldTypes=fieldTypes
firstField=sortedFields.firstObject
lastField=sortedFields.lastObject
destroyAction="destroy"
moveUpAction="moveUp"
moveDownAction="moveDown"}}
destroyAction=(action "destroy")
moveUpAction=(action "moveUp")
moveDownAction=(action "moveDown")}}
{{/each}}
{{/if}}
{{d-button disabled=createDisabled
class="btn-primary"
action="createField"
action=(action "createField")
label="admin.user_fields.create"
icon="plus"}}

View File

@ -8,11 +8,11 @@
{{/if}}
{{#if model.can_view_action_logs}}
{{d-button action="viewActionLogs" class="btn-default" actionParam=model.username icon="list-alt" label="admin.user.action_logs"}}
{{d-button action=(action "viewActionLogs") class="btn-default" actionParam=model.username icon="list-alt" label="admin.user.action_logs"}}
{{/if}}
{{#if model.active}}
{{#if currentUser.admin}}
{{d-button class="btn-default" action="logOut" icon="power-off" label="admin.user.log_out"}}
{{d-button class="btn-default" action=(action "logOut") icon="power-off" label="admin.user.log_out"}}
{{/if}}
{{/if}}
{{plugin-outlet name="admin-user-controls-after" args=(hash model=model) tagName="" connectorTagName=""}}
@ -44,7 +44,7 @@
{{#if model.email}}
<a href="mailto:{{unbound model.email}}">{{model.email}}</a>
{{else}}
{{d-button class="btn-default" action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{d-button class="btn-default" action=(route-action "checkEmail") actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{/if}}
</div>
</div>
@ -64,7 +64,7 @@
{{i18n 'user.email.no_secondary'}}
{{/if}}
{{else}}
{{d-button action="checkEmail"
{{d-button action=(route-action "checkEmail")
class="btn-default"
actionParam=model
icon="envelope-o"
@ -79,7 +79,7 @@
<div class='value'>{{model.bounceScore}}</div>
<div class='controls'>
{{#if model.canResetBounceScore}}
{{d-button class="btn-default" action="resetBounceScore" label="admin.user.reset_bounce_score.label" title="admin.user.reset_bounce_score.title"}}
{{d-button class="btn-default" action=(action "resetBounceScore") label="admin.user.reset_bounce_score.label" title="admin.user.reset_bounce_score.title"}}
{{/if}}
{{model.bounceScoreExplanation}}
</div>
@ -91,7 +91,7 @@
{{#if associatedAccountsLoaded}}
{{associatedAccounts}}
{{else}}
{{d-button class="btn-default" action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{d-button class="btn-default" action=(route-action "checkEmail") actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{/if}}
</div>
</div>
@ -117,7 +117,7 @@
<div class='value'>{{model.ip_address}}</div>
<div class='controls'>
{{#if currentUser.staff}}
{{d-button class="btn-default" action="refreshBrowsers" label="admin.user.refresh_browsers"}}
{{d-button class="btn-default" action=(action "refreshBrowsers") label="admin.user.refresh_browsers"}}
{{ip-lookup ip=model.ip_address userId=model.id}}
{{/if}}
</div>
@ -156,7 +156,7 @@
</div>
<div class='controls'>
{{#if canDisableSecondFactor}}
{{d-button class="btn-default" action="disableSecondFactor" icon="unlock-alt" label="user.second_factor.disable"}}
{{d-button class="btn-default" action=(action "disableSecondFactor") icon="unlock-alt" label="user.second_factor.disable"}}
{{/if}}
</div>
</div>
@ -201,7 +201,7 @@
{{i18n 'admin.user.approve_success'}}
{{else}}
{{#if model.can_approve}}
{{d-button class="btn-default" action="approve" icon="check" label="admin.user.approve"}}
{{d-button class="btn-default" action=(action "approve") icon="check" label="admin.user.approve"}}
{{/if}}
{{/if}}
</div>
@ -214,15 +214,15 @@
<div class='controls'>
{{#if model.active}}
{{#if model.can_deactivate}}
{{d-button class="btn-default" action="deactivate" label="admin.user.deactivate_account"}}
{{d-button class="btn-default" action=(action "deactivate") label="admin.user.deactivate_account"}}
{{i18n 'admin.user.deactivate_explanation'}}
{{/if}}
{{else}}
{{#if model.can_send_activation_email}}
{{d-button class="btn-default" action="sendActivationEmail" icon="envelope" label="admin.user.send_activation_email"}}
{{d-button class="btn-default" action=(action "sendActivationEmail") icon="envelope" label="admin.user.send_activation_email"}}
{{/if}}
{{#if model.can_activate}}
{{d-button class="btn-default" action="activate" icon="check" label="admin.user.activate"}}
{{d-button class="btn-default" action=(action "activate") icon="check" label="admin.user.activate"}}
{{/if}}
{{/if}}
</div>
@ -240,15 +240,15 @@
{{#if model.api_key}}
<div class='long-value'>
{{model.api_key.key}}
{{d-button class="btn-default" action="regenerateApiKey" icon="undo" label="admin.api.regenerate"}}
{{d-button class="btn-default" action="revokeApiKey" icon="times" label="admin.api.revoke"}}
{{d-button class="btn-default" action=(action "regenerateApiKey") icon="undo" label="admin.api.regenerate"}}
{{d-button class="btn-default" action=(action "revokeApiKey") icon="times" label="admin.api.revoke"}}
</div>
{{else}}
<div class='value'>
&mdash;
</div>
<div class='controls'>
{{d-button class="btn-default" action="generateApiKey" icon="key" label="admin.api.generate"}}
{{d-button class="btn-default" action=(action "generateApiKey") icon="key" label="admin.api.generate"}}
</div>
{{/if}}
</div>
@ -259,10 +259,10 @@
<div class='value'>{{i18n-yes-no model.admin}}</div>
<div class='controls'>
{{#if model.can_revoke_admin}}
{{d-button class="btn-default" action="revokeAdmin" icon="shield" label="admin.user.revoke_admin"}}
{{d-button class="btn-default" action=(action "revokeAdmin") icon="shield" label="admin.user.revoke_admin"}}
{{/if}}
{{#if model.can_grant_admin}}
{{d-button class="btn-default" action="grantAdmin" icon="shield" label="admin.user.grant_admin"}}
{{d-button class="btn-default" action=(action "grantAdmin") icon="shield" label="admin.user.grant_admin"}}
{{/if}}
</div>
</div>
@ -272,10 +272,10 @@
<div class='value'>{{i18n-yes-no model.moderator}}</div>
<div class='controls'>
{{#if model.can_revoke_moderation}}
{{d-button class="btn-default" action="revokeModeration" icon="shield" label="admin.user.revoke_moderation"}}
{{d-button class="btn-default" action=(action "revokeModeration") icon="shield" label="admin.user.revoke_moderation"}}
{{/if}}
{{#if model.can_grant_moderation}}
{{d-button class="btn-default" action="grantModeration" icon="shield" label="admin.user.grant_moderation"}}
{{d-button class="btn-default" action=(action "grantModeration") icon="shield" label="admin.user.grant_moderation"}}
{{/if}}
</div>
</div>
@ -286,8 +286,8 @@
{{combo-box content=site.trustLevels value=model.trust_level nameProperty="detailedName"}}
{{#if model.dirty}}
<div>
{{d-button class="ok no-text" action="saveTrustLevel" icon="check"}}
{{d-button class="cancel no-text" action="restoreTrustLevel" icon="times"}}
{{d-button class="ok no-text" action=(action "saveTrustLevel") icon="check"}}
{{d-button class="cancel no-text" action=(action "restoreTrustLevel") icon="times"}}
</div>
{{/if}}
</div>
@ -295,10 +295,10 @@
{{#if model.canLockTrustLevel}}
{{#if hasLockedTrustLevel}}
{{d-icon "lock" title="admin.user.trust_level_locked_tip"}}
{{d-button class="btn-default" action="lockTrustLevel" actionParam=false label="admin.user.unlock_trust_level"}}
{{d-button class="btn-default" action=(action "lockTrustLevel") actionParam=false label="admin.user.unlock_trust_level"}}
{{else}}
{{d-icon "unlock" title="admin.user.trust_level_unlocked_tip"}}
{{d-button class="btn-default" action="lockTrustLevel" actionParam=true label="admin.user.lock_trust_level"}}
{{d-button class="btn-default" action=(action "lockTrustLevel") actionParam=true label="admin.user.lock_trust_level"}}
{{/if}}
{{/if}}
{{#if model.tl3Requirements}}
@ -367,7 +367,7 @@
{{#if model.silenced}}
{{d-button
class="btn-danger unsilence-user"
action="unsilence"
action=(action "unsilence")
icon="microphone-slash"
label="admin.user.unsilence"}}
{{i18n 'admin.user.silence_explanation'}}
@ -429,8 +429,8 @@
</div>
{{#if customGroupsDirty}}
<div class='controls'>
{{d-button icon="check" class="ok" action="saveCustomGroups"}}
{{d-button icon="times" class="cancel" action="resetCustomGroups"}}
{{d-button icon="check" class="ok" action=(action "saveCustomGroups")}}
{{d-button icon="times" class="cancel" action=(action "resetCustomGroups")}}
</div>
{{/if}}
</div>
@ -442,8 +442,8 @@
</div>
{{#if primaryGroupDirty}}
<div class='controls'>
{{d-button icon="check" class="ok" action="savePrimaryGroup"}}
{{d-button icon="times" class="cancel" action="resetPrimaryGroup"}}
{{d-button icon="check" class="ok" action=(action "savePrimaryGroup")}}
{{d-button icon="times" class="cancel" action=(action "resetPrimaryGroup")}}
</div>
{{/if}}
</div>
@ -480,7 +480,7 @@
<div class='controls'>
{{#if model.can_delete_all_posts}}
{{#if model.post_count}}
{{d-button class="btn-danger" action="deleteAllPosts" icon="trash-o" label="admin.user.delete_all_posts"}}
{{d-button class="btn-danger" action=(action "deleteAllPosts") icon="trash-o" label="admin.user.delete_all_posts"}}
{{/if}}
{{else}}
{{deleteAllPostsExplanation}}
@ -563,7 +563,7 @@
<div class="pull-right">
{{#if model.active}}
{{#if model.can_impersonate}}
{{d-button class="btn-danger" action="impersonate" icon="crosshairs" label="admin.impersonate.title" title="admin.impersonate.help"}}
{{d-button class="btn-danger" action=(action "impersonate") icon="crosshairs" label="admin.impersonate.title" title="admin.impersonate.help"}}
{{/if}}
{{/if}}
@ -571,14 +571,14 @@
{{d-button label="admin.user.anonymize"
icon="exclamation-triangle"
class="btn-danger"
action="anonymize"}}
action=(action "anonymize")}}
{{/if}}
{{#if model.canBeDeleted}}
{{d-button label="admin.user.delete"
icon="exclamation-triangle"
class="btn-danger"
action="destroy"}}
action=(action "destroy")}}
{{/if}}
</div>

View File

@ -14,10 +14,10 @@
{{nav-item route='groups' label='groups.index.title'}}
<div class="admin-actions">
{{#unless siteSettings.enable_sso}}
{{d-button class="btn-default" action="sendInvites" title="admin.invite.button_title" icon="user-plus" label="admin.invite.button_text"}}
{{d-button class="btn-default" action=(route-action "sendInvites") title="admin.invite.button_title" icon="user-plus" label="admin.invite.button_text"}}
{{/unless}}
{{#if currentUser.admin}}
{{d-button class="btn-default" action="exportUsers" title="admin.export_csv.button_title.user" icon="download" label="admin.export_csv.button_text"}}
{{d-button class="btn-default" action=(route-action "exportUsers") title="admin.export_csv.button_title.user" icon="download" label="admin.export_csv.button_text"}}
{{/if}}
</div>
</ul>

View File

@ -5,11 +5,11 @@
<div class="watched-word-controls">
{{watched-word-form
actionKey=actionNameKey
action="recordAdded"
action=(action "recordAdded")
filteredContent=filteredContent
regularExpressions=adminWatchedWords.regularExpressions}}
{{watched-word-uploader uploading=uploading actionKey=actionNameKey done="uploadComplete"}}
{{watched-word-uploader uploading=uploading actionKey=actionNameKey done=(action "uploadComplete")}}
</div>
<div>
<label class="show-words-checkbox">
@ -20,7 +20,7 @@
<div class="watched-words-list">
{{#if showWordsList}}
{{#each filteredContent as |word| }}
<div class="watched-word-box">{{admin-watched-word word=word action="recordRemoved"}}</div>
<div class="watched-word-box">{{admin-watched-word word=word action=(action "recordRemoved")}}</div>
{{/each}}
{{else}}
{{i18n 'admin.watched_words.word_count' count=wordCount}}

View File

@ -1,8 +1,8 @@
<div class='admin-controls'>
<div class='controls'>
{{d-button action="toggleMenu" class="menu-toggle" icon="bars"}}
{{d-button action=(action "toggleMenu") class="menu-toggle" icon="bars"}}
{{text-field value=filter placeholderKey="admin.watched_words.search" class="no-blur"}}
{{d-button action="clearFilter" label="admin.watched_words.clear_filter"}}
{{d-button action=(action "clearFilter") label="admin.watched_words.clear_filter"}}
</div>
</div>

View File

@ -2,7 +2,7 @@
{{#link-to 'adminWebHooks' tagName='button' classNames='btn'}}
{{d-icon 'list'}} {{i18n 'admin.web_hooks.events.go_list'}}
{{/link-to}}
{{d-button icon="paper-plane" label="admin.web_hooks.events.ping" action="ping" disabled=pingDisabled}}
{{d-button icon="paper-plane" label="admin.web_hooks.events.ping" action=(action "ping") disabled=pingDisabled}}
{{#link-to 'adminWebHooks.show' model.extras.web_hook_id tagName='button' classNames='btn'}}
{{d-icon 'far-edit'}} {{i18n 'admin.web_hooks.events.go_details'}}
{{/link-to}}
@ -10,7 +10,7 @@
<div class='web-hook-events-listing'>
{{#if model}}
{{#load-more selector=".web-hook-events li" action="loadMore"}}
{{#load-more selector=".web-hook-events li" action=(action "loadMore")}}
<div class='web-hook-events content-list'>
<div class='heading-container'>
<div class='col heading first status'>{{i18n 'admin.web_hooks.events.status'}}</div>

View File

@ -81,9 +81,10 @@
</form>
<div class='controls'>
<button class='btn btn-default' {{action 'save'}} disabled={{saveButtonDisabled}}>{{saveButtonText}}</button>
{{d-button class="btn-default" translatedLabel=saveButtonText action=(action "save") disabled=saveButtonDisabled}}
{{#unless model.isNew}}
{{d-button class="btn-danger" label="admin.web_hooks.destroy" action="destroy"}}
{{d-button class="btn-danger" label="admin.web_hooks.destroy" action=(action "destroy")}}
{{#link-to 'adminWebHooks.showEvents' model.id class="btn"}}
{{i18n 'admin.web_hooks.events.go_events'}}
{{/link-to}}

View File

@ -7,7 +7,7 @@
{{/link-to}}
</div>
{{#if model}}
{{#load-more selector=".web-hooks tr" action="loadMore"}}
{{#load-more selector=".web-hooks tr" action=(action "loadMore")}}
<table class='web-hooks grid'>
<thead>
<tr>
@ -25,7 +25,7 @@
<td class='description'>{{webHook.description}}</td>
<td class='controls'>
{{#link-to 'adminWebHooks.show' webHook tagName='button' classNames='btn btn-default no-text'}}{{d-icon 'far-edit'}}{{/link-to}}
{{d-button class="destroy btn-danger" action='destroy' actionParam=webHook icon="remove"}}
{{d-button class="destroy btn-danger" action=(action "destroy") actionParam=webHook icon="remove"}}
</td>
</tr>
{{/each}}

View File

@ -24,10 +24,6 @@ RawHandlebars.helpers["get"] = function(context, options) {
context = context.slice(context.indexOf(".") + 1);
}
if (val && val.isDescriptor) {
return Em.get(firstContext, context);
}
return val === undefined ? Em.get(firstContext, context) : val;
};

View File

@ -29,10 +29,10 @@ export default DropdownSelectBoxComponent.extend({
onSelect(id) {
switch (id) {
case "notYou":
this.sendAction("showToken", this.get("token"));
this.showToken(this.get("token"));
break;
case "logOut":
this.sendAction("revokeAuthToken", this.get("token"));
this.revokeAuthToken(this.get("token"));
break;
}
}

View File

@ -24,7 +24,7 @@ export default Em.Component.extend(UploadMixin, {
uploadedAvatarId: upload.id
});
this.sendAction("done");
this.done();
},
@computed("user_id")

View File

@ -17,7 +17,7 @@ export default Em.Component.extend(UploadMixin, {
},
uploadDone() {
this.sendAction("done");
this.done();
},
calculateUploadUrl() {

View File

@ -66,11 +66,5 @@ export default Ember.Component.extend({
}
return false;
}
},
actions: {
showInserted() {
this.sendAction("showInserted");
}
}
});

View File

@ -12,7 +12,11 @@ export default Ember.Component.extend({
},
title: "topics.bulk.actions"
});
controller.set("refreshClosure", () => this.sendAction());
const action = this.get("action");
if (action) {
controller.set("refreshClosure", () => action());
}
}
}
});

View File

@ -22,6 +22,6 @@ export default Ember.Component.extend({
click(e) {
e.preventDefault();
this.sendAction("selectColor", this.get("color"));
this.selectColor(this.get("color"));
}
});

View File

@ -58,7 +58,7 @@ export default Ember.Component.extend(KeyEnterEscape, {
},
keyUp() {
this.sendAction("typed");
this.typed();
const lastKeyUp = new Date();
this._lastKeyUp = lastKeyUp;
@ -117,6 +117,6 @@ export default Ember.Component.extend(KeyEnterEscape, {
},
click() {
this.sendAction("openIfDraft");
this.openIfDraft();
}
});

View File

@ -546,7 +546,7 @@ export default Ember.Component.extend({
const $e = $(e);
var name = $e.data("name");
if (found.indexOf(name) === -1) {
this.sendAction("groupsMentioned", [
this.groupsMentioned([
{
name: name,
user_count: $e.data("mentionable-user-count"),
@ -590,7 +590,7 @@ export default Ember.Component.extend({
$preview.find('.mention.cannot-see[data-name="' + name + '"]')
.length > 0
) {
this.sendAction("cannotSeeMention", [{ name: name }]);
this.cannotSeeMention([{ name }]);
found.push(name);
}
},
@ -789,23 +789,27 @@ export default Ember.Component.extend({
this._teardownInputPreviewSync();
},
showUploadSelector(toolbarEvent) {
this.send("showUploadSelector", toolbarEvent);
},
onExpandPopupMenuOptions(toolbarEvent) {
const selected = toolbarEvent.selected;
toolbarEvent.selectText(selected.start, selected.end - selected.start);
this.storeToolbarState(toolbarEvent);
},
actions: {
importQuote(toolbarEvent) {
this.sendAction("importQuote", toolbarEvent);
this.importQuote(toolbarEvent);
},
onExpandPopupMenuOptions(toolbarEvent) {
const selected = toolbarEvent.selected;
toolbarEvent.selectText(selected.start, selected.end - selected.start);
this.sendAction("storeToolbarState", toolbarEvent);
this.onExpandPopupMenuOptions(toolbarEvent);
},
togglePreview() {
this.sendAction("togglePreview");
},
showUploadModal(toolbarEvent) {
this.sendAction("showUploadSelector", toolbarEvent);
this.togglePreview();
},
extraButtons(toolbar) {
@ -813,7 +817,7 @@ export default Ember.Component.extend({
id: "quote",
group: "fontStyles",
icon: "comment-o",
sendAction: "importQuote",
sendAction: this.get("importQuote"),
title: "composer.quote_post_title",
unshift: true
});
@ -824,7 +828,7 @@ export default Ember.Component.extend({
group: "insertions",
icon: this.get("uploadIcon"),
title: "upload",
sendAction: "showUploadModal"
sendAction: this.get("showUploadModal")
});
}
@ -833,7 +837,7 @@ export default Ember.Component.extend({
group: "extras",
icon: "gear",
title: "composer.options",
sendAction: "onExpandPopupMenuOptions",
sendAction: this.onExpandPopupMenuOptions.bind(this),
popupMenu: true
});
@ -843,7 +847,7 @@ export default Ember.Component.extend({
group: "mobileExtras",
icon: "television",
title: "composer.show_preview",
sendAction: "togglePreview"
sendAction: this.get("togglePreview")
});
}
},
@ -952,7 +956,7 @@ export default Ember.Component.extend({
}
this.trigger("previewRefreshed", $preview);
this.sendAction("afterRefresh", $preview);
this.afterRefresh($preview);
}
}
});

View File

@ -16,7 +16,7 @@ export default Ember.Component.extend({
actions: {
closeMessage() {
this.sendAction("closeMessage", this.get("message"));
this.closeMessage(this.get("message"));
}
}
});

View File

@ -166,7 +166,7 @@ export default Ember.Component.extend({
if (similarTopics.get("length") > 0) {
message.set("similarTopics", similarTopics);
this.send("popup", message);
} else if (message) {
} else if (message && !(this.isDestroyed || this.isDestroying)) {
this.send("hideMessage", message);
}
});
@ -200,10 +200,7 @@ export default Ember.Component.extend({
// Checking composer messages on replies can give us a list of links to check for
// duplicates
if (messages.extras && messages.extras.duplicate_lookup) {
this.sendAction(
"addLinkLookup",
new LinkLookup(messages.extras.duplicate_lookup)
);
this.addLinkLookup(new LinkLookup(messages.extras.duplicate_lookup));
}
this.set("checkedMessages", true);

View File

@ -12,7 +12,7 @@ export default Ember.Component.extend({
if (!this.get("disabled") && e.keyCode === 13) {
e.preventDefault();
e.stopPropagation();
this.sendAction();
this.action();
return false;
}
});

View File

@ -37,7 +37,12 @@ export default Ember.Component.extend({
},
click() {
this.sendAction("action", this.get("actionParam"));
if (typeof this.get("action") === "string") {
this.sendAction("action", this.get("actionParam"));
} else {
this.get("action")(this.get("actionParam"));
}
return false;
}
});

View File

@ -13,7 +13,7 @@ export default Ember.Component.extend({
// In Ember 13.3 we can use action on the checkbox `{{input}}` but not in 1.11
this.$("input").on("click.d-checkbox", () => {
Ember.run.scheduleOnce("afterRender", () =>
this.sendAction("change", this.$("input").prop("checked"))
this.change(this.$("input").prop("checked"))
);
});
},

View File

@ -51,7 +51,7 @@ export default Ember.Component.extend({
actions: {
ok() {
this.set("hidden", true);
this.sendAction("okAction");
this.okAction();
},
cancel() {

View File

@ -7,9 +7,6 @@ import {
import { categoryHashtagTriggerRule } from "discourse/lib/category-hashtags";
import { search as searchCategoryTag } from "discourse/lib/category-tag-search";
import { cookAsync } from "discourse/lib/text";
import { translations } from "pretty-text/emoji/data";
import { emojiSearch, isSkinTonableEmoji } 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 { siteDir } from "discourse/lib/text-direction";
@ -20,6 +17,9 @@ import {
import toMarkdown from "discourse/lib/to-markdown";
import deprecated from "discourse-common/lib/deprecated";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import { translations } from "pretty-text/emoji/data";
import { emojiSearch, isSkinTonableEmoji } from "pretty-text/emoji";
import { emojiUrlFor } from "discourse/lib/text";
// Our head can be a static string or a function that returns a string
// based on input (like for numbered lists).
@ -55,6 +55,7 @@ class Toolbar {
constructor(opts) {
const { site, siteSettings } = opts;
this.shortcuts = {};
this.context = null;
this.groups = [
{ group: "fontStyles", buttons: [] },
@ -87,7 +88,7 @@ class Toolbar {
id: "link",
group: "insertions",
shortcut: "K",
action: "showLinkModal"
action: (...args) => this.context.send("showLinkModal", args)
});
}
@ -107,7 +108,7 @@ class Toolbar {
id: "code",
group: "insertions",
shortcut: "Shift+C",
action: "formatCode"
action: (...args) => this.context.send("formatCode", args)
});
this.addButton({
@ -158,7 +159,7 @@ class Toolbar {
className: button.className || button.id,
label: button.label,
icon: button.label ? null : button.icon || button.id,
action: button.action || "toolbarButton",
action: button.action || (a => this.context.send("toolbarButton", a)),
perform: button.perform || function() {},
trimLeading: button.trimLeading,
popupMenu: button.popupMenu || false
@ -220,8 +221,8 @@ export default Ember.Component.extend({
linkText: "",
lastSel: null,
_mouseTrap: null,
emojiPickerIsActive: false,
showLink: true,
emojiPickerIsActive: false,
@computed("placeholder")
placeholderTranslated(placeholder) {
@ -238,15 +239,15 @@ export default Ember.Component.extend({
},
init() {
this._super();
this._super(...arguments);
this.register = getRegister(this);
},
didInsertElement() {
this._super();
this._super(...arguments);
const $editorInput = this.$(".d-editor-input");
this._applyEmojiAutocomplete($editorInput);
this._applyCategoryHashtagAutocomplete($editorInput);
@ -267,7 +268,7 @@ export default Ember.Component.extend({
Object.keys(shortcuts).forEach(sc => {
const button = shortcuts[sc];
mouseTrap.bind(sc, () => {
this.send(button.action, button);
button.action(button);
return false;
});
});
@ -331,8 +332,13 @@ export default Ember.Component.extend({
const toolbar = new Toolbar(
this.getProperties("site", "siteSettings", "showLink")
);
toolbar.context = this;
_createCallbacks.forEach(cb => cb(toolbar));
this.sendAction("extraButtons", toolbar);
if (this.extraButtons) {
this.extraButtons(toolbar);
}
return toolbar;
},
@ -355,7 +361,10 @@ export default Ember.Component.extend({
}
const $preview = this.$(".d-editor-preview");
if ($preview.length === 0) return;
this.sendAction("previewUpdated", $preview);
if (this.previewUpdated) {
this.previewUpdated($preview);
}
});
});
},
@ -410,17 +419,10 @@ export default Ember.Component.extend({
},
onKeyUp(text, cp) {
// Regular expressions used to extract emoji name from text.
// The space version requires a ' ' (space) before the emoji name
// (i.e. ' :smile'), while the other one does not and is used
// when enable_inline_emoji_translation is true.
const noSpaceColonEmoji = /(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi;
const spaceColonEmoji = /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi;
const matches = /(?:^|[^a-z])(:(?!:).?[\w-]*:?(?!:)(?:t\d?)?:?) ?$/gi.exec(
text.substring(0, cp)
);
const regex = self.siteSettings.enable_inline_emoji_translation
? noSpaceColonEmoji
: spaceColonEmoji;
const matches = regex.exec(text.substring(0, cp));
if (matches && matches[1]) {
return [matches[1]];
}
@ -455,8 +457,8 @@ export default Ember.Component.extend({
const match = term.match(/^:?(.*?):t([2-6])?$/);
if (match) {
let name = match[1];
let scale = match[2];
const name = match[1];
const scale = match[2];
if (isSkinTonableEmoji(name)) {
if (scale) {
@ -837,10 +839,17 @@ export default Ember.Component.extend({
},
actions: {
emoji() {
if (this.get("disabled")) {
return;
}
this.set("emojiPickerIsActive", !this.get("emojiPickerIsActive"));
},
emojiSelected(code) {
let selected = this._getSelected();
const captures = selected.pre.match(/\B:(\w*)$/);
if (_.isEmpty(captures)) {
this._addText(selected, `:${code}:`);
} else {
@ -875,7 +884,7 @@ export default Ember.Component.extend({
};
if (button.sendAction) {
return this.sendAction(button.sendAction, toolbarEvent);
return button.sendAction(toolbarEvent);
} else {
button.perform(toolbarEvent);
}
@ -962,13 +971,6 @@ export default Ember.Component.extend({
this._selectText(sel.start + 1, origLink.length);
}
}
},
emoji() {
if (this.get("disabled")) {
return;
}
this.set("emojiPickerIsActive", !this.get("emojiPickerIsActive"));
}
}
});

View File

@ -89,13 +89,13 @@ export default Ember.Component.extend({
actions: {
recheckPermission() {
this.propertyDidChange("notificationsPermission");
this.notifyPropertyChange("notificationsPermission");
},
turnoff() {
if (this.get("isEnabledDesktop")) {
this.set("notificationsDisabled", "disabled");
this.propertyDidChange("notificationsPermission");
this.notifyPropertyChange("notificationsPermission");
}
if (this.get("isEnabledPush")) {
unsubscribePushNotification(this.currentUser, () => {
@ -113,7 +113,7 @@ export default Ember.Component.extend({
this.set("notificationsDisabled", "");
Notification.requestPermission(() => {
confirmNotification();
this.propertyDidChange("notificationsPermission");
this.notifyPropertyChange("notificationsPermission");
});
}
}

View File

@ -10,7 +10,7 @@ export default Ember.Component.extend({
click(event) {
if (event.target.tagName.toUpperCase() === "A") {
this.sendAction("action", this.get("actionParam"));
this.action(this.get("actionParam"));
}
return false;

View File

@ -1,8 +1,5 @@
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
import {
default as computed,
observes
} from "ember-addons/ember-computed-decorators";
import { default as computed } from "ember-addons/ember-computed-decorators";
export default buildCategoryPanel("images").extend({
@computed("category.uploaded_background.url")
@ -10,39 +7,45 @@ export default buildCategoryPanel("images").extend({
return uploadedBackgroundUrl || "";
},
@computed("category.uploaded_background.id")
backgroundImageId(uploadedBackgroundId) {
return uploadedBackgroundId || null;
},
@computed("category.uploaded_logo.url")
logoImageUrl(uploadedLogoUrl) {
return uploadedLogoUrl || "";
},
@computed("category.uploaded_logo.id")
logoImageId(uploadedLogoId) {
return uploadedLogoId || null;
actions: {
logoUploadDone(upload) {
this._setFromUpload("category.uploaded_logo", upload);
},
logoUploadDeleted() {
this._deleteUpload("category.uploaded_logo");
},
backgroundUploadDone(upload) {
this._setFromUpload("category.uploaded_background", upload);
},
backgroundUploadDeleted() {
this._deleteUpload("category.uploaded_background");
}
},
@observes("backgroundImageUrl", "backgroundImageId")
_setBackgroundUpload() {
_deleteUpload(path) {
this.set(
"category.uploaded_background",
path,
Ember.Object.create({
id: this.get("backgroundImageId"),
url: this.get("backgroundImageUrl")
id: null,
url: null
})
);
},
@observes("logoImageUrl", "logoImageId")
_setLogoUpload() {
_setFromUpload(path, upload) {
this.set(
"category.uploaded_logo",
path,
Ember.Object.create({
id: this.get("logoImageId"),
url: this.get("logoImageUrl")
url: upload.url,
id: upload.id
})
);
}

View File

@ -72,7 +72,9 @@ export default Ember.Component.extend({
@observes("selection")
_updateBasedOnLastPost() {
if (!this.get("autoClose")) {
this.set("topicTimer.based_on_last_post", false);
Ember.run.schedule("afterRender", () => {
this.set("topicTimer.based_on_last_post", false);
});
}
}
});

View File

@ -333,7 +333,7 @@ export default Ember.Component.extend({
this._trackEmojiUsage(code);
}
this.sendAction("emojiSelected", code);
this.emojiSelected(code);
if (this.$modal.hasClass("fadeIn")) {
this.set("active", false);

Some files were not shown because too many files have changed in this diff Show More