From b749bc6c124a02a6949dc67ea703d880e1acd2ac Mon Sep 17 00:00:00 2001
From: Aaron Parecki <aaron@parecki.com>
Date: Fri, 20 Jul 2018 17:59:18 -0500
Subject: disable post type buttons if the server doesn't support them

---
 views/dashboard.php | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

(limited to 'views/dashboard.php')

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>
-- 
cgit v1.2.3