如何编辑或覆盖ActiveAdmin的页脚? [英] How do I edit or override the footer of ActiveAdmin?

查看:45
本文介绍了如何编辑或覆盖ActiveAdmin的页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编辑或覆盖Active_Admin的页脚?

How do I edit or override the footer of Active_Admin?

推荐答案

答案:

在Rails应用程序中,创建以下文件: app / admin / footer.rb

In your rails app, create this file: app/admin/footer.rb

内容类似于:

module ActiveAdmin
  module Views
    class Footer < Component

      def build
        super :id => "footer"                                                    
        super :style => "text-align: right;"                                     

        div do                                                                   
          small "Cool footer #{Date.today.year}"                                       
        end
      end

    end
  end
end

别忘了! 重新启动应用/服务器。

Don't forget! restart the app/server.

可以这样自定义任何ActiveAdmin布局组件。

Any ActiveAdmin layout component can be customized like this.

有关它的更多信息:

它为什么起作用?
这是露比的魔法酱。我们将重新打开Footer类的定义,并为我们的自定义内容更改它。

Why does it work? This is Ruby's magic sauce. We are reopening the definition of the Footer class and changing it for our custom content.

它是完全可定制的吗?我不知道。这是继承路径:

Is it totally customizable? I don't know. This is the inheritance path:

ActiveAdmin

ActiveAdmin

class Component < Arbre::Component
class Footer < Component

Arbre

class Component < Arbre::HTML::Div

这意味着我们可以直接使用Arbre的DSL。

This means that we can use Arbre's DSL directly.

这篇关于如何编辑或覆盖ActiveAdmin的页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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