This commit is contained in:
joshua-arts 2018-05-31 22:15:18 -04:00
parent 39414e269b
commit 1bcd176285
14 changed files with 137 additions and 77 deletions

View File

@ -41,6 +41,8 @@
$background-color: #F5F7FB; $background-color: #F5F7FB;
$rule-color: lightblue; $rule-color: lightblue;
$footer-height: 70px;
.video-container { .video-container {
position: relative; position: relative;
width: 100%; width: 100%;
@ -98,12 +100,13 @@ html, body {
} }
.wrapper { .wrapper {
min-height: 100%; min-height: calc(100% - $footer-height);
position: relative; position: relative;
} }
.footer { .footer {
width: 100%; width: 100%;
height: 70px;
text-align: center; text-align: center;
} }

View File

@ -4,7 +4,6 @@ class MainController < ApplicationController
# GET / # GET /
def index def index
@user = User.new
end end
private private

View File

@ -8,7 +8,7 @@ class RoomsController < ApplicationController
# POST /r # POST /r
def create def create
room = Room.new(name: room_params[:name]) room = Room.new(name: room_params[:name])
room.user = current_user room.owner = current_user
if room.save if room.save
if room_params[:auto_join] == "1" if room_params[:auto_join] == "1"
@ -38,10 +38,15 @@ class RoomsController < ApplicationController
render :join render :join
end end
else else
# If the meeting isn't running and you don't own the room, go to the waiting page. # If the room isn't running, go to join page to enter a name.
if !@room.owned_by?(current_user) if !@room.owned_by?(current_user)
redirect_to wait_room_path(@room) render :join
end end
# If the meeting isn't running and you don't own the room, go to the waiting page.
#if !@room.owned_by?(current_user)
# redirect_to wait_room_path(@room)
#end
end end
end end

View File

@ -4,7 +4,7 @@ class Room < ApplicationRecord
validates :name, presence: true validates :name, presence: true
belongs_to :user belongs_to :owner, class_name: 'User', foreign_key: :user_id
has_one :meeting has_one :meeting
ROOM_ICONS = %w(circle star certificate play cloud heart square bookmark cog) ROOM_ICONS = %w(circle star certificate play cloud heart square bookmark cog)
@ -111,7 +111,7 @@ class Room < ApplicationRecord
def bbb def bbb
@bbb = BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8") @bbb = BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8")
#@bbb ||= if Rails.configuration.loadbalanced_configuration #@bbb ||= if Rails.configuration.loadbalanced_configuration
# lb_user = retrieve_loadbalanced_credentials(self.room.user.provider) # lb_user = retrieve_loadbalanced_credentials(self.room.owner.provider)
# BigBlueButton::BigBlueButtonApi.new(remove_slash(lb_user["apiURL"]), lb_user["secret"], "0.8") # BigBlueButton::BigBlueButtonApi.new(remove_slash(lb_user["apiURL"]), lb_user["secret"], "0.8")
#else #else
# BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8") # BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8")
@ -120,7 +120,7 @@ class Room < ApplicationRecord
# Generates a uid for the room and BigBlueButton. # Generates a uid for the room and BigBlueButton.
def setup def setup
self.uid = [user.firstname, (0...8).map { (65 + rand(26)).chr }.join].join('-').downcase self.uid = [owner.firstname, (0...9).map { (65 + rand(26)).chr }.join].join('-').downcase
self.bbb_id = Digest::SHA1.hexdigest(Rails.application.secrets[:secret_key_base] + Time.now.to_i.to_s).to_s self.bbb_id = Digest::SHA1.hexdigest(Rails.application.secrets[:secret_key_base] + Time.now.to_i.to_s).to_s
self.icon = ROOM_ICONS.sample self.icon = ROOM_ICONS.sample

View File

@ -90,7 +90,7 @@ class User < ApplicationRecord
# Initializes a room for the user. # Initializes a room for the user.
def initialize_main_room def initialize_main_room
self.main_room = Room.create!(user: self, name: firstname + "'s Room") self.main_room = Room.create!(owner: self, name: firstname + "'s Room")
self.save self.save
end end
end end

View File

