# frozen_string_literal: true module Rodauth Feature.define(:oauth_management_base, :OauthManagementBase) do depends :oauth_authorize_base button "Previous", "oauth_management_pagination_previous" button "Next", "oauth_management_pagination_next" def oauth_management_pagination_links(paginated_ds) html = +'" end def oauth_management_pagination_link(page, label: page, current: false, classes: "") classes += " disabled" if current || !page classes += " active" if current if page params = request.GET.merge("page" => page).map do |k, v| v ? "#{CGI.escape(String(k))}=#{CGI.escape(String(v))}" : CGI.escape(String(k)) end.join("&") href = "#{request.path}?#{params}" <<-HTML
  • #{label}
  • HTML else <<-HTML
  • #{label} #{'(current)' if current}
  • HTML end end def post_configure super # TODO: remove this in v1, when resource-server mode does not load all of the provider features. return unless db db.extension :pagination end private def per_page_param(default_per_page) per_page = param_or_nil("per_page") return default_per_page unless per_page per_page = per_page.to_i return default_per_page if per_page <= 0 [per_page, default_per_page].min end end end