Skip to content

Commit

Permalink
chore: remove ujs (#2256)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob authored Dec 19, 2023
1 parent a58caf2 commit 486409c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
5 changes: 3 additions & 2 deletions app/components/avo/resource_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,14 @@ def render_edit_button(control)
def render_detach_button(control)
return unless is_a_related_resource? && can_detach?

a_button url: detach_path,
a_link detach_path,
icon: "detach",
method: :delete,
form_class: "flex flex-col sm:flex-row sm:inline-flex",
style: :text,
data: {
confirm: "Are you sure you want to detach this #{title}."
turbo_method: :delete,
turbo_confirm: "Are you sure you want to detach this #{title}."
} do
control.label || t("avo.detach_item", item: title).humanize
end
Expand Down
5 changes: 3 additions & 2 deletions app/components/avo/sidebar_profile_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@
<% end %>
<%= render "avo/partials/profile_menu_extra" %>
<% if can_destroy_user? %>
<%= button_to helpers.main_app.send(destroy_user_session_path),
<%= link_to helpers.main_app.send(destroy_user_session_path),
form: { "data-turbo" => "false" },
method: :delete,
data: {
confirm: t('avo.are_you_sure')
turbo_method: :delete,
turbo_confirm: t('avo.are_you_sure')
},
class: "flex-1 flex items-center justify-center bg-white text-left cursor-pointer text-red-600 font-semibold hover:bg-red-100 block px-4 py-1 w-full py-3 text-center rounded w-full",
form_class: 'flex-1' do %>
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/avo.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'regenerator-runtime/runtime'
import * as ActiveStorage from '@rails/activestorage'
import * as Mousetrap from 'mousetrap'
import { Turbo } from '@hotwired/turbo-rails'
import Rails from '@rails/ujs'
import tippy from 'tippy.js'

import { LocalStorageService } from './js/local-storage-service'
Expand All @@ -18,7 +17,6 @@ import './js/active-storage'
import './js/controllers'
import './js/custom-stream-actions'

Rails.start()

window.Turbolinks = Turbo

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo-rails": "^7.3.0",
"@rails/activestorage": "^6.1.7",
"@rails/ujs": "^6.1.0",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"@yaireo/tagify": "^4.17.9",
Expand Down
1 change: 1 addition & 0 deletions spec/system/avo/belongs_to_polymorphic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@

click_on "Save"
wait_for_loaded
sleep 0.5

expect(current_path).to eq "/admin/resources/projects/#{project.id}"

Expand Down
17 changes: 8 additions & 9 deletions spec/system/avo/sign_out_dropdown_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@
visit "/admin/resources/posts"

expect(page.body).to have_text admin.name
expect(page.body).to have_button "Sign out", visible: false
expect(page.body).to have_link "Sign out", visible: false

dots_button = find("[data-control='profile-dots']")
dots_link = find("[data-control='profile-dots']")

dots_button.click
dots_link.click

expect(page.body).to have_button "Sign out", visible: true
expect(page.body).to have_link "Sign out", visible: true

# Test click away
# FIXME: Selenium::WebDriver::Error::ElementNotInteractableError: element not interactable
# page.find("body").click
# expect(page.body).to have_button "Sign out", visible: false
page.find("body").click
expect(page.body).to have_link "Sign out", visible: false

# dots_button.click
click_button "Sign out"
dots_link.click
click_link "Sign out"
accept_alert
wait_for_loaded

Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1502,11 +1502,6 @@
dependencies:
spark-md5 "^3.0.0"

"@rails/ujs@^6.1.0":
version "6.1.0"
resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-6.1.0.tgz#9a48df6511cb2b472c9f596c1f37dc0af022e751"
integrity sha512-kQNKyM4ePAc4u9eR1c4OqrbAHH+3SJXt++8izIjeaZeg+P7yBtgoF/dogMD/JPPowNC74ACFpM/4op0Ggp/fPw==

"@tailwindcss/forms@^0.5.7":
version "0.5.7"
resolved "https://registry.yarnpkg.com/@tailwindcss/forms/-/forms-0.5.7.tgz#db5421f062a757b5f828bc9286ba626c6685e821"
Expand Down

0 comments on commit 486409c

Please sign in to comment.