Skip to content

Commit

Permalink
Ensure current project is selected for new sprints
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Nov 18, 2024
1 parent 6da255a commit cbc8aff
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 10 deletions.
63 changes: 63 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions app/Domain/Sprints/Templates/sprintdialog.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
<label><?= $tpl->__('label.sprint_name') ?></label>
<input type="text" name="name" value="<?php echo $currentSprint->name?>" placeholder="<?= $tpl->__('label.sprint_name') ?>"/><br />

<?php

function isSelected($projectId, $currentSprint, $currentProject) {
return (isset($currentSprint) && ($currentSprint->projectId == $projectId || $currentProject == $projectId)) ||
(!isset($currentSprint) && $currentProject == $projectId);
}

$currentProject = session('currentProject');
?>
<label><?= $tpl->__('label.project') ?></label>
<select name="projectId">
<?php foreach ($allAssignedprojects as $project) { ?>
<option value="<?= $project['id'] ?>"
<?php
if (isset($currentSprint)) {
if ($currentSprint->projectId == $project['id']) {
echo 'selected';
}
} elseif (session('currentProject') == $project['id']) {
echo 'selected';
}
?>
<option value="<?= $project['id'] ?>" <?= isSelected($project['id'], $currentSprint ?? null, $currentProject) ? 'selected' : '' ?>
><?= $tpl->escape($project['name']); ?></option>
<?php } ?>
</select><br />
Expand Down

0 comments on commit cbc8aff

Please sign in to comment.