Skip to content

Commit

Permalink
Added gestions translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilien Bausson committed Oct 12, 2023
1 parent db0dd87 commit a78e98f
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 27 deletions.
6 changes: 3 additions & 3 deletions app/controllers/gestions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create

respond_to do |format|
if @gestion.save
format.html { redirect_to @gestion, notice: 'Gestion was successfully created.' }
format.html { redirect_to @gestion, notice: t(".flashes.created") }
format.json { render :show, status: :created, location: @gestion }
else
format.html { render :new }
Expand All @@ -42,7 +42,7 @@ def create
def update
respond_to do |format|
if @gestion.update(gestion_params)
format.html { redirect_to @gestion, notice: 'Gestion was successfully updated.' }
format.html { redirect_to @gestion, notice: t(".flashes.updated") }
format.json { render :show, status: :ok, location: @gestion }
else
format.html { render :edit }
Expand All @@ -56,7 +56,7 @@ def update
def destroy
if @gestion.destroy
respond_to do |format|
format.html { redirect_to gestions_url, notice: 'Gestion a bien été supprimé.' }
format.html { redirect_to gestions_url, notice: t(".flashes.destroyed") }
format.json { head :no_content }
end
else
Expand Down
12 changes: 8 additions & 4 deletions app/views/gestions/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<%= form_for(@gestion, html: { class: "form-horizontal", role: "form" }) do |f| %>
<% if @gestion.errors.any? %>
<div class="alert alert-danger alert-dismissable" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4><%= pluralize(@gestion.errors.count, "erreur", "erreurs") %> lors de la sauvegarde :</h4>
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">
<%= t("action.close") %>
</span></button>
<h4>
<%= t("form.errors.title", count: @gestion.errors.count) %>
</h4>

<ul>
<% @gestion.errors.full_messages.each do |msg| %>
Expand All @@ -13,7 +17,7 @@
<% end %>

<div class="form-group">
<%= f.label 'Nom', class: "col-sm-2 control-label" %>
<%= f.label :name, class: "col-sm-2 control-label" %>
<div class="col-sm-10">
<%= f.text_field :name, class: "form-control" %>
</div>
Expand All @@ -26,7 +30,7 @@
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<%= f.submit 'Valider', class: "btn btn-primary" %>
<%= f.submit t("form.submit"), class: "btn btn-primary" %>
</div>
</div>
<% end %>
8 changes: 5 additions & 3 deletions app/views/gestions/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<div class="page-header">
<%= link_to gestions_path, class: 'btn btn-default' do %>
<span class="glyphicon glyphicon-list-alt"></span>
Retour
<%= t("action.back") %>
<% end %>
<%= link_to @gestion, class: 'btn btn-primary' do %>
<span class="glyphicon glyphicon-info-sign"></span>
Voir
<%= t("action.show") %>
<% end %>
<h1>Modifier le gestionnaire</h1>
<h1>
<%= t(".title") %>
</h1>
</div>

<%= render 'form' %>
Expand Down
29 changes: 19 additions & 10 deletions app/views/gestions/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<%= render 'layouts/breadcrumb', breadcrumb_variables: { 'Paramètres' => modeles_url, 'Gestionnaires' => '' } %>
<%= render 'layouts/breadcrumb', breadcrumb_variables: {
t("breadcrumb.settings") => modeles_url,
t("breadcrumb.gestions") => "" }
%>

<div class="container-fluid">

Expand All @@ -13,17 +16,23 @@
<div class="page-header">
<%= link_to new_gestion_path, class: 'btn btn-primary' do %>
<span class="glyphicon glyphicon-plus"></span>
Ajouter un gestionnaire
<%= t(".new_gestion") %>
<% end %>
<h1>Gestionnaires</h1>
<h1>
<%= t(".title") %>
</h1>
</div>

<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Nom</th>
<th>Usage</th>
<th>
<%= Gestion.human_attribute_name(:name) %>
</th>
<th>
<%= Gestion.human_attribute_name(:usage) %>
</th>
<th></th>
<th></th>
<th></th>
Expand All @@ -33,14 +42,14 @@
<tbody>
<%= content_tag_for(:tr, @gestions) do |gestion| %>
<td><%= gestion %></td>
<td><%= pluralize(gestion.servers.count, 'serveur', 'serveurs') %> </td>
<td><%= link_to 'Voir', gestion_path(gestion), class: 'btn btn-primary' %></td>
<td><%= link_to 'Modifier', edit_gestion_path(gestion), class: 'btn btn-primary' %></td>
<td><%= Gestion.human_attribute_name(:servers, count: gestion.servers.count) %> </td>
<td><%= link_to t("action.show"), gestion_path(gestion), class: 'btn btn-primary' %></td>
<td><%= link_to t("action.edit"), edit_gestion_path(gestion), class: 'btn btn-primary' %></td>
<td>
<%= link_to 'Supprimer',
<%= link_to t("action.delete"),
gestion,
method: :delete,
data: { confirm: 'Ce gestionnaire ne pourra pas être supprimé tant qu\'il sera associé à au moins un serveur. Voulez-vous continuer ?' },
data: { confirm: t(".delete_confirmation") },
class: 'btn btn-danger' %>
</td>
<% end %>
Expand Down
6 changes: 4 additions & 2 deletions app/views/gestions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<div class="page-header">
<%= link_to gestions_path, class: 'btn btn-default' do %>
<span class="glyphicon glyphicon-list-alt"></span>
Retour
<%= t("action.back") %>
<% end %>
<h1>Nouveau gestionnaire</h1>
<h1>
<%= t(".title") %>
</h1>
</div>

<%= render 'form' %>
12 changes: 8 additions & 4 deletions app/views/gestions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
<div class="page-header">
<%= link_to gestions_path, class: 'btn btn-default' do %>
<span class="glyphicon glyphicon-list-alt"></span>
Retour
<%= t("action.back") %>
<% end %>
<%= link_to edit_gestion_path(@gestion), class: 'btn btn-primary' do %>
<span class="glyphicon glyphicon-pencil"></span>
Edit
<%= t("action.edit") %>
<% end %>
<h1>Gestionnaire <%= @gestion %></h1>
<h1>
<%= t(".title", gestion: @gestion) %>
</h1>
</div>

<dl class="dl-horizontal">
<dt>Description:</dt>
<dt>
<%= Gestion.human_attribute_name(:description) %> :
</dt>
<dd><%= @gestion.description %></dd>
</dl>

Expand Down
7 changes: 7 additions & 0 deletions config/locales/activerecord.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ fr:
errors_count:
one: 1 erreur
other: "%{count} erreurs"
gestion:
name: Nom
description: Description
usage: Usage
servers:
one: 1 serveur
other: "%{count} serveurs"
errors:
models:
user:
Expand Down
24 changes: 23 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ fr:
edit: Modifier
delete: Supprimer
back: Retour
show: Voir
close: Fermer
breadcrumb:
settings: Paramètres
gestions: Gestionnaires
pages:
params_menu:
location:
Expand Down Expand Up @@ -37,7 +40,26 @@ fr:
destroy:
flashes:
destroyed: Site a bien été supprimé.

gestions:
index:
new_gestion: Ajouter un gestionnaire
title: Gestionnaires
delete_confirmation: Ce gestionnaire ne pourra pas être supprimé tant qu'il sera associé à au moins un serveur. Voulez-vous continuer ?
show:
title: Gestionnaire %{gestion}
new:
title: Nouveau gestionnaire
create:
flashes:
created: Gestion was successfully created.
edit:
title: Modifier le gestionnaire
update:
flashes:
updated: Gestion was succesffully updated.
destroy:
flashes:
destroyed: Gestion a bien été supprimé.
devise:
registrations:
signed_up: 'Vous pouvez désormais vous connecter avec Cerbère'
Expand Down

0 comments on commit a78e98f

Please sign in to comment.