Merge pull request #55 from zach-chai/previously_joined_sessions

Previously joined sessions
This commit is contained in:
Zachary Chai 2016-11-29 15:49:38 -05:00 committed by GitHub
commit f400ca390e
6 changed files with 59 additions and 18 deletions

View File

@ -35,7 +35,7 @@
$('.center-panel-wrapper').on ('click', '.meeting-join', function (event) {
var name = $('.meeting-user-name').val();
Meeting.getInstance().setName(name);
Meeting.getInstance().setURL(Meeting.buildMeetingURL());
Meeting.getInstance().setId($(".page-wrapper").data('id'));
var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
jqxhr.done(function(data) {
@ -136,11 +136,18 @@
$('.generate-link').click (function (e) {
e.preventDefault();
var newId = Math.trunc(Math.random() * 1000000000);
Meeting.getInstance().setId(newId);
$(".page-wrapper.meetings").data('id', newId);
$('.meeting-url').val(Meeting.buildMeetingURL());
$('.meeting-url').val(Meeting.getInstance().getURL());
});
$('.generate-link').click();
$('ul.previously-joined').empty();
var joinedMeetings = localStorage.getItem('joinedMeetings').split(',');
for (var i = joinedMeetings.length - 1; i >= 0; i--) {
$('ul.previously-joined').append('<li><a href="/meetings/'+joinedMeetings[i]+'">'+joinedMeetings[i]+'</a></li>');
}
};
var initMeetings = function() {

View File

@ -19,26 +19,24 @@
_meetingInstance = null
class @Meeting
constructor: (@id, @url, @name) ->
constructor: (@id, @type, @name) ->
# Gets the current instance or creates a new one
@getInstance: ->
if _meetingInstance
return _meetingInstance
id = $(".page-wrapper").data('id')
url = @buildMeetingURL()
if (type = location.pathname.split('/')[1]) != 'rooms'
type = 'meetings'
name = $('.meeting-user-name').val()
_meetingInstance = new Meeting(id, url, name)
_meetingInstance = new Meeting(id, type, name)
return _meetingInstance
@clear: ->
_meetingInstance = null
@buildMeetingURL: (id) ->
if (resource = location.pathname.split('/')[1]) != 'rooms'
resource = 'meetings'
id ||= $(".page-wrapper").data('id')
return @buildFullDomainURL() + '/' + resource + '/' + id
@buildMeetingURL: (id, type) ->
return @buildFullDomainURL() + '/' + type + '/' + id
@buildFullDomainURL: ->
url = location.protocol + '//' + location.hostname
@ -50,7 +48,7 @@ class @Meeting
# Returns a response object
endMeeting: ->
return $.ajax({
url: @url + "/end",
url: @getURL() + "/end",
type: 'DELETE'
})
@ -58,35 +56,53 @@ class @Meeting
# Returns a response object
# The response object contains the URL to join the meeting
getJoinMeetingResponse: ->
return $.get @url + "/join?name=" + @name, ->
return $.get @getURL() + "/join?name=" + @name, (data) =>
if data.messageKey == 'ok' && @type == 'meetings'
try
joinedMeetings = localStorage.getItem('joinedMeetings') || ''
joinedMeetings = joinedMeetings.split(',')
joinedMeetings = joinedMeetings.filter (item) => item != @id.toString()
if joinedMeetings.length >= 5
joinedMeetings.splice(0, 1)
joinedMeetings.push(@id)
localStorage.setItem('joinedMeetings', joinedMeetings.join(','))
catch err
localStorage.setItem('joinedMeetings', @id)
getId: ->
return @id
setId: (id) ->
@id = id
return this
getType: ->
return @type
setType: (type) ->
@type = type
return this
getURL: ->
return @url
setURL: (url) ->
@url = url
return Meeting.buildMeetingURL(@id, @type)
getName: ->
return @name
setName: (name) ->
@name = name
return this
getModJoined: ->
return @modJoined
setModJoined: (modJoined) ->
@modJoined = modJoined
return this
getWaitingForMod: ->
return @waitingForMod
setWaitingForMod: (wMod) ->
@waitingForMod = wMod
return this

View File

@ -14,6 +14,15 @@
// You should have received a copy of the GNU Lesser General Public License along
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
.meetings {
.previously-joined {
list-style-type: none;
margin:auto;
width: 200px;
padding: 0;
}
}
.rooms {
.table-wrapper {

View File

@ -74,7 +74,6 @@ html, body {
}
.panel-footer {
padding: 35px;
background-color: white;
}

View File

@ -19,6 +19,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</div>
<% end %>
<% content_for :footer do %>
<div class="panel-footer">
<div class="list-group text-center">
<h4><%= t('previously_joined_meetings') %></h4>
<ul class="previously-joined"></ul>
</div>
</div>
<% end %>
<div class="page-wrapper meetings">
<div class="container-fluid">

View File

@ -72,6 +72,7 @@ en-US:
past_recordings: Past Recordings
powered_bigbluebutton_html: Powered by %{link}
presentation: Presentation
previously_joined_meetings: Previously Joined Sessions
return_to_room: Return to your personal room
session_url_explanation: The session will be taking place using the following URL
start: Start