Don't use instace variables in component views

Just like we do every else (sometimes even on that very same file), we
use the method instead of the instance variable.

We're doing this change now because we're about to modify one of these
files (the poll question answers documents index component).
This commit is contained in:
Javi Martín
2024-05-14 00:16:52 +02:00
parent bfee1b0ecb
commit 6188281d33
6 changed files with 8 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
<%= back_link_to admin_question_path(@answer.question) %> <%= back_link_to admin_question_path(answer.question) %>
<h2><%= t("admin.questions.show.answers.documents_list") %></h2> <h2><%= t("admin.questions.show.answers.documents_list") %></h2>
@@ -8,7 +8,7 @@
</ul> </ul>
<div class="poll-question-form"> <div class="poll-question-form">
<% if can?(:update, @answer) %> <% if can?(:update, answer) %>
<%= form_for(Poll::Question::Answer.new, url: admin_answer_documents_path(answer)) do |f| %> <%= form_for(Poll::Question::Answer.new, url: admin_answer_documents_path(answer)) do |f| %>
<%= render "shared/errors", resource: answer %> <%= render "shared/errors", resource: answer %>

View File

@@ -4,7 +4,7 @@
<%= header do %> <%= header do %>
<%= render Admin::ActionComponent.new( <%= render Admin::ActionComponent.new(
:destroy, :destroy,
@page, page,
text: t("admin.site_customization.pages.index.delete"), text: t("admin.site_customization.pages.index.delete"),
confirm: true, confirm: true,
class: "delete" class: "delete"

View File

@@ -14,7 +14,7 @@
</thead> </thead>
<tbody> <tbody>
<% @tenants.each do |tenant| %> <% tenants.each do |tenant| %>
<%= render Admin::Tenants::RowComponent.new(tenant) %> <%= render Admin::Tenants::RowComponent.new(tenant) %>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -8,7 +8,7 @@
<h1><%= t("sdg.goals.help.title") %></h1> <h1><%= t("sdg.goals.help.title") %></h1>
<p><%= t("sdg.goals.help.description") %></p> <p><%= t("sdg.goals.help.description") %></p>
<ul class="tabs" id="help_tabs" data-deep-link="true" data-tabs> <ul class="tabs" id="help_tabs" data-deep-link="true" data-tabs>
<% @goals.each do |goal| %> <% goals.each do |goal| %>
<li class="tabs-title <%= is_active?(goal) %>"> <li class="tabs-title <%= is_active?(goal) %>">
<%= link_to "#goal_#{goal.code}_tab" do %> <%= link_to "#goal_#{goal.code}_tab" do %>
<% render SDG::Goals::IconComponent.new(goal) %> <% render SDG::Goals::IconComponent.new(goal) %>
@@ -18,7 +18,7 @@
</ul> </ul>
<div class="tabs-content" data-tabs-content="help_tabs"> <div class="tabs-content" data-tabs-content="help_tabs">
<% @goals.each do |goal| %> <% goals.each do |goal| %>
<div id="goal_<%= goal.code %>_tab" class="tabs-panel <%= is_active?(goal) %>"> <div id="goal_<%= goal.code %>_tab" class="tabs-panel <%= is_active?(goal) %>">
<h2><%= goal.code_and_title %></h2> <h2><%= goal.code_and_title %></h2>
<p><%= sanitize t("sdg.goals.goal_#{goal.code}.description") %></p> <p><%= sanitize t("sdg.goals.goal_#{goal.code}.description") %></p>

View File

@@ -2,7 +2,7 @@
<ul class="tabs" id="goal_<%= goal.code %>_targets" data-deep-link="true" data-tabs> <ul class="tabs" id="goal_<%= goal.code %>_targets" data-deep-link="true" data-tabs>
<% [global_targets, local_targets].each do |targets| %> <% [global_targets, local_targets].each do |targets| %>
<li class="tabs-title <%= active(targets) %>"> <li class="tabs-title <%= active(targets) %>">
<%= link_to title(targets), "#goal_#{@goal.code}_tab_#{type(targets)}_targets" %> <%= link_to title(targets), "#goal_#{goal.code}_tab_#{type(targets)}_targets" %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@@ -14,7 +14,7 @@
</thead> </thead>
<tbody> <tbody>
<% @records.each do |record| %> <% records.each do |record| %>
<tr> <tr>
<td><%= record.title %></td> <td><%= record.title %></td>
<td><%= record.sdg_goal_list %></td> <td><%= record.sdg_goal_list %></td>