Skip to content

Commit

Permalink
Remove superflous dom ids of ingredient editors
Browse files Browse the repository at this point in the history
These ingredients do not have JS events and the id
rails generates is not unique, so we remove them to avoid
DOM exceptions/warnings.
  • Loading branch information
tvdeyen committed Aug 10, 2021
1 parent 593e24e commit cb49ce8
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/views/alchemy/ingredients/_boolean_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
data: boolean_editor.data_attributes do %>
<%= element_form.fields_for(:ingredients, boolean_editor.ingredient) do |f| %>
<%= f.label :value, style: "display: inline-block" do %>
<%= f.check_box :value %>
<%= f.check_box :value, id: nil %>
<%= render_ingredient_role(boolean_editor) %>
<% end %>
<%= render_hint_for(boolean_editor) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/alchemy/ingredients/_headline_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
data: headline_editor.data_attributes do %>
<%= element_form.fields_for(:ingredients, headline_editor.ingredient) do |f| %>
<%= ingredient_label(headline_editor) %>
<%= f.text_field :value %>
<%= f.text_field :value, id: nil %>

<div class="input-row">
<% if headline_editor.level_options.length > 1 %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/alchemy/ingredients/_html_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
data: html_editor.data_attributes do %>
<%= element_form.fields_for(:ingredients, html_editor.ingredient) do |f| %>
<%= ingredient_label(html_editor) %>
<%= f.text_area :value %>
<%= f.text_area :value, id: nil %>
<% end %>
<% end %>
8 changes: 4 additions & 4 deletions app/views/alchemy/ingredients/_link_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
id: link_editor.form_field_id,
disabled: true
%>
<%= f.hidden_field :value, "data-link-value": true %>
<%= f.hidden_field :link_title, "data-link-title": true %>
<%= f.hidden_field :link_class_name, "data-link-class": true %>
<%= f.hidden_field :link_target, "data-link-target": true %>
<%= f.hidden_field :value, "data-link-value": true, id: nil %>
<%= f.hidden_field :link_title, "data-link-title": true, id: nil %>
<%= f.hidden_field :link_class_name, "data-link-class": true, id: nil %>
<%= f.hidden_field :link_target, "data-link-target": true, id: nil %>
<% end %>
<%= render "alchemy/ingredients/shared/link_tools", ingredient_editor: link_editor %>
<% end %>
Expand Down
12 changes: 6 additions & 6 deletions app/views/alchemy/ingredients/_picture_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
image_file_width: picture_editor.image_file_width,
image_file_height: picture_editor.image_file_height
} %>
<%= f.hidden_field :link, data: { link_value: true } %>
<%= f.hidden_field :link_title, data: { link_title: true } %>
<%= f.hidden_field :link_class_name, data: { link_class: true } %>
<%= f.hidden_field :link_target, data: { link_target: true } %>
<%= f.hidden_field :crop_from, data: { crop_from: true } %>
<%= f.hidden_field :crop_size, data: { crop_size: true } %>
<%= f.hidden_field :link, data: { link_value: true }, id: nil %>
<%= f.hidden_field :link_title, data: { link_title: true }, id: nil %>
<%= f.hidden_field :link_class_name, data: { link_class: true }, id: nil %>
<%= f.hidden_field :link_target, data: { link_target: true }, id: nil %>
<%= f.hidden_field :crop_from, data: { crop_from: true }, id: nil %>
<%= f.hidden_field :crop_size, data: { crop_size: true }, id: nil %>
<% end %>
<% end %>
1 change: 1 addition & 0 deletions app/views/alchemy/ingredients/_select_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
options_tags = options_for_select(select_values, select_editor.value)
end %>
<%= f.select :value, options_tags, {}, {
id: nil,
class: ["alchemy_selectbox", "ingredient-editor-select"]
} %>
<% end %>
Expand Down
9 changes: 5 additions & 4 deletions app/views/alchemy/ingredients/_text_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
<%= ingredient_label(text_editor) %>
<%= f.text_field :value,
class: text_editor.settings[:linkable] ? "text_with_icon" : "",
id: nil,
type: text_editor.settings[:input_type] || "text" %>
<% if text_editor.settings[:linkable] %>
<%= f.hidden_field :link, "data-link-value": true %>
<%= f.hidden_field :link_title, "data-link-title": true %>
<%= f.hidden_field :link_class_name, "data-link-class": true%>
<%= f.hidden_field :link_target, "data-link-target": true %>
<%= f.hidden_field :link, "data-link-value": true, id: nil %>
<%= f.hidden_field :link_title, "data-link-title": true, id: nil %>
<%= f.hidden_field :link_class_name, "data-link-class": true, id: nil %>
<%= f.hidden_field :link_target, "data-link-target": true, id: nil %>
<%= render "alchemy/ingredients/shared/link_tools", ingredient_editor: text_editor %>
<% end %>
<% end %>
Expand Down

0 comments on commit cb49ce8

Please sign in to comment.