This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/input-tip.js.es6
2019-05-27 10:42:53 +02:00

20 lines
566 B
JavaScript

import { bufferedRender } from "discourse-common/lib/buffered-render";
import { iconHTML } from "discourse-common/lib/icon-library";
export default Ember.Component.extend(
bufferedRender({
classNameBindings: [":tip", "good", "bad"],
rerenderTriggers: ["validation"],
bad: Ember.computed.alias("validation.failed"),
good: Ember.computed.not("bad"),
buildBuffer(buffer) {
const reason = this.get("validation.reason");
if (reason) {
buffer.push(iconHTML(this.good ? "check" : "times") + " " + reason);
}
}
})
);