Module: NativeHelper

Defined in:
app/helpers/native_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_appObject



3
4
5
# File 'app/helpers/native_helper.rb', line 3

def current_app
    Native::App.find(cookies[:nativeAppId]) if cookies[:nativeAppId]
end

#current_platformObject



7
8
9
# File 'app/helpers/native_helper.rb', line 7

def current_platform
    current_app&.platform || 'web'
end

#native_assetsObject



11
12
13
14
15
# File 'app/helpers/native_helper.rb', line 11

def native_assets
    stylesheet = stylesheet_link_tag "native/#{current_platform}", media: 'all', 'data-turbolinks-track': 'reload'
    javascript = javascript_include_tag "native/#{current_platform}", 'data-turbolinks-track': 'reload'
    stylesheet.concat javascript
end

#set_app_ownerObject



17
18
19
# File 'app/helpers/native_helper.rb', line 17

def set_app_owner
    current_user if current_user
end