mastery badge + fix Integrations helper access (restores Reset button) (v0.5.0)
This commit is contained in:
@@ -193,4 +193,18 @@ class QualKardHelper extends Base
|
||||
));
|
||||
$this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array('date_due' => $due));
|
||||
}
|
||||
|
||||
/**
|
||||
* The mastery badge (label + CSS class) for a card, from its stored average.
|
||||
*
|
||||
* @param int $task_id
|
||||
* @return array
|
||||
*/
|
||||
public function cardBadge($task_id)
|
||||
{
|
||||
$raw = $this->taskMetadataModel->get($task_id, 'qualkard_avg', '');
|
||||
$avg = ($raw === '' || $raw === null) ? null : (float) $raw;
|
||||
|
||||
return self::badge($avg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,13 @@ class Plugin extends Base
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Mastery badge under the card title on the board, plus its stylesheet.
|
||||
$this->template->hook->attach('template:board:private:task:after-title', 'qualKard:board/badge');
|
||||
$this->template->hook->attach('template:board:public:task:after-title', 'qualKard:board/badge');
|
||||
$this->hook->on('template:layout:css', array(
|
||||
'template' => 'plugins/QualKard/Asset/css/qualkard.css',
|
||||
));
|
||||
}
|
||||
|
||||
public function getHelpers()
|
||||
@@ -74,7 +81,7 @@ class Plugin extends Base
|
||||
|
||||
public function getPluginVersion()
|
||||
{
|
||||
return '0.4.0';
|
||||
return '0.5.0';
|
||||
}
|
||||
|
||||
public function getPluginHomepage()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<h3><i class="fa fa-graduation-cap fa-fw" aria-hidden="true"></i> <?= t('QualKard') ?></h3>
|
||||
<div class="listing">
|
||||
<?php if (! $this->helper->QualKardHelper->hasRecoReco()): ?>
|
||||
<?php if (! $this->QualKardHelper->hasRecoReco()): ?>
|
||||
|
||||
<p class="form-help"><?= t('QualKard needs the RecoReco plugin (its move engine). Install RecoReco to use QualKard.') ?></p>
|
||||
|
||||
<?php elseif (! $this->helper->QualKardHelper->isEnabled($project['id'])): ?>
|
||||
<?php elseif (! $this->QualKardHelper->isEnabled($project['id'])): ?>
|
||||
|
||||
<p class="form-help"><?= t('Turn this project into a spaced-repetition study board. This restructures the columns to Drafts | Study | Hairy | Hard | Medium | Easy | Done and moves every card to Drafts.') ?></p>
|
||||
<form method="post" action="<?= $this->url->href('QualKardController', 'setup', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onsubmit="return confirm('<?= t('This restructures the board and moves all cards to Drafts. Continue?') ?>');">
|
||||
|
||||
Reference in New Issue
Block a user