Skip to content

Commit

Permalink
Optimized MentionWidget for IE and Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
andystrobel committed May 14, 2014
1 parent 6ee31c6 commit 686dbbf
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 200 deletions.
16 changes: 11 additions & 5 deletions protected/modules_core/comment/widgets/views/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
?>


<div class="well well-small" style="<?php if (count($comments) == 0) {
echo 'display: none;';
} ?>" id="comment_<?php echo $id; ?>">
<div class="well well-small" style="display: none;" id="comment_<?php echo $id; ?>">
<div class="comment" id="comments_area_<?php echo $id; ?>">
<?php if ($isLimited): ?>
<?php
Expand Down Expand Up @@ -48,7 +46,7 @@
<?php echo CHtml::textArea("message", Yii::t('CommentModule.base', ""), array('id' => 'newCommentForm_' . $id, 'rows' => '1', 'class' => 'form-control autosize commentForm', 'placeholder' => 'Write a new comment...')); ?>

<?php

/* Modify textarea for mention input */
$this->widget('application.widgets.MentionWidget', array(
'element' => '#newCommentForm_' . $id,
Expand All @@ -64,6 +62,8 @@
'success' => "function(html) {
$('#comments_area_" . $id . "').html(html);
$('#newCommentForm_" . $id . "').val('').trigger('autosize.resize');
$.fn.mention.reset('#newCommentForm_" . $id . "');
}",
), array(
'id' => "comment_create_post_" . $id,
Expand All @@ -80,6 +80,11 @@

<script type="text/javascript">

<?php if (count($comments) != 0) { ?>
// make comments visible at this point to fixing autoresizing issue for textareas in Firefox
$('#comment_<?php echo $id; ?>').show();
<?php } ?>

// Fire click event for comment button by typing enter
$('#newCommentForm_<?php echo $id; ?>').keydown(function (event) {

Expand All @@ -95,7 +100,8 @@
$('#comment_create_post_<?php echo $id; ?>').click();

// empty input
$(this).val('');
//$(this).val('');

}


Expand Down
4 changes: 2 additions & 2 deletions protected/modules_core/wall/widgets/views/contentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
$('#contentFrom_files').val('');
$('#public').attr('checked', false);
//$('.contentForm').
$.fn.mention.reset('.contentForm');
// Notify FileUploadButtonWidget to clear (by providing uploaderId)
Expand Down Expand Up @@ -138,7 +137,7 @@ class="icon-unlock"></i> <?php echo Yii::t('WallModule.base', 'Make public'); ?>

</div>

<?php echo CHtml::endForm(); ?>


<?php
// Creates a list of already uploaded Files
Expand All @@ -150,6 +149,7 @@ class="icon-unlock"></i> <?php echo Yii::t('WallModule.base', 'Make public'); ?>

</div>
<!-- /contentForm_Options -->
<?php echo CHtml::endForm(); ?>
</div>
<!-- /panel body -->
</div> <!-- /panel -->
Expand Down
Loading

0 comments on commit 686dbbf

Please sign in to comment.