Remove stimuls reflex dependencies

This commit is contained in:
wandji20
2024-10-24 11:57:52 +01:00
parent 489541d6e0
commit deba26f907
10 changed files with 2 additions and 117 deletions

View File

@@ -101,8 +101,6 @@ gem 'redis'
gem 'sidekiq'
gem 'sidekiq-scheduler'
gem "stimulus_reflex"
gem "turbo_power"
gem "turbo-rails"

View File

@@ -969,7 +969,6 @@ DEPENDENCIES
spring-commands-rspec
spring-commands-rubocop
state_machines-activerecord
stimulus_reflex
stimulus_reflex_testing!
stringex (~> 2.8.5)
stripe

View File

@@ -4,7 +4,6 @@ class ConfirmModalComponent < ModalComponent
# @param actions_alignment_class [String] possible classes: 'justify-space-around', 'justify-end'
def initialize(
id:,
reflex: nil,
controller: nil,
message: nil,
confirm_actions: nil,
@@ -16,7 +15,6 @@ class ConfirmModalComponent < ModalComponent
)
super(id:, close_button: true)
@confirm_actions = confirm_actions
@reflex = reflex
@form_url = form_url
@controller = controller
@message = message

View File

@@ -1,4 +1,4 @@
%div{ id: @id, "data-controller": "modal #{@controller}", "data-action": "keyup@document->modal#closeIfEscapeKey", "data-#{@controller}-reflex-value": @reflex }
%div{ id: @id, "data-controller": "modal #{@controller}", "data-action": "keyup@document->modal#closeIfEscapeKey" }
.reveal-modal-bg.fade{ "data-modal-target": "background", "data-action": "click->modal#close" }
.reveal-modal.fade.tiny.modal-component{ "data-modal-target": "modal" }
- if @confirm_actions

View File

@@ -1,27 +0,0 @@
# frozen_string_literal: true
class ApplicationReflex < StimulusReflex::Reflex
# Put application-wide Reflex behavior and callbacks in this file.
#
# Learn more at: https://docs.stimulusreflex.com/rtfm/reflex-classes
#
# For code examples, considerations and caveats, see:
# https://docs.stimulusreflex.com/rtfm/patterns#internationalization
include CanCan::ControllerAdditions
delegate :current_user, to: :connection
before_reflex do
I18n.locale = current_user.locale
end
private
def current_ability
Spree::Ability.new(current_user)
end
def morph_admin_flashes
morph "#flashes", render(partial: "admin/shared/flashes", locals: { flashes: flash })
end
end

View File

@@ -1,12 +0,0 @@
# frozen_string_literal: true
module EnterpriseConcern
extend ActiveSupport::Concern
included do
before_reflex do
@enterprise = Enterprise.find_by(permalink: params[:id])
authorize! :update, @enterprise
end
end
end

View File

@@ -1,38 +0,0 @@
# frozen_string_literal: true
class ExampleReflex < ApplicationReflex
# Add Reflex methods in this file.
#
# All Reflex instances include CableReady::Broadcaster and expose the following properties:
#
# - connection - the ActionCable connection
# - channel - the ActionCable channel
# - request - an ActionDispatch::Request proxy for the socket connection
# - session - the ActionDispatch::Session store for the current visitor
# - flash - the ActionDispatch::Flash::FlashHash for the current request
# - url - the URL of the page that triggered the reflex
# - params - parameters from the element's closest form (if any)
# - element - a Hash like object that represents the HTML element that triggered the reflex
# - signed - use a signed Global ID to map dataset attribute to a model
# eg. element.signed[:foo]
# - unsigned - use an unsigned Global ID to map dataset attribute to a model
# eg. element.unsigned[:foo]
# - cable_ready - a special cable_ready that can broadcast to the current visitor
# (no brackets needed)
# - reflex_id - a UUIDv4 that uniquely identies each Reflex
# - tab_id - a UUIDv4 that uniquely identifies the browser tab
#
# Example:
#
# before_reflex do
# # throw :abort # this will prevent the Reflex from continuing
# # learn more about callbacks at https://docs.stimulusreflex.com/rtfm/lifecycle
# end
#
# def example(argument=true)
# # Your logic here...
# # Any declared instance variables will be made available to the Rails controller and view.
# end
#
# Learn more at: https://docs.stimulusreflex.com/rtfm/reflex-classes
end

View File

@@ -36,7 +36,7 @@
= f.label :terms_and_conditions, t('.terms_and_conditions')
%i.text-big.icon-question-sign{ "data-controller": "help-modal-link", "data-action": "click->help-modal-link#open", "data-help-modal-link-target-value": "terms_and_conditions_info_modal" }
.omega.eight.columns#terms_and_conditions{data: { 'reflex-root': '#terms_and_conditions' } }
.omega.eight.columns#terms_and_conditions
- if @enterprise.terms_and_conditions.attached?
= link_to "#{@enterprise.terms_and_conditions.blob.filename} #{ t('.uploaded_on') } #{@enterprise.terms_and_conditions.blob.created_at}", url_for(@enterprise.terms_and_conditions), target: '_blank'
%div

View File

@@ -1,32 +0,0 @@
# frozen_string_literal: true
StimulusReflex.configure do |config|
config.on_failed_sanity_checks = :warn
# Enable/disable exiting / warning when the sanity checks fail options:
# `:exit` or `:warn` or `:ignore`
# config.on_failed_sanity_checks = :exit
# Override the parent class that the StimulusReflex ActionCable channel inherits from
# config.parent_channel = "ApplicationCable::Channel"
# Customize server-side Reflex logging format, with optional colorization:
# Available tokens: session_id, session_id_full, reflex_info, operation, reflex_id, reflex_id_full, mode, selector, operation_counter, connection_id, connection_id_full, timestamp
# Available colors: red, green, yellow, blue, magenta, cyan, white
# You can also use attributes from your ActionCable Connection's identifiers that resolve to valid ActiveRecord models
# eg. if your connection is `identified_by :current_user` and your User model has an email attribute, you can access r.email (it will display `-` if the user isn't logged in)
# Learn more at: https://docs.stimulusreflex.com/troubleshooting#stimulusreflex-logging
# config.logging = proc { "[#{session_id}] #{operation_counter.magenta} #{reflex_info.green} -> #{selector.cyan} via #{mode} Morph (#{operation.yellow})" }
# Optimized for speed, StimulusReflex doesn't enable Rack middleware by default.
# If you are using Page Morphs and your app uses Rack middleware to rewrite part of the request path, you must enable those middleware modules in StimulusReflex.
#
# Learn more about registering Rack middleware in Rails here: https://guides.rubyonrails.org/rails_on_rack.html#configuring-middleware-stack
# config.middleware.use FirstRackMiddleware
# config.middleware.use SecondRackMiddleware
end

View File

@@ -29,7 +29,6 @@
"shortcut-buttons-flatpickr": "^0.4.0",
"stimulus": "^3.2.2",
"stimulus-flatpickr": "^1.4.0",
"stimulus_reflex": "3.5.1",
"tom-select": "^2.3.1",
"trix": "^2.1.7",
"turbo_power": "^0.7.0",