Module: Glib::Auth::Response
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/glib/auth/response.rb
Overview
Keep this module small because it needs to be compatible with Devise::FailureApp, which is not a Rails controller.
Instance Method Summary collapse
- #__glib_error_dialog(title, message, bottom_views = []) ⇒ Object
- #glib_json_dialog_mode? ⇒ Boolean
- #json_ui_401_response(sign_in_url) ⇒ Object
Instance Method Details
#__glib_error_dialog(title, message, bottom_views = []) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/concerns/glib/auth/response.rb', line 14 def __glib_error_dialog(title, , bottom_views = []) { action: 'dialogs/show', # Don't show another dialog, just use the current one since it's a new dialog anyway, which means # that it wouldn't contain existing user data. updateExisting: glib_json_dialog_mode?, title: title, body: { childViews: [ { view: 'label', text: }, ].concat(bottom_views), padding: { x: 20, y: 22, }, } } end |
#glib_json_dialog_mode? ⇒ Boolean
10 11 12 |
# File 'app/controllers/concerns/glib/auth/response.rb', line 10 def glib_json_dialog_mode? params[:_dialog].present? # E.g. _dialog=v1 end |
#json_ui_401_response(sign_in_url) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/concerns/glib/auth/response.rb', line 36 def json_ui_401_response(sign_in_url) { # Handle dialogs_open and windows_open glib_json_dialog_mode? ? :onLoad : :onResponse => __glib_error_dialog( 'Your session has ended', 'Please re-login.', [ { view: 'spacer', height: 20 }, { view: 'button', text: 'Re-login', onClick: { action: 'dialogs/close', onClose: { action: 'windows/open', url: sign_in_url } } }, ]) } end |