Sha256: a2a42fc831fbf24fc54bd0dfba01dcc35aae731d5dd5ba04d34ef496642699fb

Contents?: true

Size: 695 Bytes

Versions: 11

Compression:

Stored size: 695 Bytes

Contents

require_dependency "mongoid_forums/application_controller"

module MongoidForums
  module Admin
    class UsersController < BaseController

      before_action :set_user, only: [:add_admin, :remove_admin]

      def index
        @admins = User.where(mongoid_admin: true)
        @non_admins = User.where(mongoid_admin: false)
      end

      def add_admin
        @user.mongoid_admin = true
        @user.save
        redirect_to admin_users_path
      end

      def remove_admin
        @user.mongoid_admin = false
        @user.save
        redirect_to admin_users_path
      end

      private

      def set_user
        @user = User.find(params[:user][:id])
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
mongoid-forums-1.0.7 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-1.0.6 app/controllers/mongoid_forums/admin/users_controller.rb
ack-mongoid-forums-1.0.5 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-1.0.4 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-1.0.3 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-1.0.2 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-1.0.1 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-1.0.0 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-0.0.11 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-0.0.10 app/controllers/mongoid_forums/admin/users_controller.rb
mongoid-forums-0.0.9 app/controllers/mongoid_forums/admin/users_controller.rb