How to add custom code to active admin menu?

240 views Asked by At

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??

1

There are 1 answers

0
Archagy On

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 %>