⚠ 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

Move Success Message on Delete to Bottom??



amityweb
  • profile picture
  • Member

Posted 26 January 2012 - 11:01 AM

When I add data the messages are at the bottom.

What I delete a row from the table, the success message ids at the top.

Because of this the table bounces up and down and is quite distracting.

To be consistent, and remove the table from bouncing, is there a way to move this success message to the bottom under the table without hacking the core?

(not a massive issue but an improvement nevertheless)

Thanks!

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 26 January 2012 - 19:22 PM

You can change the place of the messages. I don't think it's a core changing just a little change to the views.
You can simply change it from assets/grocery_crud/themes/datatables/views/list_template.php at around line 49:

.....
<?php
if(!empty($actions)){
?>
<style type="text/css">
<?php foreach($actions as $action_unique_id => $action){?>
<?php if(!empty($action->image_url)){ ?>
.<?php echo $action_unique_id; ?>{
background: url('<?php echo $action->image_url; ?>') !important;
}
<?php }?>
<?php }?>
</style>
<?php
}
?>
<!-- Move those lines here -->
<div id='report-error' class='report-div error report-list'></div>
<div id='report-success' class='report-div success report-list'>
</div>
<!-- ///////////////////////////////// -->
<?php if(!$unset_add){?>
<a role="button" class="edit_button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" href="<?php echo $add_url?>">
<span class="ui-button-icon-primary ui-icon ui-icon-circle-plus"></span>
<span class="ui-button-text"><?php echo $this->l('list_add'); ?> <?php echo $subject?></span>
</a>
<?php }?>
<div style='height:10px;'></div>
<?php echo $list_view?>

to the bottom of your list template, so it will be:

.....
<?php
if(!empty($actions)){
?>
<style type="text/css">
<?php foreach($actions as $action_unique_id => $action){?>
<?php if(!empty($action->image_url)){ ?>
.<?php echo $action_unique_id; ?>{
background: url('<?php echo $action->image_url; ?>') !important;
}
<?php }?>
<?php }?>
</style>
<?php
}
?>
</div>
<?php if(!$unset_add){?>
<a role="button" class="edit_button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" href="<?php echo $add_url?>">
<span class="ui-button-icon-primary ui-icon ui-icon-circle-plus"></span>
<span class="ui-button-text"><?php echo $this->l('list_add'); ?> <?php echo $subject?></span>
</a>
<?php }?>
<div style='height:10px;'></div>
<?php echo $list_view?>
<!-- Move the lines to here -->
<div id='report-error' class='report-div error report-list'></div>
<div id='report-success' class='report-div success report-list'></div>
<!-- ///////////////////////////////// -->


The same thing with the flexigrid theme. If you go to : assets/grocery_crud/themes/flexigrid/views/list_template.php at around line 21,22 and move those two lines at the end of the file (like datatables example) it will work fine. Actually I didn't thought that this was annoying. The bouncing it was just to understand that another record has been deleted.
However I think you are right. I have to change this one. Maybe a better information message with an X button, opacity and a fixed place that appears without bouncing. Also it has to dissapear after some seconds it will be much more better.
Thanks to mention it. I will have this in mind but not for the next version (1.1.9).
At the next version I will change the uploading plugin and the format that dates appears so I have some stuff to do. I try to this plugin fast as many users asked for it.

amityweb
  • profile picture
  • Member

Posted 27 January 2012 - 15:31 PM

Thanks for that... I will consider using it, but not sure because I do not want to edit any core files (including Flexigrid) in case of updates. From experience I have a lot of (older) systems when I used to edit core files which because they are tricky/time consuming to update due to edits, they are not updated, which has security implications. So only if absolutely necessary do I want to edit core files.

Thanks a lot

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 27 January 2012 - 21:33 PM

You are absolutely right for that. Also grocery CRUD updates include all the views and all the javascripts and CSS, so it will better not to change core files. However I think that if you update to a newer version and move just the two lines code again (if this is the only change) it will not be a problem for you.

amityweb
  • profile picture
  • Member

Posted 07 February 2012 - 11:19 AM

As stated I hate modifying the core, so I came up with another solution with works!

Just use JQuery to move the error and success boxes to after the flexigrid table (I have my own custom JQuery document ready code not in the flexigrid stiff so wont be changed on new updates):



/*******************************/
// MOVE FLEXIGRID ERROR TO BOTTOM
/*******************************/
$('.flexigrid').after($('#report-error').remove().clone());
$('.flexigrid').after($('#report-success').remove().clone());



The more I learn how to add in my own customisations in GroceryCRUD the much more flexible this app becomes, its fantastic.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 07 February 2012 - 22:04 PM

Yes this is a better solution than mine. Great ;)