Don't ask for a name in the landing page, redir to the room/meeting

Instead of asking the user for a name in the landing page, it just
redirects to the room/meeting page, where the user is asked to enter a
name. If the user is signed in, no redirect is necessary and the user's
name is used automatically.
This commit is contained in:
Leonardo Crauss Daronco 2017-01-11 14:55:39 -02:00
parent b82f693bff
commit b8c4ffe80b
4 changed files with 56 additions and 25 deletions

View File

@ -32,7 +32,10 @@
Meeting.clear(); Meeting.clear();
var nameInput = $('.meeting-user-name'); var nameInput = $('.meeting-user-name');
if (!nameInput.val()) { if (!nameInput.val()) {
nameInput.val(localStorage.getItem('lastJoinedName')); var lastName = localStorage.getItem('lastJoinedName');
if (lastName !== 'undefined') {
nameInput.val(localStorage.getItem('lastJoinedName'));
}
} }
// setup event handlers // setup event handlers
@ -40,18 +43,25 @@
var name = $('.meeting-user-name').val(); var name = $('.meeting-user-name').val();
Meeting.getInstance().setName(name); Meeting.getInstance().setName(name);
Meeting.getInstance().setId($(".page-wrapper").data('id')); Meeting.getInstance().setId($(".page-wrapper").data('id'));
var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
jqxhr.done(function(data) { // a user name is set, join the user into the session
if (data.messageKey === 'wait_for_moderator') { if (name !== undefined && name !== null) {
waitForModerator(Meeting.getInstance().getURL()); var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
} else { jqxhr.done(function(data) {
$(location).attr("href", data.response.join_url); if (data.messageKey === 'wait_for_moderator') {
} waitForModerator(Meeting.getInstance().getURL());
}); } else {
jqxhr.fail(function(xhr, status, error) { $(location).attr("href", data.response.join_url);
console.info("meeting join failed"); }
}); });
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) { $('.center-panel-wrapper').on ('keypress', '.meeting-user-name', function (event) {

View File

@ -43,6 +43,11 @@ module ApplicationHelper
end end
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 def version
Greenlight::VERSION Greenlight::VERSION
rescue rescue

View File

@ -16,12 +16,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<div class="join-form-wrapper"> <div class="join-form-wrapper">
<div class="center-block"> <div class="center-block">
<div class="join-form input-group input-spacing"> <div class="join-form input-group input-spacing">
<!-- if the user is signed in, add a hidden input with their name -->
<% if current_user %> <% if current_user %>
<% @current_user = current_user %> <%= text_field_tag 'user[name]', current_user.name, class: 'form-control meeting-user-name', type: 'hidden' %>
<%= 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') %>
<% end %> <% end %>
<!-- if admin means the user is signed in and owns the room -->
<% if admin? %> <% if admin? %>
<% if @meeting_running %> <% if @meeting_running %>
<div class="col-sm-6"> <div class="col-sm-6">
@ -36,19 +37,33 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</div> </div>
<% else %> <% 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_meeting') %>
</button> </button>
<% end %> <% end %>
<% elsif current_user %>
<button type="button" class="btn btn-primary center-block meeting-join">
<%= t('join') %>
</button>
<% else %> <% else %>
<span class="input-group-btn">
<button type="button" class="btn btn-primary meeting-join"> <!-- on the page of a room/meeting, the user might have to enter a name -->
<%= t('join') %> <% 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 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> </button>
</span> <% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

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