tao_on_rails 0.6.4 → 0.6.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 716f324b1fda4a39a51e9394ca8555b5735be3c4
4
- data.tar.gz: 4342e665147645e67d47f7488a703bcfd43d2a56
3
+ metadata.gz: 73617025bb5fd1f6c8b185b4b7bf2e0f69b525d6
4
+ data.tar.gz: 26d38bad6618841c2ec15a3ac98e6f10d36af605
5
5
  SHA512:
6
- metadata.gz: 3b1ce11f1c5eaaf5b4e03a44ab2ab230b322cedad5404d63bf879cf0ec1289b33f8006b9b79e7bc3d42c1d4895cee08f0f85edfe009c31fabbc8a91c7cf4e3b2
7
- data.tar.gz: 732be96d04a5e3c2133a951601b846edb3ea806644cf1812eadd1a6573bd04b4160e415b111a6309242a09a8ac6f0f5f4d56f8f229a81cd9e7ec8033930f1861
6
+ metadata.gz: 697414f18585e740746b88b05891d3595884637bc8089ba5bc1eef8359ca59b593465ddc5fb6230e2b685ff5bdaea280e91678eeefe132ad85f4c84b0bd36272
7
+ data.tar.gz: ac5ccf4e488bde8f82d9721e99b57f36727f2dca5f9d219bd97a7c4ab023d01a3ad50f5eb3dc2959a7eeac3a299869ef2571a0323bd4bbe639788a9840d0b566
@@ -5,7 +5,7 @@ class TaoPage extends TaoComponent
5
5
  @attribute 'layout', default: 'default'
6
6
 
7
7
  beforeCache: ->
8
- @jp.find('[tao-id]').each (i, el) =>
8
+ @jq.find('[tao-id]').each (i, el) =>
9
9
  el.beforeCache?()
10
10
  null
11
11
 
@@ -0,0 +1,41 @@
1
+ module TaoOnRails
2
+ module ActionView
3
+ module Helpers
4
+
5
+ include ::ActionView::Helpers
6
+ include ::ActionView::Context
7
+
8
+ def page_id
9
+ controller_names = controller_path.split('/')
10
+ [controller_names, action_name].compact.flatten.join('-')
11
+ end
12
+
13
+ def icon_tag(name, attributes = {})
14
+ if attributes[:class].present?
15
+ attributes[:class] += " icon icon-#{name}"
16
+ else
17
+ attributes[:class] = "icon icon-#{name}"
18
+ end
19
+
20
+ use_tag = %Q(<use xlink:href="#icon-#{name}"/>).html_safe
21
+ content_tag(:svg, use_tag, attributes).html_safe
22
+ end
23
+
24
+ def tao_page(tag, attributes = nil, &block)
25
+ if tag.is_a? Hash
26
+ attributes = tag
27
+ tag = "#{page_id.dasherize}-page"
28
+ end
29
+
30
+ if attributes[:class].present?
31
+ attributes[:class] += " tao-page"
32
+ else
33
+ attributes[:class] = "tao-page"
34
+ end
35
+
36
+ content_tag(tag, capture(&block), attributes)
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -1,9 +1,16 @@
1
1
  require 'turbolinks'
2
2
  require 'jquery-rails'
3
3
  require 'lodash-rails'
4
+ require 'tao_on_rails/action_view/helpers'
4
5
 
5
6
  module TaoOnRails
6
7
  class Engine < Rails::Engine
7
8
 
9
+ initializer "tao_on_rails.view_helpers" do |app|
10
+ ActiveSupport.on_load :action_view do
11
+ include TaoOnRails::ActionView::Helpers
12
+ end
13
+ end
14
+
8
15
  end
9
16
  end
@@ -1,3 +1,3 @@
1
1
  module TaoOnRails
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
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.6.4
4
+ version: 0.6.5
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-02-15 00:00:00.000000000 Z
12
+ date: 2017-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: turbolinks
@@ -172,6 +172,7 @@ files:
172
172
  - lib/generators/tao/view/templates/update.js.coffee
173
173
  - lib/generators/tao/view/view_generator.rb
174
174
  - lib/tao_on_rails.rb
175
+ - lib/tao_on_rails/action_view/helpers.rb
175
176
  - lib/tao_on_rails/engine.rb
176
177
  - lib/tao_on_rails/version.rb
177
178
  - lib/templates/app/app_template.rb