mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 21:56:19 +10:00
Safari 9.0 does not yet honor the HTML5 `origin-when-cross-origin` mode, and it's possible load balancers/proxies strip the HTTP_REFERER from the request header. In these cases, default to some default path. Closes #3122 Closes https://github.com/gitlabhq/gitlabhq/issues/9731
40 lines
959 B
Ruby
40 lines
959 B
Ruby
class Admin::BroadcastMessagesController < Admin::ApplicationController
|
|
before_action :broadcast_messages
|
|
|
|
def index
|
|
@broadcast_message = BroadcastMessage.new
|
|
end
|
|
|
|
def create
|
|
@broadcast_message = BroadcastMessage.new(broadcast_message_params)
|
|
|
|
if @broadcast_message.save
|
|
redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully created.'
|
|
else
|
|
render :index
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
BroadcastMessage.find(params[:id]).destroy
|
|
|
|
respond_to do |format|
|
|
format.html { redirect_back_or_default(default: { action: 'index' }) }
|
|
format.js { render nothing: true }
|
|
end
|
|
end
|
|
|
|
protected
|
|
|
|
def broadcast_messages
|
|
@broadcast_messages ||= BroadcastMessage.order("starts_at DESC").page(params[:page])
|
|
end
|
|
|
|
def broadcast_message_params
|
|
params.require(:broadcast_message).permit(
|
|
:alert_type, :color, :ends_at, :font,
|
|
:message, :starts_at
|
|
)
|
|
end
|
|
end
|