Skip to content

Commit

Permalink
Merge pull request #773 from KuJoe/master
Browse files Browse the repository at this point in the history
Added a focus mode to the Add/Edit for Posts/Pages by @KuJoe
  • Loading branch information
danpros authored May 28, 2024
2 parents 4a78e48 + f7c8fed commit dfee568
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lang/en_US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,5 @@ mfa_config = "Multi Factor Authentication (MFA)"
set_mfa_globally = "Set the status of MFA"
explain_mfa = "When enabled, MFA is optional for all users. When disabled, no users can use it and it hides the field on the login page."
set_version_publicly = "Version Visibility"
explain_version = "By default the version of HTMLy is visible publicly in the source code, some bots and bad actors can use this information for bad reasons so some admins may prefer to hide this."
explain_version = "By default the version of HTMLy is visible publicly in the source code, some bots and bad actors can use this information for bad reasons so some admins may prefer to hide this."
focus_mode = "Toggle Focus"
19 changes: 17 additions & 2 deletions system/admin/views/add-content.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function extractLast( term ) {
<div class="row">
<div class="wmd-panel" style="width:100%;">
<form method="POST">
<div class="row">
<div id="post-settings" class="row">
<div class="col-sm-6">
<label for="pTitle"><?php echo i18n('Title');?> <span class="required">*</span></label>
<input autofocus type="text" class="form-control text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" id="pTitle" name="title" value="<?php if (isset($postTitle)) { echo $postTitle;} ?>"/>
Expand Down Expand Up @@ -181,7 +181,7 @@ function extractLast( term ) {
<label for="wmd-input"><?php echo i18n('Content');?> <span class="required">*</span></label>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="form-control wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error'; } } ?>" name="content" cols="20" rows="15"><?php if (isset($postContent)) { echo $postContent;} ?></textarea><br>
<input type="submit" name="publish" class="btn btn-primary submit" value="<?php echo i18n('Publish');?>"/> <input type="submit" name="draft" class="btn btn-primary draft" value="<?php echo i18n('Save_as_draft');?>"/>
<input type="submit" name="publish" class="btn btn-primary submit" value="<?php echo i18n('Publish');?>"/> <input type="submit" name="draft" class="btn btn-primary draft" value="<?php echo i18n('Save_as_draft');?>"/> <input type="button" id="hideButton" class="btn btn-secondary" value="<?php echo i18n('Focus_mode');?>"/>
<br><br>
</div>
</div>
Expand Down Expand Up @@ -319,6 +319,21 @@ function loadImages(page) {
$('#insertImageDialogURL').val($(e.target).attr('src'));
});
</script>
<script>
function toggleDivs() {
var div1 = document.getElementById('post-settings');
if (div1.style.display === 'none') {
div1.style.display = '';
document.body.classList.add("sidebar-mini");
document.body.classList.remove("sidebar-collapse")
} else {
div1.style.display = 'none';
document.body.classList.remove("sidebar-mini")
document.body.classList.add("sidebar-collapse");
}
}
document.getElementById('hideButton').addEventListener('click', toggleDivs);
</script>
<?php if (config('autosave.enable') == 'true' ):?>
<script src="<?php echo site_url();?>system/resources/js/save_draft.js"></script>
<?php endif;?>
18 changes: 17 additions & 1 deletion system/admin/views/add-page.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="row">
<div class="wmd-panel" style="width:100%;">
<form method="POST">
<div class="row">
<div id="post-settings" class="row">
<div class="col-sm-6">
<label for="pTitle"><?php echo i18n('Title');?> <span class="required">*</span></label>
<input type="text" class="form-control text <?php if (isset($postTitle)) {if (empty($postTitle)) {echo 'error';}} ?>" id="pTitle" name="title" value="<?php if (isset($postTitle)) {echo $postTitle;} ?>"/>
Expand Down Expand Up @@ -48,6 +48,7 @@
<?php if ($type == 'is_category') :?>
<input type="submit" name="submit" class="btn btn-primary submit" value="<?php echo i18n('Add_category');?>"/>
<?php endif;?>
<input type="button" id="hideButton" class="btn btn-secondary" value="<?php echo i18n('Focus_mode');?>"/>
</div>
<div class="col-sm-6">
<label><?php echo i18n('Preview');?></label>
Expand Down Expand Up @@ -145,6 +146,21 @@ function loadImages(page) {
$('#insertImageDialogURL').val($(e.target).attr('src'));
});
</script>
<script>
function toggleDivs() {
var div1 = document.getElementById('post-settings');
if (div1.style.display === 'none') {
div1.style.display = '';
document.body.classList.add("sidebar-mini");
document.body.classList.remove("sidebar-collapse")
} else {
div1.style.display = 'none';
document.body.classList.remove("sidebar-mini")
document.body.classList.add("sidebar-collapse");
}
}
document.getElementById('hideButton').addEventListener('click', toggleDivs);
</script>
<?php if (config('autosave.enable') == 'true' ):?>
<script src="<?php echo site_url();?>system/resources/js/save_draft.js"></script>
<?php endif;?>
18 changes: 17 additions & 1 deletion system/admin/views/edit-content.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function extractLast( term ) {
<div class="row">
<div class="wmd-panel" style="width:100%;">
<form method="POST">
<div class="row">
<div id="post-settings" class="row">
<div class="col-sm-6">
<label for="pTitle"><?php echo i18n('Title');?> <span class="required">*</span></label>
<input autofocus type="text" id="pTitle" name="title" class="form-control text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';} } ?>" value="<?php echo $oldtitle ?>"/>
Expand Down Expand Up @@ -233,6 +233,7 @@ function extractLast( term ) {
<?php } else { ?>
<input type="submit" name="updatepost" class="btn btn-primary submit" value="<?php echo i18n('Update_post');?>"/> <input type="submit" name="revertpost" class="btn btn-primary revert" value="<?php echo i18n('Revert_to_draft');?>"/> <a class="btn btn-danger" href="<?php echo $delete ?>"><?php echo i18n('Delete');?></a>
<?php }?>
<input type="button" id="hideButton" class="btn btn-secondary" value="<?php echo i18n('Focus_mode');?>"/>
<br><br>
</div>
</div>
Expand Down Expand Up @@ -369,6 +370,21 @@ function loadImages(page) {
$('#insertImageDialogURL').val($(e.target).attr('src'));
});
</script>
<script>
function toggleDivs() {
var div1 = document.getElementById('post-settings');
if (div1.style.display === 'none') {
div1.style.display = '';
document.body.classList.add("sidebar-mini");
document.body.classList.remove("sidebar-collapse")
} else {
div1.style.display = 'none';
document.body.classList.remove("sidebar-mini")
document.body.classList.add("sidebar-collapse");
}
}
document.getElementById('hideButton').addEventListener('click', toggleDivs);
</script>
<?php if (config('autosave.enable') == 'true' ):?>
<?php if ($isdraft[4] == 'draft') : ?>
<script src="<?php echo site_url();?>system/resources/js/save_draft.js"></script>
Expand Down
18 changes: 17 additions & 1 deletion system/admin/views/edit-page.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<div class="row">
<div class="wmd-panel" style="width:100%;">
<form method="POST">
<div class="row">
<div id="post-settings" class="row">
<div class="col-sm-6">
<label for="pTitle"><?php echo i18n('Title');?> <span class="required">*</span></label>
<input type="text" id="pTitle" name="title" class="form-control text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error'; } } ?>" value="<?php echo $oldtitle ?>"/>
Expand Down Expand Up @@ -159,6 +159,7 @@
<input type="submit" name="submit" class="btn btn-primary submit" value="<?php echo i18n('Save');?>"/> <?php if (empty($dd) && empty($dr) && $type != 'is_page'):?><input type="submit" name="revertpage" class="btn btn-primary revert" value="<?php echo i18n('Revert_to_draft');?>"/> <a class="btn btn-danger" href="<?php echo $delete ?>"><?php echo i18n('Delete');?></a><?php endif;?>
<?php } ?>
<?php } ?>
<input type="button" id="hideButton" class="btn btn-secondary" value="<?php echo i18n('Focus_mode');?>"/>
</div>
<div class="col-sm-6">
<label><?php echo i18n('Preview');?></label>
Expand Down Expand Up @@ -296,6 +297,21 @@ function loadImages(page) {
$('#insertImageDialogURL').val($(e.target).attr('src'));
});
</script>
<script>
function toggleDivs() {
var div1 = document.getElementById('post-settings');
if (div1.style.display === 'none') {
div1.style.display = '';
document.body.classList.add("sidebar-mini");
document.body.classList.remove("sidebar-collapse")
} else {
div1.style.display = 'none';
document.body.classList.remove("sidebar-mini")
document.body.classList.add("sidebar-collapse");
}
}
document.getElementById('hideButton').addEventListener('click', toggleDivs);
</script>
<?php if (config('autosave.enable') == 'true' ):?>
<?php if (stripos($dir . '/', '/draft/') !== false): ?>
<script src="<?php echo site_url();?>system/resources/js/save_draft.js"></script>
Expand Down

0 comments on commit dfee568

Please sign in to comment.