Only render 1 delete room modal (#819)

This commit is contained in:
Ahmad Farhat 2019-10-10 15:45:42 -04:00 committed by Jesus Federico
parent 58cfb0ec30
commit 3f5affd116
4 changed files with 17 additions and 9 deletions

View File

@ -54,6 +54,10 @@ $(document).on('turbolinks:load', function(){
$(".update-room").click(function(){
showUpdateRoom(this)
})
$(".delete-room").click(function() {
showDeleteRoom(this)
})
}
});
@ -113,6 +117,11 @@ function showUpdateRoom(target) {
}
}
function showDeleteRoom(target) {
$("#delete-header").text(getLocalizedString("modal.delete_room.confirm").replace("%{room}", $(target).data("name")))
$("#delete-confirm").parent().attr("action", $(target).data("path"))
}
//Update the createRoomModal to show the correct current settings
function updateCurrentSettings(settings){
//set checkbox

View File

@ -54,7 +54,7 @@
<a href="" data-toggle="modal" data-target="#createRoomModal" class="update-room dropdown-item">
<i class="dropdown-icon fas fa-cog"></i> <%= t("room.settings") %>
</a>
<a href="" data-toggle="modal" data-target="#deleteRoomModal_<%= room.uid %>"class="dropdown-item">
<a href="" data-toggle="modal" data-target="#deleteRoomModal" data-path="<%= room_path(room) %>" data-name="<%= room.name %>" class="delete-room dropdown-item">
<i class="dropdown-icon far fa-trash-alt"></i> <%= t("delete") %>
</a>
</div>

View File

@ -89,7 +89,6 @@
<%= render "rooms/components/room_block", room: room %>
<% end %>
</div>
<%= render "shared/modals/delete_room_modal", room: room %>
<% end %>
<% end %>
<% unless room_limit_exceeded %>
@ -101,4 +100,6 @@
<%= render "shared/sessions", recordings: @recordings, pagy: @pagy, only_public: false, user_recordings: false, title: t("room.recordings")%>
<%= render "shared/modals/delete_room_modal" %>
<%= render "shared/modals/create_room_modal" %>

View File

@ -13,30 +13,28 @@
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
%>
<div class="modal fade" id="deleteRoomModal_<%= room.uid %>" tabindex="-1" role="dialog">
<div class="modal fade" id="deleteRoomModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content text-center">
<div class="modal-body">
<div class="card-body p-6">
<div class="card-title">
<h3><%= t("modal.delete_room.confirm", room: room.name) %></h3>
<h3 id="delete-header"></h3>
</div>
<button type="button" class="btn btn-info my-1 btn-del-room" data-dismiss="modal">
<%= t("modal.delete_room.keep") %>
</button>
<%= button_to room, method: :delete, id: "delete-confirm", class: "btn btn-danger my-1 btn-del-room" do %>
<%= button_to "/", method: :delete, id: "delete-confirm", class: "btn btn-danger my-1 btn-del-room" do %>
<%= t("modal.delete_room.delete") %>
<% end %>
</div>
<div class="card-footer">
<p>
<p id="delete-footer">
<%= t("modal.delete_room.warning").html_safe %>
<% if @recordings.length > 0 %>
<%= t("modal.delete_room.recording_warning", recordings_num: @recordings.length).html_safe %>
<% end %>
<%= t("modal.delete_room.recording_warning", recordings_num:"").html_safe %>
</p>
</div>
</div>