glib-web 0.4.50 → 0.4.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2879893523ba9889fedf7a2bcd3e51958a99ad7
4
- data.tar.gz: 0e6f5cf4958c64131c2194cdc9bc76b9d6d63ca9
3
+ metadata.gz: 2d1e6bb6de1d215afd3d12655b76d6a4adcce163
4
+ data.tar.gz: 17b20a7da5dec1b330c81799c05be288ab4c2b67
5
5
  SHA512:
6
- metadata.gz: 5726baf5d47827701fafb0966161ff9650a49cab9ce60322d19a2d8ed23ab8f5ab33b58bf1927e67198bbb0797135f0cbca5a164a751f12f6bab0c175741d9a6
7
- data.tar.gz: c906379501cd1be2ff58f881583e1e4471109eb343d8ac41ece00d6a8d78b0cf4015711480a111901ed23b8ca7fe9c82a7340dbd0f3b60b70bd7ed25c734d588
6
+ metadata.gz: d51c2d223f1f90902035d9169d64c7155c727feb5edefa25b148e6cb8299b9670bf9f904b10620390e97d00cdfac1974422c69ea39874f8b5733b2651bfaed10
7
+ data.tar.gz: d87768d62d3d2d5c7967551a2d2d43afeb173e4737858c47766c81c665de0cc8d22265d15a617fef271fe173225041bac389d4049dc28aa6aa9002d950e52bba
@@ -111,13 +111,13 @@ module Glib::Json::DynamicText
111
111
  end
112
112
 
113
113
  # TODO: Reuse method from DynamicTextsHelper
114
- def image_server_url(blob_key, w: 100, h: 100)
114
+ def image_server_url(blob_key)
115
115
  return unless blob_key.present?
116
116
 
117
117
  uri = URI::HTTPS.build(
118
118
  host: 'imageserver-demo.herokuapp.com',
119
119
  path: "/image/#{ENV['AWS_S3_BUCKET']}/#{blob_key}",
120
- query: { w: w, h: h }.to_param
120
+ query: { w: 100, h: 100 }.to_param
121
121
  )
122
122
 
123
123
  uri.to_s
@@ -118,18 +118,5 @@ module Glib::Json::NewDynamicText
118
118
  end
119
119
  }
120
120
  end
121
-
122
- # # TODO: Reuse method from DynamicTextsHelper
123
- # def image_server_url(blob_key, w: 100, h: 100)
124
- # return unless blob_key.present?
125
-
126
- # uri = URI::HTTPS.build(
127
- # host: 'imageserver-demo.herokuapp.com',
128
- # path: "/image/#{ENV['AWS_S3_BUCKET']}/#{blob_key}",
129
- # query: { w: w, h: h }.to_param
130
- # )
131
-
132
- # uri.to_s
133
- # end
134
121
  end
135
122
  end
@@ -1,26 +1,14 @@
1
1
  module Glib
2
2
  module DynamicImagesHelper
3
- # # TODO: The bucket should probably be set as a parameter for json_libs
4
- # def dynamic_image_url(blob_key, w: 100, h: 100, fit: 'clip', bucket: Rails.application.config.try(:aws_s3_bucket))
5
- # return unless blob_key.present?
6
-
7
- # uri = URI::HTTPS.build(
8
- # host: 'imageserver-demo.herokuapp.com',
9
- # path: "/image/#{bucket}/#{blob_key}",
10
- # query: { w: w, h: h, fit: fit }.to_param
11
- # )
12
-
13
- # uri.to_s
14
- # end
15
-
16
- def dynamic_image_url(blob_key, w: 100, h: 100, fit: 'clip', bucket: Rails.application.config.try(:aws_s3_bucket))
3
+ # NOTE: The bucket should probably be set as a parameter for json_libs
4
+ def dynamic_image_url(blob_key, width: 100, height: 100, fit: 'clip', bucket: Rails.application.config.try(:aws_s3_bucket))
17
5
  return unless blob_key.present?
18
6
 
19
7
  full_params_hash = {
20
8
  bucket_name: bucket,
21
9
  blob_key: blob_key,
22
- w: w,
23
- h: h,
10
+ w: width,
11
+ h: height,
24
12
  fit: fit,
25
13
  expires: 1.hours.from_now.to_i
26
14
  }
@@ -38,47 +38,5 @@ module Glib
38
38
  dt_key: new_key
39
39
  }.merge(args)
40
40
  end
41
-
42
- # def dt_image_server_url(blob_key, w: 100, h: 100)
43
- # return unless blob_key.present?
44
-
45
- # encryption_service = EncryptionService.new(ENV['AWS_S3_BUCKET'], ENV['PRIVATE_API_KEY'])
46
- # params_hash = {
47
- # bucket_name: ENV['AWS_S3_BUCKET'],
48
- # blob_key: blob_key,
49
- # w: w,
50
- # h: h,
51
- # expires: 1.hours.from_now.to_i
52
- # }
53
- # signature = encryption_service.encrypt(params_hash)
54
-
55
- # # TODO: This should probably be set as a parameter for json_libs
56
- # uri = URI::HTTPS.build(
57
- # host: 'imageserver-demo.herokuapp.com',
58
- # path: "/image/#{ENV['AWS_S3_BUCKET']}/#{blob_key}",
59
- # query: params_hash.except(:bucket_name, :blob_key).merge(signature: signature).to_param
60
- # )
61
-
62
- # uri.to_s
63
- # end
64
-
65
- # EncryptionService = Struct.new(:salt, :private_key) do
66
- # def encrypt(value)
67
- # encryptor.encrypt_and_sign(value)
68
- # end
69
-
70
- # def decrypt(value)
71
- # encryptor.decrypt_and_verify(value)
72
- # end
73
-
74
- # private
75
- # def encryptor
76
- # encryptor ||= begin
77
- # key_len = ActiveSupport::MessageEncryptor.key_len
78
- # key = ActiveSupport::KeyGenerator.new(private_key).generate_key(salt, key_len)
79
- # ActiveSupport::MessageEncryptor.new(key)
80
- # end
81
- # end
82
- # end
83
41
  end
