redo rooms page

This commit is contained in:
Josh 2018-05-31 15:04:18 -04:00
parent 9e5250353b
commit ede80075c1
27 changed files with 258 additions and 154 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -52,12 +52,22 @@ a {
text-decoration: none !important; text-decoration: none !important;
} }
.sessions {
background-color: white;
}
.start-block { .start-block {
background-color: white; background-color: white;
border: 3px solid lightblue; border: 3px solid lightblue;
border-radius: 4px; border-radius: 4px;
} }
.start-button {
font-size: 26px;
position: absolute;
bottom: 0;
}
.main-large { .main-large {
font-size: 20px; font-size: 20px;
} }
@ -83,16 +93,12 @@ html, body {
} }
.wrapper { .wrapper {
min-height:100%; min-height: 100%;
position:relative; position: relative;
} }
.footer { .footer {
width: 100%; width: 100%;
height: 70px;
position: absolute;
bottom: 0;
left: 0;
text-align: center; text-align: center;
} }

View File

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

View File

@ -48,7 +48,7 @@ class RoomsController < ApplicationController
# POST /r/:room_uid # POST /r/:room_uid
def join def join
opts = default_meeting_options opts = default_meeting_options
# 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[:join_name] if params[:join_name]
redirect_to @room.join_path(params[:join_name], opts) redirect_to @room.join_path(params[:join_name], opts)
@ -57,9 +57,9 @@ class RoomsController < ApplicationController
# DELETE /r/:room_uid # DELETE /r/:room_uid
def destroy def destroy
@room.destroy @room.destroy unless @room == current_user.main_room
redirect_to root_path redirect_to current_user.main_room
end end
# GET /r/:room_uid/start # GET /r/:room_uid/start
@ -87,7 +87,11 @@ class RoomsController < ApplicationController
# GET /r/:room_uid/logout # GET /r/:room_uid/logout
def logout def logout
# Redirect the owner to their room. # Redirect the owner to their room.
redirect_to root_path if current_user
redirect_to current_user.main_room
else
redirect_to root_path
end
end end
# GET /r/:room_uid/sessions # GET /r/:room_uid/sessions

View File

@ -1,5 +1,5 @@
class UsersController < ApplicationController class UsersController < ApplicationController
# GET /signup # GET /signup
def new def new
@user = User.new @user = User.new
@ -9,11 +9,11 @@ class UsersController < ApplicationController
def create def create
user = User.new(user_params) user = User.new(user_params)
user.provider = "greenlight" user.provider = "greenlight"
if user.save if user.save
login(user) login(user)
else else
render :new
end end
end end
@ -25,6 +25,6 @@ class UsersController < ApplicationController
private private
def user_params def user_params
params.require(:user).permit(:name, :email, :username, :password, :password_confirmation) params.require(:user).permit(:name, :email, :password, :password_confirmation)
end end
end end

View File

@ -1,9 +1,9 @@
module SessionsHelper module SessionsHelper
# Logs a user into GreenLight. # Logs a user into GreenLight.
def login(user) def login(user)
session[:user_id] = user.id session[:user_id] = user.id
redirect_to root_path redirect_to user.main_room
#redirect_to room_path(user.room.uid)
end end
# Logs current user out of GreenLight. # Logs current user out of GreenLight.

View File

