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

@ -16,6 +16,9 @@
<%= render 'shared/room_event' do %>
<%= form_for room_path(@room), method: :post do |f| %>
<div class="input-group join-input">
<%= f.hidden_field(:search, :value => params[:search])%>
<%= f.hidden_field(:column, :value => params[:column])%>
<%= f.hidden_field(:direction, :value => params[:direction])%>
<%= f.text_field :join_name,
required: true,
class: "form-control join-form",

View File

@ -86,6 +86,6 @@
</div>
</div>
<%= render "shared/sessions", recordings: @recordings, only_public: false, user_recordings: false, title: t("room.recordings")%>
<%= render "shared/sessions", recordings: @recordings, pagy: @pagy, only_public: false, user_recordings: false, title: t("room.recordings")%>
<%= render "shared/modals/create_room_modal" %>

View File

@ -40,4 +40,4 @@
</div>
</div>
<%= render "shared/sessions", recordings: @room.public_recordings, only_public: true, user_recordings: false, title: t("room.recordings") %>
<%= render "shared/sessions", recordings: @public_recordings, pagy: @pagy, only_public: true, user_recordings: false, title: t("room.recordings") %>

View File

@ -21,21 +21,54 @@
<div class="col-12">
<div class="card">
<div class="table-responsive">
<table class="table table-hover table-outline table-vcenter text-nowrap card-table">
<table id="recordings-table" class="table table-hover table-outline table-vcenter text-nowrap card-table">
<thead>
<tr>
<th data-header="<%= t("recording.table.name") %>" data-order="none"><%= t("recording.table.name") %></th>
<th data-header="name" data-order="<%= @order_column == "name" ? @order_direction : "none" %>">
<%= t("recording.table.name") %>
<% if @order_column == "name" && @order_direction == "desc" %>
<% elsif @order_column == "name" && @order_direction == "asc" %>
<% end %>
</th>
<% if recording_thumbnails? %>
<th><%= t("recording.table.thumbnails") %></th>
<th>
<%= t("recording.table.thumbnails") %>
</th>
<% end %>
<th class="text-left" data-header="<%= t("recording.table.length") %>" data-order="none">
<th class="text-left" data-header="length" data-order="<%= @order_column == "length" ? @order_direction : "none" %>">
<%= t("recording.table.length") %>
<% if @order_column == "length" && @order_direction == "desc" %>
<% elsif @order_column == "length" && @order_direction == "asc" %>
<% end %>
</th>
<th class="text-left" data-header="<%= t("recording.table.users") %>" data-order="none">
<th class="text-left" data-header="users" data-order="<%= @order_column == "users" ? @order_direction : "none" %>">
<%= t("recording.table.users") %>
<% if @order_column == "users" && @order_direction == "desc" %>
<% elsif @order_column == "users" && @order_direction == "asc" %>
<% end %>
</th>
<th class="text-left" data-header="visibility" data-order="<%= @order_column == "visibility" ? @order_direction : "none" %>">
<%= t("recording.table.visibility") %>
<% if @order_column == "visibility" && @order_direction == "desc" %>
<% elsif @order_column == "visibility" && @order_direction == "asc" %>
<% end %>
</th>
<th data-header="formats" data-order="<%= @order_column == "formats" ? @order_direction : "none" %>">
<%= t("recording.table.formats") %>
<% if @order_column == "formats" && @order_direction == "desc" %>
<% elsif @order_column == "formats" && @order_direction == "asc" %>
<% end %>
</th>
<th class="text-left"><%= t("recording.table.visibility") %></th>
<th><%= t("recording.table.formats") %></th>
<% unless only_public %>
<th class="text-center"><i class="icon-settings"></i></th>
<% end %>
@ -68,6 +101,11 @@
<% end %>
</tbody>
</table>
<% if !recordings.empty?%>
<div class="float-right mr-4 mt-4">
<%== pagy_bootstrap_nav(pagy) %>
</div>
<% end %>
</div>
</div>
</div>

View File

@ -18,14 +18,24 @@
<p class="subtitle"><%= subtitle %></p>
</div>
<% if search %>
<div id="search_bar" class="col-4">
<div class="input-icon">
<input type="text" class="form-control btn-pill" placeholder="Search...">
<span class="input-icon-addon">
<i class="fas fa-search"></i>
</span>
<div class="col-4">
<div id="search-bar">
<div class="input-group">
<input id="search-input" type="text" class="form-control" placeholder="<%= t("settings.search") %>..." value="<%= @search %>">
<% unless @search.blank? %>
<span id="clear-search" class="text-primary" onclick="clearSearch()">
<i class="fas fa-times"></i>
</span>
<% end %>
<span class="input-group-append">
<button class="btn btn-primary" type="button" onclick="searchPage()">
<i class="fas fa-search"></i>
</button>
</span>
</div>
</div>
</div>
<% end %>
</div>
<hr class="mt-0">
<hr class="mt-0">

View File

@ -17,38 +17,9 @@
<div class="card-body p-6">
<div class="card-title text-primary">
<div class="form-group">
<div class="row">
<% if setting_id == "users" %>
<div class="col-7 mt-2">
<h4><%= setting_title %></h4>
</div>
<div class="col-5 float-right">
<div id="search-bar">
<div class="input-group">
<input id="search-input" type="text" class="form-control" placeholder="<%= t("settings.search") %>..." value="<%= @search %>">
<% unless @search.blank? %>
<span id="clear-search" class="text-primary" onclick="clearSearch()">
<i class="fas fa-times"></i>
</span>
<% end %>
<span class="input-group-append">
<button class="btn btn-primary" type="button" onclick="searchPage()">
<i class="fas fa-search"></i>
</button>
</span>
</div>
</div>
</div>
<% else %>
<div class="col-12 mt-2">
<h4 class="text-primary"><%= setting_title %></h4>
</div>
<% end %>
</div>
<%= render "shared/components/subtitle", subtitle: setting_title, search: setting_id == "users" %>
</div>
</div>
<hr>
<% unless (defined?(admin_view)).nil? %>
<%= render "shared/admin_settings/#{setting_id}" %>

View File

@ -18,4 +18,4 @@
# without losing all css
%>
<%= render "shared/sessions", recordings: @recordings, only_public: false, user_recordings: true, title: t("recording.all_recordings") %>
<%= render "shared/sessions", recordings: @recordings, pagy: @pagy, only_public: false, user_recordings: true, title: t("recording.all_recordings") %>