svalavuo 4 päivää sitten
vanhempi
sitoutus
97e87d1643
4 muutettua tiedostoa jossa 67 lisäystä ja 1 poistoa
  1. 55 0
      css/style.css
  2. 1 0
      languages/en.php
  3. 1 0
      languages/fi.php
  4. 10 1
      public/publication.php

+ 55 - 0
css/style.css

@@ -894,3 +894,58 @@ textarea {
         overflow-x: auto;
     }
 }
+
+/* Admin Edit Button Styles */
+.publication-title-section {
+    display: flex;
+    align-items: center;
+    gap: 1rem;
+    margin-bottom: 1rem;
+}
+
+.admin-edit-btn {
+    display: inline-flex;
+    align-items: center;
+    gap: 0.5rem;
+    padding: 0.5rem 1rem;
+    background: linear-gradient(135deg, #007bff, #0056b3);
+    color: white;
+    text-decoration: none;
+    border-radius: 0.375rem;
+    font-size: 0.875rem;
+    font-weight: 500;
+    transition: all 0.2s ease;
+    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
+}
+
+.admin-edit-btn:hover {
+    background: linear-gradient(135deg, #0056b3, #004085);
+    color: white;
+    text-decoration: none;
+    transform: translateY(-1px);
+    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
+}
+
+.admin-edit-btn:active {
+    transform: translateY(0);
+    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
+}
+
+.admin-edit-btn .icon-edit {
+    font-size: 1rem;
+}
+
+/* Responsive adjustments for edit button */
+@media (max-width: 768px) {
+    .publication-title-section {
+        flex-direction: column;
+        align-items: flex-start;
+        gap: 0.5rem;
+    }
+    
+    .admin-edit-btn {
+        align-self: flex-start;
+        font-size: 0.8rem;
+        padding: 0.4rem 0.8rem;
+    }
+}

+ 1 - 0
languages/en.php

@@ -17,6 +17,7 @@ return [
     'save' => 'Save',
     'delete' => 'Delete',
     'edit' => 'Edit',
+    'admin_edit_publication' => 'Edit Publication',
     'create' => 'Create',
     'update' => 'Update',
     'view' => 'View',

+ 1 - 0
languages/fi.php

@@ -17,6 +17,7 @@ return [
     'save' => 'Tallenna',
     'delete' => 'Poista',
     'edit' => 'Muokkaa',
+    'admin_edit_publication' => 'Muokkaa julkaisua',
     'create' => 'Luo',
     'update' => 'Päivitä',
     'view' => 'Näytä',

+ 10 - 1
public/publication.php

@@ -10,11 +10,13 @@ require_once '../includes/publication.php';
 require_once '../includes/comment.php';
 require_once '../includes/captcha.php';
 require_once '../includes/translation.php';
+require_once '../includes/auth.php';
 
 // Translation system is auto-initialized when translation.php is included
 
 $publication = new Publication();
 $comment = new Comment();
+$auth = new Auth();
 
 $id = (int)($_GET['id'] ?? 0);
 $pub = $publication->getById($id);
@@ -68,7 +70,14 @@ $commentCount = $comment->getCountByPublication($id);
     <div class="container">
         <article class="publication-full">
             <header class="publication-header">
-                <h1><?php echo htmlspecialchars($pub['title']); ?></h1>
+                <div class="publication-title-section">
+                    <h1><?php echo htmlspecialchars($pub['title']); ?></h1>
+                    <?php if ($auth->isAdmin()): ?>
+                        <a href="../admin/edit.php?id=<?php echo $id; ?>" class="admin-edit-btn" title="<?php echo t('admin_edit_publication'); ?>">
+                            <i class="icon-edit">✏️</i> <?php echo t('edit'); ?>
+                        </a>
+                    <?php endif; ?>
+                </div>
                 
                 <div class="publication-meta">
                     <span class="author">By <?php echo htmlspecialchars($pub['author']); ?></span>