Files
ubicloud/views/layouts/sidebar/project_switcher.erb
Jeremy Evans 5db2ea706d Rename current_user to current_account
This was recommended by Enes, and is more aligned with the model
naming (the model is Account).

This was a completely mechanical change, using the following code:

```
sed -i -e 's/current_user/current_account/' `git grep -l 'current_user' clover*.rb routes/clover_base.rb routes views`
```

This makes some naming more consistent, such as `account_ubid: current_account.ubid`.

This makes some naming less consistent, such as `user: current_account`

We could fix the less consistent naming by changing
`Routes::Common::Base#initialize` to use `account` instead of `user` as a
keyword argument.  This commit doesn't make that change.  It's likely
Routes::Common will go away when merging CloverWeb and CloverApi, so
I'm not sure it's worth it.
2024-10-28 16:32:03 -07:00

43 lines
1.8 KiB
Plaintext

<div class="group dropdown inline-block w-full">
<div>
<button
type="button"
class="inline-flex w-full items-center gap-x-4 px-6 py-3 text-md font-semibold leading-6 text-white bg-orange-700 hover:bg-orange-800"
id="menu-button"
>
<%== render("components/icon", locals: { name: "hero-folder-open", classes: "h-8 w-8 rounded-full" }) %>
<span><%= @project ? @project[:name] : "Global" %></span>
<%== render("components/icon", locals: { name: "hero-chevron-up-down", classes: "h-8 w-8 ml-auto" }) %>
</button>
</div>
<div
class="hidden opacity-0 scale-95 group-[.active]:block group-[.active]:opacity-100 group-[.active]:scale-100 transition ease-out duration-100 absolute bottom-12 left-12 z-10 mt-2 w-64 origin-bottom divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none text-gray-800"
role="menu"
tabindex="-1"
>
<div class="py-1 max-h-64 overflow-y-auto" role="none">
<% current_account.projects.each do |p| %>
<a
href="<%= p.path %>/dashboard"
class="block px-4 py-2 hover:bg-gray-100 hover:text-gray-900 <% if p.id == @project&.id %> bg-orange-50 text-orange-600 hover:bg-orange-50 hover:text-orange-700 <% end %>"
role="menuitem"
tabindex="-1"
><%= p.name %></a>
<% end %>
</div>
<div class="py-1" role="none">
<a
href="/project/create"
class="group flex items-center px-4 py-2 hover:bg-gray-100 hover:text-gray-900"
role="menuitem"
tabindex="-1"
>
<div class="mr-2 text-gray-400 group-hover:text-gray-500">
<%== render("components/icon", locals: { name: "hero-plus", classes: "h-5 w-5 stroke-[2.5px]" }) %>
</div>
Create Project
</a>
</div>
</div>
</div>