forked from External/greenlight
* <Added Pagination> * <Created search bar in Room> * <Fixed search bar UI> * <Fixed searching> * <Modified search> * <Fixed code style> * <fixed changes> * <Added pagination and search for public recordings> * <added rspec tests> * <Added and Updated search.js> * <Fixed live searching for current user room> * <Fixed live searching for current user room> * <Added live search for join> * <Fixed errors> * <fixed gemfile> * <Fix gems> * <> * <Fixed rspec tests> * <Removed commented code> * Update search.js
This commit is contained in:
parent
8b41dec8ac
commit
895af7494e
|
@ -0,0 +1,53 @@
|
|||
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
|
||||
//
|
||||
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Lesser General Public License as published by the Free Software
|
||||
// Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along
|
||||
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$(document).on('turbolinks:load', function(){
|
||||
var controller = $("body").data('controller');
|
||||
var action = $("body").data('action');
|
||||
|
||||
if(controller == "rooms" && action == "show" || controller == "rooms" && action == "update"){
|
||||
search_input = $('#search_bar');
|
||||
|
||||
search_input.bind("keyup", function(event){
|
||||
|
||||
// Retrieve the current search query
|
||||
search_query = search_input.find(".form-control").val();
|
||||
|
||||
//Search for recordings and display them based on name match
|
||||
var recordings_found = 0;
|
||||
|
||||
recordings = $('#recording-table').find('tr');
|
||||
|
||||
recordings.each(function(){
|
||||
if($(this).find('text').text().toLowerCase().includes(search_query.toLowerCase())){
|
||||
recordings_found = recordings_found + 1;
|
||||
$(this).show();
|
||||
}
|
||||
else{
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Show "No recordings match your search" if no recordings found
|
||||
if(recordings_found == 0){
|
||||
$('#no_recordings_found').show();
|
||||
}
|
||||
else{
|
||||
$('#no_recordings_found').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
|
@ -66,7 +66,6 @@ class RoomsController < ApplicationController
|
|||
# POST /:room_uid
|
||||
def join
|
||||
opts = default_meeting_options
|
||||
|
||||
unless @room.owned_by?(current_user)
|
||||
# Assign join name if passed.
|
||||
if params[@room.invite_path]
|
||||
|
|
|
@ -38,21 +38,26 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="recording-table">
|
||||
<% if recordings.empty? %>
|
||||
<tr>
|
||||
<td colspan="7" class="text-center h4 p-6 font-weight-normal">
|
||||
<%= t("recording.no_recordings", inject: only_public ? t("recording.visibility.public").downcase + " " : "") %>
|
||||
<tr id="no_recordings_found" style="display: none;">
|
||||
<td colspan="7" class="text-center h4 p-6 font-weight-normal" >
|
||||
<%= t("recording.no_matched_recordings", inject: only_public ? t("recording.visibility.public").downcase + " " : "") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% recordings.each do |recording| %>
|
||||
<% if only_public %>
|
||||
<%= render "shared/components/public_recording_row", recording: recording %>
|
||||
<% else %>
|
||||
<%= render "shared/components/recording_row", recording: recording %>
|
||||
<% if recordings.empty? %>
|
||||
<tr>
|
||||
<td colspan="7" class="text-center h4 p-6 font-weight-normal">
|
||||
<%= t("recording.no_recordings", inject: only_public ? t("recording.visibility.public").downcase + " " : "") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% recordings.each do |recording| %>
|
||||
<% if only_public %>
|
||||
<%= render "shared/components/public_recording_row", recording: recording %>
|
||||
<% else %>
|
||||
<%= render "shared/components/recording_row", recording: recording %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -16,11 +16,13 @@
|
|||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<% if recording[:metadata][:name] %>
|
||||
<%= recording[:metadata][:name] %>
|
||||
<% else %>
|
||||
<%= recording[:name] %>
|
||||
<% end %>
|
||||
<text>
|
||||
<% if recording[:metadata][:name] %>
|
||||
<%= recording[:metadata][:name] %>
|
||||
<% else %>
|
||||
<%= recording[:name] %>
|
||||
<% end %>
|
||||
</text>
|
||||
</div>
|
||||
<div class="small text-muted">
|
||||
<%= t("recording.recorded_on", date: recording_date(recording[:startTime])) %>
|
||||
|
|
|
@ -18,16 +18,14 @@
|
|||
<p class="subtitle"><%= subtitle %></p>
|
||||
</div>
|
||||
<% if search %>
|
||||
<!--
|
||||
<div class="col-3">
|
||||
<div id="search_bar" class="col-3">
|
||||
<div class="input-icon">
|
||||
<span class="input-icon-addon">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
<input type="text" class="form-control btn-pill" placeholder="Search...">
|
||||
<span class="input-icon-addon">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<% end %>
|
||||
</div>
|
||||
<hr class="mt-0">
|
||||
|
|
|
@ -114,6 +114,7 @@ en:
|
|||
recording:
|
||||
email: Email Recording
|
||||
no_recordings: This room has no %{inject}recordings.
|
||||
no_matched_recordings: No %{inject} recordings match your search.
|
||||
recorded_on: Recorded on %{date}
|
||||
table:
|
||||
name: Name
|
||||
|
|
|
@ -65,7 +65,6 @@ Rails.application.routes.draw do
|
|||
post '/start', to: 'rooms#start', as: :start_room
|
||||
get '/logout', to: 'rooms#logout', as: :logout_room
|
||||
|
||||
# Mange recordings.
|
||||
scope '/:record_id' do
|
||||
post '/', to: 'rooms#update_recording', as: :update_recording
|
||||
delete '/', to: 'rooms#delete_recording', as: :delete_recording
|
||||
|
|
|
@ -43,6 +43,14 @@ describe RoomsController, type: :controller do
|
|||
expect(assigns(:is_running)).to eql(@owner.main_room.running?)
|
||||
end
|
||||
|
||||
it "should be able to search recordings if user is owner" do
|
||||
@request.session[:user_id] = @owner.id
|
||||
|
||||
get :show, params: { room_uid: @owner.main_room, search: :none }
|
||||
|
||||
expect(assigns(:recordings)).to eql([])
|
||||
end
|
||||
|
||||
it "should render join if user is not owner" do
|
||||
@request.session[:user_id] = @user.id
|
||||
|
||||
|
@ -51,6 +59,14 @@ describe RoomsController, type: :controller do
|
|||
expect(response).to render_template(:join)
|
||||
end
|
||||
|
||||
it "should be able to search public recordings if user is not owner" do
|
||||
@request.session[:user_id] = @user.id
|
||||
|
||||
get :show, params: { room_uid: @owner.main_room, search: :none }
|
||||
|
||||
expect(assigns(:recordings)).to eql(nil)
|
||||
end
|
||||
|
||||
it "should raise if room is not valid" do
|
||||
expect do
|
||||
get :show, params: { room_uid: "non_existent" }
|
||||
|
|
Loading…
Reference in New Issue