@ -1,7 +1,30 @@
<p>The join the meeting, enter a name.</p> <div class="room-section pb-9">
<div class="container">
<div class="row pt-9">
<div class="col-lg-12 col-sm-12">
<h4 class="text-left text-primary">You have been invited to join</h4>
<h1 class="display-3 text-left text-primary mb-3"><%= @room.name %></h1>
<hr class="mt-2 float-left bg-azure" style="width: 20%;">
</div>
</div>
<p>Enter a name to start a session.</p> <div class="row">
<%= form_tag room_path(@room) do %> <div class="col-lg-6 col-md-8 col-sm-12 form-inline mb-5">
<%= text_field_tag "join_name" %> <% if @room.owner.image.nil? %>
<%= submit_tag "Join" %> <span class="avatar"><%= @room.owner.name.first %></span>
<% end %> <% else %>
<span class="avatar" style="background-image: url(<%= @room.owner.image %>)"></span>
<% end %>
<h5 class="font-weight-normal ml-4 mt-3 text-primary"><%= @room.owner.name %> (Owner)</h5>
</div>
<div class="col-lg-6 col-md-4 col-sm-12">
<div class="input-group" style="height: 60px;">
<input type="text" id="name-input" class="form-control main-large" placeholder="Enter your name!"></input>
<span class="input-group-append">
<button class="btn btn-primary px-7 main-large">Join</button>
</span>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,8 +1,12 @@
<div class="room-section"> <div class="room-section pb-1">
<div class="container"> <div class="container">
<div class="row pt-9"> <div class="row pt-8">
<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 text-primary mb-3"><%= @room.name %></h1> <h1 id="user-text" class="display-3 text-left text-primary mb-3"><%= @room.name %>
<% if current_user.main_room == @room %>
<i class="fas fa-home align-top" style="font-size: 22px;"></i>
<% end %>
</h1>
<h4 class="text-left text-primary mb-6">0 Sessions | 0 Recordings</h4> <h4 class="text-left text-primary mb-6">0 Sessions | 0 Recordings</h4>
<label class="form-label text-primary">Invite Participants</label> <label class="form-label text-primary">Invite Participants</label>
<form class="form-inline"> <form class="form-inline">
@ -29,7 +33,7 @@
<div class="row mt-7 mb-2"> <div class="row mt-7 mb-2">
<% (current_user.rooms - [@room]).each do |room| %> <% (current_user.rooms - [@room]).each do |room| %>
<div class="col-4"> <div class="col-lg-4 col-md-6 col-sm-12">
<%= link_to room do %> <%= link_to room do %>
<%= render "shared/components/room_block", room: room %> <%= render "shared/components/room_block", room: room %>
<% end %> <% end %>
@ -39,7 +43,7 @@
</div> </div>
</div> </div>
<%= render "shared/sessions" %> <%= render "shared/sessions", recordings: @room.recordings %>
<script> <script>
var invite_url; var invite_url;

View File

@ -11,13 +11,13 @@
<% end %> <% end %>
<% end %> <% end %>
<div class="d-flex order-lg-2 ml-auto"> <div class="d-flex ml-auto">
<% if current_user %> <% if current_user %>
<a class="px-5" 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> Create Room
</a> </a>
<div class="dropdown"> <div class="dropdown">
<a href="#" class="nav-link pr-0 leading-none" data-toggle="dropdown"> <a href="#" class="nav-link pr-0" data-toggle="dropdown">
<% if current_user.image.nil? %> <% if current_user.image.nil? %>
<span class="avatar"><%= current_user.name.first %></span> <span class="avatar"><%= current_user.name.first %></span>
<% else %> <% else %>
@ -28,6 +28,9 @@
</span> </span>
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow" x-placement="bottom-end" style="position: absolute; transform: translate3d(-56px, 32px, 0px); top: 0px; left: 0px; will-change: transform;"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow" x-placement="bottom-end" style="position: absolute; transform: translate3d(-56px, 32px, 0px); top: 0px; left: 0px; will-change: transform;">
<%= link_to current_user.main_room, class: "dropdown-item" do %>
<i class="dropdown-icon fas fa-home"></i> Home Room
<% end %>
<%= link_to settings_path, class: "dropdown-item" do %> <%= link_to settings_path, class: "dropdown-item" do %>
<i class="dropdown-icon fe fe-settings"></i> Settings <i class="dropdown-icon fe fe-settings"></i> Settings
<% end %> <% end %>

View File

