diff options
author | Aaron Parecki <aaron@parecki.com> | 2018-07-20 17:59:18 -0500 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2018-07-20 17:59:18 -0500 |
commit | b749bc6c124a02a6949dc67ea703d880e1acd2ac (patch) | |
tree | e6695ac1a3a2cb59977d77434179908295e93029 /views | |
parent | 33796f7bd5def85a5753cc3b4430769379b60475 (diff) |
disable post type buttons if the server doesn't support them
Diffstat (limited to 'views')
-rw-r--r-- | views/dashboard.php | 34 | ||||
-rw-r--r-- | views/layout.php | 16 | ||||
-rw-r--r-- | views/new-post.php | 4 | ||||
-rw-r--r-- | views/settings.php | 15 |
4 files changed, 56 insertions, 13 deletions
diff --git a/views/dashboard.php b/views/dashboard.php index adde977..7b8af63 100644 --- a/views/dashboard.php +++ b/views/dashboard.php @@ -3,14 +3,30 @@ <div style=" margin-top: 4em; margin-bottom: 4em;"> <ul class="post-type-icons"> - <li><a href="/editor">📄</a></li> - <li><a href="/new">✏️</a></li> - <li><a href="/event">📅</a></li> - <li><a href="/bookmark">🔖</a></li> - <li><a href="/favorite">👍</a></li> - <li><a href="/repost">♺</a></li> - <li><a href="/itinerary">✈️</a></li> - <li><a href="/review">⭐️</a></li> + <?php if(supports_post_type($this->user, 'article')): ?> + <li><a href="/editor">📄</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'note')): ?> + <li><a href="/new">✏️</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'event')): ?> + <li><a href="/event">📅</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'bookmark')): ?> + <li><a href="/bookmark">🔖</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'like')): ?> + <li><a href="/favorite">👍</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'repost')): ?> + <li><a href="/repost">♺</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'itinerary')): ?> + <li><a href="/itinerary">✈️</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'review')): ?> + <li><a href="/review">⭐️</a></li> + <?php endif; ?> <li><a href="/email">✉️</a></li> <li><a href="/settings">⚙</a></li> </ul> @@ -27,4 +43,4 @@ float: left; margin-right: 12px; } -</style>
\ No newline at end of file +</style> diff --git a/views/layout.php b/views/layout.php index 0850537..450d982 100644 --- a/views/layout.php +++ b/views/layout.php @@ -77,10 +77,18 @@ <ul class="nav navbar-nav"> <?php if(session('me')) { ?> - <li><a href="/editor">📄 Editor</a></li> - <li><a href="/new">✏️ Note</a></li> - <li><a href="/bookmark">🔖 Bookmark</a></li> - <li><a href="/favorite">👍 Favorite</a></li> + <?php if(supports_post_type($this->user, 'article')): ?> + <li><a href="/editor">📄 Editor</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'note')): ?> + <li><a href="/new">✏️ Note</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'bookmark')): ?> + <li><a href="/bookmark">🔖 Bookmark</a></li> + <?php endif; ?> + <?php if(supports_post_type($this->user, 'like')): ?> + <li><a href="/favorite">👍 Favorite</a></li> + <?php endif; ?> <?php } ?> <li><a href="/docs">Docs</a></li> diff --git a/views/new-post.php b/views/new-post.php index 02733bc..69e3a84 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -65,11 +65,15 @@ <input type="text" id="note_slug" value="" class="form-control"> </div> + <?php if(supports_post_type($this->user, 'photo')): ?> + <div class="form-group hidden" id="photo-previews"> </div> <a href="javascript:addNewPhoto();" id="expand-photo-section"><i class="glyphicon glyphicon-camera" style="color: #aaa; font-size: 36px;"></i></a> + <?php endif ?> + <div class="form-group" style="margin-top: 1em;"> <label for="note_syndicate-to">Syndicate <a href="javascript:reload_syndications()">(refresh list)</a></label> <div id="syndication-container"> diff --git a/views/settings.php b/views/settings.php index 6b69bc2..247aaf6 100644 --- a/views/settings.php +++ b/views/settings.php @@ -20,6 +20,21 @@ <td>media endpoint</td> <td><?= $this->user->micropub_media_endpoint ? '<code>'.$this->user->micropub_media_endpoint.'</code>' : '<a href="https://www.w3.org/TR/micropub/#media-endpoint">no media endpoint</a>' ?></td> </tr> + <?php if($this->user->supported_post_types): ?> + <tr> + <td>supported post types</td> + <td> + <ul> + <?php + $types = json_decode($this->user->supported_post_types, true); + foreach($types as $type) { + echo '<li>'.htmlspecialchars($type['name']).' ('.$type['type'].')</li>'; + } + ?> + </ul> + </td> + </tr> + <?php endif ?> <tr> <td width="140">access token</td> <td><code style="word-break: break-word; white-space: pre-wrap;"><?= $this->user->micropub_access_token ?></code></td> |