Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

activeadmin, remove empty message

In ActiveAdmin, when there are no items for the model (in my example User), it shows a default 'There are no Users yet. Create one'.

There are no * yet

  1. How can I remove this message?
  2. Is there the possibility of customizinig it on per-page basis, that is having a particular message for a particular ActiveAdmin page?
like image 487
AgostinoX Avatar asked Aug 06 '14 11:08

AgostinoX


2 Answers

This is a MonkeyPatch:

Create a new file in lib folder and copy:

module ActiveAdmin
  module Views
    # Build a Blank Slate
    class BlankSlate < ActiveAdmin::Component
      builder_method :blank_slate

      def default_class_name
        'blank_slate_container'
      end

      def build(content)
        super(span(content.html_safe, class: "blank_slate"))
      end

    end
  end
end

Customize the content variable in build method to change the default message.

like image 166
nistvan Avatar answered Oct 10 '22 16:10

nistvan


  1. For now you cannot do it by ActiveAdmin settings. Look issues in repository.
  2. You can render any html or erb.html in your resources
like image 41
Philidor Avatar answered Oct 10 '22 14:10

Philidor