glib-web 0.10.7 → 0.11.0

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: 70e0e354a117db0f43c758fa03658f3a61d4e448bd60c2dfc0f36c2d5d3b285e
4
- data.tar.gz: d249de3f86d3360f25eeaee8a79c5ad24b6c97a17a3f2441e419daa048f39393
3
+ metadata.gz: b752fcae7cc608d5890e82e1d8684ef0c00bcb825d4048384c39a8436b1a0960
4
+ data.tar.gz: 27b120d2754f94a98733ade53e81208631fd30d0ee78c8122c295fe5fb171e55
5
5
  SHA512:
6
- metadata.gz: c7b77e90c5d9c7512922340fcf0b6dc6c85618f955273eca2588cc18995066c2df0cebed894a8590f624b4ee6b542d0993e99c888b11392710514361df2c8dcb
7
- data.tar.gz: c65055fde230fe9d21d6a7fab294082ab965c76abc28a2f80dfa1cbbd9ff9e6884fc527baa1f5965f3054f977f213804c138304bdd2dd57cabbd3e740df1c22d
6
+ metadata.gz: 4d1970741807a9de81b871d4d88c3d7ffd20de6cf1a52f54e8e8d8c9de3fb121bf039c55b319218d08735b747f415bde933ec36fb9201f51d2bc6d075f5acec1
7
+ data.tar.gz: bf8e5cb1620b44914a692ea142733ce1eab9eab8207f1392e10ee37b9efe616cc88cef5b854a771c7654363ee94d88225a61602784ff4cde902756a1b24858e4
@@ -1,7 +1,15 @@
1
1
  module Glib
2
2
  module DynamicImagesHelper
3
3
  # NOTE: The bucket should probably be set as a parameter for json_libs
4
- def glib_dynamic_image_url(blob_key, width: 100, height: 100, fit: 'clip', bucket: Rails.application.config.try(:aws_s3_bucket), signature_key: nil)
4
+ def glib_dynamic_image_url(blob_key,
5
+ width: 100,
6
+ height: 100,
7
+ fit: 'clip',
8
+ https: true,
9
+ host: 'imageserver-demo.herokuapp.com',
10
+ port: nil,
11
+ bucket: Rails.application.config.try(:aws_s3_bucket),
12
+ signature_key: nil)
5
13
  return unless blob_key.present?
6
14
 
