Sha256: ca6ec0d26fbda7e48224005de3596caa2b604460c13038ea3bab353040b985c5
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true module ZuoraConnectUi # General helpers for application level module ApplicationHelper def zuo_parameterize(string) string.parameterize(separator: '_') end def zuo_include_tag script_tag(type: 'module', src: anjuna(ANJUNA_VERSION, true)) + script_tag(nomodule: '', src: anjuna(ANJUNA_VERSION, false)) + script_tag(type: 'module', src: charts(ANJUNA_VERSION, true)) + script_tag(nomodule: '', src: charts(ANJUNA_VERSION, false)) + link_tag(href: theme(THEME_VERSION, 'application'), rel: 'stylesheet') + link_tag(href: theme(THEME_VERSION, 'theme'), rel: 'stylesheet') + link_tag(href: theme(THEME_VERSION, 'icons'), rel: 'stylesheet') end def script_tag(attrs) attr_map = attrs.map { |key, value| " #{key}=\"#{value}\"" } "<script#{attr_map.join('')}></script>".html_safe end def anjuna(version, esm) "https://cdn.zuora.com/@anjuna/core@#{version}" \ "/anjuna-core/anjuna-core#{'.esm' if esm}.js" end def charts(version, esm) "https://cdn.zuora.com/@anjuna/charts@#{version}" \ "/anjuna-charts/anjuna-charts#{'.esm' if esm}.js" end def link_tag(attrs) attr_map = attrs.map { |key, value| " #{key}=\"#{value}\"" } "<link#{attr_map.join('')}>".html_safe end def theme(version, file) "https://cdn.zuora.com/@anjuna/theme@#{version}/css/#{file}.css" end ANJUNA_VERSION = '1.2.14' THEME_VERSION = '1.2.14' end end
Version data entries
3 entries across 3 versions & 1 rubygems