glib-web 0.10.8 → 0.11.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: 23de874348dde798e5ec0f017f769efd605c8747b15c99a75ba9ad2353d20673
4
- data.tar.gz: 88d00f3b59edf17ceaa71c8d5713159bae1015668f5a0f2e380fc76390d9b7ba
3
+ metadata.gz: a0ad96fd8e7f59b3203f94cc7e183479f70203ace059a962df88e6b659e75427
4
+ data.tar.gz: e4f06add5a2eb5bc62d0654409519aca7d177a018edbddd0fbac8fea086d303b
5
5
  SHA512:
6
- metadata.gz: f10fd44428ad6c865020b86c8b48b8e724ef7782ecaad5c7abb341c2faad0a2bb421862dddc8e121f32cfbe122e7352d53e8d267721909b29564bced6c6730b9
7
- data.tar.gz: '09bc9d77703e5ffd6007163f8491eeec1d136c0656d045aff80cbf205c0483096dbf75b509c3850b1b4dda2bb1473eec43c473941f4d88a320b16d34422061d5'
6
+ metadata.gz: 7d0293ad9ce0952aba5bf741eae32c23c536f21ea1e73315fbfe556dd80bb7094f112b42a926a98106fc4bb1c3c849f0b66a413ce9a8766d959f8d30041e0c05
7
+ data.tar.gz: 836c1e141247c1073e9528dbb09e63d47c0198f910845ad9f03a0b50823aaf6b02b6ee4fdc0b3b17820f1cedd72ad4252d3a4316a6ff48077c560f1a1f4a15f2
@@ -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.8
4
+ version: 0.11.1
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