public function setFields()
{
$hostingProtocols = static::getHostingProtocols();
- $nothostingProtocols = array_diff(array_keys($this->getProtocols(), $hostingProtocols));
+ $nothostingProtocols = array_diff(array_keys($this->getProtocols()),$hostingProtocols);
parent::setFields();
$this->getField('base_url')->setAttribute('when', ['protocol' => $nothostingProtocols]);
$this->addField('subdomains', Textarea::class, __('Sous-domaines'), ['when' => ['protocol' => $hostingProtocols]]);
$this->addField('php', Checkbox::class, __('Activer le support de PHP'), ['default' => false, 'when' => ['protocol' => $hostingProtocols]]);
- $this->addField('redirections', Table::class, __('Redirections'), ['entity_singular' => __('redirection'), 'columns' => ['from' => __('De'), 'to' => __('Vers')], 'when' => ['protocol' => 'hosting']]);
+ $this->addField('redirections', Table::class, __('Redirections'), ['entity_singular' => __('redirection'), 'columns' => ['from' => __('De'), 'to' => __('Vers')], 'when' => ['protocol' => $hostingProtocols]]);
$this->addField('allows_root', Checkbox::class, __('Autoriser le chargement à la racine (sur le chemin de base)'), ['default' => false]);
}
// When clicking on a locale link in the dropdown menu, it doesn't preserve
// the current tab because this is stored in the hash and managed by JS.
// To overcome this, we catch the locale links and append the hash to them...
- $(document).on('click', '.dropdown-menu a[href*="?locale="]', function(event) {
+ $(document).on('click', '.dropdown-menu a[href*="?locale="]', function (event) {
event.preventDefault();
window.location.href = $(this).attr('href') + document.location.hash;
});
}, "5000");
}
- $(document).on("click", "#verifyconnection", function(e) {
+ $(document).on("click", "#verifyconnection", function (e) {
e.preventDefault();
const data = {
id: {{$entry->id}},
_token: $('[name=_token]').val(),
}
$.ajax({
- url: '{{url('fluidbook-external-install-server/'.$entry->id)}}/verifyconnection',
+ url: '{{url('fluidbook-external-install-server/'.$entry->id.'/verifyconnection')}}',
method: 'post',
data: data,
success: function (data) {
let type = 'success'
- if(data.error) {
+ if (data.error) {
type = 'error'
}
- $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__'+type+' noty_theme__backstrap"><div class="p-3">'+data.message+'</div></div>')
+ $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__' + type + ' noty_theme__backstrap"><div class="p-3">' + data.message + '</div></div>')
removeBtn()
},
- error: function(xhr) {
+ error: function (xhr) {
let message = xhr.responseJSON.message ?? "{{ __('Une erreur est survenue') }}"
- $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__error noty_theme__backstrap"><div class="p-3">'+message+'</div></div>')
+ $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__error noty_theme__backstrap"><div class="p-3">' + message + '</div></div>')
removeBtn()
}
});
});
</script>
<style>
- #message { border-radius: 5px; }
+ #message {
+ border-radius: 5px;
+ }
</style>
@endpush
function checkFormValidity(form) {
// the condition checks if `checkValidity` is defined in the form (browser compatibility)
if (form[0].checkValidity) {
+ for (var i in form[0].elements) {
+ let e = form[0].elements[i];
+ try {
+ if (!e.checkValidity()) {
+ console.warn('Invalid value for field ', e);
+ }
+ } catch (e) {
+
+ }
+ }
return form[0].checkValidity();
}
return false;