bludit/admin/views/edit-page.php

127 lines
4.2 KiB
PHP
Raw Normal View History

2015-07-03 22:44:26 +02:00
<h2 class="title"><i class="fa fa-pencil"></i> <?php $Language->p('Edit page') ?></h2>
2015-05-05 03:00:01 +02:00
2015-07-04 02:14:58 +02:00
<form id="jsform" method="post" action="" class="forms">
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
<input type="hidden" id="jskey" name="key" value="<?php echo $_Page->key() ?>">
2015-05-05 03:00:01 +02:00
<label>
2015-07-03 22:44:26 +02:00
<?php $Language->p('Title') ?>
2015-07-29 04:30:41 +02:00
<input id="jstitle" name="title" type="text" class="width-80" value="<?php echo $_Page->title() ?>">
2015-05-05 03:00:01 +02:00
</label>
2015-08-27 07:05:59 +02:00
<label class="width-80">
2015-07-03 22:44:26 +02:00
<?php $Language->p('Content') ?> <span class="forms-desc"><?php $Language->p('HTML and Markdown code supported') ?></span>
2015-08-27 07:05:59 +02:00
<textarea id="jscontent" name="content" rows="15"><?php echo $_Page->contentRaw(false) ?></textarea>
2015-05-05 03:00:01 +02:00
</label>
2015-08-26 05:42:32 +02:00
<button id="jsadvancedButton" class="btn btn-smaller"><?php $Language->p('Advanced options') ?></button>
2015-05-05 03:00:01 +02:00
2015-08-26 05:42:32 +02:00
<div id="jsadvancedOptions">
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
<?php
// Remove setting pages parents if the page is a parent.
if(count($_Page->children())===0)
{
?>
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
<label for="jsparent">
<?php $Language->p('Parent') ?>
<select id="jsparent" name="parent" class="width-50">
2015-05-05 03:00:01 +02:00
<?php
2015-07-07 06:24:51 +02:00
$htmlOptions[NO_PARENT_CHAR] = '('.$Language->g('No parent').')';
2015-05-05 03:00:01 +02:00
$htmlOptions += $dbPages->parentKeyList();
unset($htmlOptions[$_Page->key()]);
foreach($htmlOptions as $value=>$text) {
echo '<option value="'.$value.'"'.( ($_Page->parentKey()===$value)?' selected="selected"':'').'>'.$text.'</option>';
}
?>
</select>
</label>
2015-07-03 22:44:26 +02:00
<?php } ?>
2015-05-05 03:00:01 +02:00
<label>
2015-07-03 22:44:26 +02:00
<?php $Language->p('Friendly URL') ?>
2015-05-05 03:00:01 +02:00
<div class="input-groups width-50">
2015-07-03 22:44:26 +02:00
<span class="input-prepend"><?php echo $Site->url() ?><span id="jsparentExample"><?php echo $_Page->parentKey()?$_Page->parentKey().'/':''; ?></span></span>
<input id="jsslug" type="text" name="slug" value="<?php echo $_Page->slug() ?>">
2015-05-05 03:00:01 +02:00
</div>
2015-07-20 05:14:12 +02:00
<span class="forms-desc"><?php $Language->p('you-can-modify-the-url-which-identifies') ?></span>
2015-05-05 03:00:01 +02:00
</label>
<label>
2015-07-03 22:44:26 +02:00
<?php $Language->p('Description') ?>
<input id="jsdescription" type="text" name="description" class="width-50" value="<?php echo $_Page->description() ?>">
2015-07-20 05:14:12 +02:00
<span class="forms-desc"><?php $Language->p('this-field-can-help-describe-the-content') ?></span>
2015-05-05 03:00:01 +02:00
</label>
<label>
2015-07-03 22:44:26 +02:00
<?php $Language->p('Tags') ?>
<input id="jstags" name="tags" type="text" class="width-50" value="<?php echo $_Page->tags() ?>">
2015-07-20 05:14:12 +02:00
<span class="forms-desc"><?php $Language->p('write-the-tags-separeted-by-comma') ?></span>
2015-05-05 03:00:01 +02:00
</label>
<label>
2015-07-03 22:44:26 +02:00
<?php $Language->p('Position') ?>
<input id="jsposition" name="position" type="text" class="width-20" value="<?php echo $_Page->position() ?>">
2015-05-05 03:00:01 +02:00
</label>
</div>
2015-07-14 06:41:32 +02:00
<button class="btn btn-blue" name="publish"><?php echo ($_Page->published()?$Language->p('Save'):$Language->p('Publish now')) ?></button>
2015-05-05 03:00:01 +02:00
2015-07-04 02:14:58 +02:00
<?php if(count($_Page->children())===0) { ?>
2015-07-14 06:41:32 +02:00
<button class="btn" name="draft"><?php $Language->p('Draft') ?></button>
<button id="jsdelete" class="btn" name="delete"><?php $Language->p('Delete') ?></button>
2015-07-04 02:14:58 +02:00
<?php } ?>
2015-05-05 03:00:01 +02:00
</form>
<script>
$(document).ready(function()
{
2015-07-03 22:44:26 +02:00
var key = $("#jskey").val();
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
$("#jsslug").keyup(function() {
2015-05-05 03:00:01 +02:00
var text = $(this).val();
2015-07-03 22:44:26 +02:00
var parent = $("#jsparent").val();
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
checkSlugPage(text, parent, key, $("#jsslug"));
2015-05-05 03:00:01 +02:00
});
2015-07-03 22:44:26 +02:00
$("#jstitle").keyup(function() {
2015-05-05 03:00:01 +02:00
var text = $(this).val();
2015-07-03 22:44:26 +02:00
var parent = $("#jsparent").val();
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
checkSlugPage(text, parent, key, $("#jsslug"));
2015-05-05 03:00:01 +02:00
});
2015-07-03 22:44:26 +02:00
$("#jsparent").change(function() {
2015-05-05 03:00:01 +02:00
var parent = $(this).val();
2015-07-03 22:44:26 +02:00
var text = $("#jsslug").val();
2015-05-05 03:00:01 +02:00
if(parent==NO_PARENT_CHAR) {
2015-07-03 22:44:26 +02:00
$("#jsparentExample").text("");
2015-05-05 03:00:01 +02:00
}
else {
2015-07-03 22:44:26 +02:00
$("#jsparentExample").text(parent+"/");
2015-05-05 03:00:01 +02:00
}
2015-07-03 22:44:26 +02:00
checkSlugPage(text, parent, key, $("#jsslug"));
2015-05-05 03:00:01 +02:00
});
2015-07-04 02:14:58 +02:00
$("#jsdelete").click(function() {
2015-08-26 05:42:32 +02:00
if(confirm("<?php $Language->p('confirm-delete-this-action-cannot-be-undone') ?>")==false) {
return false;
2015-07-04 02:14:58 +02:00
}
});
2015-08-26 05:42:32 +02:00
$("#jsadvancedButton").click(function() {
$("#jsadvancedOptions").slideToggle();
return false;
});
2015-05-05 03:00:01 +02:00
});
2015-07-04 00:36:37 +02:00
</script>