zuora_connect_ui 0.11.8 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b75f3d3cf14a7411bdead1cd83dbbc4047ee7666dcb8f345f5d04877cff44da7
4
- data.tar.gz: 6946aab23da7a0b10f7944db7e4a9a94d4e6de6f2e3d1e75665596880c470d06
3
+ metadata.gz: af05f9c154c0a34817597e9adf7229897d218a74dc31e8f3913701224c608453
4
+ data.tar.gz: fc815683a22743e2f346cb57f1f7072f54c4ff3c2f7fcdc089e08b82ce6901bc
5
5
  SHA512:
6
- metadata.gz: 21f7d99ad494bca3070d15ad2f16aa841744efbb71a2f27887e0983156584fb07e292f2c30c40fb2fd8b2fb14afeae1f9b41e57d0c3b6145470e57994d160a7a
7
- data.tar.gz: b354f52d8864d0d5a232955a095eb93b2669cb8bb2783a94be7a630391825e1e2943cee590c47da56b786ab65c9066e571250704966483a0c991405d7f43759b
6
+ metadata.gz: 7e4141390d9ed416295554014ae6529bc1bce7dc0cdca4d2ea8e6f99410ef20f61a7ce1c8c46aee57d115f05473f5a2bd908a08331f1751776ba42d1c452128e
7
+ data.tar.gz: 0ecfba913b5f1a6d2ddf2966b1fcf325b90465692dc32faa85fd8c22bc6c011946a136fd4194f77c980738e38ae9ce9389b0bd8a0288c10e461fd071df10fb12
@@ -1,6 +1,6 @@
1
1
  const process = {
2
2
  env: {
3
- APP_NAME: "<%= Rails.application.class.parent_name %>",
3
+ APP_NAME: "<%= ZuoraConnectUi.app_parent_name %>",
4
4
  NODE_ENV: "<%= Rails.env %>",
5
5
  ZUORA_CONNECT_UI: true
6
6
  }
@@ -6,44 +6,5 @@ module ZuoraConnectUi
6
6
  def zuo_parameterize(string)
7
7
  string.parameterize(separator: '_')
8
8
  end
9
-
10
- def zuo_include_tag
11
- script_tag(type: 'module', src: anjuna(ANJUNA_VERSION, true)) +
12
- script_tag(nomodule: '', src: anjuna(ANJUNA_VERSION, false)) +
13
- script_tag(type: 'module', src: charts(ANJUNA_VERSION, true)) +
14
- script_tag(nomodule: '', src: charts(ANJUNA_VERSION, false)) +
15
- link_tag(href: theme(THEME_VERSION, 'application'), rel: 'stylesheet') +
16
- link_tag(href: theme(THEME_VERSION, 'theme'), rel: 'stylesheet') +
17
- link_tag(href: theme(THEME_VERSION, 'icons'), rel: 'stylesheet')
18
- end
19
-
20
- def script_tag(attrs)
21
- attr_map = attrs.map { |key, value| " #{key}=\"#{value}\"" }
22
-
23
- "<script#{attr_map.join('')}></script>".html_safe
24
- end
25
-
26
- def anjuna(version, esm)
27
- "https://cdn.zuora.com/@anjuna/core@#{version}" \
28
- "/anjuna-core/anjuna-core#{'.esm' if esm}.js"
29
- end
30
-
31
- def charts(version, esm)
32
- "https://cdn.zuora.com/@anjuna/charts@#{version}" \
33
- "/anjuna-charts/anjuna-charts#{'.esm' if esm}.js"
34
- end
35
-
36
- def link_tag(attrs)
37
- attr_map = attrs.map { |key, value| " #{key}=\"#{value}\"" }
38
-
39
- "<link#{attr_map.join('')}>".html_safe
40
- end
41
-
42
- def theme(version, file)
43
- "https://cdn.zuora.com/@anjuna/theme@#{version}/css/#{file}.css"
44
- end
45
-
46
- ANJUNA_VERSION = '1.2.14'
47
- THEME_VERSION = '1.2.14'
48
9
  end
49
10
  end
@@ -3,5 +3,42 @@
3
3
  module ZuoraConnectUi
4
4
  # Helper methods for including CDN links in views
5
5
  module AssetHelper
6
+ ANJUNA_VERSION = '1.2.14'
7
+ ANJUNA_CORE_URL = "https://cdn.zuora.com/@anjuna/core@#{ANJUNA_VERSION}/anjuna-core/anjuna-core.js"
8
+ ANJUNA_CHARTS_URL = "https://cdn.zuora.com/@anjuna/charts@#{ANJUNA_VERSION}/anjuna-charts/anjuna-charts.js"
9
+
10
+ def zuo_include_tag
11
+ anjuna_core + anjuna_charts + anjuna_theme
12
+ end
13
+
14
+ private
15
+
16
+ def to_esm(url)
17
+ url.gsub('.js', '.esm.js')
18
+ end
19
+
20
+ # NOTE(hartley): nomodule was added as an explict boolean attribute in Rails
21
+ # 6.1, meaning 'nomodule: true' should be used once minimum version is 6.1
22
+ # However, for consistency with older versions we have to specify 'nomodule'
23
+ # as the value
24
+ def anjuna_core
25
+ tag.script(type: 'module', src: to_esm(ANJUNA_CORE_URL)) +
26
+ tag.script(nomodule: 'nomodule', src: ANJUNA_CORE_URL)
27
+ end
28
+
29
+ def anjuna_charts
30
+ tag.script(type: 'module', src: to_esm(ANJUNA_CHARTS_URL)) +
31
+ tag.script(nomodule: 'nomodule', src: ANJUNA_CHARTS_URL)
32
+ end
33
+
34
+ def anjuna_theme
35
+ tag.link(href: anjuna_theme_url('application'), rel: 'stylesheet') +
36
+ tag.link(href: anjuna_theme_url('theme'), rel: 'stylesheet') +
37
+ tag.link(href: anjuna_theme_url('icons'), rel: 'stylesheet')
38
+ end
39
+
40
+ def anjuna_theme_url(file)
41
+ "https://cdn.zuora.com/@anjuna/theme@#{ANJUNA_VERSION}/css/#{file}.css"
42
+ end
6
43
  end
7
44
  end
@@ -75,7 +75,7 @@
75
75
  '<%= table_name %>',
76
76
  {
77
77
  columns: <%= raw columns.to_json %>,
78
- filters: <%= raw table_filters.to_json %>,
78
+ filters: <%= json_escape table_filters.to_json.html_safe %>,
79
79
  view: '<%= table_views.select { |k, v| v == true }.first[0].to_s %>',
80
80
  size: <%= initial_size %>,
81
81
  sort: <%= raw sort %>
@@ -258,7 +258,7 @@
258
258
  '<%= table_name %>',
259
259
  { view, size },
260
260
  columns,
261
- <%= raw table_filters.to_json %>
261
+ <%= json_escape table_filters.to_json.html_safe %>
262
262
  );
263
263
 
264
264
  }
