Skip to content

Commit 611d45e

Browse files
committed
Fix broken stimulus controllers after better_together namespace added to files
1 parent 7264a4d commit 611d45e

16 files changed

+36
-30
lines changed

app/helpers/better_together/share_buttons_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def share_buttons(platforms: BetterTogether::Metrics::Share::SHAREABLE_PLATFORMS
3232
link_to share_button_content(platform).html_safe, '#',
3333
class: "share-button share-#{platform}",
3434
data: {
35-
action: 'click->share#share',
35+
action: 'click->better_together--share#share',
3636
platform: platform,
3737
url: url,
3838
title: title,

app/helpers/better_together/translatable_fields_helper.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ def translation_tab_button(attribute:, locale:, temp_id:, model:) # rubocop:todo
1010
translation_present = model.public_send(locale_attribute).present?
1111

1212
content_tag(:li, class: 'nav-item', role: 'presentation',
13-
data: { attribute:, translation_target: 'tab', locale: }) do
13+
data: { attribute:, locale: },
14+
'data-better_together--translation-target' => 'tab') do
1415
content_tag(:button,
1516
id: "#{unique_locale_attribute}-tab",
1617
class: ['nav-link', ('active' if locale.to_s == I18n.locale.to_s),
1718
('text-success' if translation_present)],
1819
data: { bs_toggle: 'tab',
1920
bs_target: "##{unique_locale_attribute}-field",
20-
action: 'click->translation#syncLocaleAcrossFields',
21-
locale:,
22-
translation_target: 'tabButton' },
21+
action: 'click->better_together--translation#syncLocaleAcrossFields',
22+
locale:
23+
},
24+
'data-better_together--translation-target' => 'tabButton',
2325
role: 'tab',
2426
type: 'button',
2527
aria: { controls: "#{unique_locale_attribute}-field",

app/views/better_together/addresses/_address_fields.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</div>
6363
</div>
6464
<div class="form-group mt-3 mt-sm-0">
65-
<%= link_to '#', class: 'btn btn-outline-danger btn-sm', data: { action: 'click->dynamic-fields#remove' } do %>
65+
<%= link_to '#', class: 'btn btn-outline-danger btn-sm', data: { action: 'click->better_together--dynamic-fields#remove' } do %>
6666
<i class="fas fa-minus"></i> <%= t('better_together.remove') %>
6767
<% end %>
6868
</div>

app/views/better_together/content/blocks/fields/shared/_translatable_field.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<%- temp_id = temp_id_for(model, temp_id:) %>
44

55
<div id="<%= dom_id(model) %>-<%= attribute %>-translation-fields" class="localized-fields" data-controller="better_together--translation">
6-
<ul class="nav nav-tabs px-2" id="<%= attribute %>-translation-tabs-<%= temp_id %>" role="tablist" data-translation-target="tab">
6+
<ul class="nav nav-tabs px-2" id="<%= attribute %>-translation-tabs-<%= temp_id %>" role="tablist" data-better_together--translation-target="tab">
77
<%- I18n.available_locales.each do |locale| %>
88
<%= translation_tab_button(attribute: attribute, locale: locale, temp_id: temp_id, model: model) %>
99
<% end %>
@@ -18,7 +18,7 @@
1818
role="tabpanel"
1919
aria-labelledby="<%= "#{unique_locale_attribute}-tab" %>"
2020
data-locale="<%= locale %>"
21-
data-translation-target="tabContent">
21+
data-better_together--translation-target="tabContent">
2222

2323
<%= label_tag "#{scope}[#{locale_attribute}]",
2424
model.class.human_attribute_name(locale_attribute) %>

app/views/better_together/content/blocks/fields/shared/_translatable_rich_text_field.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
<%= render layout: 'better_together/content/blocks/fields/shared/translatable_field',
66
locals: { model: model, scope: scope, temp_id: temp_id, attribute: attribute } do |locale_attribute| %>
7-
7+
88
<%=
99
rich_text_area_tag "#{scope}[#{locale_attribute}]", model.public_send(locale_attribute),
1010
class: "form-control#{' is-invalid' if model.errors[locale_attribute].any?}",
11-
data: { translation_target: 'trix' },
11+
'data-better_together-translation-target' => 'trix',
1212
id: "#{dom_id(model)}-#{locale_attribute}"
1313
%>
14-
14+
1515
<% end %>

app/views/better_together/content/blocks/fields/shared/_translatable_string_field.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
model.public_send(locale_attribute),
1010
id: "#{dom_id(model)}-#{locale_attribute}",
1111
class: "form-control#{' is-invalid' if model.errors[locale_attribute].any?}",
12-
data: { translation_target: "input", action: "input->translation#updateTranslationStatus" } %>
12+
data: {action: "input->better_together--translation#updateTranslationStatus" },
13+
'data-better_together-translation-target' => "input" %>
1314

1415
<% end %>

app/views/better_together/content/blocks/fields/shared/_translatable_text_field.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
model.public_send(locale_attribute),
1010
id: "#{dom_id(model)}-#{locale_attribute}",
1111
class: "form-control#{' is-invalid' if model.errors[locale_attribute].any?}",
12-
data: { translation_target: "input", action: "input->translation#updateTranslationStatus" } %>
12+
data: {action: "input->better_together--translation#updateTranslationStatus" },
13+
'data-better_together-translation-target' => "input" %>
1314

1415
<% end %>

app/views/better_together/content/page_blocks/_form_fields.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% temp_id = page_block.persisted? ? page_block.id : SecureRandom.uuid %>
22

3-
<div id="<%= dom_id(page_block, temp_id) %>" class="page-block-fields <%= dom_class(page_block) %>" data-page-blocks-target="pageBlock">
3+
<div id="<%= dom_id(page_block, temp_id) %>" class="page-block-fields <%= dom_class(page_block) %>" data-better_together--page-blocks-target="pageBlock">
44
<div class="d-flex justify-content-between align-items-center mb-3">
55
<!-- Title and control buttons in a toolbar -->
66
<h5 class="mb-0"><%= page_block.block.class.model_name.human %></h5>
@@ -16,11 +16,11 @@
1616
</div>
1717

1818
<div class="btn-group me-2" role="group" aria-label="Position controls">
19-
<button type="button" class="btn btn-outline-secondary" data-action="click->page-blocks#moveUp"
19+
<button type="button" class="btn btn-outline-secondary" data-action="click->better_together--page-blocks#moveUp"
2020
aria-label="Move up" data-bs-toggle="tooltip" title="Move Up">
2121
<i class="fas fa-arrow-up"></i>
2222
</button>
23-
<button type="button" class="btn btn-outline-secondary" data-action="click->page-blocks#moveDown"
23+
<button type="button" class="btn btn-outline-secondary" data-action="click->better_together--page-blocks#moveDown"
2424
aria-label="Move down" data-bs-toggle="tooltip" title="Move Down">
2525
<i class="fas fa-arrow-down"></i>
2626
</button>

app/views/better_together/email_addresses/_email_address_fields.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<%= form.email_field :email, class: 'form-control', required: true %>
1919
</div>
2020
<div class="col-md-2 mt-3 mt-md-0">
21-
<%= link_to '#', class: 'btn btn-outline-danger btn-sm', data: { action: 'click->dynamic-fields#remove' } do %>
21+
<%= link_to '#', class: 'btn btn-outline-danger btn-sm', data: { action: 'click->better_together--dynamic-fields#remove' } do %>
2222
<i class="fas fa-minus"></i> <%= t('better_together.remove') %>
2323
<% end %>
2424
</div>

app/views/better_together/phone_numbers/_phone_number_fields.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<%= form.telephone_field :number, class: 'form-control', required: true %>
1919
</div>
2020
<div class="col-md-2 mt-3 mt-md-0">
21-
<%= link_to '#', class: 'btn btn-outline-danger btn-sm', data: { action: 'click->dynamic-fields#remove' } do %>
21+
<%= link_to '#', class: 'btn btn-outline-danger btn-sm', data: { action: 'click->better_together--dynamic-fields#remove' } do %>
2222
<i class="fas fa-minus"></i> <%= t('better_together.remove') %>
2323
<% end %>
2424
</div>

0 commit comments

Comments
 (0)