Remove site logo button and improve in UI
This commit is contained in:
parent
18778226eb
commit
9962b0ba48
@ -520,14 +520,27 @@
|
||||
<?php
|
||||
echo Bootstrap::formTitle(array('title'=>$L->g('Site logo')));
|
||||
?>
|
||||
<div class="custom-file mb-2">
|
||||
<input type="file" class="custom-file-input" id="jssiteLogoInputFile" name="inputFile">
|
||||
<label class="custom-file-label" for="jssiteLogoInputFile"><?php $L->p('Choose images to upload'); ?></label>
|
||||
</div>
|
||||
<div>
|
||||
<img id="jssiteLogoPreview" class="img-fluid img-thumbnail" alt="Site logo preview" src="<?php echo ($site->logo()?DOMAIN_UPLOADS.$site->logo(false).'?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-4 col-sm-12 p-0 pr-2">
|
||||
<div class="custom-file">
|
||||
<input id="jssiteLogoInputFile" class="custom-file-input" type="file" name="inputFile">
|
||||
<label for="jssiteLogoInputFile" class="custom-file-label"><?php $L->p('Upload image'); ?></label>
|
||||
</div>
|
||||
<button id="jsbuttonRemoveLogo" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i> Remove logo</button>
|
||||
</div>
|
||||
<div class="col-lg-8 col-sm-12 p-0 text-center">
|
||||
<img id="jssiteLogoPreview" class="img-fluid img-thumbnail" alt="Site logo preview" src="<?php echo ($site->logo()?DOMAIN_UPLOADS.$site->logo(false).'?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("#jsbuttonRemoveLogo").on("click", function() {
|
||||
bluditAjax.removeLogo();
|
||||
$("#jssiteLogoPreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
|
||||
});
|
||||
|
||||
$("#jssiteLogoInputFile").on("change", function() {
|
||||
var formData = new FormData();
|
||||
formData.append('tokenCSRF', tokenCSRF);
|
||||
|
15
bl-kernel/ajax/remove-logo.php
Normal file
15
bl-kernel/ajax/remove-logo.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Delete logo image
|
||||
$logoFilename = $site->logo(false);
|
||||
if ($logoFilename) {
|
||||
Filesystem::rmfile(PATH_UPLOADS.$logoFilename);
|
||||
}
|
||||
|
||||
// Remove the logo from the database
|
||||
$site->set(array('logo'=>''));
|
||||
|
||||
ajaxResponse(0, 'Logo removed.');
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user