-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connect the sidebar/account_nav component to the authentication helpers
Compact the specs so they run a single render with aggregate_failures.
- Loading branch information
Showing
7 changed files
with
66 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,13 +27,26 @@ module ControllerHelper | |
extend ActiveSupport::Concern | ||
|
||
included do | ||
include SolidusAdmin::Auth | ||
helper ActionView::Helpers | ||
helper SolidusAdmin::ContainerHelper | ||
helper_method :current_component | ||
end | ||
|
||
private | ||
|
||
def spree_current_user | ||
Spree::LegacyUser.new(email: "[email protected]") | ||
end | ||
|
||
def authenticate_solidus_backend_user! | ||
# noop | ||
end | ||
|
||
def admin_logout_path | ||
"/logout" | ||
end | ||
|
||
def current_component | ||
@current_component ||= begin | ||
# Lookbook sets the @preview instance variable with a PreviewEntity instance, while ViewComponent uses the preview class. | ||
|
39 changes: 26 additions & 13 deletions
39
...components/previews/solidus_admin/sidebar/account_nav/component_preview/overview.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
<div class="flex h-screen"> | ||
<div class="flex h-4/5"> | ||
<div class="self-end"> | ||
<%= render current_component.new( | ||
user_label: "Alice Doe" | ||
) %> | ||
</div> | ||
<div class="mb-8"> | ||
<h6 class="text-gray-500 mb-3 mt-0"> | ||
Short name | ||
</h6> | ||
|
||
<div class="w-[17.78rem] pt-20 rounded border-dotted border-2 border-gray-300"> | ||
<%= render current_component.new( | ||
user_label: "Alice Doe", | ||
account_path: "#account", | ||
logout_path: "#logout", | ||
logout_method: :delete | ||
) %> | ||
</div> | ||
<div class="flex h-4/5"> | ||
<div class="self-end"> | ||
<%= render current_component.new( | ||
user_label: "Alice Supercalifragilisticexpialidocious" | ||
) %> | ||
</div> | ||
</div> | ||
|
||
<div class="mb-8"> | ||
<h6 class="text-gray-500 mb-3 mt-0"> | ||
Long name | ||
</h6> | ||
|
||
<div class="w-[17.78rem] pt-20 rounded border-dotted border-2 border-gray-300"> | ||
<%= render current_component.new( | ||
user_label: "Alice Supercalifragilisticexpialidocious", | ||
account_path: "#account", | ||
logout_path: "#logout", | ||
logout_method: :delete | ||
) %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters