Skip to content

Commit

Permalink
Refatora chamada das traduções
Browse files Browse the repository at this point in the history
  • Loading branch information
Luckvc committed Feb 13, 2024
1 parent 1cb684d commit 616eb65
Show file tree
Hide file tree
Showing 38 changed files with 238 additions and 225 deletions.
4 changes: 2 additions & 2 deletions app/controllers/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ def index; end
def deactivate_profile
current_user.profile.inactive!
sign_out current_user
redirect_to root_path, alert: t('settings.deactivate_profile')
redirect_to root_path, alert: t('.success')
end

def delete_account
current_user.delete_user_data
redirect_to root_path, notice: t('settings.delete_account')
redirect_to root_path, notice: t('.success')
end

def change_privacy
Expand Down
2 changes: 1 addition & 1 deletion app/views/connections/following.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="container text-center">
<div class="d-flex flex-column">
<h1 class="text-primary"><%= @profile.full_name %></span></h1>
<h3><%= t('connections.following') %> <%= @followed_profiles.count %> <%= User.model_name.human(count: @followed_profiles.count).downcase %></h3>
<h3><%= t('.following') %> <%= @followed_profiles.count %> <%= User.model_name.human(count: @followed_profiles.count).downcase %></h3>
</div>
<div class="row row-cols-1 row-cols-md-3 g-4 justify-content-center gap-3 mt-4">
<% @followed_profiles.each do |followed| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/connections/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="container text-center">
<div class="d-flex flex-column">
<h1 class="text-primary"><%= @profile.full_name %></span></h1>
<h2><%= t('connections.followed_by') %> <%= @follower_profiles.count %> <%= User.model_name.human(count: @follower_profiles.count).downcase %></h2>
<h2><%= t('.followed_by') %> <%= @follower_profiles.count %> <%= User.model_name.human(count: @follower_profiles.count).downcase %></h2>
</div>
<div class="row row-cols-1 row-cols-md-3 g-4 justify-content-center gap-3 mt-4">
<% @follower_profiles.each do |connection| %>
Expand Down
22 changes: 11 additions & 11 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@
<% if user_signed_in? %>
<div class="row">
<section class="col-md-9 y-5">
<h2><%= t('home.feed') %></h2>
<h2><%= t('.feed') %></h2>
<% if current_user.profile.followed_count > 0 %>
<% if @followed_posts.any? %>
<div>
<%= render partial: 'posts/listing', locals: { posts: @followed_posts.each } %>
</div>
<% else %>
<div>
<h4> <%= t('home.what_people_are_posting') %>: </h4>
<h4> <%= t('.what_people_are_posting') %>: </h4>
<%= render partial: 'posts/listing', locals: { posts: @posts } %>
</div>
<% end %>
<% else %>
<div>
<h4> <%= t('home.follow_someone') %> </h4>
<h4> <%= t('.follow_someone') %> </h4>
<%= render partial: 'posts/listing', locals: { posts: @posts } %>
</div>
<% end %>
</section>

<aside class="col-md-3">
<h2> <%= t('home.most_followed') %> </h2>
<h2> <%= t('.most_followed') %> </h2>

<div class="py-2" style="width: 18rem;">
<% @most_followed.each do |profile| %>
<div class="card mb-3 bg-light-subtle text-center">
<div class="card-body">
<h5 class="card-title"><%= profile.full_name %></h5>
<p class="card-text"><%= profile.followers_count %> <%= t('followers', count: profile.followers_count) %></p>
<a href="<%= profile_path(profile) %>" class="btn btn-primary"> <%= t('home.view_profile_btn') %> </a>
<a href="<%= profile_path(profile) %>" class="btn btn-primary"> <%= t('.view_profile_btn') %> </a>
</div>
</div>
<% end %>
Expand All @@ -44,17 +44,17 @@
<div class="row g-0 d-flex align-items-center border-bottom justify-content-center">
<%= image_tag 'logop.svg', class: 'home_logo col-sm-8 col-md-2'%>
<h3 class="col-6 col-md-4">
<%= t('home.find_connect_shine') %> <br>
<span> <%= t('home.your_profile_your_space') %> </span><br>
<span class="text-primary fw-bold py-3"><%= t('home.become_part_of_comunity') %></span> <br>
<%= link_to t('home.create_account'), new_user_registration_path, class: 'btn btn-primary col-10 py-2 my-4 fs-4' %>
<%= t('.find_connect_shine') %> <br>
<span> <%= t('.your_profile_your_space') %> </span><br>
<span class="text-primary fw-bold py-3"><%= t('.become_part_of_comunity') %></span> <br>
<%= link_to t('.create_account'), new_user_registration_path, class: 'btn btn-primary col-10 py-2 my-4 fs-4' %>
</h3>
</div>
</div>

