tao_on_rails 0.7.2 → 0.7.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
  SHA1:
3
- metadata.gz: d8669bacf1e592e1823a64cf6d2a27cc2ea404a1
4
- data.tar.gz: 1893448a03167c606a7714b1ea2c00cbbedebacb
3
+ metadata.gz: 228e7dfa827df0d446bedd259820d17065450fd2
4
+ data.tar.gz: 67ea86aa0062a0592de2172fa20d420aaf7aad5f
5
5
  SHA512:
6
- metadata.gz: bc779cd5ab88ec0e912a53fc7d307b7ecfe72259159f2f1dcdf3b99b668fb6e802d9dbd84da6bd8bed4880accfadf87c1220c90ce645319086109df1f6a63edf
7
- data.tar.gz: 8d8f658b3271fb276cfd619ef03a813dc5b5263b182c66704edee64267189e4d5f0afb55966f943efd0cfb6fe079d5c11cde42ee0786972cbd62d0d3fd203f0b
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
- template "component.coffee.erb", File.join('app/assets/javascripts/', class_path, "components/#{file_name}.coffee")
15
- template "component.scss.erb", File.join('app/assets/stylesheets/', class_path, "components/#{file_name}.scss")
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.render layout: template_path, locals: {component: self}, &block
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
 
@@ -1,3 +1,3 @@
1
1
  module TaoOnRails
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
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.2
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-26 00:00:00.000000000 Z
12
+ date: 2017-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: turbolinks