Refactor category edit and preview templates for improved layout and consistency
This commit is contained in:
6
.vscode/ftp-kr.sync.cache.json
vendored
6
.vscode/ftp-kr.sync.cache.json
vendored
@@ -53,7 +53,7 @@
|
||||
"class.S.php": {
|
||||
"type": "-",
|
||||
"size": 7575,
|
||||
"lmtime": 1731744360591,
|
||||
"lmtime": 1736804276620,
|
||||
"modified": false
|
||||
},
|
||||
"class.Tpl.php": {
|
||||
@@ -172,8 +172,8 @@
|
||||
},
|
||||
"config.php": {
|
||||
"type": "-",
|
||||
"size": 347,
|
||||
"lmtime": 1731233601663,
|
||||
"size": 348,
|
||||
"lmtime": 1736804262637,
|
||||
"modified": false
|
||||
},
|
||||
"cron.php": {
|
||||
|
||||
@@ -1,102 +1,96 @@
|
||||
<? global $user;?>
|
||||
<div class="row block-header">
|
||||
<div class="col-12">
|
||||
<h2>Kategoria: <strong><?= $this -> category['name'];?></strong></h2>
|
||||
<? global $user; ?>
|
||||
<div class="form_container" style="max-width: 100%;">
|
||||
<div class="block-header">
|
||||
<h2>Kategoria: <strong><?= $this->category['name']; ?></strong></h2>
|
||||
</div>
|
||||
<div class="action_menu" id="g-menu">
|
||||
<a href="#" onclick='checkForm( "formularz" ); return false;' class="btn btn-success btn-sm" title="Zapisz kategorię">
|
||||
<i class="fa fa-check-circle"></i>Zapisz kategorię
|
||||
</a>
|
||||
<a href="/wiki/main_view/" class="btn btn-dark btn-sm" title="Wstecz">
|
||||
<i class="fa fa-reply"></i>Wstecz
|
||||
</a>
|
||||
</div>
|
||||
<div id="g-form-container">
|
||||
<form method='POST' action='/wiki/category_save/' id="formularz" class="form-horizontal">
|
||||
<input type="hidden" name="id" value="<?= $this->category['id']; ?>" />
|
||||
<div class="row">
|
||||
<div class="col-lg-7">
|
||||
<?= \Html::input([
|
||||
'label' => 'Nazwa',
|
||||
'name' => 'name',
|
||||
'id' => 'name',
|
||||
'value' => $this->category['name'],
|
||||
'class' => 'require',
|
||||
'inline' => true
|
||||
]); ?>
|
||||
<?= \Html::textarea([
|
||||
'name' => 'text',
|
||||
'id' => 'text',
|
||||
'value' => $this->category['text']
|
||||
]) ?>
|
||||
<? if ($user['id'] == 1 or $user['id'] == 3): ?>
|
||||
<br>
|
||||
<?= \Html::textarea([
|
||||
'name' => 'text_admin',
|
||||
'id' => 'text_admin',
|
||||
'value' => $this->category['text_admin']
|
||||
]) ?>
|
||||
<? endif; ?>
|
||||
</div>
|
||||
<div class="col-lg-5" style="padding: 25px; background: #FFF;">
|
||||
<? if ( $user['id'] == 1 ):?>
|
||||
<p class="bold">Widoczne dla</p>
|
||||
<? foreach ($this->users as $user_tmp): ?>
|
||||
<? if ($user['id'] != 4): ?>
|
||||
<p style="display: flex; align-items: center;">
|
||||
<input type="checkbox" class="g-checkbox" name="users[]" value="<?= $user_tmp['id']; ?>" <? if (in_array($user_tmp['id'], $this->category['users']) or $user_tmp['id'] == 1 or $user_tmp['id'] == 3): ?>checked="checked" <? endif; ?>>
|
||||
<span style="margin-left: 5px;"><?= $user_tmp['name']; ?> <?= $user_tmp['surname']; ?></span>
|
||||
</p>
|
||||
<? endif; ?>
|
||||
<? endforeach; ?>
|
||||
<? endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu-buttons">
|
||||
<a href="#" onclick='checkForm( "formularz" ); return false;' class="btn btn-success btn-sm" title="Zapisz kategorię">
|
||||
<i class="fa fa-check-circle"></i>Zapisz kategorię
|
||||
</a>
|
||||
<a href="/wiki/main_view/" class="btn btn-dark btn-sm" title="Wstecz">
|
||||
<i class="fa fa-reply"></i>Wstecz
|
||||
</a>
|
||||
</div>
|
||||
<form method='POST' action='/wiki/category_save/' id="formularz" class="form-horizontal">
|
||||
<input type="hidden" name="id" value="<?= $this -> category['id'];?>" />
|
||||
<div class="row">
|
||||
<div class="col-lg-7">
|
||||
<?= \Html::input( [
|
||||
'label' => 'Nazwa',
|
||||
'name' => 'name',
|
||||
'id' => 'name',
|
||||
'value' => $this -> category['name'],
|
||||
'class' => 'require',
|
||||
'inline' => true
|
||||
] );?>
|
||||
<?= \Html::textarea([
|
||||
'name' => 'text',
|
||||
'id' => 'text',
|
||||
'value' => $this -> category['text']
|
||||
])?>
|
||||
<? if ( $user['id'] == 1 or $user['id'] == 3 ):?>
|
||||
<br>
|
||||
<?= \Html::textarea( [
|
||||
'name' => 'text_admin',
|
||||
'id' => 'text_admin',
|
||||
'value' => $this -> category['text_admin']
|
||||
] )?>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<div class="col-lg-5" style="padding: 25px; background: #FFF;">
|
||||
<? if ( $user['id'] == 1 or $user['id'] == 3 ):?>
|
||||
<p class="bold">Widoczne dla</p>
|
||||
<? foreach ( $this -> users as $user_tmp ):?>
|
||||
<? if ( $user['id'] != 4 ):?>
|
||||
<p style="display: flex; align-items: center;">
|
||||
<input type="checkbox" class="g-checkbox" name="users[]" value="<?= $user_tmp['id'];?>" <? if ( in_array( $user_tmp['id'], $this -> category['users'] ) or $user_tmp['id'] == 1 or $user_tmp['id'] == 3 ):?>checked="checked"<? endif;?>>
|
||||
<span style="margin-left: 5px;"><?= $user_tmp['name'];?> <?= $user_tmp['surname'];?></span>
|
||||
</p>
|
||||
<? endif;?>
|
||||
<? endforeach;?>
|
||||
<? endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
|
||||
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
|
||||
<script type="text/javascript">
|
||||
function checkForm( id )
|
||||
{
|
||||
function checkForm(id) {
|
||||
check = true;
|
||||
$( 'form#' + id + ' input[type="text"]' ).each( function() {
|
||||
if ( $( this ).hasClass( 'require' ) && $( this ).val() ==='' )
|
||||
{
|
||||
$( this ).parents( '.form-group' ).addClass( 'has-error' );
|
||||
$('form#' + id + ' input[type="text"]').each(function() {
|
||||
if ($(this).hasClass('require') && $(this).val() === '') {
|
||||
$(this).parents('.form-group').addClass('has-error');
|
||||
check = false;
|
||||
}
|
||||
else
|
||||
$( this ).parents( '.form-group' ).removeClass( 'has-error' );
|
||||
} else
|
||||
$(this).parents('.form-group').removeClass('has-error');
|
||||
});
|
||||
|
||||
$( 'form#' + id + ' textarea' ).each( function() {
|
||||
if ( $( this ).hasClass( 'require' ) && $( this ).val() === '' )
|
||||
{
|
||||
$( this ).parents( '.form-group' ).addClass( 'has-error' );
|
||||
$('form#' + id + ' textarea').each(function() {
|
||||
if ($(this).hasClass('require') && $(this).val() === '') {
|
||||
$(this).parents('.form-group').addClass('has-error');
|
||||
check = false;
|
||||
}
|
||||
else
|
||||
$( this ).parents( '.form-group' ).removeClass( 'has-error' );
|
||||
} else
|
||||
$(this).parents('.form-group').removeClass('has-error');
|
||||
});
|
||||
|
||||
if ( check )
|
||||
$( 'form#' + id ).submit();
|
||||
if (check)
|
||||
$('form#' + id).submit();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$( document ).ready( function ()
|
||||
{
|
||||
$( 'textarea#text' ).ckeditor(
|
||||
{
|
||||
toolbar : 'MyToolbar',
|
||||
$(document).ready(function() {
|
||||
$('textarea#text').ckeditor({
|
||||
toolbar: 'MyToolbar',
|
||||
language: 'pl',
|
||||
height: '350'
|
||||
});
|
||||
|
||||
$( 'textarea#text_admin' ).ckeditor(
|
||||
{
|
||||
toolbar : 'MyToolbar',
|
||||
$('textarea#text_admin').ckeditor({
|
||||
toolbar: 'MyToolbar',
|
||||
language: 'pl',
|
||||
height: '350'
|
||||
});
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<? global $user;?>
|
||||
<div class="row block-header">
|
||||
<div class="col-12">
|
||||
<div class="form_container" style="max-width: 100%;">
|
||||
<div class="block-header">
|
||||
<h2>Kategoria: <strong><?= $this -> category['name'];?></strong></h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu-buttons">
|
||||
<? if ( $user['id'] == 1 or $user['id'] == 3 ):?>
|
||||
<a href="/wiki/category_edit/id=<?= $this -> category['id'];?>" class="btn btn-success btn-sm" title="Edytuj kategorię">
|
||||
<i class="fa fa-edit"></i>Edytuj kategorię
|
||||
<div class="action_menu" id="g-menu">
|
||||
<? if ( $user['id'] == 1 ):?>
|
||||
<a href="/wiki/category_edit/id=<?= $this -> category['id'];?>" class="btn btn-success btn-sm" title="Edytuj kategorię">
|
||||
<i class="fa fa-edit"></i>Edytuj kategorię
|
||||
</a>
|
||||
<? endif;?>
|
||||
<a href="/wiki/main_view/" class="btn btn-dark btn-sm" title="Wstecz">
|
||||
<i class="fa fa-reply"></i>Wstecz
|
||||
</a>
|
||||
<? endif;?>
|
||||
<a href="/wiki/main_view/" class="btn btn-dark btn-sm" title="Wstecz">
|
||||
<i class="fa fa-reply"></i>Wstecz
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-container">
|
||||
<?= $this -> category['text'];?>
|
||||
</div>
|
||||
<? if ( $user['id'] == 1 or $user['id'] == 3 ):?>
|
||||
<br>
|
||||
<div class="text-container">
|
||||
<?= $this -> category['text_admin'];?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<div id="g-form-container">
|
||||
<?= $this -> category['text'];?>
|
||||
<? if ( $user['id'] == 1 or $user['id'] == 3 ):?>
|
||||
<br>
|
||||
<div class="text-container">
|
||||
<?= $this -> category['text_admin'];?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user