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-01-11 17:54:23 +01:00

22 lines
593 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.get("good") ? "check" : "times") + " " + reason
);
}
}
})
);