mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Add preview page -- Make changes based on code review
Adjust styles, add preview header, change underbar to dash.
This commit is contained in:
parent
c478f50f68
commit
5e51ebf213
3 changed files with 22 additions and 14 deletions
|
@ -260,7 +260,7 @@ figcaption { text-align: center; }
|
||||||
|
|
||||||
.printable { padding: 2rem; }
|
.printable { padding: 2rem; }
|
||||||
|
|
||||||
h1 { text-align: center; }
|
h1, h4 { text-align: center; }
|
||||||
.sitename { margin-top: 5rem; margin-bottom: 3rem; font-size: 2.5rem; }
|
.sitename { margin-top: 5rem; margin-bottom: 3rem; font-size: 2.5rem; }
|
||||||
.logo { max-width: 4rem; max-height: 4rem; vertical-align: middle; }
|
.logo { max-width: 4rem; max-height: 4rem; vertical-align: middle; }
|
||||||
.logo.small { max-width: 2rem; max-height: 2rem; }
|
.logo.small { max-width: 2rem; max-height: 2rem; }
|
||||||
|
@ -288,8 +288,7 @@ textarea { min-height: 10em; line-height: 1.3em; font-size: 1.25rem; }
|
||||||
textarea, textarea[name=content] + pre, textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
textarea, textarea[name=content] + pre, textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
||||||
textarea ~ input[type=submit] { margin: 0.5rem 0; padding: 0.5rem; font-weight: bolder; }
|
textarea ~ input[type=submit] { margin: 0.5rem 0; padding: 0.5rem; font-weight: bolder; }
|
||||||
.editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
.editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
||||||
input.edit-page-button[name='submit-edit'] { width: calc(50% - 1.25rem); margin-right: 1rem }
|
input.edit-page-button[type='submit'] { width: 49.5%; box-sizing: border-box; }
|
||||||
input.edit-page-button[name='preview-edit'] { width: calc(50% - 1.25rem); margin-left: 1rem }
|
|
||||||
.jump-to-comments { position: relative; top: -2.5em; display: block; text-align: right; pointer-events: none; }
|
.jump-to-comments { position: relative; top: -2.5em; display: block; text-align: right; pointer-events: none; }
|
||||||
.jump-to-comments > a { pointer-events: all; }
|
.jump-to-comments > a { pointer-events: all; }
|
||||||
|
|
||||||
|
@ -5079,13 +5078,14 @@ register_module([
|
||||||
global $settings, $env;
|
global $settings, $env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} ?action=preview_edit&page={pageName}[&newpage=yes] Get a preview of the page
|
* @api {post} ?action=preview-edit&page={pageName}[&newpage=yes] Get a preview of the page
|
||||||
* @apiDescription Gets a preview of the current edit state of a given page
|
* @apiDescription Gets a preview of the current edit state of a given page
|
||||||
* @apiName PreviewPage
|
* @apiName PreviewPage
|
||||||
* @apiPermission Anonymous
|
* @apiPermission Anonymous
|
||||||
*
|
*
|
||||||
* @apiUse PageParameter
|
* @apiUse PageParameter
|
||||||
* @apiParam {string} newpage Set to 'yes' if a new page is being created.
|
* @apiParam {string} newpage Set to 'yes' if a new page is being created.
|
||||||
|
* @apiParam {string} preview-edit Set to a value to preview an edit of a page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5103,7 +5103,7 @@ register_module([
|
||||||
* ███████ ██████ ██ ██
|
* ███████ ██████ ██ ██
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
add_action("preview_edit", function() {
|
add_action("preview-edit", function() {
|
||||||
global $pageindex, $settings, $env, $actions;
|
global $pageindex, $settings, $env, $actions;
|
||||||
|
|
||||||
if(isset($_POST['preview-edit']) && isset($_POST['content'])) {
|
if(isset($_POST['preview-edit']) && isset($_POST['content'])) {
|
||||||
|
@ -5147,6 +5147,10 @@ register_module([
|
||||||
{
|
{
|
||||||
$title = "Creating $env->page";
|
$title = "Creating $env->page";
|
||||||
}
|
}
|
||||||
|
else if(isset($_POST['preview-edit']) && isset($_POST['content']))
|
||||||
|
{
|
||||||
|
$title = "Preview Edits for $env->page";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$title = "Editing $env->page";
|
$title = "Editing $env->page";
|
||||||
|
@ -5231,11 +5235,11 @@ register_module([
|
||||||
$page_tags = $_POST['tags'];
|
$page_tags = $_POST['tags'];
|
||||||
|
|
||||||
// Insert the "view" part of the page we're editing
|
// Insert the "view" part of the page we're editing
|
||||||
$content .= parse_page_source($pagetext);
|
$content .= "<h4>To continue editing or save, scroll down...</h4>" . parse_page_source($pagetext);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$content .= "<form method='post' name='edit-form' action='index.php?action=preview_edit&page=' class='editform'>
|
$content .= "<form method='post' name='edit-form' action='index.php?action=preview-edit&page=' class='editform'>
|
||||||
<input type='hidden' name='prev-content-hash' value='" . ((isset($old_pagetext)) ? sha1($old_pagetext) : sha1($pagetext)) . "' />
|
<input type='hidden' name='prev-content-hash' value='" . ((isset($old_pagetext)) ? sha1($old_pagetext) : sha1($pagetext)) . "' />
|
||||||
<textarea name='content' autofocus tabindex='1'>$pagetext</textarea>
|
<textarea name='content' autofocus tabindex='1'>$pagetext</textarea>
|
||||||
<pre class='fit-text-mirror'></pre>
|
<pre class='fit-text-mirror'></pre>
|
||||||
|
|
|
@ -10,13 +10,14 @@ register_module([
|
||||||
global $settings, $env;
|
global $settings, $env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} ?action=preview_edit&page={pageName}[&newpage=yes] Get a preview of the page
|
* @api {post} ?action=preview-edit&page={pageName}[&newpage=yes] Get a preview of the page
|
||||||
* @apiDescription Gets a preview of the current edit state of a given page
|
* @apiDescription Gets a preview of the current edit state of a given page
|
||||||
* @apiName PreviewPage
|
* @apiName PreviewPage
|
||||||
* @apiPermission Anonymous
|
* @apiPermission Anonymous
|
||||||
*
|
*
|
||||||
* @apiUse PageParameter
|
* @apiUse PageParameter
|
||||||
* @apiParam {string} newpage Set to 'yes' if a new page is being created.
|
* @apiParam {string} newpage Set to 'yes' if a new page is being created.
|
||||||
|
* @apiParam {string} preview-edit Set to a value to preview an edit of a page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -34,7 +35,7 @@ register_module([
|
||||||
* ███████ ██████ ██ ██
|
* ███████ ██████ ██ ██
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
add_action("preview_edit", function() {
|
add_action("preview-edit", function() {
|
||||||
global $pageindex, $settings, $env, $actions;
|
global $pageindex, $settings, $env, $actions;
|
||||||
|
|
||||||
if(isset($_POST['preview-edit']) && isset($_POST['content'])) {
|
if(isset($_POST['preview-edit']) && isset($_POST['content'])) {
|
||||||
|
@ -78,6 +79,10 @@ register_module([
|
||||||
{
|
{
|
||||||
$title = "Creating $env->page";
|
$title = "Creating $env->page";
|
||||||
}
|
}
|
||||||
|
else if(isset($_POST['preview-edit']) && isset($_POST['content']))
|
||||||
|
{
|
||||||
|
$title = "Preview Edits for $env->page";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$title = "Editing $env->page";
|
$title = "Editing $env->page";
|
||||||
|
@ -162,11 +167,11 @@ register_module([
|
||||||
$page_tags = $_POST['tags'];
|
$page_tags = $_POST['tags'];
|
||||||
|
|
||||||
// Insert the "view" part of the page we're editing
|
// Insert the "view" part of the page we're editing
|
||||||
$content .= parse_page_source($pagetext);
|
$content .= "<h4>To continue editing or save, scroll down...</h4>" . parse_page_source($pagetext);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$content .= "<form method='post' name='edit-form' action='index.php?action=preview_edit&page=' class='editform'>
|
$content .= "<form method='post' name='edit-form' action='index.php?action=preview-edit&page=' class='editform'>
|
||||||
<input type='hidden' name='prev-content-hash' value='" . ((isset($old_pagetext)) ? sha1($old_pagetext) : sha1($pagetext)) . "' />
|
<input type='hidden' name='prev-content-hash' value='" . ((isset($old_pagetext)) ? sha1($old_pagetext) : sha1($pagetext)) . "' />
|
||||||
<textarea name='content' autofocus tabindex='1'>$pagetext</textarea>
|
<textarea name='content' autofocus tabindex='1'>$pagetext</textarea>
|
||||||
<pre class='fit-text-mirror'></pre>
|
<pre class='fit-text-mirror'></pre>
|
||||||
|
|
|
@ -45,7 +45,7 @@ figcaption { text-align: center; }
|
||||||
|
|
||||||
.printable { padding: 2rem; }
|
.printable { padding: 2rem; }
|
||||||
|
|
||||||
h1 { text-align: center; }
|
h1, h4 { text-align: center; }
|
||||||
.sitename { margin-top: 5rem; margin-bottom: 3rem; font-size: 2.5rem; }
|
.sitename { margin-top: 5rem; margin-bottom: 3rem; font-size: 2.5rem; }
|
||||||
.logo { max-width: 4rem; max-height: 4rem; vertical-align: middle; }
|
.logo { max-width: 4rem; max-height: 4rem; vertical-align: middle; }
|
||||||
.logo.small { max-width: 2rem; max-height: 2rem; }
|
.logo.small { max-width: 2rem; max-height: 2rem; }
|
||||||
|
@ -73,8 +73,7 @@ textarea { min-height: 10em; line-height: 1.3em; font-size: 1.25rem; }
|
||||||
textarea, textarea[name=content] + pre, textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
textarea, textarea[name=content] + pre, textarea ~ input[type=submit], #search-box { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
||||||
textarea ~ input[type=submit] { margin: 0.5rem 0; padding: 0.5rem; font-weight: bolder; }
|
textarea ~ input[type=submit] { margin: 0.5rem 0; padding: 0.5rem; font-weight: bolder; }
|
||||||
.editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
.editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; }
|
||||||
input.edit-page-button[name='submit-edit'] { width: calc(50% - 1.25rem); margin-right: 1rem }
|
input.edit-page-button[type='submit'] { width: 49.5%; box-sizing: border-box; }
|
||||||
input.edit-page-button[name='preview-edit'] { width: calc(50% - 1.25rem); margin-left: 1rem }
|
|
||||||
.jump-to-comments { position: relative; top: -2.5em; display: block; text-align: right; pointer-events: none; }
|
.jump-to-comments { position: relative; top: -2.5em; display: block; text-align: right; pointer-events: none; }
|
||||||
.jump-to-comments > a { pointer-events: all; }
|
.jump-to-comments > a { pointer-events: all; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue