Skip to content

Commit

Permalink
single-box-tenants solution for boxselection
Browse files Browse the repository at this point in the history
  • Loading branch information
stage-rl committed Sep 27, 2023
1 parent b1b4638 commit c6b7c33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/components/layout/box_selector_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
data-dropdown-leave-timeout="75"
>
<div id="dropdown-button" data-action="click->dropdown#toggle click@window->dropdown#hide" role="button" data-dropdown-target="button" tabindex="0" class="inline-block select-none">
<button type="button" class="flex items-center gap-2" aria-expanded="false" aria-haspopup="true">
<button type="button" class="flex items-center gap-2" <%= "disabled=true" if Current.tenant.boxes.one? %>aria-expanded="false" aria-haspopup="true">
<div class="flex justify-start items-center relative gap-3 py-1.5 pl-8 rounded-md bg-white">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class=" w-5 h-5 relative" preserveAspectRatio="xMidYMid meet">
<path d="M15.8333 9.16667H4.16667M15.8333 9.16667C16.2754 9.16667 16.6993 9.34226 17.0118 9.65482C17.3244 9.96738 17.5 10.3913 17.5 10.8333V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H4.16667C3.72464 17.5 3.30072 17.3244 2.98816 17.0118C2.67559 16.6993 2.5 16.2754 2.5 15.8333V10.8333C2.5 10.3913 2.67559 9.96738 2.98816 9.65482C3.30072 9.34226 3.72464 9.16667 4.16667 9.16667M15.8333 9.16667V7.5C15.8333 7.05797 15.6577 6.63405 15.3452 6.32149C15.0326 6.00893 14.6087 5.83333 14.1667 5.83333M4.16667 9.16667V7.5C4.16667 7.05797 4.34226 6.63405 4.65482 6.32149C4.96738 6.00893 5.39131 5.83333 5.83333 5.83333M14.1667 5.83333V4.16667C14.1667 3.72464 13.9911 3.30072 13.6785 2.98816C13.366 2.67559 12.942 2.5 12.5 2.5H7.5C7.05797 2.5 6.63405 2.67559 6.32149 2.98816C6.00893 3.30072 5.83333 3.72464 5.83333 4.16667V5.83333M14.1667 5.83333H5.83333" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
Expand Down
1 change: 1 addition & 0 deletions app/controllers/concerns/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def create_session
session[:login_expires_at] = SESSION_TIMEOUT.from_now
session[:tenant_id] = Current.user.tenant_id
session[:user_profile_picture_url] = auth_hash.info.image
session[:box_id] = Current.user.tenant.boxes.first.id if Current.user.tenant.boxes.one?
redirect_to session[:after_login_path] || default_after_login_path
else
render html: 'Not authorized', status: :forbidden
Expand Down

0 comments on commit c6b7c33

Please sign in to comment.