7
15
  full_params_hash = {
@@ -24,8 +32,10 @@ module Glib
24
32
  request_params_hash = request_params_hash.merge(signature: signature)
25
33
  end
26
34
 
27
- uri = URI::HTTPS.build(
28
- host: 'imageserver-demo.herokuapp.com',
35
+ request_builder = https ? URI::HTTPS : URI::HTTP
36
+ uri = request_builder.build(
37
+ host: host,
38
+ port: port,
29
39
  path: "/image/#{bucket}/#{blob_key}",
30
40
  query: request_params_hash.to_param
31
41
  )
@@ -1,7 +1,9 @@
1
1
  module Glib
2
2
  module EnumHelper
3
3
  def glib_enum_options(clazz, enum_field, keys = nil)
4
- keys ||= clazz.send("#{enum_field}s").keys
4
+ # keys ||= clazz.send("#{enum_field}s").keys
5
+
6
+ keys ||= clazz.send(enum_field.to_s.pluralize).keys
5
7
  keys.map { |i| { text: clazz.glib_enum_humanize(enum_field, i), value: i } }
6
8
  end
7
9
 
@@ -200,6 +200,7 @@ class Glib::JsonUi::ViewBuilder
200
200
  # string :name
201
201
  # string :value
202
202
  views :childViews
203
+ bool :row
203
204
 
204
205
  # Override
205
206
  def value(value)
@@ -215,6 +216,9 @@ class Glib::JsonUi::ViewBuilder
215
216
  class Radio < View
216
217
  string :label
217
218
  string :value
219
+ action :onClick
220
+ string :offIcon
221
+ string :onIcon
218
222
  end
219
223
 
220
224
  class File < Text
@@ -144,6 +144,16 @@ class Glib::JsonUi::ViewBuilder
144
144
  end
145
145
  end
146
146
 
147
+ class Timeline < View
148
+ color :completedColor
149
+ color :uncompletedColor
150
+ singleton_array :styleClass, :styleClasses
151
+ string :uncompletedIcon
152
+ string :completedIcon
153
+ array :items
154
+ views :childViews
155
+ end
156
+
147
157
  class Table < View
148
158
  hash :nextPage
149
159
  hash :export
@@ -0,0 +1,24 @@
1
+ progress = params[:progress]&.to_i&.between?(0, 5) ? params[:progress].to_i : 0
2
+
3
+ tview.panels_responsive \
4
+ width: 400,
5
+ childViews: ->(res) do
6
+ res.panels_column sm: { cols: 11 }, childViews: ->(subcolumn) do
7
+ subcolumn.panels_column sm: { cols: 2, padding: { right: 10 } }, childViews: ->(inner_column) do
8
+ inner_column.spacer height: 10
9
+ inner_column.progressBar value: progress/5.to_f, height: 5, styleClass: 'no-text'
10
+ inner_column.spacer height: 10
11
+ end
12
+ subcolumn.panels_column sm: { cols: 9 }, childViews: ->(inner_column) do
13
+ inner_column.h4 \
14
+ text: "Progress #{progress}/5"
15
+ end
16
+ subcolumn.p text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
17
+ end
18
+ res.panels_column sm: { cols: 1 }, childViews: ->(subcolumn) do
19
+ subcolumn.icon name: 'add', size: 50
20
+ end
21
+ end, onClick: ->(action) do
22
+ action.windows_reload url: json_ui_garage_url(path: 'panels/timeline', progress: progress + 1)
23
+ end
24
+ tview.spacer height: 12
@@ -30,6 +30,9 @@ json_ui_page json do |page|
30
30
  template.thumbnail title: 'Unordered List', subtitle: 'Bullet points similar to HTML\'s <ul> tag', onClick: ->(action) do
31
31
  action.windows_open url: json_ui_garage_url(path: 'panels/ul')
32
32
  end
33
+ template.thumbnail title: 'Timeline', subtitle: 'Timeline component with responsive panel as the childviews', onClick: ->(action) do
34
+ action.windows_open url: json_ui_garage_url(path: 'panels/timeline')
35
+ end
33
36
  end
34
37
  end, ->(section) do
35
38
  section.header padding: glib_json_padding_list, childViews: ->(header) do
@@ -0,0 +1,70 @@
1
+ json.title 'Timeline Panels'
2
+
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
+ scroll.h2 text: 'Basic timeline'
8
+ scroll.spacer height: 8
9
+
10
+ timeline_items = [
11
+ { name: :submitted, label: 'Order submitted' },
12
+ { name: :finding, label: 'Finding you a driver' },
13
+ { name: :driver_assigned, label: 'Driver found, picking you up..' },
14
+ { name: :otw, label: 'On the way' },
15
+ { name: :arrived, label: 'Arrived' }
16
+ ]
17
+
18
+ # Defining active or completed item
19
+ active_name = :driver_assigned
20
+ timeline_items.each_with_index do |h, i|
21
+ if h[:name] == active_name
22
+ h[:active] = true
23
+ break
24
+ else
25
+ h[:completed] = true
26
+ end
27
+ end
28
+
29
+ scroll.panels_timeline items: timeline_items
30
+ scroll.spacer height: 32
31
+
32
+ custom_completed_item = {
33
+ name: :custom,
34
+ label: 'Completed item with a custom icon',
35
+ completed: true,
36
+ uncompletedIcon: 'place',
37
+ completedIcon: 'place'
38
+ }
39
+ custom_uncompleted_item = {
40
+ name: :custom,
41
+ label: 'Uncompleted item with a custom icon',
42
+ uncompletedIcon: 'flag',
43
+ completedIcon: 'flag'
44
+ }
45
+ scroll.h2 text: 'Timeline with outlined dots, custom icons and custom colors'
46
+ scroll.spacer height: 8
47
+ scroll.panels_timeline \
48
+ items: [custom_completed_item] + timeline_items + [custom_uncompleted_item],
49
+ completedColor: '#4BB543',
50
+ uncompletedColor: '#FFA500',
51
+ styleClasses: ['outlined'],
52
+ completedIcon: 'check',
53
+ uncompletedIcon: 'hourglass_empty'
54
+ scroll.spacer height: 32
55
+
56
+ scroll.h2 text: 'Timeline with childViews'
57
+ scroll.panels_timeline \
58
+ items: timeline_items,
59
+ childViews: ->(tview) do
60
+ tview.spacer height: 16
61
+ render 'json_ui/garage/panels/timeline_content', tview: tview
62
+ tview.spacer height: 16
63
+
64
+ tview.button text: 'Reset', onClick: ->(action) do
65
+ action.windows_reload url: json_ui_garage_url(path: 'panels/timeline')
66
+ end
67
+ tview.spacer height: 16
68
+ end
69
+ scroll.spacer height: 32
70
+ end
@@ -48,8 +48,10 @@ json_ui_page json do |page|
48
48
 
49
49
  scroll.label text: "\n"
50
50
  scroll.h1 text: 'Click action'
51
- scroll.panels_vertical width: 100, height: 100, backgroundColor: '#b3bac2', onClick: ->(action) do
52
- action.dialogs_alert message: 'Perform action'
51
+ scroll.panels_vertical width: 100, height: 100, backgroundColor: '#b3bac2', align: 'center', onClick: ->(action) do
52
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
53
+ end, childViews: ->(panel) do
54
+ panel.label text: 'Click me'
53
55
  end
54
56
  end
55
57
  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.10.7
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -201,6 +201,7 @@ files:
201
201
  - app/views/json_ui/garage/pages/tab_bar.json.jbuilder
202
202
  - app/views/json_ui/garage/panels/_hover_views_content.json.jbuilder
203
203
  - app/views/json_ui/garage/panels/_styled.json.jbuilder
204
+ - app/views/json_ui/garage/panels/_timeline_content.json.jbuilder
204
205
  - app/views/json_ui/garage/panels/card.json.jbuilder
205
206
  - app/views/json_ui/garage/panels/carousel.json.jbuilder
206
207
  - app/views/json_ui/garage/panels/custom.json.jbuilder
@@ -212,6 +213,7 @@ files:
212
213
  - app/views/json_ui/garage/panels/outlined.json.jbuilder
213
214
  - app/views/json_ui/garage/panels/responsive.json.jbuilder
214
215
  - app/views/json_ui/garage/panels/split.json.jbuilder
216
+ - app/views/json_ui/garage/panels/timeline.json.jbuilder
215
217
  - app/views/json_ui/garage/panels/ul.json.jbuilder
216
218
  - app/views/json_ui/garage/panels/vertical.json.jbuilder
217
219
  - app/views/json_ui/garage/panels/web.json.jbuilder