Merge pull request #81 from daronco/issue-78

Don't ask for a name in the landing page, redir to the room/meeting
This commit is contained in:
Fred Dixon 2017-01-11 12:24:52 -05:00 committed by GitHub
commit bc6eb444ce
4 changed files with 56 additions and 25 deletions

View File

@ -32,7 +32,10 @@
Meeting.clear();
var nameInput = $('.meeting-user-name');
if (!nameInput.val()) {
nameInput.val(localStorage.getItem('lastJoinedName'));
var lastName = localStorage.getItem('lastJoinedName');
if (lastName !== 'undefined') {
nameInput.val(lastName);
}
}
// setup event handlers
@ -40,8 +43,10 @@
var name = $('.meeting-user-name').val();
Meeting.getInstance().setName(name);
Meeting.getInstance().setId($(".page-wrapper").data('id'));
var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
// a user name is set, join the user into the session
if (name !== undefined && name !== null) {
var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
jqxhr.done(function(data) {
if (data.messageKey === 'wait_for_moderator') {
waitForModerator(Meeting.getInstance().getURL());
@ -52,6 +57,11 @@
jqxhr.fail(function(xhr, status, error) {
console.info("meeting join failed");
});
// if not user name was set it means we must ask for a name
} else {
$(location).attr("href", Meeting.getInstance().getURL());
}
});
$('.center-panel-wrapper').on ('keypress', '.meeting-user-name', function (event) {

View File

@ -43,6 +43,11 @@ module ApplicationHelper
end
end
# Whether the current page is the page of a room/meeting or not
def on_room_or_meeting_page?
params[:id].present?
end
def version
Greenlight::VERSION
rescue

View File

@ -16,12 +16,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<div class="join-form-wrapper">
<div class="center-block">
<div class="join-form input-group input-spacing">
<!-- if the user is signed in, add a hidden input with their name -->
<% if current_user %>
<% @current_user = current_user %>
<%= text_field :current_user, :name, class: 'form-control meeting-user-name', type: 'hidden' %>
<% else %>
<%= text_field :nil, :nil, class: 'form-control meeting-user-name', placeholder: t('enter_name') %>
<%= text_field_tag 'user[name]', current_user.name, class: 'form-control meeting-user-name', type: 'hidden' %>
<% end %>
<!-- if admin means the user is signed in and owns the room -->
<% if admin? %>
<% if @meeting_running %>
<div class="col-sm-6">
@ -36,20 +37,34 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</div>
<% else %>
<button type="button" class="btn btn-primary center-block meeting-join">
<%= t('start') %>
<%= t('start_meeting') %>
</button>
<% end %>
<% elsif current_user %>
<% else %>
<!-- on the page of a room/meeting, the user might have to enter a name -->
<% if on_room_or_meeting_page? %>
<% if current_user %>
<button type="button" class="btn btn-primary center-block meeting-join">
<%= t('join') %>
</button>
<% else %>
<%= text_field_tag 'user[name]', '', class: 'form-control meeting-user-name', placeholder: t('enter_name') %>
<span class="input-group-btn">
<button type="button" class="btn btn-primary meeting-join">
<button type="button" class="btn btn-primary center-block meeting-join">
<%= t('join') %>
</button>
</span>
<% end %>
<!-- on the landing page we don't ask for a name, just show the start button -->
<% else %>
<button type="button" class="btn btn-primary center-block meeting-join">
<%= t('start_meeting') %>
</button>
<% end %>
<% end %>
</div>
</div>
</div>

View File

@ -98,6 +98,7 @@ en-US:
return_to_room: Return to your personal room
session_url_explanation: The meeting will be taking place using the following URL
start: Start
start_meeting: Start Meeting
your_personal_room: Your Personal Room
thumbnails: Thumbnails
unlisted: Unlisted