formulaire édition de fonte okay

This commit is contained in:
Fred Tempez 2022-03-12 12:28:28 +01:00
parent 9f2fb7732c
commit 827047b8cd
4 changed files with 46 additions and 62 deletions

View File

@ -590,7 +590,7 @@ class theme extends common {
$type, $type,
$type !== 'websafe' ? template::button('themeFontEdit' . $fontId, [ $type !== 'websafe' ? template::button('themeFontEdit' . $fontId, [
'class' => 'themeFontEdit', 'class' => 'themeFontEdit',
'href' => helper::baseUrl() . $this->getUrl(0) . '/fontEdit/' . $fontId . '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/fontEdit/' . $type . '/' . $fontId . '/' . $_SESSION['csrf'],
'value' => template::ico('pencil'), 'value' => template::ico('pencil'),
'disabled' => !empty($fontUsed[$fontId]) 'disabled' => !empty($fontUsed[$fontId])
]) ])
@ -719,8 +719,8 @@ class theme extends common {
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Ajouter une fonte', 'title' => 'Editer une fonte',
'view' => 'fontAdd' 'view' => 'fontEdit'
]); ]);
} }

View File

@ -9,7 +9,7 @@
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">
<?php echo template::button('pageEditHelp', [ <?php echo template::button('fontAddHelp', [
'href' => 'https://doc.zwiicms.fr/fontes#add', 'href' => 'https://doc.zwiicms.fr/fontes#add',
'target' => '_blank', 'target' => '_blank',
'ico' => 'help', 'ico' => 'help',

View File

@ -10,35 +10,3 @@
*/ */
/**
* Option par défaut du sélecteur de mode
*/
$(document).ready(function(){
$('input[name=fontAddFontImported]').prop('checked', true);
$('input[name=fontAddFontUrl]').prop('checked', false);
$('#containerFontAddFile').hide();
});
/**
* Mode téléchargement en ligne de la fonte ou installation locale
*/
$("input[name=fontAddFontImported]").on("click", function() {
if( $('input[name=fontAddFontImported]').is(':checked') ){
$('input[name=fontAddFontFile]').prop('checked', false);
} else {
$('input[name=fontAddFontFile]').prop('checked', true);
}
$('#containerFontAddFile').hide();
$('#containerFontAddUrl').show();
});
$("input[name=fontAddFontFile]").on("click", function() {
if( $('input[name=fontAddFontFile]').is(':checked') ){
$('input[name=fontAddFontImported]').prop('checked', false);
} else {
$('input[name=fontAddFontImported]').prop('checked', true);
}
$('#containerFontAddFile').show();
$('#containerFontAddUrl').hide();
});

View File

@ -1,7 +1,7 @@
<?php echo template::formOpen('fontAddForm'); ?> <?php echo template::formOpen('fontEditForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col2">
<?php echo template::button('fontAddBack', [ <?php echo template::button('fontEditBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme/fonts', 'href' => helper::baseUrl() . 'theme/fonts',
'ico' => 'left', 'ico' => 'left',
@ -9,7 +9,7 @@
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">
<?php echo template::button('pageEditHelp', [ <?php echo template::button('fontEditHelp', [
'href' => 'https://doc.zwiicms.fr/fontes#add', 'href' => 'https://doc.zwiicms.fr/fontes#add',
'target' => '_blank', 'target' => '_blank',
'ico' => 'help', 'ico' => 'help',
@ -18,7 +18,7 @@
]); ?> ]); ?>
</div> </div>
<div class="col2 offset6"> <div class="col2 offset6">
<?php echo template::submit('fontAddPublish', [ <?php echo template::submit('fontEditPublish', [
'value' => 'Valider', 'value' => 'Valider',
'uniqueSubmission' => true 'uniqueSubmission' => true
]); ?> ]); ?>
@ -30,51 +30,67 @@
<h4>Identité de la fonte</h4> <h4>Identité de la fonte</h4>
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::checkbox('fontAddFontImported', true, 'Fonte en ligne', []); ?> <?php switch ($this->getUrl(2)) {
</div> case 'imported':
<div class="col6"> echo template::checkbox('fontEditFontImported', true, 'Fonte en ligne',[
<?php echo template::checkbox('fontAddFontFile', true,'Fonte installée', []); ?> 'checked' => true
]);
break;
case 'files':
echo template::checkbox('fontEditFontFile', true,'Fonte installée', [
'checked' => true
]);
break;
}
?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::text('fontAddFontId', [ <?php echo template::text('fontEditFontId', [
'autocomplete' => 'off', 'autocomplete' => 'off',
'label' => 'Identifiant (sans espace ni majuscule)', 'label' => 'Identifiant (sans espace ni majuscule)',
'placeholder' => 'big-marker-extrude' 'value' => $this->getUrl(3)
]); ?> ]); ?>
</div> </div>
<div class="col6"> <div class="col6">
<?php echo template::text('fontAddFontName', [ <?php echo template::text('fontEditFontName', [
'autocomplete' => 'off', 'autocomplete' => 'off',
'label' => 'Nom', 'label' => 'Nom',
'placeholder' => 'Big Marker Extrude' 'value' => $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'name'])
]); ?> ]); ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php echo template::text('fontAddFontFamilyName', [ <?php echo template::text('fontEditFontFamilyName', [
'autocomplete' => 'off', 'autocomplete' => 'off',
'label' => 'Famille', 'label' => 'Famille',
'placeholder' => "'Big Marker Extrude', sans-serif" 'value' => $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'font-family'])
]); ?> ]); ?>
</div> </div>
</div> </div>
<div class="row" id="containerFontAddFile"> <div class="row" id="containerfontEditFile">
<div class="col12"> <div class="col12">
<?php echo template::file('fontAddFile', [ <?php switch ($this->getUrl(2)) {
'label' => 'Fichier de fonte (Format WOFF)' case 'imported':
]); ?> echo template::text('fontEditUrl', [
</div> 'label' => 'Url du fichier de fonte',
</div> 'value' => $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'ressource']),
<div class="row" id="containerFontAddUrl"> 'class' => $this->getUrl(2) === 'imported' ? '' : 'noDisplay'
<div class="col12"> ]);
<?php echo template::text('fontAddUrl', [ break;
'label' => 'Url du fichier de fonte', case 'files':
'placeholder' => 'https://fonts.cdnfonts.com/css/big-marker-extrude' echo template::file('fontEditFile', [
]); ?> 'label' => 'Fichier de fonte (Format WOFF)',
'value' => $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'ressource']),
'class' => $this->getUrl(2) === 'file' ? '' : 'noDisplay'
]);
break;
}
?>
</div> </div>
</div> </div>
</div> </div>