Skip to content

Commit

Permalink
Improve api handling
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Aug 29, 2024
1 parent bc041b8 commit a0cbf62
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Core/Http/ApiRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getAuthorizationHeader(): string
*/
public function getAPIKey(): string
{
return trim($this->headers->get('x-api-key') ?? '');
return $this->headers->get('x-api-key');
}

/**
Expand Down
18 changes: 12 additions & 6 deletions app/Domain/Api/Templates/apiKey.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,23 @@
<?php
$currentClient = '';
$i = 0;
$containerOpen = false;
foreach ($tpl->get('allProjects') as $row) {

if ($currentClient != $row['clientName']) {
if ($i > 0) {
if ($i > 0 && $containerOpen) {
echo"</div>";
$containerOpen = false;
}

echo "<h3 id='accordion_link_" . $i . "'>
<a href='#' onclick='accordionToggle(" . $i . ");' id='accordion_toggle_" . $i . "'><i class='fa fa-angle-down'></i> " . $tpl->escape($row['clientName']) . "</a>
</h3>
<div id='accordion_" . $i . "' class='simpleAccordionContainer'>";
$currentClient = $row['clientName'];
<a href='#' onclick='accordionToggle(" . $i . ");' id='accordion_toggle_" . $i . "'><i class='fa fa-angle-down'></i> " . $tpl->escape($row['clientName']) . "</a>
</h3>
<div id='accordion_" . $i . "' class='simpleAccordionContainer'>";
$currentClient = $row['clientName'];
$containerOpen = true;
} ?>

<div class="item">
<input type="checkbox" name="projects[]" id='project_<?php echo $row['id'] ?>' value="<?php echo $row['id'] ?>"
<?php if (is_array($projects) === true && in_array($row['id'], $projects) === true) {
Expand All @@ -97,7 +103,7 @@
/><label for="project_<?php echo $row['id'] ?>"><?php $tpl->e($row['name']); ?></label>
<div class="clearall"></div>
</div>
<?php $i++; ?>
<?php $i++; ?>
<?php } ?>


Expand Down
5 changes: 4 additions & 1 deletion app/Domain/Api/Templates/newAPIKey.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,19 @@
<?php
$currentClient = '';
$i = 0;
$containerOpen = false;
foreach ($tpl->get('allProjects') as $row) {
if ($currentClient != $row['clientName']) {
if ($i > 0) {
if ($i > 0 && $containerOpen) {
echo"</div>";
$containerOpen = false;
}
echo "<h3 id='accordion_link_" . $i . "'>
<a href='#' onclick='accordionToggle(" . $i . ");' id='accordion_toggle_" . $i . "'><i class='fa fa-angle-down'></i> " . $tpl->escape($row['clientName']) . "</a>
</h3>
<div id='accordion_" . $i . "' class='simpleAccordionContainer'>";
$currentClient = $row['clientName'];
$containerOpen = true;
} ?>
<div class="item">
<input type="checkbox" name="projects[]" id='project_<?php echo $row['id'] ?>' value="<?php echo $row['id'] ?>"
Expand Down

0 comments on commit a0cbf62

Please sign in to comment.