Sha256: 7d39aba94ccdc5d0468ba97a283274bdd2e55684328953812d0419ebf1fb30f5

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

<% if current_user.projects.active.any? -%>
  <ul id="project-selection">
    <li>
      <h1>
        <%= link_to current_project? ? account_project_path(current_account, current_project) : root_url do -%>
          <% if current_project? -%>
            <span><%= current_project.name %></span>
          <% else %>
            <span>Projects</span>
          <% end -%>
          <% if current_user.memberships.admin.any? || current_user.projects.active.any? -%>
            <%= image_tag "arrow-down.png", :alt => "arrow down" %>
          <% end -%>
        <% end %>
      </h1>
      <ul>
        <% current_user.projects.active.each do |project| %>
          <li><%= link_to project.name, account_project_path(project.account, project) -%></li>
        <% end %>
        <% if current_user.memberships.admin.any? -%>
          <li>
            <%= link_to current_account? && current_user.admin_of?(current_account) ? new_account_project_path(current_account) : new_account_project_path(current_user.memberships.admin.first.account) do %>
              &#43; Create a new project
            <% end %>
          </li>
        <% end -%>
      </ul>
    </li>
  </ul>
<% end -%>

<%= content_for :javascript do -%>
  <%= javascript_tag do %>
    $(function() {
      $('#project-selection h1 a').click(function() {
        var dropdownbutton = $('#project-selection h1 a');
        var dropdownlist = $('#project-selection li ul');
        if(dropdownbutton.hasClass("expanded")) {
          dropdownbutton.removeClass("expanded");
          dropdownlist.removeClass("expanded");
        } else {
          dropdownbutton.addClass("expanded");
          dropdownlist.addClass("expanded");
        }
        return false;
      });

      $('html *').live('click', function() {
        if($(this).parents('.expanded').length == 0) {
          $('.expanded').removeClass('expanded');
        }
      });
    });
  <% end %>
<% end -%>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saucy-0.16.1 app/views/shared/_project_dropdown.html.erb
saucy-0.16.0 app/views/shared/_project_dropdown.html.erb