make previous meetings per room instead of global

This commit is contained in:
Zachary Chai 2017-02-21 10:33:58 -05:00
parent 47464d35b2
commit 7b52e2ef61
4 changed files with 16 additions and 16 deletions

View File

@ -192,6 +192,7 @@
var initRooms = function() {
displayRoomURL();
var roomAdmin = $('.page-wrapper.rooms').data('admin-id');
$('.center-panel-wrapper').on('input', '.meeting-name', function (event, msg) {
var newId = $(this).val();
@ -206,7 +207,7 @@
});
if ($(".page-wrapper.rooms").data('main-room')) {
PreviousMeetings.init('joinedRooms');
PreviousMeetings.init('joinedRooms-'+roomAdmin);
if ($('input.meeting-name').val() !== '') {
$('input.meeting-name').trigger('input');

View File

@ -72,7 +72,7 @@ class @Meeting
if @type == 'meetings'
key = 'joinedMeetings'
else if @type == 'rooms'
key = 'joinedRooms'
key = 'joinedRooms-'+@adminId
# update previously joined meetings/rooms on client
try

View File

@ -19,6 +19,7 @@
class @PreviousMeetings
MAX_MEETINGS = 5
# initializes and populates previous meetings list with entries from localStorage
@init: (type) ->
$('.center-panel-wrapper').off 'click', '.fill-meeting-name'
$('.center-panel-wrapper').on 'click', '.fill-meeting-name', (event, msg) ->
@ -29,15 +30,10 @@ class @PreviousMeetings
joinedMeetings = localStorage.getItem(type)
if joinedMeetings && joinedMeetings.length > 0
joinedMeetings = joinedMeetings.split(',')
PreviousMeetings.append(joinedMeetings.reverse())
for m in joinedMeetings by -1
if $('ul.previously-joined > li').length > MAX_MEETINGS
break
$('ul.previously-joined').append('<li><a class="fill-meeting-name">'+m+'</a></li>')
$('.center-panel-wrapper .previously-joined-wrapper').removeClass('hidden')
@add: (names) ->
# adds to previous meetings list if its unique
@uniqueAdd: (names) ->
meetings = $('ul.previously-joined > li').toArray().map( (li) ->
return li.innerText
)
@ -48,9 +44,12 @@ class @PreviousMeetings
names = names.filter( (value) ->
return $.inArray(value, meetings) == -1
)
for m in names
if $('ul.previously-joined > li').length > MAX_MEETINGS
break
$('ul.previously-joined').append('<li><a class="fill-meeting-name">'+m+'</a></li>')
PreviousMeetings.append(names)
$('.center-panel-wrapper .previously-joined-wrapper').removeClass('hidden')
@append: (meeting_names) ->
for m in meeting_names
if $('ul.previously-joined > li').length > MAX_MEETINGS
break
$('ul.previously-joined').append('<li><a class="fill-meeting-name">'+m+'</a></li>')
$('.center-panel-wrapper .previously-joined-wrapper').removeClass('hidden')

View File

@ -216,7 +216,7 @@ class @Recordings
output = {}
for key in [0...recording_names.length]
output[recording_names[key]] = recording_names[key]
PreviousMeetings.add(value for key, value of output)
PreviousMeetings.uniqueAdd(value for key, value of output)
# setup click handlers for the action buttons