Module: NeetoCommonsBackend::Helpers
- Extended by:
- ActionView::Helpers::AssetTagHelper, ActionView::Helpers::AssetUrlHelper
- Defined in:
- lib/neeto_commons_backend/helpers/favicon.rb,
lib/neeto_commons_backend/helpers/global_props.rb,
lib/neeto_commons_backend/helpers/neeto_widget_helper.rb
Defined Under Namespace
Classes: AuthServerApi
Class Attribute Summary collapse
-
.current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
.organization ⇒ Object
readonly
Returns the value of attribute organization.
Class Method Summary collapse
- .build_neeto_widget_script_url ⇒ Object
- .common_client_props(organization, current_user) ⇒ Object
- .favicon(organization) ⇒ Object
- .get_neeto_widget_environment ⇒ Object
Class Attribute Details
.current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
6 7 8 |
# File 'lib/neeto_commons_backend/helpers/global_props.rb', line 6 def current_user @current_user end |
.organization ⇒ Object (readonly)
Returns the value of attribute organization.
6 7 8 |
# File 'lib/neeto_commons_backend/helpers/global_props.rb', line 6 def organization @organization end |
Class Method Details
.build_neeto_widget_script_url ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/neeto_commons_backend/helpers/neeto_widget_helper.rb', line 6 def = { production: "https://d13nryxs46eypn.cloudfront.net/neeto-widget.js", staging: "https://d13nryxs46eypn.cloudfront.net/neeto-widget-staging.js" } Rails.env == "production" ? [:production] : [:staging] end |
.common_client_props(organization, current_user) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/neeto_commons_backend/helpers/global_props.rb', line 8 def common_client_props(organization, current_user) @organization = organization @current_user = current_user @neeto_data = neeto_data if current_user.present? global_props = { rails_env: Rails.env, honeybadger_api_key: ENV["HONEYBADGER_JS_API_KEY"] || ENV["HONEYBADGER_API_KEY"], honeybadger_revision: ENV["HEROKU_SLUG_COMMIT"], organization: organization&.as_json(only: %i[name subdomain favicon_url]), authenticated: current_user.present?, app_name: build_app_name } user_props = if current_user.present? { user: current_user.as_json.merge( authentication_token: current_user.authentication_token, date_format: current_user.date_format ? current_user.date_format_before_type_cast.upcase : "DD/MM/YYYY" ), neeto_apps: user_data(:neeto_apps), is_owner: user_data(:is_owner), permissions: } else {} end global_props.merge(user_props) end |
.favicon(organization) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/neeto_commons_backend/helpers/favicon.rb', line 9 def favicon(organization) if organization&.favicon_url&.present? favicon_link_tag organization.favicon_url else favicon_link_tag "/favicon.ico" end end |
.get_neeto_widget_environment ⇒ Object
14 15 16 |
# File 'lib/neeto_commons_backend/helpers/neeto_widget_helper.rb', line 14 def Rails.env == "production" ? "production" : "staging" end |