Skip to content
Permalink
Browse files

add pagination on admin conferences (#5463)

* fix pagination on conferences

* add changelog line

* undo the ruby version

* fix ruby

* update ruby version in gemfile.lock
  • Loading branch information...
isaacmg410 authored and tramuntanal committed Oct 31, 2019
1 parent 0238aa2 commit 3875c59ef6c9d0c442e639ab1d1e0884760426c1
@@ -17,6 +17,7 @@

**Fixed**:

- **decidim-conferences**: Fix: Add pagination interface to some sections [\#5463](https://github.com/decidim/decidim/pull/5463)
- **decidim-sortitions**: Fix: Don't include drafts in sortitions [\#5434](https://github.com/decidim/decidim/pull/5434)
- **decidim-assemblies**: Fix: Fixed assembly parent_id when selecting itself [#5416](https://github.com/decidim/decidim/pull/5416)

@@ -780,7 +780,7 @@ DEPENDENCIES
web-console (~> 3.5)

RUBY VERSION
ruby 2.6.3p62
ruby 2.6.5p114

BUNDLED WITH
1.17.3
@@ -9,13 +9,14 @@ module Admin
#
class ConferenceRegistrationsController < Decidim::Conferences::Admin::ApplicationController
include Concerns::ConferenceAdmin
include Decidim::Paginable

helper_method :conference

def index
enforce_permission_to :read_conference_registrations, :conference, conference: conference

@conference_registrations = Decidim::Conferences::ConferenceRegistration.where(conference: conference).page(params[:page]).per(15)
@conference_registrations = paginate(Decidim::Conferences::ConferenceRegistration.where(conference: conference))
end

def export
@@ -8,13 +8,14 @@ module Admin
class ConferenceSpeakersController < Decidim::Conferences::Admin::ApplicationController
helper Decidim::Conferences::Admin::ConferenceSpeakersHelper
include Concerns::ConferenceAdmin
include Decidim::Paginable

def index
enforce_permission_to :index, :conference_speaker

@query = params[:q]

@conference_speakers = Decidim::Conferences::Admin::ConferenceSpeakers.for(collection, @query).page(params[:page]).per(15)
@conference_speakers = paginate(Decidim::Conferences::Admin::ConferenceSpeakers.for(collection, @query))
end

def new
@@ -7,10 +7,11 @@ module Admin
#
class ConferenceUserRolesController < Decidim::Conferences::Admin::ApplicationController
include Concerns::ConferenceAdmin
include Decidim::Paginable

def index
enforce_permission_to :index, :conference_user_role
@conference_user_roles = collection
@conference_user_roles = paginate(collection)
end

def new
@@ -8,10 +8,11 @@ module Admin
class ConferencesController < Decidim::Conferences::Admin::ApplicationController
helper_method :current_conference, :current_participatory_space
layout "decidim/admin/conferences"
include Decidim::Paginable

def index
enforce_permission_to :read, :conference_list
@conferences = collection
@conferences = paginate(collection)
end

def new
@@ -6,11 +6,12 @@ module Admin
# Controller that allows managing conference media links.
class MediaLinksController < Decidim::Conferences::Admin::ApplicationController
include Concerns::ConferenceAdmin
include Decidim::Paginable

def index
enforce_permission_to :index, :media_link

@media_links = collection.page(params[:page]).per(15)
@media_links = paginate(collection)
end

def new
@@ -7,11 +7,12 @@ module Admin
#
class PartnersController < Decidim::Conferences::Admin::ApplicationController
include Concerns::ConferenceAdmin
include Decidim::Paginable

def index
enforce_permission_to :index, :partner

@partners = collection.page(params[:page]).per(15)
@partners = paginate(collection)
end

def new
@@ -8,11 +8,12 @@ module Admin
class RegistrationTypesController < Decidim::Conferences::Admin::ApplicationController
include Concerns::ConferenceAdmin
include Decidim::ApplicationHelper
include Decidim::Paginable

def index
enforce_permission_to :index, :registration_type

@registration_types = collection.page(params[:page]).per(15)
@registration_types = paginate(collection)
end

def new
@@ -63,6 +63,7 @@
<% end %>
</tbody>
</table>
<%= paginate @conference_speakers, theme: "decidim" %>
</div>
</div>
</div>
@@ -60,6 +60,7 @@
<% end %>
</tbody>
</table>
<%= paginate @conference_user_roles, theme: "decidim" %>
</div>
</div>
</div>
@@ -60,6 +60,7 @@
<% end %>
</tbody>
</table>
<%= paginate @conferences, theme: "decidim" %>
</div>
</div>
</div>
@@ -51,6 +51,7 @@
<% end %>
</tbody>
</table>
<%= paginate @partners, theme: "decidim" %>
</div>
</div>
</div>
@@ -60,6 +60,7 @@
<% end %>
</tbody>
</table>
<%= paginate @registration_types, theme: "decidim" %>
</div>
</div>
</div>
@@ -95,7 +95,7 @@
end

context "when paginating" do
let!(:collection_size) { 20 }
let!(:collection_size) { 25 }
let!(:collection) { create_list(:media_link, collection_size, conference: conference) }
let!(:resource_selector) { "#media_links tbody tr" }

@@ -104,7 +104,7 @@
end

it "lists 15 media links per page by default" do
expect(page).to have_css(resource_selector, count: 15)
expect(page).to have_css(resource_selector, count: 20)
expect(page).to have_css(".pagination .page", count: 2)
click_link "Next"
expect(page).to have_selector(".pagination .current", text: "2")

0 comments on commit 3875c59

Please sign in to comment.
You can’t perform that action at this time.