Module: SessionTimeoutPrompter::PromptHelper
- Defined in:
- app/helpers/session_timeout_prompter/prompt_helper.rb
Instance Method Summary collapse
-
#init_session_timeout_prompter(session_timeout_in_seconds:, seconds_to_warn_before_timeout:, scope:) ⇒ Object
session_timeout_in_seconds: The session timeout length set for your app (most often from User.timeout_in.to_i if using Devise).
-
#session_timeout_prompter_icon(name, text:) ⇒ Object
Don’t create a dependency on FontAwesome.
- #session_timeout_prompter_translate(key) ⇒ Object
Instance Method Details
#init_session_timeout_prompter(session_timeout_in_seconds:, seconds_to_warn_before_timeout:, scope:) ⇒ Object
session_timeout_in_seconds: The session timeout length set for your app
(most often from User.timeout_in.to_i if using Devise)
seconds_to_warn_before_timeout: Show a warning this many seconds before the session times out.
scope: e.g. :user - most often the name of the Devise scope/model
session_key: Unique key for this app and scope - used to enable multi-tab support
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/session_timeout_prompter/prompt_helper.rb', line 12 def init_session_timeout_prompter(session_timeout_in_seconds:, seconds_to_warn_before_timeout:, scope:) render( partial: "session_timeout_prompter/modal_dialogs", locals: { container_data_attributes: { server_ping_path: session_timeout_prompter.server_pings_path, session_timeout_in_seconds: session_timeout_in_seconds, seconds_to_warn_before_timeout: seconds_to_warn_before_timeout, session_key: "#{::Rails.application.class.parent_name.downcase}-#{scope}" } } ) end |
#session_timeout_prompter_icon(name, text:) ⇒ Object
Don’t create a dependency on FontAwesome
31 32 33 34 35 36 37 |
# File 'app/helpers/session_timeout_prompter/prompt_helper.rb', line 31 def session_timeout_prompter_icon(name, text:) if defined?(fa_icon) fa_icon name, text: text else text end end |
#session_timeout_prompter_translate(key) ⇒ Object
26 27 28 |
# File 'app/helpers/session_timeout_prompter/prompt_helper.rb', line 26 def session_timeout_prompter_translate(key) I18n.t("session_timeout_prompter.#{key}") end |