@ -1,7 +1,7 @@
<div class="sessions pb-5"> <div class="sessions pb-5">
<div class="container pt-6"> <div class="container pt-6">
<%= render "shared/components/subtitle", subtitle: "Recordings" %> <%= render "shared/components/subtitle", subtitle: "Recordings", search: true %>
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
@ -19,6 +19,13 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% if recordings.empty? %>
<tr>
<td colspan="7" class="text-center h4 p-6 font-weight-normal">
This room has no recordings.
</td>
</tr>
<% else %>
<% 3.times do %> <% 3.times do %>
<tr> <tr>
<td> <td>
@ -61,12 +68,13 @@
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon far fa-eye"></i> Change Visibility</a> <a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon far fa-eye"></i> Change Visibility</a>
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon far fa-envelope"></i> Email Recording</a> <a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon far fa-envelope"></i> Email Recording</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-trash"></i> Delete</a> <a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon far fa-trash-alt"></i> Delete</a>
</div> </div>
</div> </div>
</td> </td>
</tr> </tr>
<% end %> <% end %>
<% end %>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -3,14 +3,18 @@
<table class="table table-hover table-outline table-vcenter text-nowrap card-table"> <table class="table table-hover table-outline table-vcenter text-nowrap card-table">
<tbody> <tbody>
<td> <td>
<span class="stamp stamp-md bg-primary mr-3"> <span class="stamp stamp-md bg-primary">
<% if room == current_user.main_room %>
<i class="fas fa-home"></i>
<% else %>
<i class="fas fa-<%= room.icon %>"></i> <i class="fas fa-<%= room.icon %>"></i>
<% end %>
</span> </span>
</td> </td>
<td> <td>
<div><%= room.name %></div> <div><%= room.name %></div>
<div class="small text-muted"> <div class="small text-muted">
<i>Created on <%= room.created_at.strftime("%B #{room.created_at.day.ordinalize}, %Y.") %></i> <i>Last Session on <%= room.created_at.strftime("%B #{room.created_at.day.ordinalize}, %Y.") %></i>
</div> </div>
</td> </td>
<td class="text-right"> <td class="text-right">
@ -18,11 +22,11 @@
<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 %> <%= button_to root_path, class: "dropdown-item" do %>
<i class="dropdown-icon fe fe-home"></i> Make Home Room <i class="dropdown-icon fas fa-home"></i> Make Home Room
<% end %> <% end %>
<% if room != current_user.main_room %> <% if room != current_user.main_room %>
<%= 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 fe fe-trash"></i> Delete <i class="dropdown-icon far fa-trash-alt"></i> Delete
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View File

@ -1,6 +1,16 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-9">
<p class="subtitle"><%= subtitle %></p> <p class="subtitle"><%= subtitle %></p>
<hr> </div>
<% if search %>
<div class="col-3">
<div class="input-icon">
<span class="input-icon-addon">
<i class="fas fa-search"></i>
</span>
<input type="text" class="form-control btn-pill" placeholder="Search...">
</div> </div>
</div> </div>
<% end %>
</div>
<hr class="mt-0">

View File

@ -9,7 +9,7 @@
<hr class="small-rule"> <hr class="small-rule">
<%= form_for(@user, url: signup_path) do |f| %> <%= form_for(User.new, url: signup_path) do |f| %>
<div class="form-group"> <div class="form-group">
<%= f.label :name, "Full Name", class: "form-label text-left" %> <%= f.label :name, "Full Name", class: "form-label text-left" %>
<%= f.text_field :name, class: "form-control", placeholder: "Full Name" %> <%= f.text_field :name, class: "form-control", placeholder: "Full Name" %>

View File

@ -1,6 +1,6 @@
<div class="container mt-8"> <div class="container mt-8">
<%= render "shared/components/subtitle", subtitle: "Settings" %> <%= render "shared/components/subtitle", subtitle: "Settings", search: false %>
<div class="row"> <div class="row">
<div class="col-lg-3 mb-4"> <div class="col-lg-3 mb-4">

View File

@ -6,6 +6,7 @@ class CreateRooms < ActiveRecord::Migration[5.0]
t.string :uid, index: true t.string :uid, index: true
t.string :bbb_id, index: true t.string :bbb_id, index: true
t.string :icon, index: true t.string :icon, index: true
t.integer :sessions, index: true
t.timestamps t.timestamps
end end