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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73617025bb5fd1f6c8b185b4b7bf2e0f69b525d6
|
4
|
+
data.tar.gz: 26d38bad6618841c2ec15a3ac98e6f10d36af605
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 697414f18585e740746b88b05891d3595884637bc8089ba5bc1eef8359ca59b593465ddc5fb6230e2b685ff5bdaea280e91678eeefe132ad85f4c84b0bd36272
|
7
|
+
data.tar.gz: ac5ccf4e488bde8f82d9721e99b57f36727f2dca5f9d219bd97a7c4ab023d01a3ad50f5eb3dc2959a7eeac3a299869ef2571a0323bd4bbe639788a9840d0b566
|
@@ -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
|
data/lib/tao_on_rails/engine.rb
CHANGED
@@ -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
|
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.6.
|
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-
|
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
|