Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make more than one notification counter #56

Open
ossse opened this issue May 25, 2018 · 3 comments
Open

Make more than one notification counter #56

ossse opened this issue May 25, 2018 · 3 comments

Comments

@ossse
Copy link

ossse commented May 25, 2018

I have success create notification, and I want to create other message notification in the same application, is this plugin able to do that?? In separate notification like Facebook notification and Facebook message notification

@machour
Copy link
Owner

machour commented May 25, 2018

Hi, this should be doable by using different Dom elements: https://github.com/machour/yii2-notifications/blob/master/docs/Usage.md

@ossse
Copy link
Author

ossse commented May 25, 2018

Hi Machour thanks alot for the reply,
that for only trigger for data on table notification for all key, but my case like this:

               <li class="dropdown notifications-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-bell-o"></i>
                        <span class="label label-danger notifications-icon-count"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">Anda memiliki <span class="notifications-header-count">0</span> notifikasi</li>
                        <li>
                            <ul class="menu">
                                <div id="notifications"></div>
                            </ul>
                        </li>
                        <li style="text-align: center"><a href="<?= Url::to(['/notification']) ?>">Lihat Semua</a></li>
                    </ul>
                </li>

               <li class="dropdown message-notifications-menu">
                   <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-envelope-o"></i>
                        <span class="label label-danger message-notifications-icon-count"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">Anda memiliki <span class="message-notifications-header-count">0</span> pesan</li>
                        <li>
                            <ul class="menu">
                                <div id="message-notifications"></div>
                            </ul>
                        </li>
                        <li style="text-align: center"><a href="<?= Url::to(['/message']) ?>">Lihat Semua</a></li>
                    </ul>
                </li>

i has defined KEY_ANNOUNCMENT = 'anouncment' and KEY_MESSAGE = 'message' on app\components\Notification.

each notification has own counters, elemet "message-notifications" for counter key(field name in table notification) "message" and element "notifications" for other key.

@ossse ossse changed the title Make more than one notification Make more than one notification counter May 25, 2018
@ossse
Copy link
Author

ossse commented May 27, 2018

the layout/header.php like this

                <?=
                NotificationsWidget::widget([
                    'theme' => NotificationsWidget::THEME_GROWL,
                    'clientOptions' => [
                        'location' => 'br',
                    ],
                    'counters' => [
                        '.messages-header-count',
                        '.notifications-header-count',
                        '.messages-icon-count',
                        '.notifications-icon-count'
                    ],
                    'markAllSeenSelector' => '#message-seen-all',
                    'listSelector' => [
                        '#messages',
                        '#notifications'
                    ],
                ]);
                ?>                

                <li class="dropdown notifications-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-bell-o"></i>
                        <span class="label label-danger notifications-icon-count"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">Anda memiliki <span class="notifications-header-count">0</span> notifikasi</li>
                        <li>
                            <ul class="menu">
                                <div id="notifications"></div>
                            </ul>
                        </li>
                        <li style="text-align: center"><a href="<?= Url::to(['/notification']) ?>">Lihat Semua</a></li>
                    </ul>
                </li>
                                
                <li class="dropdown notifications-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-envelope-o"></i>
                        <span class="label label-danger messages-icon-count"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">Anda memiliki <span class="messages-header-count">0</span> pesan</li>
                        <li>
                            <ul class="menu">
                                <div id="messages"></div>
                            </ul>
                        </li>
                        <li style="text-align: center"><a href="<?= Url::to(['/message']) ?>">Lihat Semua</a></li>
                    </ul>
                </li>

image

my notification view like this, but i want to each icon notification have own counter, notification and message, so if any message coming the counter of message is increase, not the notification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants