tao_popover 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +9 -1
- data/lib/assets/javascripts/tao_popover/direction.coffee +1 -1
- data/lib/assets/javascripts/tao_popover/element.coffee +45 -29
- data/lib/assets/javascripts/tao_popover/position.coffee +4 -4
- data/lib/assets/javascripts/tao_popover.coffee +1 -1
- data/lib/assets/stylesheets/tao_popover.scss +3 -2
- data/lib/tao_popover/action_view/helpers.rb +30 -0
- data/lib/tao_popover/engine.rb +14 -0
- data/lib/tao_popover/{rails/version.rb → version.rb} +1 -1
- data/lib/tao_popover.rb +2 -4
- metadata +12 -55
- data/.blade.yml +0 -47
- data/.gitignore +0 -10
- data/.travis.yml +0 -10
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/dist/tao.css +0 -475
- data/dist/tao.js +0 -31224
- data/dist/tao_popover.css +0 -89
- data/dist/tao_popover.js +0 -397
- data/index.html +0 -95
- data/lib/assets/javascripts/tao_popover/trigger.coffee +0 -46
- data/lib/tao_popover/rails/engine.rb +0 -8
- data/lib/tao_popover/rails.rb +0 -2
- data/tao_popover.gemspec +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ab53b8171ac4d35fe35daea50748361bff76c4
|
4
|
+
data.tar.gz: a1471bc1edcdd311307795655668140e406b5816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 530631e363b85b23449e5347e13c961b097712f2f9afe49d02943a3321e0d63bef4bd53812b7fe4fb10b60e58938ce570ef042851b453a05a373ac43ab8307b5
|
7
|
+
data.tar.gz: d4facfcdb608da919dd1ddc04b796f803ab0713d33fa1e17a2cfc6721cf3429b53b74db264bb3c99042881696d424329e6e7be8ced82e6ed6a4f915e698cdf29
|
data/Rakefile
CHANGED
@@ -7,25 +7,50 @@ class TaoPopover.Element extends TaoComponent
|
|
7
7
|
|
8
8
|
@tag: 'tao-popover'
|
9
9
|
|
10
|
-
@attribute 'active',
|
10
|
+
@attribute 'active', type: 'boolean', observe: true
|
11
11
|
|
12
|
-
@attribute '
|
12
|
+
@attribute 'targetSelector', 'targetTraversal', 'triggerSelector', 'triggerTraversal'
|
13
13
|
|
14
|
-
@attribute '
|
14
|
+
@attribute 'triggerAction', default: 'click'
|
15
|
+
|
16
|
+
@attribute 'boundarySelector', 'direction', 'arrowAlign', 'arrowVerticalAlign'
|
17
|
+
|
18
|
+
@attribute 'offset', default: 0
|
19
|
+
|
20
|
+
@attribute 'autoHide', type: 'boolean', default: true
|
15
21
|
|
16
22
|
_init: ->
|
17
|
-
@
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
@target = if @targetTraversal && @targetSelector
|
24
|
+
@jq[@targetTraversal]?(@targetSelector)
|
25
|
+
else if @targetSelector
|
26
|
+
$ @targetSelector
|
27
|
+
|
28
|
+
unless @target.length > 0
|
29
|
+
throw new Error 'tao-popover: targetSelector attribute is required.'
|
30
|
+
return
|
31
|
+
|
32
|
+
@trigger = if @triggerTraversal && @triggerSelector
|
33
|
+
@jq[@triggerTraversal]?(@triggerSelector)
|
34
|
+
else if @triggerSelector
|
35
|
+
$ @triggerSelector
|
36
|
+
else
|
37
|
+
@target
|
38
|
+
|
39
|
+
@_bind()
|
25
40
|
|
26
41
|
_connected: ->
|
27
|
-
@_autoHideChanged()
|
28
42
|
@refresh() if @active
|
43
|
+
@_enableAutoHide() if @autoHide && @active
|
44
|
+
|
45
|
+
_bind: ->
|
46
|
+
if @triggerAction == 'click'
|
47
|
+
@trigger.on 'click.tao-popover', (e) =>
|
48
|
+
@toggleActive()
|
49
|
+
else if @triggerAction == 'hover'
|
50
|
+
@trigger.on 'mouseenter.tao-popover', (e) =>
|
51
|
+
@active = true
|
52
|
+
.on 'mouseleave.tao-popover', (e) =>
|
53
|
+
@active = false
|
29
54
|
|
30
55
|
_activeChanged: ->
|
31
56
|
if @active
|
@@ -34,10 +59,6 @@ class TaoPopover.Element extends TaoComponent
|
|
34
59
|
else
|
35
60
|
@_disableAutoHide() if @autoHide
|
36
61
|
|
37
|
-
_autoHideChanged: ->
|
38
|
-
@_disableAutoHide()
|
39
|
-
@_enableAutoHide() if @autoHide && @active
|
40
|
-
|
41
62
|
_enableAutoHide: ->
|
42
63
|
$(document).on "mousedown.tao-popover-#{@taoId}", (e) =>
|
43
64
|
return unless @active
|
@@ -49,18 +70,12 @@ class TaoPopover.Element extends TaoComponent
|
|
49
70
|
$(document).off "mousedown.tao-popover-#{@taoId}"
|
50
71
|
|
51
72
|
refresh: ->
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
direction = new Direction
|
60
|
-
popover: @jq
|
61
|
-
target: @target
|
62
|
-
boundarySelector: @boundarySelector
|
63
|
-
@direction = direction.toString()
|
73
|
+
unless @direction
|
74
|
+
direction = new Direction
|
75
|
+
popover: @jq
|
76
|
+
target: @target
|
77
|
+
boundarySelector: @boundarySelector
|
78
|
+
@direction = direction.toString()
|
64
79
|
|
65
80
|
@position = new Position
|
66
81
|
popover: @jq
|
@@ -78,6 +93,7 @@ class TaoPopover.Element extends TaoComponent
|
|
78
93
|
@active = !@active
|
79
94
|
|
80
95
|
_disconnected: ->
|
81
|
-
@
|
96
|
+
@trigger.off '.tao-popover'
|
97
|
+
$(document).off ".tao-popover-#{@taoId}"
|
82
98
|
|
83
99
|
TaoComponent.register TaoPopover.Element
|
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
2
|
class TaoPopover.Position extends TaoModule
|
3
3
|
|
4
|
-
@
|
4
|
+
@property 'direction', 'popover', 'target'
|
5
5
|
|
6
|
-
@
|
6
|
+
@property 'arrowAlign', default: 'center'
|
7
7
|
|
8
|
-
@
|
8
|
+
@property 'arrowVerticalAlign', default: 'middle'
|
9
9
|
|
10
|
-
@
|
10
|
+
@property 'offset', default: 0
|
11
11
|
|
12
12
|
ARROW_OFFSET: 16
|
13
13
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module TaoPopover
|
2
|
+
module ActionView
|
3
|
+
module Helpers
|
4
|
+
|
5
|
+
include ::ActionView::Helpers
|
6
|
+
include ::ActionView::Context
|
7
|
+
|
8
|
+
def tao_popover(attributes = {}, &block)
|
9
|
+
if attributes[:class].present?
|
10
|
+
attributes[:class] += ' tao-popover'
|
11
|
+
else
|
12
|
+
attributes[:class] = 'tao-popover'
|
13
|
+
end
|
14
|
+
|
15
|
+
content = %Q{
|
16
|
+
<div class="tao-popover-content">
|
17
|
+
#{capture(&block)}
|
18
|
+
</div>
|
19
|
+
<div class="tao-popover-arrow">
|
20
|
+
<i class="arrow arrow-shadow"></i>
|
21
|
+
<i class="arrow arrow-border"></i>
|
22
|
+
<i class="arrow arrow-basic"></i>
|
23
|
+
</div>
|
24
|
+
}.html_safe
|
25
|
+
content_tag('tao-popover', content, attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'tao_on_rails'
|
2
|
+
require 'tao_popover/action_view/helpers'
|
3
|
+
|
4
|
+
module TaoPopover
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
initializer "tao_popover.view_helpers" do |app|
|
8
|
+
ActiveSupport.on_load :action_view do
|
9
|
+
include TaoPopover::ActionView::Helpers
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
data/lib/tao_popover.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tao_popover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- farthinker
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tao_on_rails
|
@@ -16,56 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.6.
|
19
|
+
version: 0.6.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.6.
|
26
|
+
version: 0.6.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '10.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '5.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '5.0'
|
40
|
+
version: '1.3'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: blade
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,33 +73,18 @@ executables: []
|
|
101
73
|
extensions: []
|
102
74
|
extra_rdoc_files: []
|
103
75
|
files:
|
104
|
-
- ".blade.yml"
|
105
|
-
- ".gitignore"
|
106
|
-
- ".travis.yml"
|
107
|
-
- CODE_OF_CONDUCT.md
|
108
|
-
- Gemfile
|
109
76
|
- LICENSE
|
110
|
-
- LICENSE.txt
|
111
77
|
- README.md
|
112
78
|
- Rakefile
|
113
|
-
- bin/console
|
114
|
-
- bin/setup
|
115
|
-
- dist/tao.css
|
116
|
-
- dist/tao.js
|
117
|
-
- dist/tao_popover.css
|
118
|
-
- dist/tao_popover.js
|
119
|
-
- index.html
|
120
79
|
- lib/assets/javascripts/tao_popover.coffee
|
121
80
|
- lib/assets/javascripts/tao_popover/direction.coffee
|
122
81
|
- lib/assets/javascripts/tao_popover/element.coffee
|
123
82
|
- lib/assets/javascripts/tao_popover/position.coffee
|
124
|
-
- lib/assets/javascripts/tao_popover/trigger.coffee
|
125
83
|
- lib/assets/stylesheets/tao_popover.scss
|
126
84
|
- lib/tao_popover.rb
|
127
|
-
- lib/tao_popover/
|
128
|
-
- lib/tao_popover/
|
129
|
-
- lib/tao_popover/
|
130
|
-
- tao_popover.gemspec
|
85
|
+
- lib/tao_popover/action_view/helpers.rb
|
86
|
+
- lib/tao_popover/engine.rb
|
87
|
+
- lib/tao_popover/version.rb
|
131
88
|
homepage: https://github.com/mycolorway/tao_popover
|
132
89
|
licenses:
|
133
90
|
- MIT
|
@@ -151,5 +108,5 @@ rubyforge_project:
|
|
151
108
|
rubygems_version: 2.5.1
|
152
109
|
signing_key:
|
153
110
|
specification_version: 4
|
154
|
-
summary:
|
111
|
+
summary: An easy to use popover component for Rails.
|
155
112
|
test_files: []
|
data/.blade.yml
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
load_paths:
|
2
|
-
- lib/assets/javascripts
|
3
|
-
- lib/assets/stylesheets
|
4
|
-
- test/javascripts/
|
5
|
-
- turbolinks-source: lib/assets/javascripts
|
6
|
-
- jquery-rails: vendor/assets/javascripts
|
7
|
-
- lodash-rails: vendor/assets/javascripts
|
8
|
-
- tao_on_rails:
|
9
|
-
- lib/assets/javascripts
|
10
|
-
- lib/assets/stylesheets
|
11
|
-
- vendor/assets/javascripts
|
12
|
-
- vendor/assets/stylesheets
|
13
|
-
|
14
|
-
logical_paths:
|
15
|
-
- tao.js
|
16
|
-
- tao.css
|
17
|
-
- tao_popover.css
|
18
|
-
- tao_popover.js
|
19
|
-
- tao_popover_test.js
|
20
|
-
|
21
|
-
build:
|
22
|
-
logical_paths:
|
23
|
-
- tao.js
|
24
|
-
- tao.css
|
25
|
-
- tao_popover.css
|
26
|
-
- tao_popover.js
|
27
|
-
path: dist
|
28
|
-
|
29
|
-
plugins:
|
30
|
-
sauce_labs:
|
31
|
-
tunnel_timeout: 120
|
32
|
-
browsers:
|
33
|
-
Google Chrome:
|
34
|
-
os: Mac, Windows
|
35
|
-
version: -2
|
36
|
-
Firefox:
|
37
|
-
os: Mac, Windows
|
38
|
-
version: -2
|
39
|
-
Safari:
|
40
|
-
platform: Mac
|
41
|
-
version: -3
|
42
|
-
Microsoft Edge:
|
43
|
-
version: -2
|
44
|
-
iPhone:
|
45
|
-
version: [9.3]
|
46
|
-
Motorola Droid 4 Emulator:
|
47
|
-
version: [5.1, 4.4]
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at farthinker@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 farthinker
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "tao_popover"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|