Fix minori

This commit is contained in:
Luca 2020-03-03 22:59:18 +01:00
parent a462faf606
commit 2b60df8ac5
2 changed files with 23 additions and 8 deletions

View File

@ -195,20 +195,26 @@ if (!$has_settings) {
<h3 class="panel-title">'.tr('Impostazioni di base').'</h3> <h3 class="panel-title">'.tr('Impostazioni di base').'</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">';
<div class="row">'; $i = 0;
foreach ($settings as $setting => $required) { foreach ($settings as $setting => $required) {
if (empty(setting($setting))) { if (empty(setting($setting))) {
if ($i%2==0 or $i==0)
echo ' <div class="row">';
echo ' echo '
<div class="col-md-6"> <div class="col-md-6">
'.Settings::input($setting, $required).' '.Settings::input($setting, $required).'
</div>'; </div>';
$i++;
if ($i%2==0 or $i == sizeof($settings))
echo ' </div>';
} }
} }
echo ' </div> echo ' </div>
</div>
</div>'; </div>';
} }

View File

@ -251,6 +251,16 @@ $(document).ready(function() {
}); });
}); });
function getFilenameAndExtension(pathfilename){
var filenameextension = pathfilename.replace(/^.*[\\\/]/, \'\');
var filename = filenameextension.substring(0, filenameextension.lastIndexOf(\'.\'));
var ext = filenameextension.split(\'.\').pop();
return [filename, ext];
}
// Autocompletamento nome // Autocompletamento nome
$("#'.$attachment_id.' #blob").change(function(){ $("#'.$attachment_id.' #blob").change(function(){
var nome = $("#'.$attachment_id.' #nome_allegato"); var nome = $("#'.$attachment_id.' #nome_allegato");
@ -258,10 +268,9 @@ $(document).ready(function() {
if (!nome.val()) { if (!nome.val()) {
var fullPath = $(this).val(); var fullPath = $(this).val();
var startIndex = Math.max(fullPath.lastIndexOf("\\\\"), fullPath.lastIndexOf("/")) + 1; var filename = getFilenameAndExtension(fullPath);
var filename = fullPath.substring(startIndex);
nome.val(filename); nome.val(filename[0]);
} }
}); });