简体   繁体   中英

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. 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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