Extract component to render help section
This commit is contained in:
16
app/components/pages/help/section_component.html.erb
Normal file
16
app/components/pages/help/section_component.html.erb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<div class="row section-content">
|
||||||
|
<div class="small-12 column">
|
||||||
|
<h3 id="<%= section %>" data-magellan-target="<%= section %>">
|
||||||
|
<%= t("pages.help.#{section}.title") %>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= content %>
|
||||||
|
|
||||||
|
<% if image_path %>
|
||||||
|
<figure>
|
||||||
|
<%= image_tag image_path, alt: t("pages.help.#{section}.image_alt") %>
|
||||||
|
<figcaption><%= t("pages.help.#{section}.figcaption") %></figcaption>
|
||||||
|
</figure>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
8
app/components/pages/help/section_component.rb
Normal file
8
app/components/pages/help/section_component.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Pages::Help::SectionComponent < ApplicationComponent
|
||||||
|
attr_reader :section, :image_path
|
||||||
|
|
||||||
|
def initialize(section, image_path = nil)
|
||||||
|
@section = section
|
||||||
|
@image_path = image_path
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,16 +1,6 @@
|
|||||||
<div class="row section-content">
|
<%= render Pages::Help::SectionComponent.new("budgets", "help/budgets_#{I18n.locale}.png") do %>
|
||||||
<div class="small-12 column">
|
|
||||||
<h3 id="budgets" data-magellan-target="budgets">
|
|
||||||
<%= t("pages.help.budgets.title") %>
|
|
||||||
</h3>
|
|
||||||
<p>
|
<p>
|
||||||
<%= sanitize(t("pages.help.budgets.description",
|
<%= sanitize(t("pages.help.budgets.description",
|
||||||
link: link_to(t("pages.help.budgets.link"), budgets_path))) %>
|
link: link_to(t("pages.help.budgets.link"), budgets_path))) %>
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
<figure>
|
|
||||||
<%= image_tag "help/budgets_#{I18n.locale}.png", alt: t("pages.help.budgets.image_alt") %>
|
|
||||||
<figcaption><%= t("pages.help.budgets.figcaption") %></figcaption>
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
<div class="row section-content">
|
<%= render Pages::Help::SectionComponent.new("debates", "help/debates.png") do %>
|
||||||
<div class="small-12 column">
|
|
||||||
<h3 id="debates" data-magellan-target="debates">
|
|
||||||
<%= t("pages.help.debates.title") %>
|
|
||||||
</h3>
|
|
||||||
<p>
|
<p>
|
||||||
<%= sanitize(t("pages.help.debates.description",
|
<%= sanitize(t("pages.help.debates.description",
|
||||||
org: setting["org_name"],
|
org: setting["org_name"],
|
||||||
link: link_to(t("pages.help.debates.link"),
|
link: link_to(t("pages.help.debates.link"), debates_path))) %>
|
||||||
debates_path))) %>
|
|
||||||
</p>
|
</p>
|
||||||
<ul class="features">
|
<ul class="features">
|
||||||
<li>
|
<li>
|
||||||
@@ -16,10 +11,4 @@
|
|||||||
new_user_registration_path))) %>
|
new_user_registration_path))) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<% end %>
|
||||||
<figure>
|
|
||||||
<%= image_tag "help/debates.png", alt: t("pages.help.debates.image_alt") %>
|
|
||||||
<figcaption><%= t("pages.help.debates.figcaption") %></figcaption>
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<div class="row section-content">
|
<%= render Pages::Help::SectionComponent.new("polls") do %>
|
||||||
<div class="small-12 column">
|
|
||||||
<h3 id="polls" data-magellan-target="polls"><%= t("pages.help.polls.title") %></h3>
|
|
||||||
<p>
|
<p>
|
||||||
<%= sanitize(t("pages.help.polls.description",
|
<%= sanitize(t("pages.help.polls.description",
|
||||||
link: link_to(t("pages.help.polls.link"), polls_path))) %>
|
link: link_to(t("pages.help.polls.link"), polls_path))) %>
|
||||||
@@ -12,5 +10,4 @@
|
|||||||
new_user_registration_path))) %>
|
new_user_registration_path))) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
<div class="row section-content">
|
<%= render Pages::Help::SectionComponent.new("processes", nil) do %>
|
||||||
<div class="small-12 column">
|
|
||||||
<h3 id="processes" data-magellan-target="processes">
|
|
||||||
<%= t("pages.help.processes.title") %>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<% link = link_to(t("pages.help.processes.link"), legislation_processes_path) %>
|
<% link = link_to(t("pages.help.processes.link"), legislation_processes_path) %>
|
||||||
<%= sanitize(t("pages.help.processes.description", link: link)) %>
|
<%= sanitize(t("pages.help.processes.description", link: link)) %>
|
||||||
@@ -15,5 +10,4 @@
|
|||||||
new_user_registration_path))) %>
|
new_user_registration_path))) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,16 +1,6 @@
|
|||||||
<div class="row section-content">
|
<%= render Pages::Help::SectionComponent.new("proposals", "help/proposals_#{I18n.locale}.png") do %>
|
||||||
<div class="small-12 column">
|
|
||||||
<h3 id="proposals" data-magellan-target="proposals">
|
|
||||||
<%= t("pages.help.proposals.title") %>
|
|
||||||
</h3>
|
|
||||||
<p>
|
<p>
|
||||||
<%= sanitize(t("pages.help.proposals.description",
|
<%= sanitize(t("pages.help.proposals.description",
|
||||||
link: link_to(t("pages.help.proposals.link"), proposals_path))) %>
|
link: link_to(t("pages.help.proposals.link"), proposals_path))) %>
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
<figure>
|
|
||||||
<%= image_tag "help/proposals_#{I18n.locale}.png", alt: t("pages.help.proposals.image_alt") %>
|
|
||||||
<figcaption><%= t("pages.help.proposals.figcaption") %></figcaption>
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user