Skip to content

Commit

Permalink
Few more fixes I missed
Browse files Browse the repository at this point in the history
  • Loading branch information
creecros committed Oct 19, 2022
1 parent 4c2ec10 commit 408723f
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions Action/EmailTaskHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Kanboard\Model\TaskModel;
use Kanboard\Model\CommentModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\UserMetadataModel;
use Kanboard\Action\Base;

Expand Down
5 changes: 5 additions & 0 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public function initialize()

$this->actionManager->register(new EmailTaskHistory($this->container));

if (!file_exists('plugins/Subtaskdate')) {

This comment has been minimized.

Copy link
@creecros

creecros Oct 19, 2022

Author Collaborator

this right here is what needs to be done for TemplateTitle and Group_assign to function properly together. Albeit, a little more than just this line of code, but in both plugins need to check if the other is installed, and in both plugins conditionally determine which templates to use when overriding.

$this->template->setTemplateOverride('action_creation/params', 'kanboardEmailHistory:action_creation/params');
}


}

public function onStartup()
Expand Down
57 changes: 57 additions & 0 deletions Template/action_creation/params.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<div class="page-header">
<h2><?= t('Define action parameters') ?></h2>
</div>

<form method="post" action="<?= $this->url->href('ActionCreationController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>

<?= $this->form->hidden('event_name', $values) ?>
<?= $this->form->hidden('action_name', $values) ?>

<?= $this->form->label(t('Action'), 'action_name') ?>
<?= $this->form->select('action_name', $available_actions, $values, array(), array('disabled')) ?>

<?= $this->form->label(t('Event'), 'event_name') ?>
<?= $this->form->select('event_name', $events, $values, array(), array('disabled')) ?>

<?php foreach ($action_params as $param_name => $param_desc): ?>
<?php if ($this->text->contains($param_name, 'column_id')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $columns_list, $values) ?>
<?php elseif ($this->text->contains($param_name, 'user_id')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $users_list, $values) ?>
<?php elseif ($this->text->contains($param_name, 'project_id')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $projects_list, $values) ?>
<?php elseif ($this->text->contains($param_name, 'color_id')): ?>
<?= $this->form->colorSelect('params['.$param_name.']', $values) ?>
<?php elseif ($this->text->contains($param_name, 'category_id')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $categories_list, $values) ?>
<?php elseif ($this->text->contains($param_name, 'link_id')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $links_list, $values) ?>
<?php elseif ($this->text->contains($param_name, 'check_box')): ?>
<?= $this->form->label(t('Options'), $param_name) ?>
<?= $this->form->checkbox('params['.$param_name.']', $param_desc, 1) ?>
<?php elseif ($param_name === 'priority'): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $priorities_list, $values) ?>
<?php elseif ($this->text->contains($param_name, 'duration')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->number('params['.$param_name.']', $values) ?>
<?php elseif ($this->text->contains($param_name, 'swimlane_id')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $swimlane_list, $values) ?>
<?php elseif (is_array($param_desc)): ?>
<?= $this->form->label(ucfirst($param_name), $param_name) ?>
<?= $this->form->select('params['.$param_name.']', $param_desc, $values) ?>
<?php else: ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->text('params['.$param_name.']', $values) ?>
<?php endif ?>
<?php endforeach ?>

<?= $this->modal->submitButtons() ?>
</form>

9 comments on commit 408723f

@creecros
Copy link
Collaborator Author

@creecros creecros commented on 408723f Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the "Check_box" option work as an actual check box, if you use AutoSubtask Plugin, it is not needed, so I added code to check if that plugin is installed and override the template if not.

@creecros
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its funny that i just noticed this now, its been so long since i used kanboard, and i must have always had AutoSubtask plugin installed when I tested things, that I took for granted the check_box option in the action param, and years later just realized I had to add it somewhere, as it was not a native option.

@aljawaid
Copy link
Owner

@aljawaid aljawaid commented on 408723f Nov 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its funny that i just noticed this now, its been so long since i used kanboard, and i must have always had AutoSubtask plugin installed when I tested things, that I took for granted the check_box option in the action param, and years later just realized I had to add it somewhere, as it was not a native option.

how can I make this a radio insteadof checkbox? I've looked at the file and not seen a 'radio' type in there. Related to #6 #7

@creecros
Copy link
Collaborator Author

@creecros creecros commented on 408723f Nov 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aljawaid
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

radios and check boxes are different.

a checkbox is true or false. radios are a series of true or false, within an array of options.

https://github.com/creecros/MetaMagik/blob/c822493dc4a1a5d99bf5da7f25af81f5f2e94e0a/Helper/MetaHelper.php#L59

Its fine, too compplicated, I will stick to checkboxes so the user has better multiple options.... please check latest commit

@creecros
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually it's not, I didn't realize there was a single radio function in the helper already. I'll add it when I get a moment. Thanksgiving holiday is over tomorrow.

@aljawaid
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool. Didn't realise there was a holiday going on. Not in the US. Hope you had a good one. You should know I have changed the branch name to master and also check the checkbox options I already done. Doubt any of them work.

@creecros
Copy link
Collaborator Author

@creecros creecros commented on 408723f Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this should work in the action params template.

        <?php elseif ($this->text->contains($param_name, 'radio')): ?>
            <?= $this->form->label(t('Options'), $param_name) ?>
            <?= $this->form->radio('params['.$param_name.']', $param_desc, 1) ?>    

and then use
'radio_include_project' => t('Include the Project Name in the subject line?'),
instead of
'check_box_include_project' => t('Include the Project Name in the subject line?'),

@aljawaid
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this should work in the action params template.

        <?php elseif ($this->text->contains($param_name, 'radio')): ?>
            <?= $this->form->label(t('Options'), $param_name) ?>
            <?= $this->form->radio('params['.$param_name.']', $param_desc, 1) ?>    

and then use 'radio_include_project' => t('Include the Project Name in the subject line?'), instead of 'check_box_include_project' => t('Include the Project Name in the subject line?'),

cool but if you look at the latest code, the checkboxes work better as the options will be multiple. I originally thought radios would be right but when I went through the possible requirements by the end user, checkboxes with AND/OR seemed better. Let me know if you disagree as I dont think the code functions like this anyway

Please sign in to comment.