Permalink
Browse files

resizable comment textarea using TextAreaResizer

  • Loading branch information...
nibsirahsieu committed May 16, 2011
1 parent 544a2f4 commit 3e01f87971698fe4304021f1141a4da27e80af96
@@ -11,7 +11,7 @@ public function configure()
$this->validatorSchema['author_email'] = new sfValidatorEmail(array('required' => true));
$this->validatorSchema['author_url'] = new sfValidatorUrl(array('required' => false));
$this->validatorSchema['content'] = new sfValidatorString(array('required' => true));
- $this->widgetSchema['content']->setAttribute('rows', 10);
+ $this->widgetSchema['content']->setAttributes(array('rows' => 10, 'class' => 'resizable'));
$this->widgetSchema['author_name']->setLabel('Name (required)');
$this->widgetSchema['author_email']->setLabel('Mail (required) (will not be published)');
$this->widgetSchema['author_url']->setLabel('Website');
@@ -1,7 +1,9 @@
<?php $use_ajax = sfNestedCommentConfig::isAjaxEnabled() ?>
<?php if ($use_ajax): ?>
<?php use_stylesheet('/sfNestedCommentPlugin/css/commentPreview.css', 'last') ?>
+ <?php use_stylesheet('/sfNestedCommentPlugin/css/jquery.textarearesizer.css', 'last') ?>
<?php use_javascript('/sfNestedCommentPlugin/js/commentPreview.js', 'last') ?>
+ <?php use_javascript('/sfNestedCommentPlugin/js/jquery.textarearesizer.compressed.js', 'last') ?>
<?php endif; ?>
<div id="respond">
@@ -27,4 +29,4 @@
<script type="text/javascript">
setupAjaxCommentForm(<?php echo sfNestedCommentConfig::isNestedEnabled() ?>);
</script>
-<?php endif; ?>
+<?php endif; ?>
@@ -0,0 +1,15 @@
+div.grippie {
+ background:#EEEEEE url(../images/grippie.png) no-repeat scroll center 2px;
+ border-color:#DDDDDD;
+ border-style:solid;
+ border-width:0pt 1px 1px;
+ cursor:s-resize;
+ height:9px;
+ overflow:hidden;
+}
+.resizable-textarea textarea {
+ display:block;
+ margin-bottom:0pt;
+ width:95%;
+ height: 20%;
+}
View
Binary file not shown.
View
@@ -2,7 +2,7 @@ function setupAjaxCommentForm(nestedEnabled)
{
document.getElementById('sfNestedComment_add_comment_form').onsubmit = function () {
var form = jQuery('#sfNestedComment_add_comment_form');
- loader = jQuery('#add-comment-loader');
+ var loader = jQuery('#add-comment-loader');
jQuery.ajax({
type: "post",
url: form.attr('action'),
@@ -26,4 +26,8 @@ function setupAjaxCommentForm(nestedEnabled)
});
return false;
};
-}
+
+ jQuery(document).ready(function() {
+ jQuery('textarea.resizable:not(.processed)').TextAreaResizer();
+ });
+}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 3e01f87

Please sign in to comment.