Permalink
Browse files

Fixes 148 changed the way blog demo comments are deleted

  • Loading branch information...
1 parent cdf0ac7 commit 38f20e0b529bde0cf29bfdca2dfe435694819a23 @mdomba mdomba committed Jul 27, 2012
Showing with 19 additions and 4 deletions.
  1. +1 −0 CHANGELOG
  2. +18 −4 demos/blog/protected/views/comment/_view.php
View
@@ -6,6 +6,7 @@ Version 1.1.11 work in progress
- Bug #098: No correct identity value being returned when using Active Record and mssql (c-schmitz)
- Bug #114: CUniqueValidator and CExistValidator now respect table alias while creating db query condition (klimov-paul)
- Bug #145: CGettextMoFile now can parse strings with no context (eagleoneraptor)
+- Bug #148: Fixed the bug in the blog demo that was not deleting right comment when not on the first page (mdomba)
- Bug #161: CCookieCollection::remove() now accepts an array of cookie options as a second argument to facilitate correct cookie removal (maximcherny)
- Bug #164: CEmailValidator.checkPort now checks the port 25 of listed MX servers (DaSourcerer)
- Bug #178: webapp creation with relative paths like ../ was not working correctly (cebe)
@@ -1,3 +1,20 @@
+<?php
+$deleteJS = <<<DEL
+$('.container').on('click','.time a.delete',function() {
+ var th=$(this),
+ container=th.closest('div.comment'),
+ id=container.attr('id').slice(1);
+ if(confirm('Are you sure you want to delete comment #'+id+'?')) {
+ $.ajax({
+ url:th.attr('href'),
+ type:'POST'
+ }).done(function(){container.slideUp()});
+ }
+ return false;
+});
+DEL;
+Yii::app()->getClientScript()->registerScript('delete', $deleteJS);
+?>
<div class="comment" id="c<?php echo $data->id; ?>">
<?php echo CHtml::link("#{$data->id}", $data->url, array(
@@ -18,10 +35,7 @@
)); ?> |
<?php endif; ?>
<?php echo CHtml::link('Update',array('comment/update','id'=>$data->id)); ?> |
- <?php echo CHtml::linkButton('Delete', array(
- 'submit'=>array('comment/delete','id'=>$data->id),
- 'confirm'=>"Are you sure to delete comment #{$data->id}?",
- )); ?> |
+ <?php echo CHtml::link('Delete',array('comment/delete','id'=>$data->id),array('class'=>'delete')); ?> |
<?php echo date('F j, Y \a\t h:i a',$data->create_time); ?>
</div>

0 comments on commit 38f20e0

Please sign in to comment.