Code Monkey home page Code Monkey logo

comments-blade's Introduction

comments-blade

Comments for evo3.x + blade addon

Получение дерева комментариев

    ...
    $this->data['commentsTree'] = $this->getCommentsTree();
    ...

    protected function getCommentsTree()
    {
        $params = [
            'controller' => 'TreeViewCustom',
            'config'     => 'comments:assets/snippets/Comments/config/',
        ];
        $html = evo()->runSnippet("Comments", $params);
        return $html;
    }

вывод в blade дерева комментариев

<div id="comments">
    @if(!empty($commentsTree))
        {!! $commentsTree !!}
    @endif
</div>

#получение формы ввода комментария

    ...
    $this->data['CommentsForm'] = $this->getCommentsForm();
    ...

    protected function getCommentsForm()
    {
        $params = [
            'config'=>'form:assets/snippets/Comments/config/',
        ];
        $html = evo()->runSnippet("CommentsForm", $params);
        return $html;
    }

вывод в blade формы

<div id="comments-form">
    <div class="comments-form-wrap">

        {!! $CommentsForm ?? '' !!}

    </div>
</div>

#js на нужной странице в файле comments_custom.js добавлено новое значение formPosition для возможности вставки в дерево в дополнение к существующим append и prepend см. строки 173-179


    <script src="assets/snippets/Comments/js/comments_custom.js"></script>
    <script>
        function onInitFormCallback() {
            //событие для 
            console.log('onInitFormCallback');
        }
        new Comments({
            formPosition: 'comments-form',
            thread: {{ $documentObject['id'] }},
            lastComment: {{ evo()->getPlaceholder('lastComment') ?? 0 }},
            onInitFormCallback: onInitFormCallback
        });
    </script>

comments-blade's People

Contributors

webber12 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

kiddy007

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.