<h2><%= t('home.feed') %></h2>
<h2><%= t('.feed') %></h2>
<div>
<h4><%= t('home.find_out_more.do') %> <%= link_to t('home.login'), new_user_session_path %> <%= t('home.find_out_more.or') %> <%= link_to t('home.create_account'), new_user_registration_path %> <%= t('home.find_out_more.find_out') %></h4>
<h4><%= t('.find_out_more.do') %> <%= link_to t('.login'), new_user_session_path %> <%= t('.find_out_more.or') %> <%= link_to t('.create_account'), new_user_registration_path %> <%= t('.find_out_more.find_out') %></h4>
</div>
</section>
<% end %>
Expand Down
10 changes: 5 additions & 5 deletions app/views/invitations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<div class="nav-scroller border-bottom mb-4">
<nav class="d-flex nav nav-underline">
<%= link_to t('all'), invitations_path, class: "nav-item col nav-link link-body-emphasis" %>
<%= link_to t('invitations.pending'), invitations_path(status: :pending), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'pending'}" %>
<%= link_to t('invitations.accepted'), invitations_path(status: :accepted), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'accepted'}" %>
<%= link_to t('invitations.declined'), invitations_path(status: :declined), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'declined'}" %>
<%= link_to t('invitations.expired'), invitations_path(status: :expired), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'expired'}" %>
<%= link_to t('.pending'), invitations_path(status: :pending), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'pending'}" %>
<%= link_to t('.accepted'), invitations_path(status: :accepted), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'accepted'}" %>
<%= link_to t('.declined'), invitations_path(status: :declined), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'declined'}" %>
<%= link_to t('.expired'), invitations_path(status: :expired), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'expired'}" %>
</nav>
</div>

<div class="d-flex flex-wrap justify-content-around">
<% if @invitations.empty? %>
<p class="text-center"> <%= t('invitations.empty_state') %> </p>
<p class="text-center"> <%= t('.empty_state') %> </p>
<% else %>
<% @invitations.each do |invitation| %>
<div class="col-md-5 p-4 m-4 rounded border w-25">
Expand Down
4 changes: 2 additions & 2 deletions app/views/job_categories/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div>
<h2 class="text-center"> <%= t('job_categories.register') %> </h2>
<h2 class="text-center"> <%= t('.register') %> </h2>
<% if @job_category.errors.any? %>
<div>
<% @job_category.errors.each do |error| %>
Expand All @@ -16,7 +16,7 @@
</div>
<% end %>
<div class="d-flex flex-column mt-5 align-items-center">
<h2> <%= t('job_categories.registered') %> </h2>
<h2> <%= t('.registered') %> </h2>
<div class="d-flex flex-column mt-3 gap-3 categories">
<% @job_categories.each do |category| %>
<div class="d-flex justify-content-between">
Expand Down
16 changes: 8 additions & 8 deletions app/views/likes_mailer/notify_like.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<p><%= t('likes_mailer.greeting', recipient: @user.full_name) %></p>
<p><%= t('.greeting', recipient: @user.full_name) %></p>

<p><%= t('likes_mailer.profile_activity') %>:</p>
<p><%= t('.profile_activity') %>:</p>
<dl>
<dd> <%= t('likes_mailer.post_likes', like_count: @post_likes.count) if @post_likes.any? %></dd>
<dd><%= t('likes_mailer.comment_likes', like_count: @comment_likes.count) if @comment_likes.any? %></dd>
<dd> <%= t('.post_likes', like_count: @post_likes.count) if @post_likes.any? %></dd>
<dd><%= t('.comment_likes', like_count: @comment_likes.count) if @comment_likes.any? %></dd>
</dl>
<% if @post_likes.any? %>
<br><p><%= t('likes_mailer.most_liked_post') %> <%= link_to @most_liked_post.title, post_url(@most_liked_post) %></p>
<br><p><%= t('.most_liked_post') %> <%= link_to @most_liked_post.title, post_url(@most_liked_post) %></p>
<% end %>
<% if @comment_likes.any? %>
<p><%= t('likes_mailer.most_liked_comment', comment: @most_liked_comment.message) %> <%= link_to @most_liked_comment.post.title, post_url(@most_liked_comment.post) %></p>
<p><%= t('.most_liked_comment', comment: @most_liked_comment.message) %> <%= link_to @most_liked_comment.post.title, post_url(@most_liked_comment.post) %></p>
<% end %>

<br><p><%= link_to t('click_btn'), profile_url(@user.profile) %> <%= t('likes_mailer.access_profile') %></p>
<%= t('likes_mailer.regards') %>,
<br><p><%= link_to t('click_btn'), profile_url(@user.profile) %> <%= t('.access_profile') %></p>
<%= t('.regards') %>,
Portfoliorrr
2 changes: 1 addition & 1 deletion app/views/posts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>

