DEV: introduces prettier for es6 files

This commit is contained in:
Joffrey JAFFEUX
2018-06-15 17:03:24 +02:00
committed by GitHub
parent c7ee70941e
commit 03a7d532cf
1162 changed files with 60667 additions and 29659 deletions

View File

@ -1,45 +1,58 @@
import Permalink from 'admin/models/permalink';
import Permalink from "admin/models/permalink";
export default Ember.Component.extend({
classNames: ['permalink-form'],
classNames: ["permalink-form"],
formSubmitted: false,
permalinkType: 'topic_id',
permalinkType: "topic_id",
permalinkTypes: function() {
return [
{id: 'topic_id', name: I18n.t('admin.permalink.topic_id')},
{id: 'post_id', name: I18n.t('admin.permalink.post_id')},
{id: 'category_id', name: I18n.t('admin.permalink.category_id')},
{id: 'external_url', name: I18n.t('admin.permalink.external_url')}
{ id: "topic_id", name: I18n.t("admin.permalink.topic_id") },
{ id: "post_id", name: I18n.t("admin.permalink.post_id") },
{ id: "category_id", name: I18n.t("admin.permalink.category_id") },
{ id: "external_url", name: I18n.t("admin.permalink.external_url") }
];
}.property(),
permalinkTypePlaceholder: function() {
return 'admin.permalink.' + this.get('permalinkType');
}.property('permalinkType'),
return "admin.permalink." + this.get("permalinkType");
}.property("permalinkType"),
actions: {
submit: function() {
if (!this.get('formSubmitted')) {
if (!this.get("formSubmitted")) {
const self = this;
self.set('formSubmitted', true);
const permalink = Permalink.create({url: self.get('url'), permalink_type: self.get('permalinkType'), permalink_type_value: self.get('permalink_type_value')});
permalink.save().then(function(result) {
self.set('url', '');
self.set('permalink_type_value', '');
self.set('formSubmitted', false);
self.sendAction('action', Permalink.create(result.permalink));
Em.run.schedule('afterRender', function() { self.$('.permalink-url').focus(); });
}, function(e) {
self.set('formSubmitted', false);
let error;
if (e.responseJSON && e.responseJSON.errors) {
error = I18n.t("generic_error_with_reason", {error: e.responseJSON.errors.join('. ')});
} else {
error = I18n.t("generic_error");
}
bootbox.alert(error, function() { self.$('.permalink-url').focus(); });
self.set("formSubmitted", true);
const permalink = Permalink.create({
url: self.get("url"),
permalink_type: self.get("permalinkType"),
permalink_type_value: self.get("permalink_type_value")
});
permalink.save().then(
function(result) {
self.set("url", "");
self.set("permalink_type_value", "");
self.set("formSubmitted", false);
self.sendAction("action", Permalink.create(result.permalink));
Em.run.schedule("afterRender", function() {
self.$(".permalink-url").focus();
});
},
function(e) {
self.set("formSubmitted", false);
let error;
if (e.responseJSON && e.responseJSON.errors) {
error = I18n.t("generic_error_with_reason", {
error: e.responseJSON.errors.join(". ")
});
} else {
error = I18n.t("generic_error");
}
bootbox.alert(error, function() {
self.$(".permalink-url").focus();
});
}
);
}
}
},
@ -47,10 +60,11 @@ export default Ember.Component.extend({
didInsertElement: function() {
var self = this;
self._super();
Em.run.schedule('afterRender', function() {
self.$('.external-url').keydown(function(e) {
if (e.keyCode === 13) { // enter key
self.send('submit');
Em.run.schedule("afterRender", function() {
self.$(".external-url").keydown(function(e) {
if (e.keyCode === 13) {
// enter key
self.send("submit");
}
});
});