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 notification as seen on clik on it #61

Open
rakini-yassine opened this issue May 8, 2019 · 4 comments
Open

make notification as seen on clik on it #61

rakini-yassine opened this issue May 8, 2019 · 4 comments

Comments

@rakini-yassine
Copy link

Hi i'm getting the notification by this code

{% for item in notificationList %}
        <li class="media notification-message">
            <a  href="{# path('mark_notifcation_as_seen',{'notification':item.notification.id}) #}">
                <div class="media-body">
                    <p class="m-0 noti-details">{{item.notification.message}}</p>
                    <p class="m-0"><span class="notification-time">{{item.notification.date|date }}</span></p>
                </div>
            </a>
        </li>
    {% endfor %}

so what i need is when the current user click on one of this notification that notification has to mark as read and redirect user to another view

what should i do

@beamop
Copy link
Contributor

beamop commented May 8, 2019

HTML

<a href="#" id="markAsRead{{ loop.index }}">markAsRead</a>

JS

$('#markAsRead{{ loop.index }}').click(function(){
        $.post('{{ mgilet_notification_generate_path('notification_mark_as_seen', item.notifiableEntity, item.notification) }}', function() {
        location.reload();
    });
});

Hope it helps.

@aquibbaig
Copy link

aquibbaig commented Jun 8, 2019

How do you expect to read the variable item in javascript? This would be available only in the for loop right?

@beamop
Copy link
Contributor

beamop commented Jun 8, 2019

Yes.

@aquibbaig
Copy link

@beamop So, what's the other way around?

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

3 participants