Add custom template for JS for the views

This commit is contained in:
dignajar 2021-02-07 18:22:20 +01:00
parent 0f71046b92
commit f2b8955e96
14 changed files with 439 additions and 158 deletions

View file

@ -1,3 +1,29 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('About'), 'icon'=>'info-circle'));

View file

@ -1,5 +1,53 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
$('#btnSave').on('click', function() {
var name = $('#name').val();
if (name.length < 1) {
showAlertError("<?php $L->p('Complete all fields') ?>");
return false;
}
var args = {
name: name,
description: $('#description').val()
};
api.createCategory(args).then(function(response) {
if (response.status == 0) {
logs('Category created. Key: ' + response.data.key);
window.location.replace('<?php echo HTML_PATH_ADMIN_ROOT . 'categories' ?>');
} else {
logs("An error occurred while trying to create the category.");
showAlertError(response.message);
}
});
return true;
});
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<div class="d-flex align-items-center mb-4">
<h2 class="m-0"><i class="bi bi-bookmark"></i><?php $L->p('New category') ?></h2>
<div class="ms-auto">
@ -23,32 +71,4 @@ echo Bootstrap::formTextarea(array(
'value' => isset($_POST['description']) ? $_POST['description'] : '',
'rows' => 5
));
?>
<script>
$(document).ready(function() {
$('#btnSave').on('click', function() {
var name = $('#name').val();
if (name.length < 1) {
showAlertError("<?php $L->p('Complete all fields') ?>");
return false;
}
var args = {
name: name,
description: $('#description').val()
};
api.createCategory(args).then(function(response) {
if (response.status == 0) {
logs('Category created. Key: ' + response.data.key);
window.location.replace('<?php echo HTML_PATH_ADMIN_ROOT . 'categories' ?>');
} else {
logs("An error occurred while trying to create the category.");
showAlertError(response.message);
}
});
return true;
});
});
</script>
?>

View file

@ -1,5 +1,67 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
$('#btnSave').on('click', function() {
var username = $('#username').val();
var password = $('#password').val();
var confirmPassword = $('#confirmPassword').val();
if (username.length < 1) {
showAlertError("<?php $L->p('Complete all fields') ?>");
return false;
}
if (password.length < PASSWORD_LENGTH) {
showAlertError("<?php $L->p('Password must be at least 6 characters long') ?>");
return false;
}
if (password !== confirmPassword) {
showAlertError("<?php $L->p('The password and confirmation password do not match') ?>");
return false;
}
var args = {
username: username,
password: password,
role: $('#role').val(),
email: $('#email').val()
};
api.createUser(args).then(function(response) {
if (response.status == 0) {
logs('User created. Username: ' + response.data.username);
window.location.replace(HTML_PATH_ADMIN_ROOT + 'users');
} else {
logs('An error occurred while trying to create the user.');
showAlertError(response.message);
}
});
return true;
});
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<div class="d-flex align-items-center mb-4">
<h2 class="m-0"><i class="bi bi-person"></i><?php $L->p('New user') ?></h2>
<div class="ms-auto">
@ -47,46 +109,4 @@ echo Bootstrap::formInputText(array(
'label' => $L->g('Email'),
'value' => ''
));
?>
<script>
$(document).ready(function() {
$('#btnSave').on('click', function() {
var username = $('#username').val();
var password = $('#password').val();
var confirmPassword = $('#confirmPassword').val();
if (username.length < 1) {
showAlertError("<?php $L->p('Complete all fields') ?>");
return false;
}
if (password.length < PASSWORD_LENGTH) {
showAlertError("<?php $L->p('Password must be at least 6 characters long') ?>");
return false;
}
if (password !== confirmPassword) {
showAlertError("<?php $L->p('The password and confirmation password do not match') ?>");
return false;
}
var args = {
username: username,
password: password,
role: $('#role').val(),
email: $('#email').val()
};
api.createUser(args).then(function(response) {
if (response.status == 0) {
logs('User created. Username: ' + response.data.username);
window.location.replace(HTML_PATH_ADMIN_ROOT + 'users');
} else {
logs('An error occurred while trying to create the user.');
showAlertError(response.message);
}
});
return true;
});
});
</script>
?>

View file

@ -1,5 +1,29 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<div class="d-flex align-items-center mb-4">
<h2 class="m-0"><i class="bi bi-bookmark"></i><?php $L->p('Categories') ?></h2>
<div class="ms-auto">

View file

@ -1,5 +1,53 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
$(".btnDeletePage").on("click", function() {
var key = $(this).data('key');
logs('Deleting page. Key: ' + key);
bootbox.confirm({
message: '<?php $L->p('Are you sure you want to delete this page') ?>',
buttons: {
cancel: {
label: '<i class="fa fa-times"></i><?php $L->p('Cancel') ?>',
className: 'btn-sm btn-secondary'
},
confirm: {
label: '<i class="fa fa-check"></i><?php $L->p('Confirm') ?>',
className: 'btn-sm btn-primary'
}
},
closeButton: false,
callback: function(result) {
if (result) {
// delete page
}
}
});
});
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<div class="d-flex align-items-center mb-4">
<h2 class="m-0"><i class="bi bi-folder"></i><?php $L->p('Content') ?></h2>
<div class="ms-auto">
@ -239,33 +287,3 @@ function table($type)
</div>
</div>
<!-- End Content -->
<script>
$(document).ready(function() {
$(".btnDeletePage").on("click", function() {
var key = $(this).data('key');
logs('Deleting page. Key: ' + key);
bootbox.confirm({
message: '<?php $L->p('Are you sure you want to delete this page') ?>',
buttons: {
cancel: {
label: '<i class="fa fa-times"></i><?php $L->p('Cancel') ?>',
className: 'btn-sm btn-secondary'
},
confirm: {
label: '<i class="fa fa-check"></i><?php $L->p('Confirm') ?>',
className: 'btn-sm btn-primary'
}
},
closeButton: false,
callback: function(result) {
if (result) {
// delete page
}
}
});
});
});
</script>

