Skip to content

Instantly share code, notes, and snippets.

@ermand
Created March 17, 2014 16:08
Show Gist options
  • Save ermand/a411fca22c0bfee04fa6 to your computer and use it in GitHub Desktop.
Save ermand/a411fca22c0bfee04fa6 to your computer and use it in GitHub Desktop.
This macro creates a simple actions with edit, view, deactivate and activate actions.
HTML::macro('actions', function($data, $resource, $showEdit = true, $showDelete = true, $showView = true)
{
$table = '<td class="td-actions center">';
$table .= '<div class="hidden-phone visible-desktop action-buttons bigger-110">';
if ($showEdit)
{
$table .= '<a class="green" href="' . $resource . '/' . $data->id . '/edit" data-toggle="tooltip" data-original-title="Fshi"> <i class="icon-pencil bigger-130"></i> </a>';
}
if ($showView)
{
$table .= ' ';
$table .= '<a class="blue" href="' . $resource . '/' . $data->id . '" data-toggle="tooltip" data-original-title="Detaje"> <i class="icon-eye-open bigger-130"></i> </a>';
}
if ($showDelete)
{
if ( Status::checkActive($data->status_id) )
{
$table .= ' ';
$table .= '<a class="red" href="' . $resource . '/' . $data->id . '/deactivate" data-toggle="tooltip" data-original-title="Caktivizo"> <i class="icon-remove bigger-130"></i> </a>';
} else if ( Status::checkDeactive($data->status_id) )
{
$table .= ' ';
$table .= '<a class="green" href="' . $resource . '/' . $data->id . '/activate" data-toggle="tooltip" data-original-title="Aktivizo"> <i class="icon-ok bigger-130"></i> </a>';
}
}
$table .= '</div>';
$table .= '</td>';
return $table;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment