Ejemplo n.º 1
0
        <?php 
// Creates Uploading Button
echo humhub\modules\file\widgets\FileUploadButton::widget(array('uploaderId' => 'comment_upload_' . $comment->id, 'fileListFieldName' => 'fileList', 'object' => $comment));
?>


        <?php 
echo \humhub\widgets\AjaxButton::widget(['label' => Yii::t('CommentModule.views_edit', 'Save'), 'ajaxOptions' => ['type' => 'POST', 'beforeSend' => new yii\web\JsExpression('function(html){  $("#comment_input_' . $comment->id . '_contenteditable").hide(); showLoader("' . $comment->id . '"); }'), 'success' => new yii\web\JsExpression('function(html){  $("#comment_' . $comment->id . '").replaceWith(html); }'), 'url' => Url::to(['/comment/comment/edit', 'id' => $comment->id, 'contentModel' => $comment->object_model, 'contentId' => $comment->object_id])], 'htmlOptions' => ['class' => 'btn btn-default btn-sm btn-comment-submit', 'id' => 'comment_edit_post_' . $comment->id, 'type' => 'submit']]);
?>

    </div>

    <?php 
// Creates a list of already uploaded Files
echo \humhub\modules\file\widgets\FileUploadList::widget(array('uploaderId' => 'comment_upload_' . $comment->id, 'object' => $comment));
?>

    <?php 
CActiveForm::end();
?>
</div>

<script type="text/javascript">

    // show laoder during ajax call
    function showLoader(comment_id) {
        $('#comment_edit_' + comment_id).html('<div class="loader" style="padding: 15px 0;"><div class="sk-spinner sk-spinner-three-bounce" style="margin:0;"><div class="sk-bounce1"></div><div class="sk-bounce2"></div><div class="sk-bounce3"></div></div>');
    }

Ejemplo n.º 2
0
                                    </li>
                                <?php 
}
?>
                            </ul>
                        </li>
                    </ul>


                </div>

            </div>

            <?php 
// Creates a list of already uploaded Files
echo \humhub\modules\file\widgets\FileUploadList::widget(array('uploaderId' => 'contentFormFiles'));
?>

        </div>
        <!-- /contentForm_Options -->
        <?php 
echo Html::endForm();
?>
    </div>
    <!-- /panel body -->
</div> <!-- /panel -->

<div class="clearFloats"></div>

<script type="text/javascript">
Ejemplo n.º 3
0
echo \humhub\widgets\RichTextEditor::widget(['id' => 'post_input_' . $post->id, 'inputContent' => $post->message]);
?>

    <?php 
// Creates Uploading Button
echo humhub\modules\file\widgets\FileUploadButton::widget(array('uploaderId' => 'post_upload_' . $post->id, 'object' => $post));
?>


    <?php 
echo \humhub\widgets\AjaxButton::widget(['label' => 'Save', 'ajaxOptions' => ['type' => 'POST', 'beforeSend' => new yii\web\JsExpression('function(html){  $("#post_input_' . $post->id . '_contenteditable").hide(); showLoader("' . $post->id . '"); }'), 'success' => new yii\web\JsExpression('function(html){ $(".wall_' . $post->getUniqueId() . '").replaceWith(html); }'), 'url' => Url::to(['/post/post/edit', 'id' => $post->id])], 'htmlOptions' => ['class' => 'btn btn-primary', 'id' => 'post_edit_post_' . $post->id, 'style' => 'position: absolute; left: -90000000px; opacity: 0;']]);
?>

    <?php 
// Creates a list of already uploaded Files
echo \humhub\modules\file\widgets\FileUploadList::widget(array('uploaderId' => 'post_upload_' . $post->id, 'object' => $post));
?>

    <?php 
CActiveForm::end();
?>
</div>

<script type="text/javascript">

    $('#post_input_<?php 
echo $post->id;
?>
_contenteditable').focus();

    // Hide file area of post
Ejemplo n.º 4
0
    <?php 
$jsSuccess = "function(html) {\n            \$('#comments_area_" . $id . "').append(html);\n            \$('#newCommentForm_" . $id . "').val('').trigger('autosize.resize');\n            \$('#newCommentForm_" . $id . "_contenteditable').html('" . Html::encode(Yii::t('CommentModule.widgets_views_form', 'Write a new comment...')) . "');\n            \$('#newCommentForm_" . $id . "_contenteditable').addClass('atwho-placeholder');\n            \$('#loader-" . $id . "').remove();\n            \$('#newCommentForm_" . $id . "_contenteditable').show();\n            \$('.comment-buttons').show();\n            resetUploader('comment_upload_" . $id . "');\n    }";
echo AjaxButton::widget(['label' => Yii::t('CommentModule.widgets_views_form', 'Send'), 'ajaxOptions' => ['type' => 'POST', 'beforeSend' => new yii\web\JsExpression("function(html){  \$('#newCommentForm_" . $id . "_contenteditable').hide(); \$('.comment-buttons').hide(); showLoader('" . $id . "'); }"), 'success' => new yii\web\JsExpression($jsSuccess), 'url' => Url::to(['/comment/comment/post'])], 'htmlOptions' => ['id' => "comment_create_post_" . $id, 'class' => 'btn btn-sm btn-default btn-comment-submit pull-left', 'type' => 'submit']]);
?>

    </div>

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


    <?php 
// Creates a list of already uploaded Files
echo \humhub\modules\file\widgets\FileUploadList::widget(array('uploaderId' => 'comment_upload_' . $id));
?>
</div>

<script>

    $(document).ready(function () {

        // set the size for one row (Firefox)
        $('#newCommentForm_<?php 
echo $id;
?>
').css({height: '36px'});

        // add autosize function to input
        $('.autosize').autosize();