mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Merge pull request #8445 from snipe/improve_slack_test_flow_js
Improve slack test flow js
This commit is contained in:
commit
9793d75947
|
@ -101,8 +101,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (($setting->slack_channel!='') && ($setting->slack_endpoint))
|
<div class="form-group" id="slacktestcontainer" style="display: none">
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
{{ Form::label('test_slack', 'Test Slack') }}
|
{{ Form::label('test_slack', 'Test Slack') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -117,7 +116,6 @@
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div> <!--/-->
|
</div> <!--/-->
|
||||||
</div> <!--/.box-body-->
|
</div> <!--/.box-body-->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
|
@ -139,7 +137,26 @@
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script nonce="{{ csrf_token() }}">
|
<script nonce="{{ csrf_token() }}">
|
||||||
|
var fieldcheck = function (event) {
|
||||||
|
if($('#slack_endpoint').val() != "" && $('#slack_channel').val() != "" && $('#slack_botname').val() != "") {
|
||||||
|
//enable test button *only* if all three fields are filled in
|
||||||
|
$('#slacktestcontainer').fadeIn(500);
|
||||||
|
} else {
|
||||||
|
//otherwise it's hidden
|
||||||
|
$('#slacktestcontainer').fadeOut(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event) { //on 'initial load' we don't *have* an 'event', but in the regular keyup callback, we *do*. So this only fires on 'real' callback events, not on first load
|
||||||
|
if($('#slack_endpoint').val() == "" && $('#slack_channel').val() == "" && $('#slack_botname').val() == "") {
|
||||||
|
// if all three fields are blank, the user may want to disable Slack integration; enable the Save button
|
||||||
|
$('#save_slack').removeAttr('disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fieldcheck(); //run our field-checker once on page-load to set the initial state correctly.
|
||||||
|
|
||||||
|
$('input:text').keyup(fieldcheck); // if *any* text field changes, we recalculate button states
|
||||||
|
|
||||||
|
|
||||||
$("#slacktest").click(function() {
|
$("#slacktest").click(function() {
|
||||||
|
@ -215,6 +232,7 @@
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue