notify user when joining without name provided

This commit is contained in:
Zachary Chai 2017-03-14 16:09:20 -04:00
parent 8d4aaeff03
commit 4d652463ec
7 changed files with 43 additions and 20 deletions

View File

@ -47,6 +47,7 @@
// a user name is set, join the user into the session // a user name is set, join the user into the session
if (name !== undefined && name !== null) { if (name !== undefined && name !== null) {
var jqxhr = Meeting.getInstance().getJoinMeetingResponse(); var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
if (jqxhr) {
jqxhr.done(function(data) { jqxhr.done(function(data) {
if (data.messageKey === 'wait_for_moderator') { if (data.messageKey === 'wait_for_moderator') {
waitForModerator(Meeting.getInstance().getURL()); waitForModerator(Meeting.getInstance().getURL());
@ -57,6 +58,9 @@
jqxhr.fail(function(xhr, status, error) { jqxhr.fail(function(xhr, status, error) {
console.info("meeting join failed"); console.info("meeting join failed");
}); });
} else {
$('.meeting-user-name').parent().addClass('has-error');
}
// if not user name was set it means we must ask for a name // if not user name was set it means we must ask for a name
} else { } else {
@ -68,6 +72,14 @@
Turbolinks.visit($('.meeting-url').val()); Turbolinks.visit($('.meeting-url').val());
}); });
$('.center-panel-wrapper').on ('input', '.meeting-user-name', function (event) {
if ($(this).val() === '') {
$(this).parent().addClass('has-error')
} else {
$(this).parent().removeClass('has-error')
}
});
$('.center-panel-wrapper').on ('keypress', '.meeting-user-name', function (event) { $('.center-panel-wrapper').on ('keypress', '.meeting-user-name', function (event) {
if (event.keyCode === 13) { if (event.keyCode === 13) {
event.preventDefault(); event.preventDefault();

View File

@ -63,6 +63,9 @@ class @Meeting
# Returns a response object # Returns a response object
# The response object contains the URL to join the meeting # The response object contains the URL to join the meeting
getJoinMeetingResponse: -> getJoinMeetingResponse: ->
if !@userName
showAlert(I18n.enter_name, 4000, 'danger')
return false
return $.get @getURL() + "/join?name=" + @userName, (data) => return $.get @getURL() + "/join?name=" + @userName, (data) =>
# update name used to join meeting # update name used to join meeting
localStorage.setItem('lastJoinedName', @getUserName()) localStorage.setItem('lastJoinedName', @getUserName())

View File

@ -35,12 +35,15 @@ var loopJoin = function() {
}; };
var alertTimeout = null; var alertTimeout = null;
var showAlert = function(html, timeout_delay) { var showAlert = function(html, timeout_delay, type) {
type = type || 'success'
if (!html) { if (!html) {
return; return;
} }
$('.alert-template .alert-message').html(html); $('.alert-template .alert-message').html(html);
$('.alert-template .alert').removeClass('alert-success alert-danger alert-info alert-warning').addClass('alert-'+type);
$('#alerts').html($('.alert-template').html()); $('#alerts').html($('.alert-template').html());
if (timeout_delay) { if (timeout_delay) {

View File

@ -66,14 +66,6 @@
<%= t('client.unpublished') %> <%= t('client.unpublished') %>
</button> </button>
</div> </div>
<div class="alert-template">
<div class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<span class="alert-message"></span>
</div>
</div>
<div class="recording-actions"> <div class="recording-actions">
<button type="button" class="btn btn-default has-popover recording-update-trigger visibility-tooltip" <button type="button" class="btn btn-default has-popover recording-update-trigger visibility-tooltip"
data-placement="left" data-popover-body=".recording-visibility-popover" data-placement="left" data-popover-body=".recording-visibility-popover"

View File

@ -78,5 +78,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<%= t('footer_html', bbb_link: link_to('BigBlueButton', 'http://bigbluebutton.org/', target: "_blank")) %>.<br><br> <%= t('footer_html', bbb_link: link_to('BigBlueButton', 'http://bigbluebutton.org/', target: "_blank")) %>.<br><br>
</div> </div>
<!-- End of Footer --> <!-- End of Footer -->
<div hidden class="hidden-elements">
<div class="alert-template">
<div class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<span class="alert-message"></span>
</div>
</div>
</div>
</body> </body>
</html> </html>

View File

@ -44,7 +44,9 @@
<!-- if not signed in show field to enter name --> <!-- if not signed in show field to enter name -->
<% else %> <% else %>
<div class="input-wrapper">
<%= text_field_tag 'user[name]', '', class: 'form-control meeting-user-name', placeholder: t('enter_name'), maxlength: user_name_limit %> <%= text_field_tag 'user[name]', '', class: 'form-control meeting-user-name', placeholder: t('enter_name'), maxlength: user_name_limit %>
</div>
<span class="input-group-btn"> <span class="input-group-btn">
<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

@ -45,6 +45,7 @@ en-US:
are_you_sure: Are you sure? are_you_sure: Are you sure?
change_visibility: Change visibility change_visibility: Change visibility
delete_recording: Delete recording delete_recording: Delete recording
enter_name: Enter a name to join
meeting_ended: Meeting was ended meeting_ended: Meeting was ended
meeting_started: Meeting was started meeting_started: Meeting was started
no_recordings: No Recordings no_recordings: No Recordings