Merge pull request #129 from zach-chai/previous_meetings

make previous meetings per room instead of global
This commit is contained in:
Zachary Chai 2017-02-21 11:01:28 -05:00 committed by GitHub
commit 4be08f993d
4 changed files with 16 additions and 16 deletions

View File

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

View File

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

View File

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

@ -222,7 +222,7 @@ class @Recordings
output = {} output = {}
for key in [0...recording_names.length] for key in [0...recording_names.length]
output[recording_names[key]] = recording_names[key] 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 # setup click handlers for the action buttons