forked from External/greenlight
Improve can't create room view (#723)
* Improve cant create room view * Translate role names in the promoted/demoted emails
This commit is contained in:
parent
402de8189e
commit
46e0595e3a
|
@ -74,3 +74,12 @@
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.avatar-xxxl{
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
line-height: 8rem;
|
||||
max-width: 8rem;
|
||||
margin-top: -6rem;
|
||||
font-size: 5rem;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ class RoomsController < ApplicationController
|
|||
|
||||
@pagy, @recordings = pagy_array(recs)
|
||||
else
|
||||
@recent_rooms = Room.where(id: cookies.encrypted["#{current_user.uid}_recently_joined_rooms"])
|
||||
render :cant_create_rooms
|
||||
end
|
||||
else
|
||||
|
@ -130,6 +131,13 @@ class RoomsController < ApplicationController
|
|||
# create or update cookie with join name
|
||||
cookies.encrypted[:greenlight_name] = @join_name unless cookies.encrypted[:greenlight_name] == @join_name
|
||||
|
||||
if current_user
|
||||
# create or update cookie to track the three most recent rooms a user joined
|
||||
recently_joined_rooms = cookies.encrypted["#{current_user.uid}_recently_joined_rooms"].to_a
|
||||
cookies.encrypted["#{current_user.uid}_recently_joined_rooms"] = recently_joined_rooms.prepend(@room.id)
|
||||
.uniq[0..2]
|
||||
end
|
||||
|
||||
join_room(opts)
|
||||
end
|
||||
|
||||
|
|
|
@ -303,8 +303,8 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
# Send promoted/demoted emails
|
||||
added_roles.each { |role| send_user_promoted_email(@user, role.name) if role.send_promoted_email }
|
||||
removed_roles.each { |role| send_user_demoted_email(@user, role.name) if role.send_demoted_email }
|
||||
added_roles.each { |role| send_user_promoted_email(@user, role) if role.send_promoted_email }
|
||||
removed_roles.each { |role| send_user_demoted_email(@user, role) if role.send_demoted_email }
|
||||
|
||||
# Update the roles
|
||||
@user.roles.delete(removed_roles)
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class UserMailer < ApplicationMailer
|
||||
include ApplicationHelper
|
||||
|
||||
default from: Rails.configuration.smtp_sender
|
||||
|
||||
def verify_email(user, url, image, color)
|
||||
|
@ -40,8 +42,8 @@ class UserMailer < ApplicationMailer
|
|||
@admin_url = url + "admins"
|
||||
@image = image
|
||||
@color = color
|
||||
@role = role
|
||||
mail to: user.email, subject: t('mailer.user.promoted.subtitle', role: role)
|
||||
@role = role.name
|
||||
mail to: user.email, subject: t('mailer.user.promoted.subtitle', role: translated_role_name(role))
|
||||
end
|
||||
|
||||
def user_demoted(user, role, url, image, color)
|
||||
|
@ -49,8 +51,8 @@ class UserMailer < ApplicationMailer
|
|||
@root_url = url
|
||||
@image = image
|
||||
@color = color
|
||||
@role = role
|
||||
mail to: user.email, subject: t('mailer.user.demoted.subtitle', role: role)
|
||||
@role = role.name
|
||||
mail to: user.email, subject: t('mailer.user.demoted.subtitle', role: translated_role_name(role))
|
||||
end
|
||||
|
||||
def invite_email(name, email, url, image, color)
|
||||
|
|
|
@ -18,25 +18,59 @@
|
|||
<div id="cant-create-room-wrapper" class="background h-100 cant-create-room-wrapper">
|
||||
<div class="container h-100">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="offset-3 col-6 offset-3">
|
||||
<div class="card">
|
||||
<div class="card-status bg-primary"></div>
|
||||
<div class="card-header cant-create-rooms-title">
|
||||
<h3 class="card-title"><%= t("room.no_room.title") %></h3>
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<div class="card card-profile h-100">
|
||||
<div class="card-header bg-primary h-50"></div>
|
||||
<div class="card-body text-center">
|
||||
<% if current_user.image.blank? %>
|
||||
<span class="avatar avatar-xxxl card-profile-img bg-primary"><%= current_user.name.first %></span>
|
||||
<% else %>
|
||||
<%= image_tag(current_user.image, class: "avatar avatar-xxxl card-profile-img") %>
|
||||
<% end %>
|
||||
<h2 class="mb-3"><%= current_user.name %></h2>
|
||||
<%= link_to edit_user_path(current_user), class: "btn btn-outline-primary mt-2" do %>
|
||||
<i class="dropdown-icon fas fa-id-card mr-3"></i><%= t("room.no_room.edit_profile") %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p><%= t("room.no_room.description") %></p>
|
||||
<%= form_for(:join_room, url: join_room_path) do |f| %>
|
||||
<div class="input-icon mb-2">
|
||||
<span class="input-icon-addon">
|
||||
<i class="fas fa-link"></i>
|
||||
</span>
|
||||
<%= f.text_field :url, class: "form-control", value: "", placeholder: t("room.no_room.placeholder"), required: "" %>
|
||||
<div class="col-7">
|
||||
<div class="card h-100">
|
||||
<div class="card-status bg-primary"></div>
|
||||
<div class="card-header cant-create-rooms-title">
|
||||
<h3 class="card-title"><%= t("room.no_room.title") %></h3>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<%= f.submit t("room.join"), class:"btn btn-primary btn-block" %>
|
||||
<div class="card-body d-flex flex-column justify-content-center align-items-center">
|
||||
<p class="w-75"><%= t("room.no_room.description") %></p>
|
||||
<%= form_for(:join_room, url: join_room_path, html: {class: "w-75"}) do |f| %>
|
||||
<div class="input-icon mb-2">
|
||||
<span class="input-icon-addon">
|
||||
<i class="fas fa-link"></i>
|
||||
</span>
|
||||
<%= f.text_field :url, class: "form-control", value: "", placeholder: t("room.no_room.placeholder"), required: "" %>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<%= f.submit t("room.no_room.go_to"), class:"btn btn-primary btn-block" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<hr class="mt-0 mb-0">
|
||||
<div class="card-body d-flex flex-column justify-content-center align-items-center">
|
||||
<ul class="list-group w-75 text-center">
|
||||
<li class="list-group-item active"><%= t("room.no_room.recent_rooms") %></li>
|
||||
<% @recent_rooms.each do |room| %>
|
||||
<%= link_to room_path(room), class: "list-group-item list-group-item-action dropdown-item" do %>
|
||||
<%= room.owner.name + " " + room.name %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @recent_rooms.count == 0 %>
|
||||
<li class="list-group-item"><%= t("room.no_room.no_recent_rooms") %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -412,10 +412,14 @@ en:
|
|||
login: Enter
|
||||
owner: Owner
|
||||
no_room:
|
||||
title: Join a Room
|
||||
description: Enter the room url or the room id for the room you want to join.
|
||||
edit_profile: Edit User Profile
|
||||
go_to: Go to the Room
|
||||
invalid_room_uid: The room url/uid you entered was invalid.
|
||||
placeholder: Room url/uid
|
||||
no_recent_rooms: You don't have any recently joined rooms
|
||||
recent_rooms: Go To a Recently Joined Room
|
||||
title: Join a Room
|
||||
no_sessions: This room has no sessions, yet!
|
||||
recordings: Room Recordings
|
||||
room_limit: You have reached the maximum number of rooms allowed
|
||||
|
|
|
@ -53,7 +53,7 @@ class UserMailerPreview < ActionMailer::Preview
|
|||
# http://localhost:3000/rails/mailers/user_mailer/user_promoted
|
||||
def user_promoted
|
||||
user = User.first
|
||||
role = Role.first.name
|
||||
role = Role.first
|
||||
url = "http://example.com"
|
||||
logo_image = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png"
|
||||
user_color = "#467fcf"
|
||||
|
@ -64,7 +64,7 @@ class UserMailerPreview < ActionMailer::Preview
|
|||
# http://localhost:3000/rails/mailers/user_mailer/user_demoted
|
||||
def user_demoted
|
||||
user = User.first
|
||||
role = Role.first.name
|
||||
role = Role.first
|
||||
url = "http://example.com"
|
||||
logo_image = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png"
|
||||
user_color = "#467fcf"
|
||||
|
|
Loading…
Reference in New Issue