forked from External/greenlight
finish settings and public recordings
This commit is contained in:
parent
39b687a58f
commit
8390e075e1
|
@ -25,9 +25,10 @@ class RoomsController < ApplicationController
|
||||||
# GET /r/:room_uid
|
# GET /r/:room_uid
|
||||||
def show
|
def show
|
||||||
if current_user && @room.owned_by?(current_user)
|
if current_user && @room.owned_by?(current_user)
|
||||||
@is_running = @room.is_running?
|
|
||||||
@recordings = @room.recordings
|
@recordings = @room.recordings
|
||||||
|
@is_running = @room.is_running?
|
||||||
else
|
else
|
||||||
|
@recordings = @room.public_recordings
|
||||||
render :join
|
render :join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -97,10 +98,8 @@ class RoomsController < ApplicationController
|
||||||
meta = {
|
meta = {
|
||||||
"meta_#{META_LISTED}": (params[:state] == "public")
|
"meta_#{META_LISTED}": (params[:state] == "public")
|
||||||
}
|
}
|
||||||
puts '-------------'
|
|
||||||
puts params[:record_id]
|
|
||||||
res = @room.update_recording(params[:record_id], meta)
|
res = @room.update_recording(params[:record_id], meta)
|
||||||
puts res
|
|
||||||
redirect_to @room if res[:updated]
|
redirect_to @room if res[:updated]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ class UsersController < ApplicationController
|
||||||
# Update account information if passed.
|
# Update account information if passed.
|
||||||
@user.name = user_params[:name] if user_params[:name]
|
@user.name = user_params[:name] if user_params[:name]
|
||||||
@user.email = user_params[:email] if user_params[:email]
|
@user.email = user_params[:email] if user_params[:email]
|
||||||
|
@user.image = user_params[:image] if user_params[:image]
|
||||||
|
|
||||||
|
# Custom errors not generated by validations.
|
||||||
|
errors = {}
|
||||||
|
|
||||||
# Verify that the provided password is correct.
|
# Verify that the provided password is correct.
|
||||||
if user_params[:password] && @user.authenticate(user_params[:password])
|
if user_params[:password] && @user.authenticate(user_params[:password])
|
||||||
|
@ -50,17 +54,20 @@ class UsersController < ApplicationController
|
||||||
@user.password = user_params[:new_password]
|
@user.password = user_params[:new_password]
|
||||||
else
|
else
|
||||||
# New passwords don't match.
|
# New passwords don't match.
|
||||||
|
errors[:password_confirmation] = "'s don't match"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Original password is incorrect, can't update.
|
# Original password is incorrect, can't update.
|
||||||
|
errors[:password] = "is incorrect"
|
||||||
end
|
end
|
||||||
|
|
||||||
if @user.save
|
if @user.save
|
||||||
# Notify the use that their account has been updated.
|
# Notify the use that their account has been updated.
|
||||||
redirect_to edit_user_path(@user), notice: "Information successfully updated."
|
redirect_to edit_user_path(@user), notice: "Information successfully updated."
|
||||||
else
|
else
|
||||||
|
# Append custom errors.
|
||||||
|
errors.each do |k, v| @user.errors.add(k, v) end
|
||||||
|
|
||||||
# Handle validation errors.
|
# Handle validation errors.
|
||||||
render :edit
|
render :edit
|
||||||
end
|
end
|
||||||
|
@ -82,6 +89,6 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_params
|
def user_params
|
||||||
params.require(:user).permit(:name, :email, :password, :password_confirmation, :new_password, :provider)
|
params.require(:user).permit(:name, :email, :image, :password, :password_confirmation, :new_password, :provider)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Room < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fetches all recordings for a meeting.
|
# Fetches all recordings for a room.
|
||||||
def recordings
|
def recordings
|
||||||
res = bbb.get_recordings(meetingID: bbb_id)
|
res = bbb.get_recordings(meetingID: bbb_id)
|
||||||
|
|
||||||
|
@ -130,6 +130,11 @@ class Room < ApplicationRecord
|
||||||
res[:recordings]
|
res[:recordings]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Fetches a rooms public recordings.
|
||||||
|
def public_recordings
|
||||||
|
recordings.select do |r| r[:metadata]["gl-listed"] end
|
||||||
|
end
|
||||||
|
|
||||||
def update_recording(record_id, meta)
|
def update_recording(record_id, meta)
|
||||||
meta.merge!({recordID: record_id})
|
meta.merge!({recordID: record_id})
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
validates :name, length: { maximum: 24 }, presence: true
|
validates :name, length: { maximum: 24 }, presence: true
|
||||||
validates :provider, presence: true
|
validates :provider, presence: true
|
||||||
validates :email, length: { maximum: 60 }, allow_nil: true,
|
validates :image, format: {with: /\.(png|jpg)\Z/i}, allow_blank: true
|
||||||
|
validates :email, length: { maximum: 60 }, allow_blank: true,
|
||||||
uniqueness: { case_sensitive: false },
|
uniqueness: { case_sensitive: false },
|
||||||
format: {with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }
|
format: {with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def twitter_image(auth)
|
def twitter_image(auth)
|
||||||
auth['info']['image']
|
auth['info']['image'].gsub!("_normal", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
def google_name(auth)
|
def google_name(auth)
|
||||||
|
@ -72,7 +73,7 @@ class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def google_image(auth)
|
def google_image(auth)
|
||||||
auth['info']['picture']
|
auth['info']['image']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render "shared/sessions", recordings: @recordings %>
|
<%= render "shared/sessions", recordings: @recordings, only_public: false %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var invite_url;
|
var invite_url;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</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">
|
||||||
<% if current_user.image.nil? %>
|
<% if current_user.image.blank? %>
|
||||||
<span class="avatar"><%= current_user.name.first %></span>
|
<span class="avatar"><%= current_user.name.first %></span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="avatar" style="background-image: url(<%= current_user.image %>)"></span>
|
<span class="avatar" style="background-image: url(<%= current_user.image %>)"></span>
|
||||||
|
|
|
@ -24,3 +24,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= render "shared/sessions", recordings: @recordings, only_public: true %>
|
||||||
|
|
|
@ -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", search: true %>
|
<%= render "shared/components/subtitle", subtitle: (only_public ? "Public " : "") + "Recordings", search: true %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<% if recordings.empty? %>
|
<% if recordings.empty? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="7" class="text-center h4 p-6 font-weight-normal">
|
<td colspan="7" class="text-center h4 p-6 font-weight-normal">
|
||||||
This room has no recordings.
|
<%= "This room has no #{(only_public ? "public " : "")} recordings." %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
<div class="modal-content text-center">
|
<div class="modal-content text-center">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="card-body p-6">
|
<div class="card-body p-6">
|
||||||
<div class="card-title text-primary">
|
<div class="card-title">
|
||||||
<h3>Create New Room</h3>
|
<h3>Create New Room</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class="small-rule">
|
|
||||||
<%= form_for(:room, url: rooms_path) do |f| %>
|
<%= form_for(:room, url: rooms_path) do |f| %>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<span class="input-icon-addon">
|
<span class="input-icon-addon">
|
||||||
|
|
|
@ -5,26 +5,34 @@
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<%= f.label "Fullname", class: "form-label" %>
|
<%= f.label "Fullname", class: "form-label" %>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<span class="input-icon-addon">
|
<%= f.text_field :name, class: "form-control #{form_is_invalid?(@user, :name)}", value: @user.name, placeholder: "Fullname" %>
|
||||||
<i class="fas fa-user"></i>
|
|
||||||
</span>
|
|
||||||
<%= f.text_field :name, class: "form-control", value: @user.name, placeholder: "Fullname" %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<%= f.label "Email", class: "form-label" %>
|
<%= f.label "Email", class: "form-label" %>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<span class="input-icon-addon">
|
<%= f.text_field :email, class: "form-control #{form_is_invalid?(@user, :email)}", value: @user.email, placeholder: "Email" %>
|
||||||
<i class="fas fa-at"></i>
|
|
||||||
</span>
|
|
||||||
<%= f.text_field :email, class: "form-control #{'is-invalid' if !@user.errors.messages[:email].empty?}", value: @user.email, placeholder: "Email" %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<%= f.label "Provider", class: "form-label" %>
|
<%= 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", value: @user.provider.capitalize, readonly: "" %>
|
||||||
|
|
||||||
|
<%= f.label "Image", class: "form-label mt-5" %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-2">
|
||||||
|
<% if current_user.image.blank? %>
|
||||||
|
<span class="avatar avatar-xxl mr-5 mt-2"><%= current_user.name.first %></span>
|
||||||
|
<% else %>
|
||||||
|
<span class="avatar avatar-xxl mr-5 mt-2" style="background-image: url(<%= current_user.image %>)"></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="col-10" style="transform: translateY(25%);">
|
||||||
|
<%= f.text_field :image, class: "form-control #{form_is_invalid?(@user, :image)}", value: @user.image, placeholder: "Profile Image URL" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<%= f.submit "Update", class: "btn btn-primary float-right" %>
|
<%= f.submit "Update", class: "btn btn-primary float-right" %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-12">
|
||||||
|
<center>Customization not currently supported.</center>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<div class="form-group">
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -4,13 +4,13 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<%= f.label "Old Password", class: "form-label" %>
|
<%= f.label "Old Password", class: "form-label" %>
|
||||||
<%= f.password_field :password, class: "form-control" %>
|
<%= f.password_field :password, class: "form-control #{form_is_invalid?(@user, :password)}" %>
|
||||||
<br>
|
<br>
|
||||||
<%= f.label "New Password", class: "form-label" %>
|
<%= f.label "New Password", class: "form-label" %>
|
||||||
<%= f.password_field :new_password, class: "form-control" %>
|
<%= f.password_field :new_password, class: "form-control #{form_is_invalid?(@user, :password)}" %>
|
||||||
<br>
|
<br>
|
||||||
<%= f.label "New Password Confirmation", class: "form-label" %>
|
<%= f.label "New Password Confirmation", class: "form-label" %>
|
||||||
<%= f.password_field :password_confirmation, class: "form-control" %>
|
<%= f.password_field :password_confirmation, class: "form-control #{form_is_invalid?(@user, :password_confirmation)}" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,23 +5,19 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-3 mb-4">
|
<div class="col-lg-3 mb-4">
|
||||||
<div class="list-group list-group-transparent mb-0">
|
<div class="list-group list-group-transparent mb-0">
|
||||||
<%= link_to edit_user_path(@user, setting: "account"), id: "account", class: "list-group-item list-group-item-action setting-btn" do %>
|
<button id="account" class="list-group-item list-group-item-action setting-btn active">
|
||||||
<span class="icon mr-3"><i class="fe fe-user"></i></span>Account
|
<span class="icon mr-3"><i class="fe fe-user"></i></span>Account
|
||||||
<% end %>
|
</button>
|
||||||
|
|
||||||
<%= link_to edit_user_path(@user, setting: "image"), id: "image", class: "list-group-item list-group-item-action setting-btn" do %>
|
|
||||||
<span class="icon mr-3"><i class="fe fe-image"></i></span>Profile Image
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @user.social_uid.nil? %>
|
<% if @user.social_uid.nil? %>
|
||||||
<%= link_to edit_user_path(@user, setting: "password"), id: "password", class: "list-group-item list-group-item-action setting-btn" do %>
|
<button id="password" class="list-group-item list-group-item-action setting-btn">
|
||||||
<span class="icon mr-3"><i class="fe fe-lock"></i></span>Password
|
<span class="icon mr-3"><i class="fe fe-lock"></i></span>Password
|
||||||
<% end %>
|
</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link_to edit_user_path(@user, setting: "design"), id: "design", class: "list-group-item list-group-item-action setting-btn" do %>
|
<button id="design" class="list-group-item list-group-item-action setting-btn">
|
||||||
<span class="icon mr-3"><i class="fe fe-edit-2"></i></span>Design
|
<span class="icon mr-3"><i class="fe fe-edit-2"></i></span>Design
|
||||||
<% end %>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @user.errors.any? %>
|
<% if @user.errors.any? %>
|
||||||
|
@ -41,7 +37,6 @@
|
||||||
|
|
||||||
<div class="col-lg-9">
|
<div class="col-lg-9">
|
||||||
<%= render "shared/settings/setting_view", setting_id: "account", setting_title: "Update your Account Info" %>
|
<%= render "shared/settings/setting_view", setting_id: "account", setting_title: "Update your Account Info" %>
|
||||||
<%= render "shared/settings/setting_view", setting_id: "image", setting_title: "Change your Profile Image" %>
|
|
||||||
|
|
||||||
<% if @user.social_uid.nil? %>
|
<% if @user.social_uid.nil? %>
|
||||||
<%= render "shared/settings/setting_view", setting_id: "password", setting_title: "Change your Password" %>
|
<%= render "shared/settings/setting_view", setting_id: "password", setting_title: "Change your Password" %>
|
||||||
|
@ -53,34 +48,23 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/*
|
settingsButtons = $('.setting-btn');
|
||||||
// Helper for grabbing URL params.
|
|
||||||
$.urlParam = function(name){
|
|
||||||
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
|
|
||||||
if (results==null){
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return results[1] || 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsViews = $('.setting-view');
|
settingsViews = $('.setting-view');
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var setting = $.urlParam("setting");
|
settingsButtons.each(function(i, btn) {
|
||||||
|
if(i != 0){ $(settingsViews[i]).hide(); }
|
||||||
/*if (!["account", "image", "password", "design"].includes(setting)){
|
$(btn).click(function(){
|
||||||
var url = [location.protocol, '//', location.host, location.pathname].join('');
|
$(btn).addClass("active");
|
||||||
window.location.href = url + "?setting=account";
|
|
||||||
}
|
|
||||||
if (!["account", "image", "password", "design"].includes(setting)){ setting = "account"; }
|
|
||||||
|
|
||||||
$("#" + setting).addClass("active");
|
|
||||||
|
|
||||||
settingsViews.each(function(i, view){
|
settingsViews.each(function(i, view){
|
||||||
if($(view).attr("id") != setting){
|
if($(view).attr("id") == $(btn).attr("id")){
|
||||||
|
$(view).show();
|
||||||
|
} else {
|
||||||
|
$(settingsButtons[i]).removeClass("active");
|
||||||
$(view).hide();
|
$(view).hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});*/
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue