# frozen_string_literal: true require_dependency 'c/application_controller' module C class AdminController < ApplicationController check_authorization unless: :devise_controller? before_action :authenticate_user! before_action :current_user_id def edit ajax_form end def new ajax_form end private def current_ability @current_ability ||= ::C::Ability.new(current_user) end def ajax_form respond_to do |format| format.html format.js { render 'quick_edit' } end end def current_user_id # For the Authorable concern $user_id = current_user.id end def filter_and_paginate(collection, default_sort='id asc', per_page=30) @q = collection.ransack(params[:q]) @q.sorts = default_sort if @q.sorts.empty? @q.result.paginate(page: params[:page], per_page: per_page) end end end