Skip to content

Commit

Permalink
Merge pull request #66 from TreinaDev/adiciona-area-comum-no-navbar
Browse files Browse the repository at this point in the history
Adicionar área comum à barra de navegação
  • Loading branch information
Vinigperuzzi authored Jul 5, 2024
2 parents dde1a08 + 27f4f8c commit 449001a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
29 changes: 29 additions & 0 deletions app/views/shared/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<li class="nav-item">
<a class="nav-link custom-element text-white" href="#" data-bs-toggle="modal" data-bs-target="#condoSelectPopupForTowers">Criar Torre</a>
</li>
<li><hr class="nav-divider m-0"></li>
<li class="nav-item">
<a class="nav-link custom-element text-white" href="#" data-bs-toggle="modal" data-bs-target="#condoSelectPopupForCommonAreas">Criar Área Comum</a>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -101,4 +105,29 @@
</div>
</div>
</div>
</div>

<div class="modal fade" id="condoSelectPopupForCommonAreas" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="condoSelectPopupLabel" aria-hidden="true" >
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="condoSelectPopupLabel">Selecione o Condominio</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class='container text-center'>
<div class='row'>
<% Condo.all.each do |condo| %>
<div class='col'>
<%= button_to condo.name, new_condo_common_area_path(condo), method: :get, class:'btn btn-dark', data: { turbo: false }%>
</div>
<% end %>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fechar</button>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/unit_types/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Editar um novo tipo de unidade</h1>
<h1>Editar tipo de unidade</h1>

<%= render 'shared/errors', model: @unit_type %>
Expand Down
17 changes: 17 additions & 0 deletions spec/system/common_area/manager_registers_new_common_area_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
require 'rails_helper'

describe 'Manager registers new common area' do
it 'and access from nav bar' do
manager = create(:manager)
condo = create(:condo, name: 'Condomínio dos rubinhos')

login_as(manager, scope: :manager)
visit root_path
within 'nav' do
click_on id: 'side-menu'
click_on 'Criar Área Comum'
end
within '#condoSelectPopupForCommonAreas' do
click_on 'Condomínio dos rubinhos'
end

expect(current_path).to eq new_condo_common_area_path(condo)
end

it 'successfully' do
manager = create(:manager)
condo = create(:condo)
Expand Down

0 comments on commit 449001a

Please sign in to comment.