show all rooms

This commit is contained in:
Josh 2018-06-01 17:28:39 -04:00
parent 475646f7c1
commit 11a61180ed
8 changed files with 43 additions and 40 deletions

View File

@ -43,7 +43,7 @@
$background-color: #F5F7FB; $background-color: #F5F7FB;
$rule-color: lightblue; $rule-color: lightblue;
$footer-height: 70px; $footer-height: 80px;
.video-container { .video-container {
position: relative; position: relative;
@ -96,20 +96,22 @@ iframe{
html, body { html, body {
width: 100%; width: 100%;
height: 100%; height: 100%;
//background: linear-gradient(180deg, $background-color 50%, white 50%);
//background-repeat: no-repeat;
background-color: white; background-color: white;
} }
.font-weight-400 {
font-weight: 400;
}
.wrapper { .wrapper {
min-height: calc(100% - $footer-height); min-height: calc(100% - #{$footer-height});
position: relative; position: relative;
} }
.footer { .footer {
width: 100%; width: 100%;
height: 70px; position: abolute;
text-align: center; bottom: 0px;
} }
.small-rule { .small-rule {

View File

@ -56,27 +56,17 @@ class RoomsController < ApplicationController
# POST /r/:room_uid # POST /r/:room_uid
def join def join
opts = default_meeting_options opts = default_meeting_options
puts
puts @room.invite_path
# If you're unauthenticated, you must enter a name to join the meeting. # If you're unauthenticated, you must enter a name to join the meeting.
if params[@room.invite_path][:join_name] if params[@room.invite_path][:join_name]
redirect_to @room.join_path(params[:join_name], opts) redirect_to @room.join_path(params[@room.invite_path][:join_name], opts)
end end
end end
# DELETE /r/:room_uid # DELETE /r/:room_uid
def destroy def destroy
# Only delete a room if there is another to fallback too. # Don't delete the users home room.
if current_user.rooms.length > 1 @room.destroy if @room != current_user.main_room
# Assign a new random main_room if it's the main room.
if @room == current_user.main_room
current_user.main_room = (current_user.rooms - [@room]).sample
current_user.save
end
@room.destroy
end
redirect_to current_user.main_room redirect_to current_user.main_room
end end

View File

@ -36,8 +36,9 @@
<% if current_user %> <% if current_user %>
<%= render "shared/modals/create_room_modal" %> <%= render "shared/modals/create_room_modal" %>
<% end %> <% end %>
</div> </div>
<%= render "shared/footer" %> <%= render "shared/footer" %>
</body> </body>
</html> </html>

View File

@ -2,9 +2,9 @@
<div class="container"> <div class="container">
<div class="row pt-9"> <div class="row pt-9">
<div class="col-lg-12 col-sm-12"> <div class="col-lg-12 col-sm-12">
<h4 class="text-left text-primary">You have been invited to join</h4> <h4 class="text-left">You have been invited to join</h4>
<h1 class="display-3 text-left text-primary mb-3"><%= @room.name %></h1> <h1 class="display-3 text-left mb-3 font-weight-400"><%= @room.name %></h1>
<hr class="mt-2 float-left bg-azure" style="width: 20%;"> <hr class="mt-2 float-left" style="width: 20%;">
</div> </div>
</div> </div>
@ -15,15 +15,19 @@
<% else %> <% else %>
<span class="avatar" style="background-image: url(<%= @room.owner.image %>)"></span> <span class="avatar" style="background-image: url(<%= @room.owner.image %>)"></span>
<% end %> <% end %>
<h5 class="font-weight-normal ml-4 mt-3 text-primary"><%= @room.owner.name %> (Owner)</h5> <h5 class="font-weight-normal ml-4 mt-3"><%= @room.owner.name %> (Owner)</h5>
</div> </div>
<div class="col-lg-6 col-md-4 col-sm-12"> <div class="col-lg-6 col-md-4 col-sm-12">
<%= form_for room_path, method: :post do |f| %> <%= form_for room_path, method: :post do |f| %>
<div class="input-group" style="height: 60px;"> <div class="input-group" style="height: 60px;">
<%= f.text_field :join_name, class: "form-control main-large", placeholder: "Enter your name!" %> <% if current_user %>
<span class="input-group-append"> <%= f.submit "Join", class: "btn btn-primary px-7 main-large btn-block"%>
<%= f.submit "Join", class: "btn btn-primary px-7 main-large" %> <% else %>
</span> <%= f.text_field :join_name, class: "form-control main-large", placeholder: "Enter your name!" %>
<span class="input-group-append">
<%= f.submit "Join", class: "btn btn-primary px-7 main-large" %>
</span>
<% end %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<div class="row pt-9"> <div class="row pt-9">
<div class="col-lg-9 col-sm-12"> <div class="col-lg-9 col-sm-12">
<h1 id="user-text" class="display-3 text-left mb-3"><%= @room.name %> <h1 id="user-text" class="display-3 text-left mb-3 font-weight-400"><%= @room.name %>
<% if current_user.main_room == @room %> <% if current_user.main_room == @room %>
<i class="fas fa-home align-top" style="font-size: 22px;"></i> <i class="fas fa-home align-top" style="font-size: 22px;"></i>
<% end %> <% end %>
@ -32,12 +32,14 @@
</div> </div>
<div class="row mt-7 mb-2"> <div class="row mt-7 mb-2">
<% (current_user.rooms - [@room]).each do |room| %> <% if current_user.rooms.length > 1 %>
<div class="col-lg-4 col-md-6 col-sm-12"> <% current_user.rooms.each do |room| %>
<%= link_to room do %> <div class="col-lg-4 col-md-6 col-sm-12">
<%= render "shared/components/room_block", room: room %> <%= link_to room do %>
<% end %> <%= render "shared/components/room_block", room: room %>
</div> <% end %>
</div>
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -14,7 +14,7 @@
<div class="d-flex ml-auto"> <div class="d-flex ml-auto">
<% if current_user %> <% if current_user %>
<a class="px-5 ml-2 mt-1" href="" data-toggle="modal" data-target="#createRoomModal"> <a class="px-5 ml-2 mt-1" href="" data-toggle="modal" data-target="#createRoomModal">
<i class="fas fa-plus"></i> Create Room <i class="fas fa-plus"></i>&nbsp; Create Room
</a> </a>
<div class="dropdown"> <div class="dropdown">
<a href="#" class="nav-link pr-0" data-toggle="dropdown"> <a href="#" class="nav-link pr-0" data-toggle="dropdown">

View File

@ -21,13 +21,16 @@
<div class="item-action dropdown"> <div class="item-action dropdown">
<a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a> <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<%= button_to root_path, class: "dropdown-item" do %>
<i class="dropdown-icon fe fe-link"></i> Copy Link
<% end %>
<% if room != current_user.main_room %> <% if room != current_user.main_room %>
<%= button_to make_home_path(room), class: "dropdown-item" do %> <%= button_to make_home_path(room), class: "dropdown-item" do %>
<i class="dropdown-icon fas fa-home"></i> Make Home Room <i class="dropdown-icon fas fa-home"></i> Make Home Room
<% end %> <% end %>
<% end %> <%= button_to room, method: :delete, data: { confirm: 'Are you sure?' }, class: "dropdown-item" do %>
<%= button_to room, method: :delete, data: { confirm: 'Are you sure?' }, class: "dropdown-item" do %> <i class="dropdown-icon far fa-trash-alt"></i> Delete
<i class="dropdown-icon far fa-trash-alt"></i> Delete <% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -14,6 +14,7 @@
<i class="fas fa-chalkboard-teacher"></i> <i class="fas fa-chalkboard-teacher"></i>
</span> </span>
<%= f.text_field :name, id: "room-name", class: "form-control", placeholder: "Enter a room name...", autocomplete: :off %> <%= f.text_field :name, id: "room-name", class: "form-control", placeholder: "Enter a room name...", autocomplete: :off %>
<div class="invalid-feedback text-left">Room name cannot be blank.</div>
</div> </div>
<label class="custom-switch mt-5 mb-5 float-left"> <label class="custom-switch mt-5 mb-5 float-left">
<%= f.check_box :auto_join, class: "custom-switch-input", checked: true %> <%= f.check_box :auto_join, class: "custom-switch-input", checked: true %>