-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from TreinaDev/refactor/troca-localizacao-de-…
…botoes-do-perfil Refactor/Ajuste na tela de configurações
- Loading branch information
Showing
11 changed files
with
116 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
<h2>Configurações</h2> | ||
<div> | ||
<%= form_with(url: deactivate_profile_path, method: :patch) do |form| %> | ||
<p><strong class="text-danger">Atenção:</strong> Todos os dados relacionados ao seu perfil serão ARQUIVADOS. Você pode reativar sua conta fazendo log-in novamente.</p> | ||
<%= form.submit 'Desativar Perfil', | ||
class: "btn btn-danger", | ||
data: { turbo_confirm: 'Seu perfil será DESATIVADO, deseja prosseguir?' } | ||
%> | ||
<% end %> | ||
</div> | ||
<h2 class="text-center">Configurações</h2> | ||
|
||
<div> | ||
<%= form_with(url: delete_account_path, method: :delete) do |form| %> | ||
<p><strong class="text-danger">Atenção:</strong> Todos os dados relacionados a conta serão EXCLUÍDOS e não poderão ser recuperados.</p> | ||
<%= form.submit 'Excluir Conta', | ||
class: "btn btn-danger", | ||
data: { turbo_confirm: 'Sua conta será EXCLUÍDA, deseja prosseguir?' } | ||
%> | ||
<% end %> | ||
</div> | ||
<section class="text-center mt-4"> | ||
<h3>Privacidade</h3> | ||
<div class="mt-3"> | ||
<% if @profile.public_profile? %> | ||
<p class="text-success fs-4"><%= t Profile.human_attribute_name("privacy.#{@profile.privacy}") %></p> | ||
<% else %> | ||
<p class="text-secondary fs-4"><%= t Profile.human_attribute_name("privacy.#{@profile.privacy}") %></p> | ||
<% end %> | ||
<%= button_to 'Alterar Privacidade', change_privacy_path, method: :patch, class: 'btn btn-outline-primary btn-sm' %> | ||
</div> | ||
<div class="mt-2"> | ||
<% if @profile.open_to_work? %> | ||
<p class="text-success fs-4"><%= t Profile.human_attribute_name("work_status.#{@profile.work_status}") %></p> | ||
<%= button_to 'Alterar Disponibilidade', work_unavailable_path, method: :patch, class: 'btn btn-outline-primary btn-sm' if current_user.profile == @profile %> | ||
<% else %> | ||
<p class="text-danger fs-4"><%= t Profile.human_attribute_name("work_status.#{@profile.work_status}") %></p> | ||
<%= button_to 'Alterar Disponibilidade', open_to_work_path, method: :patch, class: 'btn btn-outline-primary btn-sm' if current_user.profile == @profile %> | ||
<% end %> | ||
</div> | ||
</section> | ||
<br> | ||
<h3 class="text-center">Remoção de conta</h3> | ||
<p class="text-center"><strong class="text-danger">Atenção:</strong> Ao desativar o perfil todos os dados relacionados serão <strong>ARQUIVADOS</strong>. Você pode reativar sua conta fazendo login novamente.</p> | ||
<section class="text-center d-flex justify-content-around w-25 mx-auto"> | ||
<div> | ||
<%= form_with(url: deactivate_profile_path, method: :patch) do |form| %> | ||
<%= form.submit 'Desativar Perfil', | ||
class: "btn btn-danger", | ||
data: { turbo_confirm: 'Seu perfil será DESATIVADO, deseja prosseguir?' } | ||
%> | ||
<% end %> | ||
</div> | ||
|
||
<div> | ||
<%= form_with(url: delete_account_path, method: :delete) do |form| %> | ||
<%= form.submit 'Excluir Conta', | ||
class: "btn btn-danger", | ||
data: { turbo_confirm: 'Sua conta será EXCLUÍDA, deseja prosseguir?' } | ||
%> | ||
<% end %> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
pt-BR: | ||
deactivate_profile: Perfil desativado com sucesso | ||
delete_account: Conta excluída com sucesso | ||
delete_account: Conta excluída com sucesso | ||
settings: | ||
change_privacy: | ||
success: Privacidade alterada com sucesso | ||
work_unavailable: | ||
success: Alteração salva com sucesso | ||
open_to_work: | ||
success: Alteração salva com sucesso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'rails_helper' | ||
|
||
describe 'Usuário altera o status de disponibilidade de trabalho' do | ||
context 'de disponível para indisponível' do | ||
it 'com sucesso' do | ||
user = create(:user) | ||
|
||
login_as user | ||
visit profile_settings_path(user.profile) | ||
click_on 'Alterar Disponibilidade' | ||
|
||
expect(page).to have_current_path profile_settings_path(user.profile) | ||
expect(page).to have_content 'Alteração salva com sucesso' | ||
expect(page).to have_content 'Indisponível Para Trabalho' | ||
end | ||
end | ||
|
||
context 'de indisponível para disponível' do | ||
it 'com sucesso' do | ||
user = create(:user) | ||
user.profile.unavailable! | ||
|
||
login_as user | ||
visit profile_settings_path(user.profile) | ||
click_on 'Alterar Disponibilidade' | ||
|
||
expect(page).to have_current_path profile_settings_path(user.profile) | ||
expect(page).to have_content 'Alteração salva com sucesso' | ||
expect(page).to have_content 'Disponível Para Trabalho' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters