yii2-comments icon indicating copy to clipboard operation
yii2-comments copied to clipboard

Example of comments index for administrators

Open newscloud opened this issue 6 years ago • 5 comments

Nice widget, thank you!

Could you please give an example of setting up comments/index?

My test site uses paths e.g. http://localhost:8888/cityx/site/about

But http://localhost:8888/cityx/comments/index fails to 404

'urlManager' => [
          'enablePrettyUrl' => true,
          'showScriptName' => false,
          'rules' => [
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
          ],
      ],

I am logged in as a user role admin

Thank you.

p.s. One suggestion. I was confused when I first displayed comments and they just showed 0 with o form. It may help to remind people they need to be logged in to the creation form.

newscloud avatar Oct 09 '18 23:10 newscloud

Hi, you can check comment configuration in the following template - https://github.com/yii2mod/base

ihorchepurnyi avatar Oct 10 '18 07:10 ihorchepurnyi

Hi, again, aiming for simplification ... can you please clarify where on that page?

Do you mean in config main that does address comments/index? (I'm not sure how to access the admin view either).

'comment' => [
            'class' => 'yii2mod\comments\Module',
            'controllerMap' => [
                'manage' => [
                    'class' => 'yii2mod\comments\controllers\ManageController',
                    'layout' => '@app/modules/admin/views/layouts/column2',
                ],
            ],
        ],

Also, is there a way to customize the text for the comments button e.g. "Add your comment" instead of "comment".

THANK YOU

newscloud avatar Oct 11 '18 18:10 newscloud

If you need to override the comment view file, in your case "change the button text" you can just create your view file and override this property - https://github.com/yii2mod/yii2-comments/blob/master/widgets/Comment.php#L37

ihorchepurnyi avatar Oct 15 '18 10:10 ihorchepurnyi

FYI,

In my yii2 with enablePrettyUrl, I found the comment index worked at this url:

http://sample.com/comment/manage/index

Normally I would translate the url listed in the readme from:

http://localhost/path/to/index.php?r=comments/index

To:

http://sample.com/comments/index

But this one didn't work.

Thanks for the module!

ejcramer avatar Dec 04 '18 18:12 ejcramer

In my Yii2 app i found comment edit page on same link, like @ejcramer at

example.com/comment/manage

instead of url from readme

example.com/comments/index

undefence avatar Mar 12 '19 18:03 undefence