View file

@ -1,3 +1,29 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<div id="dashboard" class="container">
<div class="row">
<div class="col-md-7">

View file

@ -1,3 +1,29 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Developers'), 'icon'=>'gears'));

View file

@ -1,51 +1,19 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<div class="d-flex align-items-center mb-4">
<h2 class="m-0"><i class="bi bi-bookmark"></i><?php $L->p('Edit category') ?></h2>
<div class="ms-auto">
<button id="btnSave" type="button" class="btn btn-primary btn-sm"><?php $L->p('Save') ?></button>
<button id="btnDelete" type="button" class="btn btn-danger btn-sm"><?php $L->p('Delete') ?></button>
<a id="btnCancel" class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT . 'categories' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
</div>
<?php
echo Bootstrap::formInputHidden(array(
'id' => 'key',
'name' => 'key',
'value' => $categoryMap['key']
));
echo Bootstrap::formInputText(array(
'id' => 'name',
'name' => 'name',
'label' => $L->g('Name'),
'value' => $categoryMap['name']
));
echo Bootstrap::formTextarea(array(
'name' => 'description',
'label' => $L->g('Description'),
'value' => isset($categoryMap['description']) ? $categoryMap['description'] : '',
'rows' => 3
));
echo Bootstrap::formInputText(array(
'name' => 'template',
'label' => $L->g('Template'),
'value' => isset($categoryMap['template']) ? $categoryMap['template'] : ''
));
echo Bootstrap::formInputText(array(
'name' => 'friendlyURL',
'label' => $L->g('Friendly URL'),
'value' => $categoryMap['key'],
'tip' => DOMAIN_CATEGORIES . $categoryMap['key']
));
?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
$('#btnSave').on('click', function() {
var name = $('#name').val();
var friendlyURL = $('#friendlyURL').val();
@ -110,5 +78,58 @@ echo Bootstrap::formInputText(array(
}
});
});
});
</script>
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<div class="d-flex align-items-center mb-4">
<h2 class="m-0"><i class="bi bi-bookmark"></i><?php $L->p('Edit category') ?></h2>
<div class="ms-auto">
<button id="btnSave" type="button" class="btn btn-primary btn-sm"><?php $L->p('Save') ?></button>
<button id="btnDelete" type="button" class="btn btn-danger btn-sm"><?php $L->p('Delete') ?></button>
<a id="btnCancel" class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT . 'categories' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
</div>
<?php
echo Bootstrap::formInputHidden(array(
'id' => 'key',
'name' => 'key',
'value' => $categoryMap['key']
));
echo Bootstrap::formInputText(array(
'id' => 'name',
'name' => 'name',
'label' => $L->g('Name'),
'value' => $categoryMap['name']
));
echo Bootstrap::formTextarea(array(
'name' => 'description',
'label' => $L->g('Description'),
'value' => isset($categoryMap['description']) ? $categoryMap['description'] : '',
'rows' => 3
));
echo Bootstrap::formInputText(array(
'name' => 'template',
'label' => $L->g('Template'),
'value' => isset($categoryMap['template']) ? $categoryMap['template'] : ''
));
echo Bootstrap::formInputText(array(
'name' => 'friendlyURL',
'label' => $L->g('Friendly URL'),
'value' => $categoryMap['key'],
'tip' => DOMAIN_CATEGORIES . $categoryMap['key']
));
?>

View file

@ -1,14 +1,14 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ----------------------------------------------------------------------------
// ============================================================================
// Variables for the view
// ----------------------------------------------------------------------------
// ============================================================================
var _pageKey = <?php echo $pageKey ? '"' . $pageKey . '"' : 'null' ?>;
// ----------------------------------------------------------------------------
// ============================================================================
// Functions for the view
// ----------------------------------------------------------------------------
// ============================================================================
// Default function for the editor
// These functions work if the user does not activate any plugin
@ -139,9 +139,9 @@
return true;
}
// ----------------------------------------------------------------------------
// ============================================================================
// Events for the view
// ----------------------------------------------------------------------------
// ============================================================================
$(document).ready(function() {
// Main interface events
@ -304,9 +304,9 @@
});
// ----------------------------------------------------------------------------
// Initlization for the view
// ----------------------------------------------------------------------------
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// How do you hang your toilet paper ? over or under ?

View file

@ -1,4 +1,30 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<?php
echo '<h1 class="text-center fw-normal mb-5">'.$site->title().'</h1>';

View file

@ -1,5 +1,29 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initlization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'plugin-form')); ?>
<div class="align-middle">

View file

@ -71,7 +71,7 @@
});
// ============================================================================
// Initlization for the view
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// nothing here yet

View file

@ -1,3 +1,29 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Themes'), 'icon'=>'eye'));

View file

@ -1,5 +1,29 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<script>
// ============================================================================
// Variables for the view
// ============================================================================
// ============================================================================
// Functions for the view
// ============================================================================
// ============================================================================
// Events for the view
// ============================================================================
$(document).ready(function() {
// No events for the view yet
});
// ============================================================================
// Initialization for the view
// ============================================================================
$(document).ready(function() {
// No initialization for the view yet
});
</script>
<div class="d-flex align-items-center mb-4">
<h2 class="m-0"><i class="bi bi-people"></i><?php $L->p('Users') ?></h2>
<div class="ms-auto">