Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Network types locales + add help text on form #10

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/views/modeles/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@
<%= f.select :network_types,
Modele::Network::TYPES.map { |type| [Modele.human_attribute_name("network_types.#{type}"), type] },
{ prompt: true, include_blank: true },
{ class: "form-select", data: { controller: "select" }, multiple: true } %>
{
class: "form-select",
data: { controller: "select" },
multiple: true,
placeholder: Modele.human_attribute_name("network_types.blank")
}
%>
<div id="networkTypesHelp" class="form-text fst-italic">
<%= Modele.human_attribute_name("network_types.help") %>
</div>
</fieldset>

<fieldset data-controller="nested-form" class="col-12 mt-4">
Expand Down
8 changes: 6 additions & 2 deletions app/views/modeles/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
<dd class="mb-0 pb-2 ps-3"><%= @modele.public_send(attribute_name) %></dd>
<% end %>

<dt class="pb-2"><%= Modele.human_attribute_name(:network_types) %> :</dt>
<dt class="pb-2"><%= Modele.human_attribute_name(:network_types) %></dt>
<dd class="mb-0 pb-2 ps-3">
<%= @modele.network_types.map { |type| Modele.human_attribute_name("network_types.#{type}") }.join(", ") %>
<% if network_types = @modele.network_types.presence %>
<%= network_types.map { |type| Modele.human_attribute_name("network_types.#{type}") }.join(", ") %>
<% else %>
<%= Modele.human_attribute_name("network_types.blank") %>
<% end %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be done in a decorator helper?

</dd>
</dl>
<% end %>
Expand Down
11 changes: 10 additions & 1 deletion app/views/servers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,16 @@
<%= f.select :network_types,
Modele::Network::TYPES.map { |type| [Modele.human_attribute_name("network_types.#{type}"), type] },
{ prompt: true, include_blank: true },
{ class: "form-select", data: { controller: "select" }, multiple: true } %>
{
class: "form-select",
data: { controller: "select" },
multiple: true,
placeholder: Modele.human_attribute_name("network_types.blank")
}
%>
<div id="networkTypesHelp" class="form-text fst-italic">
<%= Modele.human_attribute_name("network_types.help") %>
</div>
</fieldset>

<fieldset class="col-md-6 col-12 mt-4 align-self-center">
Expand Down
6 changes: 5 additions & 1 deletion app/views/servers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@

<dt class="pb-2"><%= Server.human_attribute_name(:network_types) %></dt>
<dd class="mb-0 pb-2 ps-3">
<%= @server.network_types.map { |type| Modele.human_attribute_name("network_types.#{type}") }.join(", ") %>
<% if network_types = @server.network_types.presence %>
<%= network_types.map { |type| Modele.human_attribute_name("network_types.#{type}") }.join(", ") %>
<% else %>
<%= Modele.human_attribute_name("network_types.blank") %>
<% end %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be done in a decorator helper?

</dd>
</dl>
<% end %>
Expand Down
13 changes: 7 additions & 6 deletions config/locales/activerecord.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fr:
modele_id: Modèle
critique: Critique
gestion_id: Gestionnaire
network_types: Type de visualisation
network_types: Composant réseau
stack: Stack
stack_id: Stack
comment: Commentaire
Expand Down Expand Up @@ -236,12 +236,13 @@ fr:
manufacturer_id: Constructeur
nb_elts: Nb d'éléments
color: Couleur
network_types: Type de visualisation
network_types: Composant réseau
modele/network_types:
gbe: Composant Réseau Gb
10gbe: Composant Réseau 10 Gb
fiber: Composant Réseau Fibre
blank: Pas de
gbe: Backbone Gbps
10gbe: Backbone 10Gbps
fiber: Backbone Fibre
blank: Non (par défaut)
help: Représentation ou non sur les dashboard d'infrastructure réseau
short_gbe: Gb
short_10gbe: 10 Gb
short_fiber: Fibre
Expand Down