glib-web 0.4.50 → 0.4.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/json/dynamic_text.rb +2 -2
- data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -13
- data/app/helpers/glib/dynamic_images_helper.rb +4 -16
- data/app/helpers/glib/dynamic_texts_helper.rb +0 -42
- data/app/helpers/glib/json_ui/abstract_builder.rb +5 -1
- data/app/helpers/glib/json_ui/view_builder.rb +0 -1
- data/app/views/json_ui/garage/services/image.json.jbuilder +7 -7
- data/app/views/json_ui/garage/tables/export_import.json.jbuilder +23 -25
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d1e6bb6de1d215afd3d12655b76d6a4adcce163
|
4
|
+
data.tar.gz: 17b20a7da5dec1b330c81799c05be288ab4c2b67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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:
|
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
|
-
#
|
4
|
-
|
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:
|
23
|
-
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
|
-
|
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
|
|
@@ -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,
|
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,
|
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,
|
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',
|
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',
|
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',
|
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',
|
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
|
4
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|