Преглед на файлове

fix for issue 2 and a few style tweaks

sirjeff преди 1 седмица
родител
ревизия
9780cf31a1
променени са 3 файла, в които са добавени 32 реда и са изтрити 25 реда
  1. 5 1
      Controller/ProjectBrandingController.php
  2. 4 1
      Template/header.php
  3. 23 23
      Template/project_branding/show.php

+ 5 - 1
Controller/ProjectBrandingController.php

@@ -34,12 +34,16 @@ class ProjectBrandingController extends BaseController {
       return $this->response->redirect($this->helper->url->to("ProjectBrandingController", "show", ["project_id" => $project["id"], "plugin" => "OMIProjectBranding"]), true);
     }
     
-    $branding = $this->projectBrandingModel->getBrandingByProjectId($project["id"]);
+    #$branding = $this->projectBrandingModel->getBrandingByProjectId($project["id"]);
+    $branding = $this->projectBrandingModel->getBrandingByProjectId($project["id"]) ?? [];
+        
+    $colors = $this->colorModel->getList();
     
     $this->response->html($this->helper->layout->project("OMIProjectBranding:project_branding/show", [
       "project" => $project,
       "branding" => $branding,
       "title" => t("Project Branding"),
+      "colors" => $colors,
     ]));
   }
 }

+ 4 - 1
Template/header.php

@@ -30,7 +30,7 @@ if (isset($project) && isset($project["id"])) {
   }
   .project-header{
     background-color:<?= !empty($branding["second_background_color"]) ? $branding["second_background_color"] : "transparent" ?>;
-    padding:.5em;
+    padding:.5em .5em .8em .5em;
     height: 1.5em;
   }
   h1 {
@@ -42,6 +42,9 @@ if (isset($project) && isset($project["id"])) {
     margin-right:5px;
     opacity:1;
   }
+  a .fa {
+    color:<?= !empty($branding["foreground_color"]) ? $branding["foreground_color"] : "initial" ?>;
+  }
 </style>
 <?php endif ?>
 

+ 23 - 23
Template/project_branding/show.php

@@ -1,31 +1,31 @@
 <div class="page-header">
-  <h2><?= t("Project Branding Settings") ?></h2>
+    <h2><?= t("Project Branding Settings") ?></h2>
 </div>
 
 <form method="post" action="<?= $this->url->to('ProjectBrandingController', 'show', ['project_id' => $project['id'], 'plugin' => 'OMIProjectBranding']) ?>" autocomplete="off">
-  <?= $this->form->csrf() ?>
-  
-  <p>
-    <?= t("Configure the header logo and colours for this project.") ?>
-  </p>
-  
-  <?= $this->form->label(t("Enable custom branding"), "enabled") ?>
-  <?= $this->form->checkbox("enabled", "", 1, $branding["enabled"] ?? 0) ?>
-  
-  <?= $this->form->label(t("Logo URL"), "logo_url") ?>
-  <?= $this->form->text("logo_url", $branding, [], ['placeholder="https://example.com/logo.png"']) ?>
-  
-  <?= $this->form->label(t("Foreground Color"), "foreground_color") ?>
-  <?= $this->form->colorSelect("foreground_color", $branding) ?>
+    <?= $this->form->csrf() ?>
+    
+    <p>
+        <?= t("Configure the header logo and colours for this project.") ?>
+    </p>
+    
+    <?= $this->form->label(t("Enable custom branding"), "enabled") ?>
+    <?= $this->form->checkbox("enabled", "", 1, $branding["enabled"] ?? 0) ?>
+    
+    <?= $this->form->label(t("Logo URL"), "logo_url") ?>
+    <?= $this->form->text("logo_url", $branding, [], ['placeholder="https://example.com/logo.png"']) ?>
+    
+    <?= $this->form->label(t("Foreground Color"), "foreground_color") ?>
+    <?= $this->form->colorSelect("foreground_color", $branding, $colors) ?>
 
     
-  <?= $this->form->label(t("Background Color"), "background_color") ?>
-  <?= $this->form->colorSelect("background_color", $branding) ?>
+    <?= $this->form->label(t("Background Color"), "background_color") ?>
+    <?= $this->form->colorSelect("background_color", $branding, $colors) ?>
 
-  <?= $this->form->label(t("Secondary Background Color"), "second_background_color") ?>
-  <?= $this->form->colorSelect("second_background_color", $branding) ?>
-  
-  <div class="form-actions">
-    <button type="submit" class="btn btn-blue"><?= t("Save") ?></button>
-  </div>
+    <?= $this->form->label(t("Secondary Background Color"), "second_background_color") ?>
+    <?= $this->form->colorSelect("second_background_color", $branding, $colors) ?>
+    
+    <div class="form-actions">
+        <button type="submit" class="btn btn-blue"><?= t("Save") ?></button>
+    </div>
 </form>