From b0512a05691b38ffed83f64e44ea4857b44bc3ad Mon Sep 17 00:00:00 2001 From: Zachary Chai Date: Tue, 14 Mar 2017 12:13:18 -0400 Subject: [PATCH 1/2] allow periods in meeting name --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index f9e764ad..c20412e9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -45,7 +45,7 @@ Rails.application.routes.draw do # routes shared between meetings and rooms get '/(:room_id)/:id/join', to: 'bbb#join', defaults: {room_id: nil, format: 'json'} - get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil} + get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}, :constraints => {:id => /[^\/]+/} end root to: 'landing#index', :resource => 'meetings' From b2031c97a3f5c2f4a6bd0f25cc42f9af8df73b4d Mon Sep 17 00:00:00 2001 From: Zachary Chai Date: Tue, 14 Mar 2017 14:16:14 -0400 Subject: [PATCH 2/2] add rails flash messages that dismiss after 5 seconds --- app/assets/javascripts/shared.js.erb | 8 ++++++++ app/controllers/landing_controller.rb | 4 ++-- app/views/layouts/application.html.erb | 10 ++++++++++ config/routes.rb | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/shared.js.erb b/app/assets/javascripts/shared.js.erb index dd7cc53e..5b8e4c5f 100644 --- a/app/assets/javascripts/shared.js.erb +++ b/app/assets/javascripts/shared.js.erb @@ -51,6 +51,13 @@ var showAlert = function(html, timeout_delay) { } }; +// remove flash alerts after 5 seconds +var flashAlertDelayedDismiss = function() { + setTimeout(function(){ + $('.flash-alerts').remove(); + }, 5000); +}; + var displayRoomURL = function() { $('.meeting-url').val(Meeting.getInstance().getURL()); }; @@ -78,4 +85,5 @@ $(document).on("turbolinks:load", function() { if (isRoomOwner()) { Notification.requestPermission(); } + flashAlertDelayedDismiss(); }); diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb index b02ed8aa..a955b0c5 100644 --- a/app/controllers/landing_controller.rb +++ b/app/controllers/landing_controller.rb @@ -23,12 +23,12 @@ class LandingController < ApplicationController def resource if params[:id].size > meeting_name_limit redirect_to action: :index - elsif params[:resource] == 'meetings' + elsif params[:resource] == 'meetings' && !params[:room_id] render_meeting elsif params[:resource] == 'rooms' render_room else - render 'errors/error' + redirect_to root_url, flash: {danger: "An error occured"} end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d213488d..d876d168 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -51,6 +51,16 @@ with BigBlueButton; if not, see . style="background-image:url(<%= image_path('greenlight_background.png') if params[:controller] == 'landing' %>);">
+
+ <% flash.each do |name, msg| %> + + <% end %> +
diff --git a/config/routes.rb b/config/routes.rb index c20412e9..15caf951 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -45,7 +45,7 @@ Rails.application.routes.draw do # routes shared between meetings and rooms get '/(:room_id)/:id/join', to: 'bbb#join', defaults: {room_id: nil, format: 'json'} - get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}, :constraints => {:id => /[^\/]+/} + get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}, :constraints => {:id => /[^\/]+/} # override the constraint to allow '.' and disallow '/' end root to: 'landing#index', :resource => 'meetings'