更改rails_admin中的徽标
我很喜欢 https://github.com/sferik/rails_admin 的rails_admin插件,但我不能我的生活得到了我的自定义徽标来替换已安装的徽标。
有人对如何实现这一目标有任何见解吗?我尝试覆盖 css 和rails_admin 目录/fil 结构,但它没有接受我的更改。
有人对如何解决这个问题有任何见解吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果你现在想这样做,有一个受支持的方法 - 只需通过在
app/views/rails_admin/main/_title.html.erb
(或 .haml 或其他)创建文件来覆盖标题部分)。例如我的包含:
if you want to do this now, there is a supported method - just override the title partial by creating a file at
app/views/rails_admin/main/_title.html.erb
(or .haml or whatever).Mine for instance contains:
我想您只需更改徽标即可将徽标放在应用程序中的这个位置:
I suppose you just change the logo to put your logo in this place in your application :
我不知道这是否正确,以及rails_admin作者是否也想要你,但一个肮脏的方法是进入你的rails_admin gem并重命名(或删除)资产文件夹,这样Rails就找不到Rack资产,因此它会回退到Rails您通过复制的内容:
然后您只需修改应用程序公共目录中的内容即可。
我知道这是一种黑客行为,如果您更新 gem,则必须再次执行此操作。
再说一次,我不知道这是否是一个好的建议,因为我不知道 Rails Admin 作者的政策。
I don't know if this is right and if rails_admin author wants you too, but a dirty method is to go into your rails_admin gem and rename (or delete) assets folders so Rails don't find the Rack assets so it fallbacks on Rails ones that you've copied through :
Then you just have to modify the ones in your app public directory.
I know it's kind of a hack and you'll have to do it again if you update the gem.
And again, I don't know if it's a good advise since I don't know Rails Admin author's policy.
您可以将 gem 安装文件夹(捆绑包 show Rails_admin)中的 /app/views/layouts/rails_admin 文件夹复制到项目的 app/views/layouts 文件夹中。然后你可以修改_header.html.erb部分,就行:
希望这有帮助
You can copy the /app/views/layouts/rails_admin folder, located in the gem installation folder (bundle show rails_admin), into your project's app/views/layouts folder. Then you can modify the _header.html.erb partial, on the line:
Hope this helps
另一种方法是:
然后用 important 重载 image_replacement 类。
Another way to do this would be:
Then you override the image_replacement class with a bang important.
经过深入研究并在rails_admin google group上询问后,似乎目前不支持此功能。
After digging around and asking on the rails_admin google group it appears that this functionality is not supported at the moment.
替换
只要您还执行了以下操作,
就应该有效:作为安装的一部分。
Replacing
Should work as long as you also did this:
As part of your install.
使用纯 scss 可以非常轻松地做到这一点。有时候,最简单的事情也会起作用:)
You can do it extremely easily with pure scss. Sometimes the simplest thing that could work will work :)