84
42
  end
@@ -141,7 +141,11 @@ module Glib
141
141
  # Support either string or dynamic_text hash
142
142
  def self.text propName, options = {}
143
143
  define_method(propName) do |value|
144
- json.set! propName, value
144
+ if value.is_a?(Hash)
145
+ json.set! propName, value
146
+ else
147
+ json.set! propName, value&.to_s
148
+ end
145
149
  end
146
150
  end
147
151
 
@@ -54,7 +54,6 @@ module Glib
54
54
 
55
55
  class AbstractText < View
56
56
  string :textAlign
57
- # string :text
58
57
  text :text
59
58
  color :color
60
59
  end
@@ -10,38 +10,38 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
10
10
  # TODO: This needs fixing
11
11
  scroll.h1 text: 'Original size'
12
12
  scroll.spacer height: 6
13
- scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, w: nil, h: nil)
13
+ scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, width: nil, height: nil)
14
14
 
15
15
  scroll.h1 text: 'fit: clip (default) to width'
16
16
  scroll.spacer height: 6
17
- scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, w: 100, h: nil)
17
+ scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, width: 100, height: nil)
18
18
 
19
19
  scroll.spacer height: 20
20
20
  scroll.h1 text: 'fit: clip (default) to height'
21
21
  scroll.spacer height: 6
22
- scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, w: nil, h: 100)
22
+ scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, width: nil, height: 100)
23
23
 
24
24
  scroll.spacer height: 20
25
25
  scroll.h1 text: 'fit: crop to width'
26
26
  scroll.spacer height: 6
27
- scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'crop', w: 100, h: nil)
27
+ scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'crop', width: 100, height: nil)
28
28
 
29
29
  scroll.spacer height: 20
30
30
  scroll.h1 text: 'fit: crop to height'
31
31
  scroll.spacer height: 6
32
- scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'crop', w: nil, h: 100)
32
+ scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'crop', width: nil, height: 100)
33
33
 
34
34
  # Currently this doesn't behave the same way as https://docs.imgix.com/apis/url/size/fit#fill
35
35
  #
36
36
  # scroll.spacer height: 20
37
37
  # scroll.h1 text: 'fit: fill to width'
38
38
  # scroll.spacer height: 6
39
- # scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'fill', w: 2000, h: nil)
39
+ # scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'fill', width: 2000, height: nil)
40
40
 
41
41
  # Currently this doesn't behave the same way as https://docs.imgix.com/apis/url/size/fit#fill
42
42
  #
43
43
  # scroll.spacer height: 20
44
44
  # scroll.h1 text: 'fit: fill to height'
45
45
  # scroll.spacer height: 6
46
- # scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'fill', w: nil, h: 2000)
46
+ # scroll.image url: dynamic_image_url(glib_json_image_blob_key, bucket: bucket, fit: 'fill', width: nil, height: 2000)
47
47
  end
@@ -1,31 +1,29 @@
1
1
  json.title 'Tables'
2
2
 
3
- json_ui_page json do |page|
4
- render "#{@path_prefix}/nav_menu", json: json, page: page
5
-
6
- page.table export: { label: 'Export', fileName: 'output' }, import: { submitUrl: json_ui_garage_url(path: 'forms/generic_post'), paramName: 'user' }, firstSection: ->(section) do
7
- section.header cellViews: ->(header) do
8
- header.label text: 'field1'
9
- header.label text: 'field2'
10
- header.label text: 'field3'
11
- header.label text: 'field4'
12
- header.label text: 'field5'
13
- header.label text: 'field6'
14
- end
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
15
5
 
16
- items = [1, 2, 3]
17
- section.rows objects: items, builder: ->(row, item, index) do
18
- row.default cellViews: ->(cell) do
19
- cell.label text: "Data #{item}"
20
- cell.label text: "Data 'A' #{item}"
21
- cell.label text: 'Data "B"' + " #{item}"
22
- cell.label text: "Data , #{item}"
23
- cell.label text: "Line A#{item}\nLine B#{item}"
24
- cell.label text: "Line A#{item}\rLine B#{item}"
25
- end, onClick: ->(action) do
26
- action.windows_open url: json_ui_garage_url(path: 'home/blank')
27
- end
28
- end
6
+ page.table export: { label: 'Export', fileName: 'output' }, import: { submitUrl: json_ui_garage_url(path: 'forms/generic_post'), paramName: 'user' }, firstSection: ->(section) do
7
+ section.header cellViews: ->(header) do
8
+ header.label text: 'field1'
9
+ header.label text: 'field2'
10
+ header.label text: 'field3'
11
+ header.label text: 'field4'
12
+ header.label text: 'field5'
13
+ header.label text: 'field6'
29
14
  end
30
15
 
16
+ items = [1, 2, 3]
17
+ section.rows objects: items, builder: ->(row, item, index) do
18
+ row.default cellViews: ->(cell) do
19
+ cell.label text: "Data #{item}"
20
+ cell.label text: "Data 'A' #{item}"
21
+ cell.label text: 'Data "B"' + " #{item}"
22
+ cell.label text: "Data , #{item}"
23
+ cell.label text: "Line A#{item}\nLine B#{item}"
24
+ cell.label text: "Line A#{item}\rLine B#{item}"
25
+ end, onClick: ->(action) do
26
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
27
+ end
28
+ end
31
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.50
4
+ version: 0.4.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''