add end button to views

This commit is contained in:
Zachary Chai 2016-11-04 18:28:52 -04:00
parent e11098c7a9
commit b8c876443f
6 changed files with 53 additions and 3 deletions

View File

@ -34,6 +34,18 @@
}); });
}); });
$('.meeting-end').click (function (event) {
var jqxhr = Meeting.getInstance().endMeeting();
var btn = $(this);
btn.prop("disabled", true);
jqxhr.done(function(data) {
});
jqxhr.fail(function(xhr, status, error) {
console.info("meeting end failed");
});
});
$('.meeting-url-copy').click (function (e) { $('.meeting-url-copy').click (function (e) {
meetingURL = $('.meeting-url'); meetingURL = $('.meeting-url');
meetingURL.select(); meetingURL.select();

View File

@ -36,6 +36,13 @@ class Meeting {
}); });
}; };
endMeeting() {
return $.ajax({
url: this.url + "/end",
type: 'DELETE'
});
}
setURL(url) { setURL(url) {
this.url = url; this.url = url;
} }

View File

@ -1,4 +1,5 @@
class LandingController < ApplicationController class LandingController < ApplicationController
include BbbApi
def index def index
if params[:resource] == 'meetings' if params[:resource] == 'meetings'
@ -29,11 +30,15 @@ class LandingController < ApplicationController
def render_room def render_room
params[:action] = 'rooms' params[:action] = 'rooms'
@user = User.find_by(username: params[:id]) @user = User.find_by(username: params[:id])
if @user.nil? if @user.nil?
redirect_to root_path redirect_to root_path
return return
end end
@meeting_running = bbb_get_meeting_info(@user.username)[:returncode]
render :action => 'rooms' render :action => 'rooms'
end end

View File

@ -71,6 +71,13 @@ module BbbApi
end end
end end
def bbb_get_meeting_info(id)
meeting_id = bbb_meeting_id(id)
response_data = bbb.get_meeting_info(meeting_id, nil)
rescue BigBlueButton::BigBlueButtonException => exc
response_data = bbb_exception_res exc
end
def bbb_get_recordings(meeting_id, record_id=nil) def bbb_get_recordings(meeting_id, record_id=nil)
options={} options={}
if record_id if record_id
@ -208,5 +215,10 @@ module BbbApi
res[:status] = :not_found res[:status] = :not_found
end end
res res
rescue
{
returncode: false,
status: :internal_server_error
}
end end
end end

View File

@ -6,9 +6,22 @@
<%= text_field :nil, :nil, class: 'form-control meeting-user-name', placeholder: t('enter_name') %> <%= text_field :nil, :nil, class: 'form-control meeting-user-name', placeholder: t('enter_name') %>
<% end %> <% end %>
<% if admin? %> <% if admin? %>
<% if @meeting_running %>
<div class="col-sm-6">
<button type="button" class="btn btn-primary meeting-join pull-right">
<%= t('join') %>
</button>
</div>
<div class="col-sm-6">
<button type="button" class="btn btn-danger meeting-end pull-left">
<%= t('end') %>
</button>
</div>
<% else %>
<button type="button" class="btn btn-primary center-block meeting-join"> <button type="button" class="btn btn-primary center-block meeting-join">
<%= t('start') %> <%= t('start') %>
</button> </button>
<% end %>
<% elsif current_user %> <% elsif current_user %>
<button type="button" class="btn btn-primary center-block meeting-join"> <button type="button" class="btn btn-primary center-block meeting-join">
<%= t('join') %> <%= t('join') %>

View File

@ -24,6 +24,7 @@ en-US:
are_you: Are you %{name} ? are_you: Are you %{name} ?
date_recorded: Date Recorded date_recorded: Date Recorded
duration: Duration duration: Duration
end: End
enter_name: Enter your name enter_name: Enter your name
greet_user: Welcome, %{name} greet_user: Welcome, %{name}
greet_guest: Welcome to %{name} Meeting Space greet_guest: Welcome to %{name} Meeting Space