【问题标题】:Disable user name from navigation link in active admin在活动管理员的导航链接中禁用用户名
【发布时间】:2020-12-31 00:45:39
【问题描述】:

如何使用 activeadmin gem 导航栏中的显示页面链接隐藏或禁用当前用户名?

红宝石 2.6.3

导轨 5.2.3

配置/初始化程序

ActiveAdmin.setup do |config|
  config.site_title = "Myapp"
  config.footer = "MYapp"
  config.root_to = 'admin/users#index'
  config.logout_link_path = :logout_path
  config.logout_link_method = :delete
  config.current_user_method = :current_user
  config.comments = false
  config.batch_actions = false
  config.namespace :admin do |admin|
     admin.build_menu do |menu|
         menu.add :label => "My Custom Link", :url => "/", :priority => 0
         menu.add :label => "Pages" do |pages|
         pages.add :label => "Homepage", :url => "/admin/homepage"
         pages.add :label => "About Us", :url => "/admin/about-us"
         pages.add :label => "Facebook", :url => "http://www.facebook.com", :html_options => { :target => "_blank" }
      end
    end
  end
end

【问题讨论】:

    标签: ruby-on-rails activeadmin


    【解决方案1】:

    查看overriding the utility menu的文档:

    ActiveAdmin.setup do |config|
      config.namespace :admin do |admin|
        admin.build_menu :utility_navigation do |menu|
          admin.add_logout_button_to_menu menu
        end
      end
    end
    

    【讨论】:

      猜你喜欢
      • 2012-07-19
      • 2012-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多