Skip to content

Instantly share code, notes, and snippets.

@MartianLee
Created January 29, 2019 16:57
Show Gist options
  • Save MartianLee/350a1e15e5799bf37db6006b505f05f3 to your computer and use it in GitHub Desktop.
Save MartianLee/350a1e15e5799bf37db6006b505f05f3 to your computer and use it in GitHub Desktop.
유저 프로필의 갱신을 자바스크립트로 반영합니다.
App.dashboard = App.cable.subscriptions.create({ channel: "PollDashboardChannel", meeting_id: meeting_id, stage_item_type: 'Poll', stage_item_id: poll_id }, {
received: function(data) {
.....
switch(data.action) {
......
case 'destroy':
......
break;
case 'update_user_image':
$('.vote').each(function(index, elm){
if($(elm).data('user-id') == data.user_id){
$(elm).css({'background-image': 'url(' + data.image_path + ')'});
}
});
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment