mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Move to simple UserReflex
This commit is contained in:
committed by
Konrad
parent
b28f40b125
commit
91e5227d80
@@ -1,11 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Enterprise
|
||||
class UserReflex < ApplicationReflex
|
||||
def accept_terms_of_services
|
||||
current_user.update(terms_of_service_accepted_at: DateTime.now)
|
||||
|
||||
morph "#banner-container", ""
|
||||
end
|
||||
end
|
||||
end
|
||||
9
app/reflexes/user_reflex.rb
Normal file
9
app/reflexes/user_reflex.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserReflex < ApplicationReflex
|
||||
def accept_terms_of_services
|
||||
current_user.update(terms_of_service_accepted_at: DateTime.now)
|
||||
|
||||
morph "#banner-container", ""
|
||||
end
|
||||
end
|
||||
@@ -3,6 +3,6 @@
|
||||
.column-left
|
||||
%p= t("admin.terms_of_service_have_been_updated_html", tos_link: link_to(t("admin.terms_of_service"), TermsOfServiceFile.current_url, target: "_blank"))
|
||||
.column-right
|
||||
%button{ data: { reflex: "click->Enterprise::User#accept_terms_of_services" } }
|
||||
%button{ data: { reflex: "click->user#accept_terms_of_services" } }
|
||||
= t("admin.accept_terms_of_service")
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "reflex_helper"
|
||||
|
||||
describe Enterprise::UserReflex, type: :reflex do
|
||||
describe UserReflex, type: :reflex do
|
||||
let(:current_user) { create(:user) }
|
||||
let(:context) { { url: spree.admin_dashboard_url, connection: { current_user: } } }
|
||||
|
||||
Reference in New Issue
Block a user