summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2017-02-27 12:31:06 -0800
committerAaron Parecki <aaron@parecki.com>2017-02-27 12:31:06 -0800
commit1123ed958f7c22116a0c432779aaf1c27fcaf787 (patch)
tree3000bb267e65efb8561c459b7a38d07bda690231 /views
parentbb5fd837d12d125f908feb09808df3f6db1fe817 (diff)
basic editing support
* new route `/edit?url=` intended to be used as an edit button target, which detects the type of post and redirects to the appropriate editing interface * implemented the edit interface for favorites
Diffstat (limited to 'views')
-rw-r--r--views/auth_start.php3
-rw-r--r--views/edit/error.php13
-rw-r--r--views/new-favorite.php13
3 files changed, 22 insertions, 7 deletions
diff --git a/views/auth_start.php b/views/auth_start.php
index 1fe0cdb..d41ffb4 100644
--- a/views/auth_start.php
+++ b/views/auth_start.php
@@ -56,7 +56,8 @@
<form action="/auth/redirect" method="get">
<p>Choose the scope to request:</p>
<ul style="list-style-type: none;">
- <li><input type="radio" name="scope" value="create" checked="checked"> create</li>
+ <li><input type="radio" name="scope" value="create update" checked="checked"> create update</li>
+ <li><input type="radio" name="scope" value="create"> create</li>
<li><input type="radio" name="scope" value="post"> post (legacy)</li>
</ul>
diff --git a/views/edit/error.php b/views/edit/error.php
new file mode 100644
index 0000000..ede6e0d
--- /dev/null
+++ b/views/edit/error.php
@@ -0,0 +1,13 @@
+<div class="narrow">
+ <?= partial('partials/header') ?>
+
+ <h1>Error</h1>
+
+ <p><?= htmlspecialchars($this->summary) ?></p>
+
+ <div class="bs-callout bs-callout-danger">
+ <h4><?= htmlspecialchars($this->error) ?></h4>
+ <?= htmlspecialchars($this->error_description) ?>
+ </div>
+
+</div> \ No newline at end of file
diff --git a/views/new-favorite.php b/views/new-favorite.php
index 9f191e8..524bb79 100644
--- a/views/new-favorite.php
+++ b/views/new-favorite.php
@@ -2,21 +2,22 @@
<?= partial('partials/header') ?>
<div style="clear: both;" class="notice-pad">
- <div class="alert alert-success hidden" id="test_success"><strong>Success! We found a Location header in the response!</strong><br>Your post should be on your website now!<br><a href="" id="post_href">View your post</a></div>
+ <div class="alert alert-success hidden" id="test_success"><strong>Success!</strong><br>Your post should be on your website now!<br><a href="" id="post_href">View your post</a></div>
<div class="alert alert-danger hidden" id="test_error"><strong>Your endpoint did not return a Location header.</strong><br>See <a href="/creating-a-micropub-endpoint">Creating a Micropub Endpoint</a> for more information.</div>
</div>
<form role="form" style="margin-top: 20px;" id="note_form">
<div class="form-group">
- <label for="note_url">URL to Favorite (<code>like-of</code>)</label>
- <input type="text" id="note_url" value="<?= $this->url ?>" class="form-control">
+ <label for="like_of">URL to Favorite (<code>like-of</code>)</label>
+ <input type="text" id="like_of" value="<?= $this->like_of ?>" class="form-control">
</div>
<div style="float: right; margin-top: 6px;">
- <button class="btn btn-success" id="btn_post">Post</button>
+ <button class="btn btn-success" id="btn_post"><?= $this->url ? 'Save' : 'Post' ?></button>
</div>
+ <input type="hidden" id="edit_url" value="<?= $this->url ?>">
</form>
<div style="clear: both;"></div>
@@ -27,7 +28,6 @@
</div>
</div>
-
<script>
$(function(){
@@ -40,7 +40,8 @@ $(function(){
});
$.post("/favorite", {
- url: $("#note_url").val()
+ like_of: $("#like_of").val(),
+ edit: $("#edit_url").val()
}, function(response){
if(response.location != false) {