Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
WIP #217 Handle isopen flag correctly for SplitButtonComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
teampolyglot committed Oct 27, 2020
1 parent b58a478 commit 615c9c3
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/components/item_panel_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</p>
</div>
<div class="ml-4 mt-4 flex-shrink-0">
<%= render SplitButtonComponent.new(item: @item, user: @user, isopen: true) %>
<%= render SplitButtonComponent.new(item: @item, user: @user, isopen: false) %>
</div>
</div>
</div>
Expand Down
9 changes: 0 additions & 9 deletions app/components/split_button_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
<!--
Dropdown panel, show/hide based on dropdown state.

Entering: "transition ease-out duration-100"
From: "transform opacity-0 scale-95"
To: "transform opacity-100 scale-100"
Leaving: "transition ease-in duration-75"
From: "transform opacity-100 scale-100"
To: "transform opacity-0 scale-95"
-->
<div
x-show="isopen"
@click.away="isopen = false"
Expand Down
2 changes: 1 addition & 1 deletion app/views/collections/toggle_item.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(".review-<%= @review.item.id %>").replaceWith("<%= escape_javascript(render partial: 'reviews/review_status', locals: { review: @review } ) %>");
$(".review-<%= @review.item.id %>").replaceWith("<%= escape_javascript(render partial: 'reviews/review_status', locals: { review: @review, isopen: true } ) %>");
2 changes: 1 addition & 1 deletion app/views/reviews/_review_status.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render SplitButtonComponent.new(item: review.item, user: current_user, isopen: true) %>
<%= render SplitButtonComponent.new(item: review.item, user: current_user, isopen: isopen) %>
2 changes: 1 addition & 1 deletion app/views/reviews/update.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(".review-<%= @review.item.id %>").replaceWith("<%= escape_javascript(render partial: 'review_status', locals: { review: @review } ) %>");
$(".review-<%= @review.item.id %>").replaceWith("<%= escape_javascript(render partial: 'review_status', locals: { review: @review, isopen: false } ) %>");
2 changes: 1 addition & 1 deletion app/views/welcome/components.html+tailwind.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="ml-64"><%= render DropDownComponent.new(label: "dropdown", items: []) %></div>

<h1>SplitButtonComponent</h1>
<div class="ml-64"><%= render SplitButtonComponent.new(item: Item.order(:created_at).first, user: current_user, isopen: true) %></div>
<div class="ml-64"><%= render SplitButtonComponent.new(item: Item.order(:created_at).first, user: current_user, isopen: false) %></div>

<h1>ActivityPanelComponent</h1>
<%= render ActivityPanelComponent.new(review: Review.last, user: current_user) %>
Expand Down

0 comments on commit 615c9c3

Please sign in to comment.