简体   繁体   English

如何将自定义代码添加到活动管理菜单?

[英]How to add custom code to active admin menu?

For admin panel i am using active admin gem. 对于管理面板,我正在使用活动管理宝石。 In active admin menu i want to show a notification to admin user if any new user is registered or any message is transfer between admin and user in system. 在活动的管理菜单中,如果要注册任何新用户或系统中的admin和用户之间传送任何消息,我想向admin用户显示通知。 Any suggestion for adding custom code to Admin menu will be appreciated. 任何将自定义代码添加到“管理”菜单的建议将不胜感激。

In my system i am using below code to show notification for new arrival message. 在我的系统中,我正在使用以下代码来显示新到达消息的通知。

<%= link_to received_messages_path(), :remote => true, :data_type => 'message', :class => 'is-active' do %>
       <%= t('message') %>
       <% if (msg_count = user_unseen_message_count(current_user)) > 0 %>
            <span class="badge js-message-count" >
              <%= msg_count %>
            </span>
       <% end %>
    <% end %>

So, how can i add this code to active admin menu?? 那么,如何将这段代码添加到活动的管理菜单中?

i'm new in rails but i hope this helps you. 我是新手,但我希望这对您有所帮助。 if you add a column with is_admin boolean type, you can validate user admin like this: 如果添加具有is_admin布尔类型的列,则可以像这样验证用户admin:

<%= if current_user.is_admin %>
 ...code...
 <% end %>

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

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