<div class="form-group">
<%= f.label :content %> <span class='text-warning-emphasis'><small><%= t('posts.views.form.suported_files') %></small></span>
<%= f.label :content %> <span class='text-warning-emphasis'><small><%= t('.suported_files') %></small></span>
<%= f.rich_text_area :content, id: 'conteudo', class: 'form-control' %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/posts/_listing.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<p>
<%= content_fixer(post) %>
</p>
<p class="card-subtitle mb-2 text-muted"><%= t('posts.views.listing.published_by') %>: <%= post.user.full_name %></p>
<p class="card-subtitle mb-2 text-muted"><%= t('.published_by') %>: <%= post.user.full_name %></p>
<% if post.scheduled?%>
<small datetime="<%= post.published_at.to_datetime %>">
<%= date_fixer(post) %> <%= I18n.l(post.published_at.to_datetime, format: :long) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/posts/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="mb-3"><%= t('posts.views.edit.edit_post') %></h2>
<h2 class="mb-3"><%= t('.edit_post') %></h2>

<%= render 'errors' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/posts/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="mb-3"><%= t('posts.views.new.new_post') %></h2>
<h2 class="mb-3"><%= t('.new_post') %></h2>

<%= render 'errors' %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/posts/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>

<h6 class="card-subtitle mb-2">
<%= link_to t('posts.views.show.authored_by', author_name: @post.user.full_name), @post.user.profile %>
<%= link_to t('.authored_by', author_name: @post.user.full_name), @post.user.profile %>
</h6>

<p class="card-text"><%= @post.content %></p>
Expand All @@ -31,7 +31,7 @@
<% end %>
<p>
<time datetime="<%= @post.edited_at.to_date %>">
<%= t('posts.views.show.last_update', update_date: I18n.l(@post.edited_at.to_datetime, format: :long)) %>
<%= t('.last_update', update_date: I18n.l(@post.edited_at.to_datetime, format: :long)) %>
</time>
</p>

Expand Down
10 changes: 5 additions & 5 deletions app/views/profile/_profile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<%= render 'profile/personal_info', personal_info: personal_info, user_is_owner: user_is_owner %>
<% end %>
<%= link_to t('profiles.views.profile.edit_personal_info'), edit_user_profile_path, class:'btn btn-secondary' if user_is_owner %>
<%= link_to t('profiles.profile.edit_personal_info'), edit_user_profile_path, class:'btn btn-secondary' if user_is_owner %>
<% if profile.professional_infos.visibles_list.any? || user_is_owner %>
<h3 class='mt-5'><%= ProfessionalInfo.model_name.human %></h3>
<% end %>

<p>
<%= link_to t('profiles.views.profile.add_professional_info'), new_user_profile_professional_info_path, class:'btn btn-primary' if user_is_owner %>
<%= link_to t('profiles.profile.add_professional_info'), new_user_profile_professional_info_path, class:'btn btn-primary' if user_is_owner %>
</p>
<% professional_infos.each do |professional_info| %>
<% if professional_info.visibility || user_is_owner %>
Expand Down Expand Up @@ -48,7 +48,7 @@
</ul>
<% end %>
<p>
<%= link_to t('profiles.views.profile.edit_professional_info'), edit_professional_info_path(professional_info), class:'btn btn-secondary' if user_is_owner %>
<%= link_to t('profiles.profile.edit_professional_info'), edit_professional_info_path(professional_info), class:'btn btn-secondary' if user_is_owner %>
</p>
<% end %>
Expand All @@ -57,7 +57,7 @@
<% end %>

<p>
<%= link_to t('profiles.views.profile.add_educational_info'), new_user_profile_education_info_path, class:'btn btn-primary' if user_is_owner %>
<%= link_to t('profiles.profile.add_educational_info'), new_user_profile_education_info_path, class:'btn btn-primary' if user_is_owner %>
</p>
<% profile.education_infos.each do |education_info| %>
<% if education_info.visibility || user_is_owner %>
Expand All @@ -82,7 +82,7 @@
</ul>
<% end %>
<p>
<%= link_to t('profiles.views.profile.edit_educational_info'), edit_education_info_path(education_info), class:'btn btn-secondary' if user_is_owner %>
<%= link_to t('profiles.profile.edit_educational_info'), edit_education_info_path(education_info), class:'btn btn-secondary' if user_is_owner %>
</p>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/profile/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2><%= PersonalInfo.model_name.human %></h2>
<p>
<% if URI.parse(request.referer || '').path == new_user_registration_path %>
<%= link_to t('profiles.views.edit.fill_later'), root_path, class: 'btn btn-secondary' %>
<%= link_to t('profiles.edit.fill_later'), root_path, class: 'btn btn-secondary' %>
<% else %>
<%= link_to t('return_btn'), profile_path(current_user.profile), class: 'btn btn-secondary' %>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/profiles/_profile_photo.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if profile.photo.present? && profile.valid? %>
<%= image_tag profile.photo, alt: t('profiles.views.photo.alt_text'), class: 'img-cover' %>
<%= image_tag profile.photo, alt: t('.alt_text'), class: 'img-cover' %>
<% else %>
<%= image_tag 'default_portfoliorrr_photo.png', alt: t('profiles.views.photo.alt_text'), class: 'img-cover' %>
<%= image_tag 'default_portfoliorrr_photo.png', alt: t('.alt_text'), class: 'img-cover' %>
<% end %>
4 changes: 2 additions & 2 deletions app/views/profiles/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% end %>

