2018-06-15 23:03:24 +08:00
|
|
|
import { on } from "ember-addons/ember-computed-decorators";
|
2015-11-24 05:45:05 +08:00
|
|
|
|
|
|
|
export default Ember.Component.extend({
|
2018-06-15 23:03:24 +08:00
|
|
|
classNames: ["site-text"],
|
|
|
|
classNameBindings: ["siteText.overridden"],
|
2015-11-24 05:45:05 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
@on("didInsertElement")
|
2015-11-24 05:45:05 +08:00
|
|
|
highlightTerm() {
|
2018-06-15 23:03:24 +08:00
|
|
|
const term = this.get("term");
|
2015-11-24 05:45:05 +08:00
|
|
|
if (term) {
|
2018-06-15 23:03:24 +08:00
|
|
|
this.$(".site-text-id, .site-text-value").highlight(term, {
|
|
|
|
className: "text-highlight"
|
|
|
|
});
|
2015-11-24 05:45:05 +08:00
|
|
|
}
|
2018-06-15 23:03:24 +08:00
|
|
|
this.$(".site-text-value").ellipsis();
|
2015-11-24 05:45:05 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
click() {
|
2018-06-15 23:03:24 +08:00
|
|
|
this.send("edit");
|
2015-11-24 05:45:05 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
edit() {
|
2018-06-15 23:03:24 +08:00
|
|
|
this.sendAction("editAction", this.get("siteText"));
|
2015-11-24 05:45:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|