From 21e0a3558dddb67e25ec4b9af8ef8f4f78e4e164 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Wed, 4 Jul 2018 15:20:12 -0400 Subject: [PATCH 1/2] add delete confirmation modal --- app/assets/stylesheets/rooms.scss | 6 ++++- app/controllers/rooms_controller.rb | 3 ++- app/views/main/index.html.erb | 2 +- app/views/rooms/show.html.erb | 1 + .../shared/components/_room_block.html.erb | 6 ++--- .../shared/modals/_delete_room_modal.html.erb | 25 +++++++++++++++++++ 6 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 app/views/shared/modals/_delete_room_modal.html.erb diff --git a/app/assets/stylesheets/rooms.scss b/app/assets/stylesheets/rooms.scss index 42daca51..6066d2db 100644 --- a/app/assets/stylesheets/rooms.scss +++ b/app/assets/stylesheets/rooms.scss @@ -7,7 +7,7 @@ } .thumbnail { - height: 40% !important; + height: 60px !important; width: auto; } @@ -22,3 +22,7 @@ .home-indicator { font-size: 22px !important; } + +.btn-del-room { + width: 70% !important; +} diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index e922f36b..57569b3a 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -65,8 +65,9 @@ class RoomsController < ApplicationController # DELETE /:room_uid def destroy + p @room # Don't delete the users home room. - @room.destroy if @room != current_user.main_room + @room.destroy if @room.owned_by?(current_user) && @room != current_user.main_room redirect_to current_user.main_room end diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb index 5ce4ab45..57ca2794 100644 --- a/app/views/main/index.html.erb +++ b/app/views/main/index.html.erb @@ -12,7 +12,7 @@

Welcome to Greenlight.

A simple front end for your BigBlueButton Open Source Web Conferencing Server.

- <%= link_to "https://www.youtube.com/watch?v=yGX3JCv7OVM&feature=youtu.be", class: "p-3", target: "_blank" do %> + <%= link_to "https://youtu.be/Hso8yLzkqj8", class: "p-3", target: "_blank" do %>

Watch a tutorial on using Greenlight

<% end %> diff --git a/app/views/rooms/show.html.erb b/app/views/rooms/show.html.erb index 79500e11..f48df08c 100644 --- a/app/views/rooms/show.html.erb +++ b/app/views/rooms/show.html.erb @@ -48,6 +48,7 @@ <%= render "shared/components/room_block", room: room %> <% end %> + <%= render "shared/modals/delete_room_modal", room: room %> <% end %> <% end %> diff --git a/app/views/shared/components/_room_block.html.erb b/app/views/shared/components/_room_block.html.erb index 528329b6..0a796d84 100644 --- a/app/views/shared/components/_room_block.html.erb +++ b/app/views/shared/components/_room_block.html.erb @@ -25,15 +25,15 @@ <% if room != current_user.main_room %>
<%= f.label "Provider", class: "form-label" %> - <%= f.text_field :provider, class: "form-control", value: @user.provider.capitalize, readonly: "" %> + <%= f.text_field :provider, class: "form-control", readonly: "" %> <%= f.label "Image", class: "form-label mt-5" %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 56620103..06b3168d 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -28,7 +28,8 @@
<%= @user.errors.full_messages_for(:password_confirmation).first %>
<% end %>