Sha256: 80e8008b320f4826a1205e15a945223fdecaa8b1c37125b69751bddf1e5c9fe6
Contents?: true
Size: 1.18 KB
Versions: 24
Compression:
Stored size: 1.18 KB
Contents
module RailsConnector class TimeMachineController < ApplicationController protect_from_forgery :except => :set_preview_time before_filter :only_available_in_editor_mode def index @language = params[:language] || 'de' @preview_time = session[:preview_time] || Time.now end # Set the preview time to the Time as specified by the parameter <tt>:preview_time</tt>. def set_preview_time if preview_time = params[:preview_time] pt = Time.from_iso(preview_time) pt = nil if pt <= Time.now handle_request pt end end # Resets the preview time, so <tt>Time::now</tt> will be used as preview time afterwards. def reset_preview_time handle_request nil end private def handle_request(preview_time) session[:preview_time] = preview_time if request.xhr? render :js => "window.location.reload();" else render :nothing => true end end def only_available_in_editor_mode unless Configuration.editor_interface_enabled? render :template => 'errors/403_forbidden', :status => 403, :content_type => Mime::HTML return false end end end end
Version data entries
24 entries across 24 versions & 1 rubygems