app_rail-steps 0.2.6 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/app_rail/steps/charts/dashboard.rb +49 -0
- data/lib/app_rail/steps/core/stack.rb +18 -8
- data/lib/app_rail/steps/displayable.rb +2 -0
- data/lib/app_rail/steps/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ac3df232c2bfd0cd864c8ab1491b6d1191906fa1e0397fc91b184342150c7d6
|
4
|
+
data.tar.gz: c0152ca0568590771013c85efa8d625240ca417b68c6bde0214e8e6a05fbe5f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2389db830f322a8beb9367eee628ebcc5b2b69594c743ed846e9ad592e2731c953e0bd9c9f723ca906c1faa4de8065d57f69b0cdf86f7f588165e5e5fad20328
|
7
|
+
data.tar.gz: e45e8cf553d0ab2e31d95ad9e022fdb2ab7336f117b79a47cb9dc44b5ad744de69956d4d05f9c0e17a75842b472fba8873c4d9b4004df0b23eba4a6aad1d5eaa
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AppRail
|
4
|
+
module Steps
|
5
|
+
module Charts
|
6
|
+
module Dashboard
|
7
|
+
def ar_charts_dashboard_statistic(id:, title:, text:)
|
8
|
+
{
|
9
|
+
id: id.to_s,
|
10
|
+
chartType: :statistic,
|
11
|
+
title: title,
|
12
|
+
text: text
|
13
|
+
}.compact
|
14
|
+
end
|
15
|
+
|
16
|
+
def ar_charts_dashboard_line_chart(id:, title:, values:, text: nil, footer: nil)
|
17
|
+
{
|
18
|
+
id: id.to_s,
|
19
|
+
chartType: :line,
|
20
|
+
title: title,
|
21
|
+
text: text,
|
22
|
+
footer: footer,
|
23
|
+
chartValues: values
|
24
|
+
}.compact
|
25
|
+
end
|
26
|
+
|
27
|
+
def ar_charts_dashboard_bar_chart(id:, title:, values:)
|
28
|
+
{
|
29
|
+
id: id.to_s,
|
30
|
+
chartType: :bar,
|
31
|
+
title: title,
|
32
|
+
chartValues: values
|
33
|
+
}.compact
|
34
|
+
end
|
35
|
+
|
36
|
+
def ar_charts_dashboard_bar_pie(id:, title:, values:, light_colors: nil, dark_colors: nil)
|
37
|
+
{
|
38
|
+
id: id.to_s,
|
39
|
+
chartType: :pie,
|
40
|
+
title: title,
|
41
|
+
chartValues: values,
|
42
|
+
chartColors: light_colors,
|
43
|
+
chartColorsDark: dark_colors
|
44
|
+
}.compact
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -5,16 +5,23 @@ module AppRail
|
|
5
5
|
module Core
|
6
6
|
module Stack
|
7
7
|
CONTENT_MODE_OPTIONS = %i[scale_aspect_fill scale_aspect_fit].freeze
|
8
|
+
IMAGE_STYLE_OPTIONS = %i[full_width profile].freeze
|
8
9
|
|
9
10
|
def ar_core_stack_text(text:, label: nil)
|
10
11
|
{ type: :text, label: label, text: text.to_s }.compact
|
11
12
|
end
|
12
13
|
|
13
|
-
def ar_core_stack_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill)
|
14
|
+
def ar_core_stack_image(preview_url:, attachment_url:, image_style: :full_width, content_mode: :scale_aspect_fill)
|
14
15
|
validate_content_mode!(content_mode)
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
validate_image_style!(image_style)
|
17
|
+
|
18
|
+
{
|
19
|
+
type: :image,
|
20
|
+
contentMode: camelcase_converter(content_mode.to_s, first_letter: :lower),
|
21
|
+
previewURL: preview_url,
|
22
|
+
url: attachment_url,
|
23
|
+
imageStyle: camelcase_converter(image_style.to_s, first_letter: :lower)
|
24
|
+
}
|
18
25
|
end
|
19
26
|
|
20
27
|
def ar_core_stack_unsplash_image(image_url)
|
@@ -22,8 +29,7 @@ module AppRail
|
|
22
29
|
unsplash_id = image_url.split("/").last
|
23
30
|
image_url = "https://source.unsplash.com/#{unsplash_id}/800x600"
|
24
31
|
end
|
25
|
-
|
26
|
-
{ type: :image, previewURL: image_url, url: image_url }.compact
|
32
|
+
ar_core_stack_image(preview_url: image_url, attachment_url: image_url)
|
27
33
|
end
|
28
34
|
|
29
35
|
def ar_core_stack_video(preview_url:, attachment_url:)
|
@@ -84,8 +90,12 @@ module AppRail
|
|
84
90
|
|
85
91
|
private
|
86
92
|
|
87
|
-
def validate_content_mode!(
|
88
|
-
raise "Unknown content_mode" unless CONTENT_MODE_OPTIONS.include?(
|
93
|
+
def validate_content_mode!(content_mode)
|
94
|
+
raise "Unknown content_mode" unless CONTENT_MODE_OPTIONS.include?(content_mode)
|
95
|
+
end
|
96
|
+
|
97
|
+
def validate_image_style!(image_style)
|
98
|
+
raise "Unknown image_style" unless IMAGE_STYLE_OPTIONS.include?(image_style)
|
89
99
|
end
|
90
100
|
end
|
91
101
|
end
|
@@ -6,6 +6,7 @@ require_relative "core_forms/form"
|
|
6
6
|
require_relative "maps/map"
|
7
7
|
require_relative "styled_content/grid"
|
8
8
|
require_relative "styled_content/stack"
|
9
|
+
require_relative "charts/dashboard"
|
9
10
|
|
10
11
|
module AppRail
|
11
12
|
module Steps
|
@@ -16,6 +17,7 @@ module AppRail
|
|
16
17
|
include Steps::Maps::Map
|
17
18
|
include Steps::StyledContent::Grid
|
18
19
|
include Steps::StyledContent::Stack
|
20
|
+
include Steps::Charts::Dashboard
|
19
21
|
|
20
22
|
BUTTON_STYLES = %i[primary outline danger textOnly].freeze
|
21
23
|
ON_SUCCESS_OPTIONS = %i[none reload backward forward].freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_rail-steps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -27,6 +27,7 @@ files:
|
|
27
27
|
- Rakefile
|
28
28
|
- app_rail-steps.gemspec
|
29
29
|
- lib/app_rail/steps.rb
|
30
|
+
- lib/app_rail/steps/charts/dashboard.rb
|
30
31
|
- lib/app_rail/steps/core/list.rb
|
31
32
|
- lib/app_rail/steps/core/stack.rb
|
32
33
|
- lib/app_rail/steps/core_forms/form.rb
|