activeadmin, remove empty message

前端 未结 2 1313
春和景丽
春和景丽 2021-01-13 01:25

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\'.

相关标签:
2条回答
  • 2021-01-13 02:09

    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.

    0 讨论(0)
  • 2021-01-13 02:27
    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
    0 讨论(0)
提交回复
热议问题