@@ -0,0 +1,14 @@
1
+ <% layout_id = "HTTP_ZUORA_LAYOUT_FETCH_TEMPLATE_ID" %>
2
+ <% ui_path = "HTTP_ZUORA_UI_PATH" %>
3
+
4
+ <% if request.headers[layout_id].present? || (!request.headers[ui_path].present? && !Rails.env.development?) %>
5
+ <%= yield %>
6
+ <% else %>
7
+ <z-unified-nav-v2>
8
+ <div slot="breadcrumbContent">
9
+ <%= yield %>
10
+ </div>
11
+ </z-unified-nav-v2>
12
+ <script type="text/javascript" crossorigin="anonymous" src="https://cdn.zuora.com/@platform-ui/nav-v2/main.js"></script>
13
+ <% end %>
14
+
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnectUi
4
- VERSION = '0.11.8'
4
+ VERSION = '0.12.1'
5
5
  end
@@ -11,4 +11,13 @@ require 'peek/views/connect'
11
11
 
12
12
  # UI for Connect Applications
13
13
  module ZuoraConnectUi
14
+ class << self
15
+ def app_parent_name
16
+ if Rails::VERSION::MAJOR >= 6
17
+ Rails.application.class.module_parent_name
18
+ else
19
+ Rails.application.class.parent_name
20
+ end
21
+ end
22
+ end
14
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.8
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-20 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '5.0'
75
+ version: '5.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '5.0'
82
+ version: '5.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: select2-rails
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -358,6 +358,7 @@ files:
358
358
  - app/views/partials/_row_actions.html.erb
359
359
  - app/views/partials/_table.html.erb
360
360
  - app/views/peek/views/_connect.html.erb
361
+ - app/views/zuora_connect_ui/_nav.html.erb
361
362
  - config/initializers/oj.rb
362
363
  - lib/peek/views/connect.rb
363
364
  - lib/zuora_connect_ui.rb