[feat]Add bootstrap style to pagination navbar

This commit is contained in:
Jimmy 2021-04-09 16:33:39 +08:00
parent bb44f10120
commit 185b2773d7
3 changed files with 10 additions and 6 deletions

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
EVENTS_PER_PAGE = 3
class ConferencesController < ApplicationController
include ConferenceHelper
@ -72,9 +74,10 @@ class ConferencesController < ApplicationController
@sponsors = @conference.sponsors
end
if splashpage.include_happening_now
@event_list = get_happening_now_events_schedules(@conference)
@event_limit = 3
@pagy, @events_schedules = pagy_array(@event_list, items: @event_limit)
events_schedules_list = get_happening_now_events_schedules(@conference)
@events_schedules_limit = EVENTS_PER_PAGE
@events_schedules_length = events_schedules_list.length
@pagy, @events_schedules = pagy_array(events_schedules_list, items: @events_schedules_limit)
@happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json)
end
end

View file

@ -57,8 +57,9 @@
%h2.text-center{ style: "margin-bottom:30px" } Happening Now
- for event_schedule in @events_schedules
= render 'schedules/event', conference: @conference, event_schedule: event_schedule, event: event_schedule.event
.container{ style: "margin:auto; width:50%" }
!= pagy_nav(@pagy)
- if @events_schedules_length > @events_schedules_limit
.container{ style: "width:100%; text-align:center" }
!= pagy_bootstrap_nav(@pagy)
- else
.row
%h3.text-center There are no events happening now.

View file

@ -36,7 +36,7 @@ require 'pagy/extras/array'
# Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination
# See https://ddnexus.github.io/pagy/extras/bootstrap
# require 'pagy/extras/bootstrap'
require 'pagy/extras/bootstrap'
# Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination
# See https://ddnexus.github.io/pagy/extras/bulma