tao_on_rails 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/generators/tao/component/component_generator.rb +12 -2
- data/lib/tao_on_rails/components/base.rb +5 -2
- data/lib/tao_on_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 228e7dfa827df0d446bedd259820d17065450fd2
|
4
|
+
data.tar.gz: 67ea86aa0062a0592de2172fa20d420aaf7aad5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 749b87886e93f79e4dc52c6627875629d7e2435ad8b9956138bbfd432d003dabdd793001416c71086242a6f183380246e7084b29ca087097c9292c6bcfb841c3
|
7
|
+
data.tar.gz: 4b9280e27eb2cd4f12bee6858a7a19fa80c0cdea7779a76fc265b80e52d2528c156fb5a56f8eaf8d99f2a2e334556748a185a0a444f4b280d11cd4e430757ae0
|
data/README.md
CHANGED
@@ -31,6 +31,10 @@ Start writing plugin for Tao on Rails with following commands:
|
|
31
31
|
rails plugin new plugin_name -m https://git.io/vSvyy
|
32
32
|
```
|
33
33
|
|
34
|
+
## Documentation
|
35
|
+
|
36
|
+
See [wiki](https://github.com/mycolorway/tao_on_rails/wiki) for tutorials and API reference.
|
37
|
+
|
34
38
|
## Contributing
|
35
39
|
|
36
40
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mycolorway/tao_on_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -6,13 +6,23 @@ module Tao
|
|
6
6
|
|
7
7
|
check_class_collision suffix: "Component"
|
8
8
|
|
9
|
+
class_option :variants, type: :array, default: [], desc: "Generate assets for different variants"
|
10
|
+
|
9
11
|
attr_reader :component_name
|
10
12
|
|
11
13
|
def create_component_file
|
12
14
|
@component_name = class_name.underscore.split('/').map(&:singularize).join('_')
|
13
15
|
template "component.rb.erb", File.join('app/components', class_path, "#{file_name}_component.rb")
|
14
|
-
|
15
|
-
|
16
|
+
|
17
|
+
if (variants = options[:variants]).any?
|
18
|
+
variants.each do |variant|
|
19
|
+
template "component.coffee.erb", File.join('app/assets/javascripts/', variant, class_path, "components/#{file_name}.coffee")
|
20
|
+
template "component.scss.erb", File.join('app/assets/stylesheets/', variant, class_path, "components/#{file_name}.scss")
|
21
|
+
end
|
22
|
+
else
|
23
|
+
template "component.coffee.erb", File.join('app/assets/javascripts/', class_path, "components/#{file_name}.coffee")
|
24
|
+
template "component.scss.erb", File.join('app/assets/stylesheets/', class_path, "components/#{file_name}.scss")
|
25
|
+
end
|
16
26
|
end
|
17
27
|
|
18
28
|
end
|
@@ -13,12 +13,15 @@ module TaoOnRails
|
|
13
13
|
def render &block
|
14
14
|
if view.lookup_context.exists?(template_path, [], true)
|
15
15
|
if block_given?
|
16
|
-
view.
|
16
|
+
block_content = view.capture(&block)
|
17
|
+
view.render layout: template_path, locals: {component: self} do
|
18
|
+
block_content
|
19
|
+
end
|
17
20
|
else
|
18
21
|
view.render partial: template_path, locals: {component: self}
|
19
22
|
end
|
20
23
|
else
|
21
|
-
view.content_tag self.class.tag_name, options, &block
|
24
|
+
view.content_tag self.class.tag_name, nil, options, &block
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
data/lib/tao_on_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tao_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siyuan Liu
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-03-
|
12
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: turbolinks
|