<div class="d-flex gap-4 flex-column align-items-center justify-content-center w-75 align-self-center mx-auto">
<h2><%= t('profile.views.edit.change_photo') %></h2>
<h2><%= t('.change_photo') %></h2>
<div class="d-flex gap-4 align-items-center w-75 justify-content-center">
<div id="photo-preview" class="ratio ratio-1x1 rounded-circle overflow-hidden w-25">
<%= render partial: 'profiles/profile_photo', locals: { profile: @profile } %>
Expand All @@ -24,7 +24,7 @@
<% end %>

<div class="mb-3">
<%= button_to t('profiles.views.edit.remove_photo'), remove_photo_profile_path(@profile), method: :patch, class: 'btn btn-danger' %>
<%= button_to t('.remove_photo'), remove_photo_profile_path(@profile), method: :patch, class: 'btn btn-danger' %>
</div>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions app/views/profiles/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% if @profile.active? %>
<% if @posts.pinned.any? %>
<div id="fixed">
<h2 id="post-list-title"><%= t('profiles.views.show.highlight') %></h2>
<h2 id="post-list-title"><%= t('.highlight') %></h2>
<section>
<%= render partial: 'posts/listing', locals: { posts: @posts.pinned } %>
</section>
Expand All @@ -13,7 +13,7 @@
<div id="publications">
<h2 id="post-list-title"><%= Post.model_name.human(count: 2) %></h2>
<% if @profile.user.posts.count - @profile.user.posts.pinned.count < 1 %>
<p><%= t('profiles.views.show.nothing_here') %> <br> <%= t('profiles.views.show.new_posts') %> :)</p>
<p><%= t('.nothing_here') %> <br> <%= t('.new_posts') %> :)</p>
<% end %>

<section>
Expand All @@ -30,7 +30,7 @@
<%= render partial: 'profile_photo', locals: { profile: @profile } %>
</div>

<%= link_to t('profiles.views.show.change_photo'), edit_profile_path(@profile), class: 'badge bg-secondary' if current_user == @profile.user %>
<%= link_to t('.change_photo'), edit_profile_path(@profile), class: 'badge bg-secondary' if current_user == @profile.user %>
<h4><%= @user.full_name %></h4>
<div class="d-flex gap-4">
<div class="d-flex flex-column" id="followers-count">
Expand All @@ -49,11 +49,11 @@
<% if current_user.profile != @profile %>
<div>
<% if @profile.following?(current_user.profile) %>
<%= button_to t('profiles.views.show.unfollow_btn'), connection_unfollow_path(@profile.followers.find_by(follower: current_user.profile)), method: :patch, class: 'btn btn-danger w-50' %>
<%= button_to t('.unfollow_btn'), connection_unfollow_path(@profile.followers.find_by(follower: current_user.profile)), method: :patch, class: 'btn btn-danger w-50' %>
<% elsif @profile.inactive_follower?(current_user.profile) %>
<%= button_to t('profiles.views.show.follow_btn'), connection_follow_again_path(@profile.followers.find_by(follower: current_user.profile)), method: :patch, class: 'btn btn-primary w-50' %>
<%= button_to t('.follow_btn'), connection_follow_again_path(@profile.followers.find_by(follower: current_user.profile)), method: :patch, class: 'btn btn-primary w-50' %>
<% else %>
<%= button_to t('profiles.views.show.follow_btn'), profile_connections_path(@profile), class: 'btn btn-primary w-50' %>
<%= button_to t('.follow_btn'), profile_connections_path(@profile), class: 'btn btn-primary w-50' %>
<% end %>
</div>
<div class="mt-2">
Expand All @@ -68,7 +68,7 @@
</section>
</aside>
<% else %>
<h2 class="text-center"><%= t('profiles.views.show.arquived_account') %></h2>
<h2 class="text-center"><%= t('.arquived_account') %></h2>
<% end %>
</div>
</div>
Loading

0 comments on commit 616eb65

Please sign in to comment.