Add paging to Recordings Table (GRN2-26) (#512)

* Add translations for the validation messages

* Add translations for next/prev button

* Add paging to recordings

* sync

* Fix line endings
This commit is contained in:
shawn-higgins1
2019-05-14 09:01:41 -04:00
committed by Jesus Federico
parent d8f6c3f872
commit 23abdb52ee
18 changed files with 725 additions and 129 deletions

View File

@ -18,6 +18,7 @@
class RoomsController < ApplicationController
include RecordingsHelper
include Pagy::Backend
before_action :validate_accepted_terms, unless: -> { !Rails.configuration.terms }
before_action :validate_verified_email, except: [:show, :join],
@ -52,9 +53,11 @@ class RoomsController < ApplicationController
# GET /:room_uid
def show
if current_user && @room.owned_by?(current_user)
recs = @room.recordings
@search, @order_column, @order_direction, recs =
@room.recordings(params.permit(:search, :column, :direction), true)
@pagy, @recordings = pagy_array(recs)
@recordings = recs
@is_running = @room.running?
else
# Get users name
@ -66,6 +69,11 @@ class RoomsController < ApplicationController
""
end
@search, @order_column, @order_direction, pub_recs =
@room.public_recordings(params.permit(:search, :column, :direction), true)
@pagy, @public_recordings = pagy_array(pub_recs)
render :join
end
end
@ -119,6 +127,13 @@ class RoomsController < ApplicationController
redirect_to @room.join_path(join_name, opts)
end
else
search_params = params[@room.invite_path] || params
@search, @order_column, @order_direction, pub_recs =
@room.public_recordings(search_params.permit(:search, :column, :direction), true)
@pagy, @public_recordings = pagy_array(pub_recs)
# They need to wait until the meeting begins.
render :wait
end

View File

@ -18,6 +18,7 @@
class UsersController < ApplicationController
include RecordingsHelper
include Pagy::Backend
include Emailer
before_action :find_user, only: [:edit, :update, :destroy]
@ -141,7 +142,9 @@ class UsersController < ApplicationController
# GET /u/:user_uid/recordings
def recordings
if current_user && current_user.uid == params[:user_uid]
@recordings = current_user.all_recordings
@search, @order_column, @order_direction, recs =
current_user.all_recordings(params.permit(:search, :column, :direction), true)
@pagy, @recordings = pagy_array(recs)
else
redirect_to root_path
end