yii2mod / yii2-comments

Comments module for Yii2
MIT License
159 stars 64 forks source link

Example of comments index for administrators #87

Open newscloud opened 6 years ago

newscloud commented 6 years ago

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.

ihorchepurnyi commented 6 years ago

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

newscloud commented 6 years ago

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

ihorchepurnyi commented 6 years ago

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

ejcramer commented 5 years ago

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!

undefence commented 5 years ago

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