activeadmin,删除空消息 [英] activeadmin, remove empty message

查看:75
本文介绍了activeadmin,删除空消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ActiveAdmin中,当该模型没有任何项目(在我的示例中为User)时,它会显示默认的尚无用户。创建一个’。

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


  1. 如何删除此消息?

  2. 是否有可能在每页上自定义它,


推荐答案

这是一个MonkeyPatch:

This is a MonkeyPatch:

在lib文件夹中创建一个新文件并复制:

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

在build方法中自定义内容变量以更改默认消息。

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

这篇关于activeadmin,删除空消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