forked from External/greenlight
add rails flash messages that dismiss after 5 seconds
This commit is contained in:
parent
b0512a0569
commit
b2031c97a3
|
@ -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() {
|
var displayRoomURL = function() {
|
||||||
$('.meeting-url').val(Meeting.getInstance().getURL());
|
$('.meeting-url').val(Meeting.getInstance().getURL());
|
||||||
};
|
};
|
||||||
|
@ -78,4 +85,5 @@ $(document).on("turbolinks:load", function() {
|
||||||
if (isRoomOwner()) {
|
if (isRoomOwner()) {
|
||||||
Notification.requestPermission();
|
Notification.requestPermission();
|
||||||
}
|
}
|
||||||
|
flashAlertDelayedDismiss();
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,12 +23,12 @@ class LandingController < ApplicationController
|
||||||
def resource
|
def resource
|
||||||
if params[:id].size > meeting_name_limit
|
if params[:id].size > meeting_name_limit
|
||||||
redirect_to action: :index
|
redirect_to action: :index
|
||||||
elsif params[:resource] == 'meetings'
|
elsif params[:resource] == 'meetings' && !params[:room_id]
|
||||||
render_meeting
|
render_meeting
|
||||||
elsif params[:resource] == 'rooms'
|
elsif params[:resource] == 'rooms'
|
||||||
render_room
|
render_room
|
||||||
else
|
else
|
||||||
render 'errors/error'
|
redirect_to root_url, flash: {danger: "An error occured"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,16 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||||
style="background-image:url(<%= image_path('greenlight_background.png') if params[:controller] == 'landing' %>);">
|
style="background-image:url(<%= image_path('greenlight_background.png') if params[:controller] == 'landing' %>);">
|
||||||
<!-- Messages -->
|
<!-- Messages -->
|
||||||
<div id='alerts'>
|
<div id='alerts'>
|
||||||
|
<div class='flash-alerts'>
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<div class="alert alert-<%= name %> alert-dismissible fade in" role="alert">
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<span class="alert-message"><%= msg %></span>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
|
|
|
@ -45,7 +45,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
# routes shared between meetings and rooms
|
# routes shared between meetings and rooms
|
||||||
get '/(:room_id)/:id/join', to: 'bbb#join', defaults: {room_id: nil, format: 'json'}
|
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
|
end
|
||||||
|
|
||||||
root to: 'landing#index', :resource => 'meetings'
|
root to: 'landing#index', :resource => 'meetings'
|
||||||
|
|
Loading…
Reference in New Issue