asbru 0.0.2 → 0.0.3

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: 89db9b29675d959d7b7dec683796e2131377b5f30dffbda72322968bb965626a
4
- data.tar.gz: e9875fcfc5db6f8c013122dc5ec75dfc261b89d8707a5e4503e8cd432ee0fe6b
3
+ metadata.gz: cc32cdd060fac8c7239f01e479aaab3f20133ce63127c39253731e034b8d0b89
4
+ data.tar.gz: 51a9bdfce5c395d16f3221c27f406665b711bf95cf59672e3dfc39e87b80a680
5
5
  SHA512:
6
- metadata.gz: 537a392f4cdbacb190abb270fb05e912b2064ba0da412d02dddd982c79a9a6b2bde62d56e2099695b4cca73a5a01662ffa89c05df646ef99973d0f22422b9b16
7
- data.tar.gz: c138d4187c3e83c6546c28bdc4f17390621042b66acc8436ce40822bf2b88380e01106939deb3f03ae14edf0fb7ec999f2b45601dff01a9ccc97c7fea185a979
6
+ metadata.gz: c71bde33b206e9af7aa6d2e2eb0db00da604cbdf592f8a282489b55a7336dd179e4b8297c2237f042e4e5ac2696602ea65d4b1b8f142767eaa1bebe097c2e407
7
+ data.tar.gz: 3fde55dacd880bcd701777f5c5723e98bb929bddba43e632e8caa139f68ed10b03b8c221eedc00493321c2df05da3b21f51e924c01d461904e08c14d7f6eb3bc
data/lib/asbru.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  require "asbru/railtie"
2
+ require 'dry-configurable'
2
3
 
3
4
  module Asbru
4
-
5
+ extend Dry::Configurable
6
+ setting :component_prefix,'app'
7
+ setting :form_builder_prefix, 'app'
5
8
  end
data/lib/asbru/cml.rb CHANGED
@@ -18,35 +18,51 @@ module Asbru
18
18
  # I think I prefer 1 even though the syntax of Sage is nicer imo.
19
19
  class << self
20
20
  def p text, **opts
21
- C.text_content text: text, **opts
21
+ C.send "#{component_prefix}_content",
22
+ text: text,
23
+ **opts
22
24
  end
23
25
 
24
26
  def h1 text, **opts
25
- C.text_title size: 'h1', text: text
27
+ C.send "#{component_prefix}_title",
28
+ size: 'h1',
29
+ text: text
26
30
  end
27
31
 
28
32
  def h2 text, **opts
29
- C.text_title size: 'h2', text: text
33
+ C.send "#{component_prefix}_title",
34
+ size: 'h2',
35
+ text: text
30
36
  end
31
37
 
32
38
  def h3 text, **opts
33
- C.text_title size: 'h3', text: text
39
+ C.send "#{component_prefix}_title",
40
+ size: 'h3',
41
+ text: text
34
42
  end
35
43
 
36
44
  def h4 text, **opts
37
- C.text_title size: 'h4', text: text
45
+ C.send "#{component_prefix}_title",
46
+ size: 'h4',
47
+ text: text
38
48
  end
39
49
 
40
50
  def h5 text, **opts
41
- C.text_title size: 'h5', text: text
51
+ C.send "#{component_prefix}_title",
52
+ size: 'h5',
53
+ text: text
42
54
  end
43
55
 
44
56
  def hr color: 'stable-500'
45
- C.ui_divider color: color, height: 1
57
+ C.send ("#{component_prefix}_divider",
58
+ color: color,
59
+ height: 1
46
60
  end
47
61
 
48
62
  def vertical_spacer height
49
- C.ui_divider color: :transparent, height: height
63
+ C.send ("#{component_prefix}_divider",
64
+ color: :transparent,
65
+ height: height
50
66
  end
51
67
 
52
68
  def table_row(*cells)
@@ -62,6 +78,12 @@ module Asbru
62
78
  cell[:customData]['data-confirm'] = confirm if confirm.present?
63
79
  cell
64
80
  end
81
+
82
+ private
83
+
84
+ def component_prefix
85
+ Asbru.config.component_prefix
86
+ end
65
87
  end
66
88
  end
67
89
  end
@@ -80,8 +80,8 @@ module Asbru
80
80
  end
81
81
  end
82
82
 
83
-
84
- Asbru::Components::Savage.form_element **new_options
83
+ Asbru::Components::Savage.send "#{Asbru.config.form_builder_prefix}_element",
84
+ **new_options
85
85
  end
86
86
 
87
87
  def create_options(attribute, choices, chosen)
data/lib/asbru/links.rb CHANGED
@@ -18,7 +18,9 @@ module Asbru
18
18
  options[:customData][:'data-method'] = method if method.present?
19
19
  options[:customData][:'data-confirm'] = confirm if confirm.present?
20
20
  options[:customData].merge(options[:custom_data]) if options[:custom_data]
21
- Asbru::Components::Savage.button_button(**options)
21
+ Asbru::Components::Savage.send "#{Asbru.config.form_builder_prefix}_button",
22
+ **options
23
+ component_prefix
22
24
  end
23
25
 
24
26
  def asbru_link_to(text, url, **options)
data/lib/asbru/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Asbru
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asbru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stev-0
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-15 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-configurable
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Creating component based webpages with short hand syntax.
42
56
  email:
43
57
  - skemp@adflow.io