forked from External/greenlight
redesigned meeting and room page
This commit is contained in:
parent
551b64bb59
commit
d3ad6980d9
|
@ -1,10 +1,12 @@
|
||||||
(function() {
|
(function() {
|
||||||
var initIndex = function() {
|
var init = function() {
|
||||||
$('#join_form_button').click (function (event) {
|
|
||||||
|
$('.meeting-join').click (function (event) {
|
||||||
|
var url = $('.meeting-url').val();
|
||||||
|
var name = $('.meeting-user-name').val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : $(this).data ('url') + "?name=" + $('#join_form_name').val(),
|
url : url + "/join?name=" + name,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
async : true,
|
|
||||||
type : 'GET',
|
type : 'GET',
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
$(location).attr("href", data.response.join_url);
|
$(location).attr("href", data.response.join_url);
|
||||||
|
@ -16,29 +18,49 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#url_form_button').click (function (event) {
|
$('.meeting-url-copy').click (function (e) {
|
||||||
$.ajax({
|
meetingURL = $('.meeting-url');
|
||||||
url : $(this).data ('url'),
|
meetingURL.select();
|
||||||
dataType : "json",
|
document.execCommand("copy");
|
||||||
async : true,
|
meetingURL.blur();
|
||||||
type : 'GET',
|
|
||||||
success : function(data) {
|
|
||||||
$('#meeting_url').html(data.response.meeting_url);
|
|
||||||
$('#text_meeting_url').attr("href", data.response.meeting_url);
|
|
||||||
$('#text_meeting_url').text(data.response.meeting_url);
|
|
||||||
},
|
|
||||||
error : function(xhr, status, error) {
|
|
||||||
},
|
|
||||||
complete : function(xhr, status) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var initIndex = function() {
|
||||||
|
|
||||||
|
$('.generate-link').click (function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var link = window.location.protocol +
|
||||||
|
'//' +
|
||||||
|
window.location.hostname +
|
||||||
|
'/' +
|
||||||
|
'meetings/' +
|
||||||
|
Math.trunc(Math.random() * 1000000000);
|
||||||
|
|
||||||
|
$('.meeting-url').val(link);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.meeting-url').val('');
|
||||||
|
$('.generate-link').click();
|
||||||
|
};
|
||||||
|
|
||||||
|
var initRooms = function() {
|
||||||
|
meetingURL = $('.meeting-url');
|
||||||
|
var link = window.location.protocol +
|
||||||
|
'//' +
|
||||||
|
window.location.hostname +
|
||||||
|
meetingURL.data('path');
|
||||||
|
meetingURL.val(link);
|
||||||
|
};
|
||||||
|
|
||||||
$(document).on("turbolinks:load", function() {
|
$(document).on("turbolinks:load", function() {
|
||||||
|
init();
|
||||||
if ($("body[data-controller=landing]").get(0)) {
|
if ($("body[data-controller=landing]").get(0)) {
|
||||||
if ($("body[data-action=meeting]").get(0) || $("body[data-action=room]").get(0)) {
|
if ($("body[data-action=meetings]").get(0)) {
|
||||||
initIndex();
|
initIndex();
|
||||||
|
} else if ($("body[data-action=rooms]").get(0)) {
|
||||||
|
initRooms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,6 +19,14 @@ class User < ApplicationRecord
|
||||||
auth_hash['info']['nickname']
|
auth_hash['info']['nickname']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ownership_name
|
||||||
|
if username.end_with? 's'
|
||||||
|
"#{username}'"
|
||||||
|
else
|
||||||
|
"#{username}'s"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def room_url
|
def room_url
|
||||||
"/rooms/#{username}"
|
"/rooms/#{username}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,28 +1,33 @@
|
||||||
<!-- Body -->
|
|
||||||
<div class='body'>
|
|
||||||
|
|
||||||
<div class="page-wrapper room">
|
|
||||||
<div class="row">
|
<% content_for :title do %>
|
||||||
<div class="col-sm-2 col-sm-offset-10">
|
<div class="title">
|
||||||
<% if !current_user.nil? %>
|
Hi Everyone
|
||||||
<span class="user">Hello <%= current_user.name %></span>
|
</div>
|
||||||
<%= link_to "Logout", user_logout_url() %>
|
<small>
|
||||||
<% if current_user.username %>
|
The session will be taking place using the following URL
|
||||||
<div><%= link_to 'Personal Room', current_user.room_url %></div>
|
</small>
|
||||||
<% else %>
|
|
||||||
<div><%= link_to 'Set Username', edit_user_path(current_user) %></div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% content_for :footer do %>
|
||||||
|
<div class="panel-footer">
|
||||||
|
<div class="text-center">
|
||||||
|
<a href="#" class="generate-link">Click refresh</a> to generate a new meeting URL
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="page-wrapper meeting">
|
||||||
<%= render 'landing/join_form' %>
|
<div class='container-fluid'>
|
||||||
|
|
||||||
<%= render 'landing/footer_message' %>
|
<%= render 'shared/title', title: 'Start A New Session' %>
|
||||||
|
|
||||||
<%= render 'landing/footer_oauth_append' %>
|
<%= render layout: 'shared/center_panel' do %>
|
||||||
|
<div class="center-block col-sm-8">
|
||||||
|
<%= render 'shared/meeting_url', hidden: false %>
|
||||||
|
<%= render 'shared/join_form', user: current_user %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,23 +1,36 @@
|
||||||
<!-- Body -->
|
<% if current_user %>
|
||||||
<div class='body'>
|
<% page_title = "Welcome, #{current_user.name.split(' ').first}" %>
|
||||||
|
|
||||||
<div class="page-wrapper room">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-2 col-sm-offset-10">
|
|
||||||
<% if admin? %>
|
|
||||||
<span class="user">Hello <%= current_user.name %></span>
|
|
||||||
<%= link_to "Logout", user_logout_url() %>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to "Login", "/auth/#{@user.provider}" %>
|
<% page_title = "Welcome to #{@user.ownership_name} Meeting Space" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% content_for :title do %>
|
||||||
|
<div class="title">
|
||||||
|
<% if current_user == @user %>
|
||||||
|
Start a new session
|
||||||
|
<% elsif current_user && current_user != @user %>
|
||||||
|
<%= "Join #{@user.ownership_name} session" %>
|
||||||
|
<% else %>
|
||||||
|
Join the current session
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="page-wrapper room">
|
||||||
<%= render 'landing/join_form' %>
|
<div class="container-fluid">
|
||||||
|
|
||||||
<%= render 'landing/footer_message' %>
|
<%= render 'shared/title', title: page_title %>
|
||||||
|
|
||||||
|
<%= render layout: 'shared/center_panel' do %>
|
||||||
|
<div class="center-block col-sm-8">
|
||||||
|
<% if current_user == @user %>
|
||||||
|
<%= render 'shared/meeting_url', hidden: false %>
|
||||||
|
<% else %>
|
||||||
|
<%= render 'shared/meeting_url', hidden: true %>
|
||||||
|
<% end %>
|
||||||
|
<%= render 'shared/join_form', user: current_user %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue