diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index e579abcd..a8948c7e 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -30,3 +30,5 @@
//= require tabler.plugins
//= require turbolinks
//= require_tree .
+//= require jquery
+//= require jquery_ujs
diff --git a/app/assets/javascripts/rename.js b/app/assets/javascripts/rename.js
new file mode 100644
index 00000000..30c68454
--- /dev/null
+++ b/app/assets/javascripts/rename.js
@@ -0,0 +1,163 @@
+// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
+//
+// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
+//
+// This program is free software; you can redistribute it and/or modify it under the
+// terms of the GNU Lesser General Public License as published by the Free Software
+// Foundation; either version 3.0 of the License, or (at your option) any later
+// version.
+//
+// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License along
+// with BigBlueButton; if not, see
- <%= room.name %>+
+
+
<%= room.name %>+
<% if room.sessions > 0 %>
<%= t("room.last_session", session: recording_date(room.last_session)) %>
@@ -47,6 +52,9 @@
<%= t("room.settings") %>
<% end %>
-->
+
+ <%= t("rename") %>
+
<%= t("delete") %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e466cc28..a406da1d 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -100,6 +100,11 @@ en:
login:
or: or
with: Sign in with %{provider}
+ rename_recording:
+
+ rename_room:
+ name_placeholder: Enter a new room name...
+ name_update_success: Room name successfully changed!
omniauth_error: An error occured while authenticating with omniauth. Please try again or contact an administrator!
password: Password
provider:
@@ -120,6 +125,7 @@ en:
visibility:
public: Public
unlisted: Unlisted
+ rename: Rename
room:
invited: You have been invited to join
invite_participants: Invite Participants
diff --git a/config/routes.rb b/config/routes.rb
index 597c78b6..90f6d854 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -61,6 +61,7 @@ Rails.application.routes.draw do
# Extended room routes.
scope '/:room_uid' do
post '/', to: 'rooms#join'
+ patch '/', to: 'rooms#update', as: :update_room
post '/start', to: 'rooms#start', as: :start_room
get '/logout', to: 'rooms#logout', as: :logout_room
diff --git a/spec/controllers/rooms_controller_spec.rb b/spec/controllers/rooms_controller_spec.rb
index 429ce430..c5f16b74 100644
--- a/spec/controllers/rooms_controller_spec.rb
+++ b/spec/controllers/rooms_controller_spec.rb
@@ -18,6 +18,15 @@
require "rails_helper"
+def random_valid_room_params
+ {
+ room: {
+ name: Faker::Name.first_name,
+ auto_join: false,
+ },
+ }
+end
+
describe RoomsController, type: :controller do
describe "GET #show" do
before do
@@ -186,4 +195,38 @@ describe RoomsController, type: :controller do
expect(response).to redirect_to(root_path)
end
end
+
+ describe "PATCH #update" do
+ before do
+ @user = create(:user)
+ @secondary_room = create(:room, owner: @user)
+ @editable_room = create(:room, owner: @user)
+ end
+
+ it "properly updates room name through room block and redirects to current page" do
+ @request.session[:user_id] = @user.id
+
+ patch :update, params: { room_uid: @secondary_room, room_block_uid: @editable_room,
+ setting: :rename_block, room_name: :name }
+
+ expect(response).to redirect_to(@secondary_room)
+ end
+
+ it "properly updates room name through room header and redirects to current page" do
+ @request.session[:user_id] = @user.id
+
+ patch :update, params: { room_uid: @secondary_room, setting: :rename_header, room_name: :name }
+
+ expect(response).to redirect_to(@secondary_room)
+ end
+
+ it "properly updates recording name and redirects to current page" do
+ @request.session[:user_id] = @user.id
+
+ patch :update, params: { room_uid: @secondary_room, recordid: :recordid,
+ setting: :rename_recording, record_name: :name }
+
+ expect(response).to redirect_to(@secondary_room)
+ end
+ end
end
|