Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Schedules: Enable/Disable state
Browse files Browse the repository at this point in the history
Just display the action button which is needed according to the schedules
state. Also display the schedule state labeled in a separate column.
  • Loading branch information
fbergkemper committed Aug 9, 2016
1 parent 284c3fe commit 0989fa8
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions module/Schedule/view/schedule/schedule/index.phtml
Expand Up @@ -72,6 +72,7 @@ $this->headTitle($title);

<thead class="bg-primary">
<th><?php echo $this->translate("Name"); ?></th>
<th><?php echo $this->translate("Status"); ?></th>
<th><?php echo $this->translate("Actions"); ?></th>
</thead>

Expand Down Expand Up @@ -107,7 +108,8 @@ $(document).ready(function() {
},
"columns": [
{ "data": "name", "defaultContent": "", "orderable": true },
{ "data": "name", "defaultContent": "", "orderable": false },
{ "data": "enabled", "defaultContent": "", "orderable": true },
{ "data": null, "defaultContent": "", "orderable": false },
],
"paging": true,
"pagingType": "full_numbers",
Expand All @@ -128,7 +130,23 @@ $(document).ready(function() {
{
"targets": 1,
"render": function(data, type, full, meta) {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=enable&schedule='+data+'" title="<?php echo $this->translate("Enable"); ?>" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=disable&schedule='+data+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
if(data) {
return '<span class="label label-success"><?php echo $this->translate("Enabled"); ?></span>';
}
else {
return '<span class="label label-danger"><?php echo $this->translate("Disabled"); ?></span>';
}
}
},
{
"targets": 2,
"render": function(data, type, full, meta) {
if(data.enabled) {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=disable&schedule='+data.name+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
}
else {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/schedule/index?action=enable&schedule='+data.name+'" title="<?php echo $this->translate("Enable"); ?>" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>';
}
}
}
]
Expand Down

0 comments on commit 0989fa8

Please sign in to comment.