@ -1,10 +1,13 @@
class Room < ApplicationRecord class Room < ApplicationRecord
before_create :generate_uids before_create :setup
validates :name, presence: true
belongs_to :user belongs_to :user
has_one :meeting has_one :meeting
ROOM_ICONS = %w(circle star certificate play cloud heart square bookmark cog)
RETURNCODE_SUCCESS = "SUCCESS" RETURNCODE_SUCCESS = "SUCCESS"
def to_param def to_param
@ -116,9 +119,11 @@ class Room < ApplicationRecord
end end
# Generates a uid for the room and BigBlueButton. # Generates a uid for the room and BigBlueButton.
def generate_uids def setup
self.uid = [user.firstname, (0...8).map { (65 + rand(26)).chr }.join].join('-') self.uid = [user.firstname, (0...8).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
end end
# Rereives the loadbalanced BigBlueButton credentials for a user. # Rereives the loadbalanced BigBlueButton credentials for a user.

View File

@ -1,12 +1,12 @@
class User < ApplicationRecord class User < ApplicationRecord
after_create :initialize_room after_create :initialize_main_room
before_save { email.downcase! unless email.nil? } before_save { email.downcase! unless email.nil? }
has_many :rooms has_many :rooms
belongs_to :main_room, class_name: 'Room', foreign_key: :room_id, required: false
validates :name, length: { maximum: 24 }, presence: true validates :name, length: { maximum: 24 }, presence: true
validates :username, presence: true
validates :provider, presence: true validates :provider, presence: true
validates :email, length: { maximum: 60 }, allow_nil: true, validates :email, length: { maximum: 60 }, allow_nil: true,
uniqueness: { case_sensitive: false }, uniqueness: { case_sensitive: false },
@ -27,6 +27,7 @@ class User < ApplicationRecord
user.username = send("#{auth['provider']}_username", auth) user.username = send("#{auth['provider']}_username", auth)
user.email = send("#{auth['provider']}_email", auth) user.email = send("#{auth['provider']}_email", auth)
user.image = send("#{auth['provider']}_image", auth) user.image = send("#{auth['provider']}_image", auth)
user.save! user.save!
user user
end end
@ -88,7 +89,8 @@ class User < ApplicationRecord
private private
# Initializes a room for the user. # Initializes a room for the user.
def initialize_room def initialize_main_room
Room.create(user_id: self.id, name: firstname + "'s Room") self.main_room = Room.create!(user: self, name: firstname + "'s Room")
self.save
end end
end end

View File

@ -32,12 +32,12 @@
<%= yield %> <%= yield %>
<%= render "shared/footer" %>
<!-- Modal Load --> <!-- Modal Load -->
<% 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" %>
</body> </body>
</html> </html>

View File

@ -1,28 +1,11 @@
<div class="container"> <div class="container">
<% if current_user %> <h1 id="main-text" class="display-3 text-center text-primary mt-9">Teach Students Online.</h1>
<h1 id="user-text" class="display-3 text-center text-primary mt-9"><%= "Welcome, #{current_user.firstname}." %></h1> <%= render "shared/modals/video_modal" %>
<% else %>
<h1 id="main-text" class="display-3 text-center text-primary mt-9">Teach Students Online.</h1>
<%= render "shared/modals/video_modal" %>
<% end %>
<hr class="small-rule"> <hr class="small-rule">
<% if current_user %> <%= render "shared/features" %>
<div class="row">
<% current_user.rooms.each do |room| %>
<div class="col-4">
<%= link_to room do %>
<%= render "shared/components/room_block", room: room %>
<% end %>
</div>
<% end %>
</div>
<br>
<% else %>
<%= render "shared/features" %>
<% end %>
</div> </div>
<script> <script>

View File

@ -2,7 +2,7 @@
<%= render "shared/components/subtitle", subtitle: "Sessions" %> <%= render "shared/components/subtitle", subtitle: "Sessions" %>
<div class="col-10 offset-1"> <div class="col-12">
<div class="card"> <div class="card">
<div class="table-responsive"> <div class="table-responsive">
<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">
@ -48,6 +48,10 @@
</div> </div>
Unlisted Unlisted
</td> </td>
<td>
<a href="#" class="btn btn-secondary">One</a>
<a href="#" class="btn btn-secondary">One</a>
</td>
<td class="text-center"> <td class="text-center">
<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>

View File

@ -1,15 +1,56 @@
<p>This is a room.</p> <div class="container">
<div class="row mt-9">
<div class="col-9">
<h1 id="user-text" class="display-3 text-left text-primary mb-5"><%= @room.name %></h1>
<label class="form-label text-primary">Invite Participants</label>
<form class="form-inline">
<input id="invite-url" type="text" class="form-control mb-5" value="<%= request.base_url + @room.invite_path %>" readonly="" style="width: 40%;">
<div id="copy" class="btn btn-primary mx-2 mb-5">
<i class="fas fa-copy"></i>
Copy
</div>
<div id="email" class="btn btn-primary mb-5">
<i class="fas fa-envelope"></i>
Email
</div>
</form>
<h4 class="text-left text-primary">2 Sessions | 3 Recordings</h4>
</div>
<div class="col-3">
<%= link_to "Start", start_room_path(@room), class: "btn btn-primary btn-block px-7 start-button float-right" %>
</div>
</div>
<p><%= @room.user.name %><p> <div class="row mt-8 mb-6">
<p><%= @room.uid %><p> <% (current_user.rooms - [@room]).each do |room| %>
<div class="col-4">
<%= link_to room do %>
<%= render "shared/components/room_block", room: room %>
<% end %>
</div>
<% end %>
</div>
</div>
<p>Click below to join the meeting.</p> <%= render "shared/sessions" %>
<% if @room.is_running? %> <script>
<p>meeting is already running</p> var invite_url;
<% else %> var copy = $('#copy');
<%= link_to "Start Room", start_room_path(@room) %>
<% end %>
<br><br> copy.on('click', function(){
<%= link_to "Sessions", sessions_path(@room) %> var inviteURL = $('#invite-url');
inviteURL.select();
var success = document.execCommand("copy");
if (success) {
inviteURL.blur();
copy.addClass('btn-success');
copy.html("<i class='fas fa-check'></i> Copy")
setTimeout(function(){
copy.removeClass('btn-success');
copy.html("<i class='fas fa-copy'></i> Copy")
}, 2000)
}
});
</script>

View File

@ -2,16 +2,14 @@
<div class="container"> <div class="container">
<div class="d-flex"> <div class="d-flex">
<%= link_to root_path, class: "header-brand" do %> <%= link_to root_path, class: "header-brand" do %>
<%= image_tag("bbb_logo.png", class: "header-brand-img") %> <%= image_tag("logo_with_text.png", class: "header-brand-img") %>
<% end %> <% end %>
<div class="d-flex order-lg-2 ml-auto"> <div class="d-flex order-lg-2 ml-auto">
<% if current_user %> <% if current_user %>
<a class="px-3" href="" data-toggle="modal" data-target="#createRoomModal"> <a class="px-5" 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>
<%= render "shared/modals/login_modal" %>
<a class="px-3" href="">Sessions</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 leading-none" data-toggle="dropdown">
<% if current_user.image.nil? %> <% if current_user.image.nil? %>
@ -41,8 +39,11 @@
</div> </div>
</div> </div>
<% else %> <% else %>
<button type="submit" class="btn btn-pill btn-outline-primary ml-auto" data-toggle="modal" data-target="#loginModal">Login</button> <button type="submit" class="btn btn-pill btn-outline-primary mx-2" data-toggle="modal" data-target="#loginModal">Login</button>
<button type="submit" class="btn btn-pill btn-outline-primary mx-2" data-toggle="modal" data-target="#signupModal">Signup</button>
<%= render "shared/modals/login_modal" %> <%= render "shared/modals/login_modal" %>
<%= render "shared/modals/signup_modal" %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -1,42 +0,0 @@
<div <%= "hidden" if hidden %> class="meeting-url-wrapper">
<div class="meeting-url-group">
<input type="text" class="form-control meeting-url"/>
</div>
<% if current_user %>
<% body = t('meeting_invite.signed_in.body', user: current_user.name) %>
<% subject = t('meeting_invite.signed_in.subject', user: current_user.name) %>
<% else %>
<% body = t('meeting_invite.not_signed_in.body') %>
<% subject = t('meeting_invite.not_signed_in.subject') %>
<% end %>
<div class="meeting-url-button-group center-block">
<button type="button" class="btn btn-default meeting-url-copy has-tooltip"
title="<%= t('url_copy_explanation') %>"
data-copied-hint="<%= t('copied') %>"
data-copy-error="<%= t('copy_error') %>"
data-copy-hint="<%= t('url_copy_explanation') %>"
>
<%= icon('clipboard') %>
</button>
<button type="button" class="btn btn-default meeting-invite has-tooltip"
title="<%= t('meeting_invite.explanation') %>"
data-invite-body="<%= body %>"
data-invite-subject="<%= subject %>"
>
<%= icon('envelope-o') %>
</button>
<button type="button" class="btn btn-default meeting-url-qrcode has-tooltip"
title="<%= t('qrcode.explanation') %>"
data-qrcode-generated-hint="<%= t('qrcode.generated') %>"
data-qrcode-generate-error="<%= t('qrcode.generate_error') %>"
data-qrcode-generate-hint="<%= t('qrcode.explanation') %>"
>
<%= icon('qrcode') %>
</button>
</div>
<div class="meeting-url-qrcode-group center-block has-tooltip"></div>
</div>

View File

@ -0,0 +1,76 @@
<div class="sessions pb-5">
<div class="container pt-6">
<%= render "shared/components/subtitle", subtitle: "Sessions" %>
<div class="col-12">
<div class="card">
<div class="table-responsive">
<table class="table table-hover table-outline table-vcenter text-nowrap card-table">
<thead>
<tr>
<th>Name</th>
<th>Thumbnails</th>
<th class="text-left">Length</th>
<th class="text-left">Users</th>
<th class="text-left">Visibility</th>
<th class="text-center"><i class="icon-settings"></i></th>
</tr>
</thead>
<tbody>
<% 3.times do %>
<tr>
<td>
<div>Example Meeting</div>
<div class="small text-muted">
June 21, 2017 <i>(about 3 hours ago)</i>
</div>
</td>
<td>
<img class="thumbnail px-2" src="http://test-install.blindsidenetworks.com/presentation/b622495d927cd99e9898b0601c2b18a5424a0627-1527259102285/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1527259102298/thumbnails/thumb-1.png">
<img class="thumbnail px-2" src="http://test-install.blindsidenetworks.com/presentation/b622495d927cd99e9898b0601c2b18a5424a0627-1527259102285/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1527259102298/thumbnails/thumb-1.png">
<img class="thumbnail px-2" src="http://test-install.blindsidenetworks.com/presentation/b622495d927cd99e9898b0601c2b18a5424a0627-1527259102285/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1527259102298/thumbnails/thumb-1.png">
</td>
<td class="text-left">
<div class="small text-muted text-uppercase">
Length
</div>
1 hr
</td>
<td class="text-left">
<div class="small text-muted text-uppercase">
Users
</div>
4
</td>
<td class="text-left">
<div class="small text-muted text-uppercase">
Visibility
</div>
Unlisted
</td>
<td>
<a href="#" class="btn btn-secondary">Presentation</a>
<a href="#" class="btn btn-secondary">Podcast</a>
</td>
<td class="text-center">
<div class="item-action dropdown">
<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">
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> Action </a>
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-edit-2"></i> Another action </a>
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-message-square"></i> Something else here</a>
<div class="dropdown-divider"></div>
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-link"></i> Separated link</a>
</div>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -26,34 +26,3 @@
</div> </div>
</div> </div>
</div> </div>
<script>
var invite_url;
var copy = $('#copy');
$('#name-input').on('input', function(){
if ($('#name-input').val() == "") {
invite_url = window.location.href + "m/your-meeting-name";
} else {
invite_url = window.location.href + "m/" + encodeURIComponent($('#name-input').val());
}
$('#invite-url').val(invite_url);
});
copy.on('click', function(){
var inviteURL = $('#invite-url');
inviteURL.select();
var success = document.execCommand("copy");
if (success) {
inviteURL.blur();
copy.addClass('btn-success');
copy.html("<i class='fas fa-check'></i> Copy")
setTimeout(function(){
copy.removeClass('btn-success');
copy.html("<i class='fas fa-copy'></i> Copy")
}, 1500)
}
});
</script>

View File

@ -3,7 +3,9 @@
<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="colorinput-color bg-azure"></span> <span class="stamp stamp-md bg-azure mr-3">
<i class="fas fa-<%= room.icon %>"></i>
</span>
</td> </td>
<td> <td>
<div><%= room.name %></div> <div><%= room.name %></div>
@ -17,8 +19,10 @@
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> Action </a> <a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> Action </a>
<a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-edit-2"></i> Another action </a> <a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fe fe-edit-2"></i> Another action </a>
<%= button_to room, method: :delete, data: { confirm: 'Are you sure?' }, class: "dropdown-item" do %> <% if room != current_user.main_room %>
<i class="dropdown-icon fe fe-trash"></i> Delete <%= button_to room, method: :delete, data: { confirm: 'Are you sure?' }, class: "dropdown-item" do %>
<i class="dropdown-icon fe fe-trash"></i> Delete
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
<div class="row"> <div class="row">
<div class="col-10 offset-1"> <div class="col-12">
<p class="subtitle"><%= subtitle %></p> <p class="subtitle"><%= subtitle %></p>
<hr> <hr>
</div> </div>

View File

@ -13,15 +13,14 @@
<span class="input-icon-addon"> <span class="input-icon-addon">
<i class="fas fa-chalkboard-teacher"></i> <i class="fas fa-chalkboard-teacher"></i>
</span> </span>
<%= f.text_field :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>
</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 %>
<span class="custom-switch-indicator"></span> <span class="custom-switch-indicator"></span>
<span class="custom-switch-description">Automatically join me into the room when created.</span> <span class="custom-switch-description">Automatically join me into the room.</span>
</label> </label>
<div class="form-footer"> <div class="form-footer">
<%= f.submit "Create Room", class: "btn btn-outline-primary btn-block btn-pill" %> <%= f.submit "Create Room", id: "create-room-submit", class: "btn btn-outline-primary btn-block btn-pill" %>
</div> </div>
<% end %> <% end %>
</div> </div>
@ -32,3 +31,15 @@
</div> </div>
</div> </div>
</div> </div>
<script>
var roomCreateValidations = function(){
if($('#room-name').val().length == 0){
$('#room-name').addClass("is-invalid");
}
}
$('#create-room-submit').on('click', roomCreateValidations);
</script>

View File

@ -35,11 +35,7 @@
<button type="submit" class="btn btn-outline-primary btn-block btn-pill">Login</button> <button type="submit" class="btn btn-outline-primary btn-block btn-pill">Login</button>
</div> </div>
</div> </div>
<div class="card-footer">
<%= link_to "Don't have an account, sign up!", "google.com" %>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,38 @@
<div class="modal fade" id="signupModal" 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 text-primary">
<h3>Signup</h3>
</div>
<hr class="small-rule">
<%= form_for(@user, url: signup_path) do |f| %>
<div class="form-group">
<%= f.label :name, "Full Name", class: "form-label text-left" %>
<%= f.text_field :name, class: "form-control", placeholder: "Full Name" %>
</div>
<div class="form-group">
<%= f.label :email, "Email", class: "form-label text-left" %>
<%= f.text_field :email, class: "form-control", placeholder: "Email" %>
</div>
<div class="form-group">
<%= f.label :password, "Password", class: "form-label text-left" %>
<%= f.password_field :password, class: "form-control", placeholder: "Password" %>
</div>
<div class="form-group">
<%= f.label :password, "Password Confirmation", class: "form-label text-left" %>
<%= f.password_field :password, class: "form-control", placeholder: "Password Confirmation" %>
</div>
<div class="form-footer">
<%= f.submit "Signup", class: "btn btn-outline-primary btn-block btn-pill" %>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>

View File

@ -3,13 +3,13 @@
<%= render "shared/components/subtitle", subtitle: "Settings" %> <%= render "shared/components/subtitle", subtitle: "Settings" %>
<div class="row"> <div class="row">
<div class="col-2 offset-1"> <div class="col-2">
<button id="account" class="setting-btn btn btn-primary btn-sm btn-block m-2">Account</button> <button id="account" class="setting-btn btn btn-primary btn-sm btn-block m-2">Account</button>
<button id="password" class="setting-btn btn btn-primary btn-sm btn-block m-2">Password</button> <button id="password" class="setting-btn btn btn-primary btn-sm btn-block m-2">Password</button>
<button id="design" class="setting-btn btn btn-primary btn-sm btn-block m-2">Design</button> <button id="design" class="setting-btn btn btn-primary btn-sm btn-block m-2">Design</button>
</div> </div>
<div class="col-8"> <div class="col-10">
<div id="account" class="setting-view card"> <div id="account" class="setting-view card">
<div class="card-body p-6"> <div class="card-body p-6">
<div class="card-title text-primary"> <div class="card-title text-primary">
@ -58,7 +58,7 @@
<hr> <hr>
<div class="form-group"> <div class="form-group">
<div class="row"> <div class="row">
<div class="col-9"> <div class="col-8">
<label class="form-label">Old Password</label> <label class="form-label">Old Password</label>
<input type="password" class="form-control"> <input type="password" class="form-control">
<br> <br>

View File

@ -12,8 +12,7 @@ Rails.application.routes.draw do
get '/sessions', to: 'rooms#sessions', as: :sessions get '/sessions', to: 'rooms#sessions', as: :sessions
end end
# Signup routes. # Signup route.
get '/signup', to: 'users#new'
post '/signup', to: 'users#create' post '/signup', to: 'users#create'
# User settings. # User settings.

View File

@ -1,6 +1,7 @@
class CreateUsers < ActiveRecord::Migration[5.0] class CreateUsers < ActiveRecord::Migration[5.0]
def change def change
create_table :users do |t| create_table :users do |t|
t.belongs_to :room, index: true
t.string :provider t.string :provider
t.string :uid t.string :uid
t.string :name t.string :name

View File

@ -5,6 +5,7 @@ class CreateRooms < ActiveRecord::Migration[5.0]
t.string :name, index: true t.string :name, index: true
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.timestamps t.timestamps
end end

View File

@ -17,15 +17,18 @@ ActiveRecord::Schema.define(version: 20180504131705) do
t.string "name" t.string "name"
t.string "uid" t.string "uid"
t.string "bbb_id" t.string "bbb_id"
t.string "icon"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["bbb_id"], name: "index_rooms_on_bbb_id" t.index ["bbb_id"], name: "index_rooms_on_bbb_id"
t.index ["icon"], name: "index_rooms_on_icon"
t.index ["name"], name: "index_rooms_on_name" t.index ["name"], name: "index_rooms_on_name"
t.index ["uid"], name: "index_rooms_on_uid" t.index ["uid"], name: "index_rooms_on_uid"
t.index ["user_id"], name: "index_rooms_on_user_id" t.index ["user_id"], name: "index_rooms_on_user_id"
end end
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.integer "room_id"
t.string "provider" t.string "provider"
t.string "uid" t.string "uid"
t.string "name" t.string "name"
@ -36,6 +39,7 @@ ActiveRecord::Schema.define(version: 20180504131705) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["password_digest"], name: "index_users_on_password_digest", unique: true t.index ["password_digest"], name: "index_users_on_password_digest", unique: true
t.index ["room_id"], name: "index_users_on_room_id"
end end
end end