<div class="admin-sidebar" data-equalizer-watch>
  <ul id="admin_menu" data-accordion-menu data-multi-open="false">
    <% if feature?(:polls) %>
      <li class="section-title">
        <a href="#">
          <span class="icon-checkmark-circle"></span>
          <strong><%= t("admin.menu.title_polls") %></strong>
        </a>
        <ul id="polls_menu" <%= "class=is-active" if menu_polls? || controller.class.parent == Admin::Poll::Questions::Answers %>>
          <li <%= "class=is-active" if %w(polls recounts results).include?(controller_name) %>>
            <%= link_to t("admin.menu.polls"), admin_polls_path %>
          </li>

          <li <%= "class=is-active" if %w(questions answers).include?(controller_name) ||
                                    controller.class.parent == Admin::Poll::Questions::Answers %>>
            <%= link_to t("admin.menu.poll_questions"), admin_questions_path %>
          </li>
        </ul>
      </li>
    <% end %>

    <li class="section-title">
      <a href="#">
        <span class="icon-box"></span>
        <strong><%= t("admin.menu.title_booths") %></strong>
      </a>
      <ul id="booths_menu" <%= "class=is-active" if menu_booths? || controller_name == "polls" && action_name == "booth_assignments" %>>
        <li <%= "class=is-active" if %w(officers officer_assignments).include?(controller_name) %>>
          <%= link_to t("admin.menu.poll_officers"), admin_officers_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "booths" &&
                                  action_name != "available" %>>
          <%= link_to t("admin.menu.poll_booths"), admin_booths_path %>
        </li>

        <li <%= "class=is-active" if (controller_name == "polls" && action_name == "booth_assignments") ||
                                  controller_name == "booth_assignments" %>>
          <%= link_to t("admin.menu.poll_booth_assignments"), booth_assignments_admin_polls_path %>
        </li>

        <li <%= "class=is-active" if %w(shifts booths).include?(controller_name) &&
                                  %w(available new).include?(action_name) %>>
          <%= link_to t("admin.menu.poll_shifts"), available_admin_booths_path %>
        </li>
      </ul>
    </li>

    <% if feature?(:legislation) %>
      <li class="section-title <%= "is-active" if controller.class.parent == Admin::Legislation %>">
        <%= link_to admin_legislation_processes_path do %>
          <span class="icon-file-text"></span>
          <strong><%= t("admin.menu.legislation") %></strong>
        <% end %>
      </li>
    <% end %>

    <% if feature?(:budgets) %>
      <li class="section-title <%= "is-active" if controller_name == "budgets" ||
                                                  controller_name == "milestone_statuses" %>">
        <%= link_to admin_budgets_path do %>
          <span class="icon-budget"></span>
          <strong><%= t("admin.menu.budgets") %></strong>
        <% end %>
      </li>
    <% end %>

    <% if feature?(:spending_proposals) %>
      <li class="section-title">
        <a href="#">
          <span class="icon-budget"></span>
          <strong><%= t("admin.menu.title_budgets") %></strong>
        </a>
        <ul <%= "class=is-active" if menu_budget? %>>
          <li <%= "class=is-active" if controller_name == "spending_proposals" %>>
            <%= link_to t("admin.menu.spending_proposals"), admin_spending_proposals_path %>
          </li>
        </ul>
      </li>
    <% end %>

    <% if feature?(:proposals) %>
      <li class="section-title">
        <%= link_to admin_proposals_path do %>
          <span class="icon-proposals"></span>
          <strong><%= t("admin.menu.proposals") %></strong>
        <% end %>
      </li>
    <% end %>

    <% messages_sections = %w(newsletters emails_download admin_notifications system_emails) %>
    <% messages_menu_active = messages_sections.include?(controller_name) %>
    <li class="section-title" <%= "class=is-active" if messages_menu_active %>>
      <a href="#">
        <span class="icon-zip"></span>
        <strong><%= t("admin.menu.messaging_users") %></strong>
      </a>
      <ul id="messaging_users_menu" <%= "class=is-active" if messages_menu_active %>>
        <li <%= "class=is-active" if controller_name == "newsletters" %>>
          <%= link_to t("admin.menu.newsletters"), admin_newsletters_path %>
        </li>
        <li <%= "class=is-active" if controller_name == "admin_notifications" %>>
          <%= link_to t("admin.menu.admin_notifications"), admin_admin_notifications_path %>
        </li>
        <li <%= "class=is-active" if controller_name == "system_emails" %>>
          <%= link_to t("admin.menu.system_emails"), admin_system_emails_path %>
        </li>
        <li <%= "class=is-active" if controller_name == "emails_download" %>>
          <%= link_to t("admin.menu.emails_download"), admin_emails_download_index_path %>
        </li>
      </ul>
    </li>

    <li class="section-title">
      <a href="#">
        <span class="icon-edit"></span>
        <strong><%= t("admin.menu.title_site_customization") %></strong>
      </a>
      <ul <%= "class=is-active" if menu_customization? &&
                                   controller.class.parent != Admin::Poll::Questions::Answers %>>

        <li <%= "class=is-active" if menu_homepage? %>>
          <%= link_to t("admin.menu.site_customization.homepage"), admin_homepage_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "pages" %>>
          <%= link_to t("admin.menu.site_customization.pages"), admin_site_customization_pages_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "banners" %>>
          <%= link_to t("admin.menu.banner"), admin_banners_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "information_texts" %>>
          <%= link_to t("admin.menu.site_customization.information_texts"), admin_site_customization_information_texts_path %>
        </li>
      </ul>
    </li>

    <% if feature?(:signature_sheets) %>
      <li class="section-title <%= "is-active" if controller_name == "signature_sheets" %>">
        <%= link_to admin_signature_sheets_path do %>
          <span class="icon-file-text-o"></span>
          <strong><%= t("admin.menu.signature_sheets") %></strong>
        <% end %>
      </li>
    <% end %>

    <li class="section-title">
      <a href="#">
        <span class="icon-eye"></span>
        <strong><%= t("admin.menu.title_moderated_content") %></strong>
      </a>
      <ul <%= "class=is-active" if menu_moderated_content? %>>
        <% if feature?(:proposals) %>
          <li <%= "class=is-active" if controller_name == "hidden_proposals" %>>
            <%= link_to t("admin.menu.hidden_proposals"), admin_hidden_proposals_path %>
          </li>
        <% end %>

        <% if feature?(:debates) %>
          <li <%= "class=is-active" if controller_name == "debates" %>>
            <%= link_to t("admin.menu.hidden_debates"), admin_debates_path %>
          </li>
        <% end %>

        <% if feature?(:budgets) %>
          <li <%= "class=is-active" if controller_name == "hidden_budget_investments" %>>
            <%= link_to t("admin.menu.hidden_budget_investments"), admin_hidden_budget_investments_path %>
          </li>
        <% end %>

        <li <%= "class=is-active" if controller_name == "comments" %>>
          <%= link_to t("admin.menu.hidden_comments"), admin_comments_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "proposal_notifications" %>>
          <%= link_to t("admin.menu.hidden_proposal_notifications"), admin_proposal_notifications_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "hidden_users" %>>
          <%= link_to t("admin.menu.hidden_users"), admin_hidden_users_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "activity" %>>
          <%= link_to t("admin.menu.activity"), admin_activity_path %>
        </li>
      </ul>
    </li>

    <li class="section-title">
      <a href="#">
        <span class="icon-organizations"></span>
        <strong><%= t("admin.menu.title_profiles") %></strong>
      </a>
      <ul <%= "class=is-active" if menu_profiles? %>>
        <li <%= "class=is-active" if controller_name == "administrators" %>>
          <%= link_to t("admin.menu.administrators"), admin_administrators_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "organizations" %>>
          <%= link_to t("admin.menu.organizations"), admin_organizations_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "officials" %>>
          <%= link_to t("admin.menu.officials"), admin_officials_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "moderators" %>>
          <%= link_to t("admin.menu.moderators"), admin_moderators_path%>
        </li>

        <li <%= "class=is-active" if controller_name == "valuators" %>>
          <%= link_to t("admin.menu.valuators"), admin_valuators_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "managers" %>>
          <%= link_to t("admin.menu.managers"), admin_managers_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "users" %>>
          <%= link_to t("admin.menu.users"), admin_users_path %>
        </li>
      </ul>
    </li>

    <li class="section-title" <%= "class=is-active" if controller_name == "stats" %>>
      <%= link_to admin_stats_path do %>
        <span class="icon-stats"></span><%= t("admin.menu.stats") %>
      <% end %>
    </li>

    <li class="section-title">
      <a href="#">
        <span class="icon-settings"></span>
        <strong><%= t("admin.menu.title_settings") %></strong>
      </a>
      <ul <%="class=is-active" if menu_settings? %>>
        <li <%= "class=is-active" if controller_name == "settings" %>>
          <%= link_to t("admin.menu.settings"), admin_settings_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "tags" %>>
          <%= link_to t("admin.menu.proposals_topics"), admin_tags_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "geozones" %>>
          <%= link_to t("admin.menu.geozones"), admin_geozones_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "images" &&
                                  controller.class.parent != Admin::Poll::Questions::Answers %>>
          <%= link_to t("admin.menu.site_customization.images"), admin_site_customization_images_path %>
        </li>

        <li <%= "class=is-active" if controller_name == "content_blocks" %>>
          <%= link_to t("admin.menu.site_customization.content_blocks"), admin_site_customization_content_blocks_path%>
        </li>
      </ul>
    </li>
  </ul>
</div>
