⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Feature Suggestion - Action Button CSS



pyromanci

pyromanci
  • profile picture
  • Member

Posted 13 July 2017 - 13:06 PM

I noticed that when creating a custom action you can not define the buttons CSS only the <i> class. What would be nice (especially for the bootstrap template) is to be able to tell the buttom to be green, blue, red, ect. Not the default gray. 

 

I've done this in my local copy. though I've made several alterations unique to my installation to fit my needs. So basically what I did was change the list_tbody.php file to create the actions URLS like this: 

                    <?php if (!empty($row->action_urls)) {
					if(!empty($row->action_urls)){
					    foreach($row->action_urls as $action_unique_id => $action_url){
						   $action = $actions[$action_unique_id];
						   $button_css = "btn-default";
						   $icon_css = $action->css_class;
						   if (is_array($action->css_class)) {
							   $button_css = $action->css_class['button'];
							   $icon_css = $action->css_class['icon'];
						   }
						   ?>
						   <a href="<?php echo $action_url; ?>" class="btn <?php echo $button_css; ?>"  target="<?php echo $action->url_target; ?>">
							  <i class="fa <?php echo $icon_css; ?>"></i> <?php echo $action->label?>
						   </a>
					    <?php }
					}
                    } ?>

So when i call add_action, i do so like this:


$crud->add_action("View", '', '', array('icon' => 'fa-eye', 'button' => 'btn-primary'));