Rename .js.es6 to .js in the admin application

This commit is contained in:
Robin Ward
2020-03-13 16:59:59 -04:00
parent ac48c4e562
commit e40e06d78c
269 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1,47 @@
import { not } from "@ember/object/computed";
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import { propertyEqual } from "discourse/lib/computed";
export default Controller.extend(bufferedProperty("model"), {
saved: false,
isSaving: false,
saveDisabled: propertyEqual("model.robots_txt", "buffered.robots_txt"),
resetDisbaled: not("model.overridden"),
actions: {
save() {
this.setProperties({
isSaving: true,
saved: false
});
ajax("robots.json", {
method: "PUT",
data: { robots_txt: this.buffered.get("robots_txt") }
})
.then(data => {
this.commitBuffer();
this.set("saved", true);
this.set("model.overridden", data.overridden);
})
.finally(() => this.set("isSaving", false));
},
reset() {
this.setProperties({
isSaving: true,
saved: false
});
ajax("robots.json", { method: "DELETE" })
.then(data => {
this.buffered.set("robots_txt", data.robots_txt);
this.commitBuffer();
this.set("saved", true);
this.set("model.overridden", false);
})
.finally(() => this.set("isSaving", false));
}
}
});