chg: [decaying] Added formula description in multiple location

pull/5032/head
mokaddem 2019-08-22 11:47:57 +02:00
parent 3a64405bd9
commit 5a9a905c8d
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
4 changed files with 22 additions and 3 deletions

View File

@ -83,6 +83,8 @@ class DecayingModelController extends AppController
$decaying_model = $this->DecayingModel->fetchModel($this->Auth->user(), $id, true);
$this->set('id', $id);
$this->set('decaying_model', $decaying_model);
$available_formulas = $this->DecayingModel->listAvailableFormulas();
$this->set('available_formulas', $available_formulas);
}
// Sets pagination condition for url parameters
@ -135,6 +137,8 @@ class DecayingModelController extends AppController
$passedArgsArray = $this->__setIndexFilterConditions($this->passedArgs);
$this->set('passedArgsArray', $passedArgsArray);
$this->set('decayingModels', $this->paginate());
$available_formulas = $this->DecayingModel->listAvailableFormulas();
$this->set('available_formulas', $available_formulas);
}
public function add()

View File

@ -2,6 +2,8 @@
abstract class DecayingModelBase
{
// Description of the formula. Will be displayed at various places in the web interface
// Should be overriden
public const DESCRIPTION = '';
public function checkLoading()

View File

@ -121,7 +121,14 @@ foreach ($decayingModels as $item): ?>
}
?>
<td data-toggle="json" ondblclick="document.location.href ='<?php echo $baseurl."/decayingModel/view/".$item['DecayingModel']['id']; ?>'"><?php echo json_encode($item['DecayingModel']['parameters']); ?>&nbsp;</td>
<td><?php echo h($item['DecayingModel']['formula']); ?>&nbsp;</td>
<td>
<?php echo h($item['DecayingModel']['formula']); ?>
<?php if (isset($available_formulas[$item['DecayingModel']['formula']]['description'])): ?>
<i class="fas fa-question-circle" data-toggle="tooltip" title="<?php echo h($available_formulas[$item['DecayingModel']['formula']]['description']); ?>"></i>
<?php else: ?>
&nbsp
<?php endif; ?>
</td>
<td><?php echo count($item['DecayingModel']['attribute_types']); ?>&nbsp;</td>
<td><?php echo h($item['DecayingModel']['version']); ?>&nbsp;</td>
<td><i class="fas fa-<?php echo $item['DecayingModel']['enabled'] ? 'check' : 'times';?>"></i></td>
@ -170,7 +177,7 @@ endforeach; ?>
<script>
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
function prettyPrintJson() {
$('[data-toggle=\"json\"]').each(function() {

View File

@ -31,7 +31,12 @@
'key' => __('Enabled'),
'html' => '<i class="fas fa-' . ($decaying_model['DecayingModel']['enabled'] ? 'check' : 'times') . '"></i>'
);
$table_data[] = array('key' => __('Formula'), 'value' => $decaying_model['DecayingModel']['formula']);
$table_data[] = array(
'key' => __('Formula'),
'html' => $decaying_model['DecayingModel']['formula'] . (
isset($available_formulas[$decaying_model['DecayingModel']['formula']]['description']) ? sprintf(' <i class="fas fa-question-circle" data-toggle="tooltip" title="%s"></i>', h($available_formulas[$decaying_model['DecayingModel']['formula']]['description'])) : ''
)
);
$table_data[] = array('key' => __('Parameters'), 'value' => json_encode($decaying_model['DecayingModel']['parameters']), 'class' => 'json-transform');
$table_data[] = array('key' => __('Reference(s)'), 'html' => implode('<br/>', (empty($decaying_model['DecayingModel']['ref']) ? array() : $decaying_model['DecayingModel']['ref'])));
$table_data[] = array('key' => __('Associated types'), 'value' => json_encode($decaying_model['DecayingModel']['attribute_types']), 'class' => 'json-transform');
@ -50,6 +55,7 @@ $(document).ready(function() {
var parsedJson = syntaxHighlightJson($(this).text().trim());
$(this).html(parsedJson);
});
$('[data-toggle="tooltip"]').tooltip({placement: 'right'});
});
</script>
<?php