24 lines
643 B
JavaScript
24 lines
643 B
JavaScript
/**
|
|
This view handles rendering a tip when a field on a form is invalid
|
|
|
|
@class InputTipView
|
|
@extends Discourse.View
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
export default Discourse.View.extend({
|
|
classNameBindings: [':tip', 'good', 'bad'],
|
|
|
|
shouldRerender: Discourse.View.renderIfChanged('validation'),
|
|
bad: Em.computed.alias('validation.failed'),
|
|
good: Em.computed.not('bad'),
|
|
|
|
render: function(buffer) {
|
|
var reason = this.get('validation.reason');
|
|
if (reason) {
|
|
var icon = this.get('good') ? 'fa-check' : 'fa-times';
|
|
return buffer.push("<i class=\"fa " + icon + "\"></i> " + reason);
|
|
}
|
|
}
|
|
});
|