Sha256: 5618ce883e634b87ea40113a17b0beda8808af1122218c15449c74bdb477fccd
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
module Elabs module Admin class UsersController < AdminApplicationController DEFAULT_ORDER_FIELD = 'username'.freeze before_action :set_admin_user, only: %i[show destroy] # GET /admin/users # GET /admin/users.json def index order = params['order_by'] || self.class::DEFAULT_ORDER_FIELD direction = params['direction'] || 'desc' @users = User.order(order => direction).page(params[:page]).per(self.class::MAX_ITEMS_PER_PAGE) end # GET /admin/users/1 # GET /admin/users/1.json def show; end # DELETE /admin/users/1 # DELETE /admin/users/1.json def destroy @user.destroy respond_to do |format| format.html { redirect_to admin_users_url, notice: _('User was successfully destroyed.') } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_admin_user @user = User.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def admin_user_params params.fetch(:user, {}) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
elabs-3.0.0 | app/controllers/elabs/admin/users_controller.rb |
elabs-2.0.0 | app/controllers/elabs/admin/users_controller.rb |
elabs-2.0.0.pre | app/controllers/elabs/admin/users_controller.rb |