admin navigation hide model does not work
I have one model that I want to hide from Navigation on the left of rails_admin but it does not work. (I still want to access it, just want to hide it from the panel, so exclude does not count)
I have tried all three kind of code below but it does not work:
config.model 'Document' do
visible false
end
from here: https://github.com/sferik/rails_admin/wiki/Navigation
As well as the code:
config.model 'Document' do
hide_from_navigation
end
from here: http://www.verious.com/code/foca/rails_admin/
As well as the code:
config.model 'Document' do
navigation do
visible = false
end
end
Can someone explain for me why ?
I have already restart the server before checking it.
Thanks!
在你的app / config / initializers / rails_admin.rb文件中,你可以添加这样的内容,并且只包含你想要在导航中显示的模型 -
config.included_models = [ User, Region, Newsletter, Article ]
I just tested the first example :
config.model 'Document' do
visible false
end
and it worked, the model was hidden.
Be sure to remember that you have to restart rails.
I had the same issue, and unfortunately I haven't found any proper solution. The only workaround was to hack Rails Admin using javascript.
So, to hide the model Document from the navigation menu I added this code in 'app/assets/javascripts/rails_admin/custom/ui.js':
$(document).on('rails_admin.dom_ready', function() {
$('ul.nav-pills li[data-model="document"]').hide();
});
I hope that a better way to do this is implemented soon.
链接地址: http://www.djcxy.com/p/71762.html上一篇: ='。';“?
下一篇: 管理员导航隐藏模式不起作用