room block enhancements (#1203)

* highlight current room block

* fix duplicated ids

* remove inline js

* remove some trailing whitespaces

* Fixed Server Rooms room settings name

Co-authored-by: farhatahmad <ahmad.af.farhat@gmail.com>
Co-authored-by: Jesus Federico <jesus@123it.ca>
This commit is contained in:
Klaus 2020-04-16 17:21:57 +02:00 committed by GitHub
parent 21cb768fc4
commit e7e0c7624c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 28 deletions

View File

@ -19,6 +19,10 @@ $(document).on('turbolinks:load', function(){
var controller = $("body").data('controller'); var controller = $("body").data('controller');
var action = $("body").data('action'); var action = $("body").data('action');
// highlight current room
$('.room-block').removeClass('current');
$('a[href="' + window.location.pathname + '"] .room-block').addClass('current');
// Only run on room pages. // Only run on room pages.
if (controller == "rooms" && action == "show"){ if (controller == "rooms" && action == "show"){
var copy = $('#copy'); var copy = $('#copy');
@ -57,7 +61,7 @@ $(document).on('turbolinks:load', function(){
$('#create-room-name').focus() $('#create-room-name').focus()
} }
}) })
if (controller == "rooms" && action == "show" || controller == "admins" && action == "server_rooms"){ if (controller == "rooms" && action == "show" || controller == "admins" && action == "server_rooms"){
// Display and update all fields related to creating a room in the createRoomModal // Display and update all fields related to creating a room in the createRoomModal
$(".update-room").click(function(){ $(".update-room").click(function(){
@ -120,13 +124,13 @@ $(document).on('turbolinks:load', function(){
let listItem = document.createElement("li") let listItem = document.createElement("li")
listItem.setAttribute('class', 'list-group-item text-left not-saved add-access'); listItem.setAttribute('class', 'list-group-item text-left not-saved add-access');
listItem.setAttribute("data-uid", uid) listItem.setAttribute("data-uid", uid)
let spanItem = "<span class='avatar float-left mr-2'>" + option.text().charAt(0) + "</span> <span class='shared-user'>" + let spanItem = "<span class='avatar float-left mr-2'>" + option.text().charAt(0) + "</span> <span class='shared-user'>" +
option.text() + " <span class='text-muted'>" + option.data("subtext") + "</span></span>" + option.text() + " <span class='text-muted'>" + option.data("subtext") + "</span></span>" +
"<span class='text-primary float-right shared-user cursor-pointer' onclick='removeSharedUser(this)'><i class='fas fa-times'></i></span>" "<span class='text-primary float-right shared-user cursor-pointer' onclick='removeSharedUser(this)'><i class='fas fa-times'></i></span>"
listItem.innerHTML = spanItem listItem.innerHTML = spanItem
$("#user-list").append(listItem) $("#user-list").append(listItem)
} }
}) })
@ -160,9 +164,9 @@ function showCreateRoom(target) {
function showUpdateRoom(target) { function showUpdateRoom(target) {
var modal = $(target) var modal = $(target)
var update_path = modal.closest("#room-block").data("path") var update_path = modal.closest(".room-block").data("path")
var settings_path = modal.data("settings-path") var settings_path = modal.data("settings-path")
$("#create-room-name").val(modal.closest("#room-block").find("#room-name-text").text().trim()) $("#create-room-name").val(modal.closest(".room-block").find(".room-name-text").text().trim())
$("#createRoomModal form").attr("action", update_path) $("#createRoomModal form").attr("action", update_path)
//show all elements & their children with a update-only class //show all elements & their children with a update-only class
@ -178,8 +182,8 @@ function showUpdateRoom(target) {
}) })
updateCurrentSettings(settings_path) updateCurrentSettings(settings_path)
var accessCode = modal.closest("#room-block").data("room-access-code") var accessCode = modal.closest(".room-block").data("room-access-code")
if(accessCode){ if(accessCode){
$("#create-room-access-code").text(getLocalizedString("modal.create_room.access_code") + ": " + accessCode) $("#create-room-access-code").text(getLocalizedString("modal.create_room.access_code") + ": " + accessCode)
@ -199,7 +203,7 @@ function showDeleteRoom(target) {
function updateCurrentSettings(settings_path){ function updateCurrentSettings(settings_path){
// Get current room settings and set checkbox // Get current room settings and set checkbox
$.get(settings_path, function(room_settings) { $.get(settings_path, function(room_settings) {
var settings = JSON.parse(room_settings) var settings = JSON.parse(room_settings)
$("#room_mute_on_join").prop("checked", settings.muteOnStart) $("#room_mute_on_join").prop("checked", settings.muteOnStart)
$("#room_require_moderator_approval").prop("checked", settings.requireModeratorApproval) $("#room_require_moderator_approval").prop("checked", settings.requireModeratorApproval)
$("#room_anyone_can_start").prop("checked", settings.anyoneCanStart) $("#room_anyone_can_start").prop("checked", settings.anyoneCanStart)
@ -249,7 +253,7 @@ function displaySharedUsers(path) {
user_list_html += "<span class='text-primary float-right shared-user cursor-pointer' onclick='removeSharedUser(this)'><i class='fas fa-times'></i></span>" user_list_html += "<span class='text-primary float-right shared-user cursor-pointer' onclick='removeSharedUser(this)'><i class='fas fa-times'></i></span>"
user_list_html += "</li>" user_list_html += "</li>"
}) })
$("#user-list").html(user_list_html) $("#user-list").html(user_list_html)
}); });
} }

View File

@ -57,6 +57,14 @@
padding-top: 12px; padding-top: 12px;
} }
.room-block {
&:not(.current) {
.stamp {
opacity: 0.5;
}
}
}
#create-room-block { #create-room-block {
border: 1px dashed lightgray; border: 1px dashed lightgray;
@ -99,4 +107,5 @@
.remove-shared { .remove-shared {
text-decoration: line-through; text-decoration: line-through;
} }

View File

@ -13,13 +13,13 @@
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. # with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
%> %>
<tr id="room-block" data-path="<%= update_settings_path(room) %>" data-room-settings=<%= room.room_settings %> data-room-access-code="<%= room.access_code %>"> <tr class="room-block" data-path="<%= update_settings_path(room) %>" data-room-settings=<%= room.room_settings %> data-room-access-code="<%= room.access_code %>">
<td> <td>
<div id="room-title" class="form-inline edit_hover_class"> <div id="room-title" class="form-inline edit_hover_class">
<% if room.id == room.owner.room_id %> <% if room.id == room.owner.room_id %>
<i class="fas fa-home pr-1"></i> <i class="fas fa-home pr-1"></i>
<% end %> <% end %>
<text id="room-name-text"> <text class="room-name-text">
<%= room.name %> <%= room.name %>
</text> </text>
</div> </div>

View File

@ -13,7 +13,7 @@
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. # with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
%> %>
<div id="room-block" data-path="<%= update_settings_path(room) %>" data-room-access-code="<%= room.access_code %>" class="card"> <div data-path="<%= update_settings_path(room) %>" data-room-access-code="<%= room.access_code %>" class="card room-block">
<div class="card-body p-1"> <div class="card-body p-1">
<table class="table table-hover table-vcenter text-wrap table-no-border"> <table class="table table-hover table-vcenter text-wrap table-no-border">
<tbody class="no-border-top"> <tbody class="no-border-top">
@ -27,11 +27,11 @@
</span> </span>
</td> </td>
<td> <td>
<div id="room-name"> <div>
<h4 id="room-name-text" contenteditable="false" class="m-0 force-text-normal" ><%= room.name %></h4> <h4 contenteditable="false" class="m-0 force-text-normal room-name-text" ><%= room.name %></h4>
</div> </div>
<div id="room-name-editable" style="display: none"> <div style="display: none">
<input id="room-name-editable-input" class="form-control input-sm w-100 h-4" value="<%= room.name %>"> <input class="form-control input-sm w-100 h-4 room-name-editable" value="<%= room.name %>">
</div> </div>
<div class="small text-muted"> <div class="small text-muted">
<% if room.sessions > 0 %> <% if room.sessions > 0 %>
@ -41,9 +41,9 @@
<% end %> <% end %>
</div> </div>
</td> </td>
<td class="text-right"> <td class="text-right">
<div class="item-action dropdown" data-display="static"> <div class="item-action dropdown" data-display="static">
<a href="javascript:void(0)" data-toggle="dropdown" data-display="static" class="icon"> <a href="#" data-toggle="dropdown" data-display="static" class="icon">
<i class="fas fa-ellipsis-v px-4"></i> <i class="fas fa-ellipsis-v px-4"></i>
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-md-left"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-md-left">
@ -61,7 +61,7 @@
</a> </a>
<% end %> <% end %>
</div> </div>
</div> </div>
</td> </td>
</tbody> </tbody>
</table> </table>

View File

@ -13,7 +13,7 @@
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. # with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
%> %>
<div id="room-block" data-room-uid="<%= room.uid %>" data-room-settings=<%= room.room_settings %> data-room-access-code="<%= room.access_code %>" class="card"> <div data-room-uid="<%= room.uid %>" data-room-settings=<%= room.room_settings %> data-room-access-code="<%= room.access_code %>" class="card room-block">
<div class="card-body p-1"> <div class="card-body p-1">
<table class="table table-hover table-vcenter text-wrap table-no-border"> <table class="table table-hover table-vcenter text-wrap table-no-border">
<tbody class="no-border-top"> <tbody class="no-border-top">
@ -37,7 +37,7 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-md-left"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-md-left">
<a href="" data-toggle="modal" data-target="#removeAccessModal" class="remove-share-room dropdown-item" data-path="<%= room_remove_shared_access_path(room) %>"> <a href="" data-toggle="modal" data-target="#removeAccessModal" class="remove-share-room dropdown-item" data-path="<%= room_remove_shared_access_path(room) %>">
<i class="dropdown-icon far fa-trash-alt"></i> <%= t("remove") %> <i class="dropdown-icon far fa-trash-alt"></i> <%= t("remove") %>
</a> </a>
</div> </div>
</div> </div>

View File

@ -84,7 +84,7 @@
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<% if shared_access_allowed %> <% if shared_access_allowed %>
<% current_user.shared_rooms.each do |room| %> <% current_user.shared_rooms.each do |room| %>
<div class="col-lg-4 col-md-6 col-sm-12"> <div class="col-lg-4 col-md-6 col-sm-12">

View File

@ -58,7 +58,7 @@
<span class="custom-switch-indicator float-right cursor-pointer"></span> <span class="custom-switch-indicator float-right cursor-pointer"></span>
</label> </label>
<% end %> <% end %>
<% if Rails.configuration.room_features.include? "anyone-can-start" %> <% if Rails.configuration.room_features.include? "anyone-can-start" %>
<label class="custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block"> <label class="custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block">
<span class="custom-switch-description"><%= t("modal.room_settings.start")%></span> <span class="custom-switch-description"><%= t("modal.room_settings.start")%></span>
@ -81,8 +81,8 @@
<span class="custom-switch-indicator float-right cursor-pointer"></span> <span class="custom-switch-indicator float-right cursor-pointer"></span>
</label> </label>
<div class="mt-4"> <div class="mt-4">
<%= f.submit t("modal.create_room.create"), id: "create-room-submit", class: "create-only btn btn-primary btn-block" %> <%= f.submit t("modal.create_room.create"), class: "create-only btn btn-primary btn-block" %>
<%= f.submit t("modal.room_settings.update"), id: "create-room-submit", class: "update-only btn btn-primary btn-block" %> <%= f.submit t("modal.room_settings.update"), class: "update-only btn btn-primary btn-block" %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -193,4 +193,10 @@ input:focus, select:focus {
&.selected { &.selected {
@extend .btn-primary; @extend .btn-primary;
} }
}
.room-block {
&.current {
box-shadow: 0 0 10px $primary-color-lighten;
}
} }