简体   繁体   English

Ruby On Rails中的主动管理员自定义

[英]Active Admin Customization in Ruby On Rails

I'm using active admin gem. 我正在使用主动管理工具。 In one table i want admins page to have some extra fields apart from the default functionalities. 在一个表中,我希望管理员页面除默认功能外还有一些其他字段。 Is it possible to have a default active admin page + a provision to render some html. 是否可以有一个默认的活动管理页面+设置以呈现一些html。

I want something like this in picture 我想要这样的照片 在此处输入图片说明

The extra feature that i was talking was about push notification and message and that text area part 我正在谈论的额外功能是关于推送通知和消息以及该文本区域的一部分

If you want a page with your own content, you could register a page: http://www.activeadmin.info/docs/10-custom-pages.html 如果您想要一个具有自己内容的页面,则可以注册一个页面: http : //www.activeadmin.info/docs/10-custom-pages.html

But if you want to customise the default html strucure of the index page, you have to re-open the ActiveAdmin::Views::Pages module and override the build_page_content method. 但是,如果要自定义索引页的默认html结构,则必须重新打开ActiveAdmin :: Views :: Pages模块,并覆盖build_page_content方法。 You can do this inside your app, for example create a new file in app/lib folder and override the method. 您可以在应用程序内部执行此操作,例如,在app / lib文件夹中创建一个新文件并覆盖该方法。

https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/base.rb#L62 https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/base.rb#L62

or if you want to customise the index table: https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/index.rb 或者如果您想自定义索引表: https : //github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/index.rb

Not a nice solution, but it's work. 这不是一个很好的解决方案,但这是可行的。 :/ :/

Unfortunately, it seems index doesn't support custom rendering: https://github.com/gregbell/active_admin/issues/813#issuecomment-3059957 不幸的是,索引似乎不支持自定义渲染: https : //github.com/gregbell/active_admin/issues/813#issuecomment-3059957

However, you might have luck using panel , except in my experience that renders above the table ActiveAdmin generates. 但是,使用panel可能会很幸运,但根据我的经验,在ActiveAdmin生成的表上方进行渲染。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM