yii2mod / yii2-comments

Comments module for Yii2
MIT License
158 stars 63 forks source link

Problem with custom js file on creating comments #65

Closed carlosgarcia8 closed 7 years ago

carlosgarcia8 commented 7 years ago

I have an event attached to, for example, the reply option, but when a comment is created, everything is reloaded and the event is lost. I see that your comment.js is reloaded every time it creates a comment, how would I add my custom js file to that?

ihorchepurnyi commented 7 years ago

You can create your own comment.js file and update CommentAsset by the following code:

// in your application configuration

'assetManager' => [
    'bundles' => [
        'yii2mod\comments\CommentAsset' => [
            'js' => [
                'path to your own comments.js file',
            ]
        ],
    ],
]
carlosgarcia8 commented 7 years ago

I'm currently trying to add some code to the comment.js and I am a bit lost. I am trying to add an event after all the comments are created so that I can add them, basically I am working with upvotes and downvotes with the comments, but when I add a new comment the event on click of every upvote/downvote is lost. With the comment.js I am having trouble trying to figure it out how to make it happen. Any help please?

ihorchepurnyi commented 7 years ago

I create issue for this feature - https://github.com/yii2mod/yii2-comments/issues/66 I'll try to solve this issue today.