limit previous meetings container to 5

This commit is contained in:
Zachary Chai 2017-02-14 15:00:23 -05:00
parent 2cc5c9e949
commit 349f4c51c6
2 changed files with 15 additions and 9 deletions

View File

@ -17,6 +17,8 @@
# Previous Meetings class # Previous Meetings class
class @PreviousMeetings class @PreviousMeetings
MAX_MEETINGS = 5
@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,6 +31,8 @@ class @PreviousMeetings
joinedMeetings = joinedMeetings.split(',') joinedMeetings = joinedMeetings.split(',')
for m in joinedMeetings by -1 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>') $('ul.previously-joined').append('<li><a class="fill-meeting-name">'+m+'</a></li>')
$('.center-panel-wrapper .previously-joined-wrapper').removeClass('hidden') $('.center-panel-wrapper .previously-joined-wrapper').removeClass('hidden')
@ -44,9 +48,9 @@ class @PreviousMeetings
names = names.filter( (value) -> names = names.filter( (value) ->
return $.inArray(value, meetings) == -1 return $.inArray(value, meetings) == -1
) )
for m in names for m in meetings
if $('ul.previously-joined').length > 4 if $('ul.previously-joined > li').length > MAX_MEETINGS
return break
$('ul.previously-joined').append('<li><a class="fill-meeting-name">'+m+'</a></li>') $('ul.previously-joined').append('<li><a class="fill-meeting-name">'+m+'</a></li>')
$('.center-panel-wrapper .previously-joined-wrapper').removeClass('hidden') $('.center-panel-wrapper .previously-joined-wrapper').removeClass('hidden')

View File

@ -202,6 +202,7 @@ class @Recordings
table_api.rows.add(data.recordings) table_api.rows.add(data.recordings)
@draw() @draw()
if $(".page-wrapper.rooms").data('main-room')
recording_names = data.recordings.map (r) -> recording_names = data.recordings.map (r) ->
return r.name return r.name
output = {} output = {}
@ -209,6 +210,7 @@ class @Recordings
output[recording_names[key]] = recording_names[key] output[recording_names[key]] = recording_names[key]
PreviousMeetings.add(value for key, value of output) PreviousMeetings.add(value for key, value of output)
# setup click handlers for the action buttons # setup click handlers for the action buttons
setupActionHandlers: -> setupActionHandlers: ->
table_api = this.table.api() table_api = this.table.api()