(function(){"use strict";RB.WebhookFormView=Backbone.View.extend({events:{"change #id_apply_to":"_onApplyToChanged","change #id_encoding":"_onEncodingChanged","change #id_use_custom_content":"_onUseCustomContentToggled","change #id_events_0":"_onAllEventsToggled"},render(){return this._$encoding=$("#id_encoding"),this._$eventCheckboxes=$("#id_events").find("input"),this._$allEventsCheckbox=this._$eventCheckboxes.filter('[value="*"]'),this._$applyTo=$("#id_apply_to"),this._$applyToSelected=this._$applyTo.find('[value="S"]'),this._$customContentRow=this.$(".field-custom_content"),this._$reposRow=this.$(".field-repositories"),this._$useCustomContent=$("#id_use_custom_content"),this._codeMirror=CodeMirror.fromTextArea($("#id_custom_content")[0],{matchBrackets:!0,mode:"application/json"}),this._$customContentRow.find("p.help").append("<br>").append($("<a>").attr("href",MANUAL_URL+"admin/configuration/webhooks/#custom-payloads").text(gettext("Custom payload reference"))),this._onAllEventsToggled(),this._onApplyToChanged(),this._onEncodingChanged(),this._onUseCustomContentToggled(),this},_onAllEventsToggled(){this._$eventCheckboxes.not(this._$allEventsCheckbox).prop("disabled",this._$allEventsCheckbox[0].checked)},_onApplyToChanged(){this._$reposRow.toggle(this._$applyToSelected[0].checked)},_onEncodingChanged(){this._codeMirror.setOption("mode",this._$encoding.val())},_onUseCustomContentToggled(){this._$customContentRow.toggle(this._$useCustomContent[0].checked)}})}).call(this);
