Browse Source

support rich editor in logged-out mode

pull/82/head
Aaron Parecki 4 years ago
parent
commit
bdff359178
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 9 additions and 7 deletions
  1. +5
    -6
      controllers/editor.php
  2. +4
    -1
      views/editor.php

+ 5
- 6
controllers/editor.php View File

@ -1,12 +1,11 @@
<?php
$app->get('/editor', function() use($app) {
if($user=require_login($app)) {
$html = $app->render('editor.php', [
'user' => $user
]);
$app->response()->body($html);
}
$user = require_login($app, false);
$html = $app->render('editor.php', [
'user' => $user
]);
$app->response()->body($html);
});
$app->post('/editor/publish', function() use($app) {

+ 4
- 1
views/editor.php View File

@ -44,7 +44,9 @@
<div class="toolbar">
<div class="toolbar-left">
<span class="item"><a href="/"><img src="/editor-files/quill-logo-36.png" width="36" height="31" class="logo"></a></span>
<span class="item text"><b><?= display_url($this->user->url) ?></b></span>
<? if($this->user): ?>
<span class="item text"><b><?= display_url($this->user->url) ?></b></span>
<? endif; ?>
<span class="item text"><span id="draft-status">Draft</span></span>
</div>
<div class="toolbar-right">
@ -109,6 +111,7 @@
<div class="helptext">You need to sign in before you can publish! Don't worry, your draft will still be here when you finish signing in.</div>
<input type="url" class="form-field-small" placeholder="yourdomain.com" id="signin-domain">
<button class="btn btn-small" id="signin-btn">Sign In</button>
<div class="helptext small"><a href="/docs">How does this work?</a></div>
</div>
</div>

Loading…
Cancel
Save