simple_active_link_to 1.1.0 → 1.1.1
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/.github/workflows/build.yml +33 -0
- data/.gitignore +2 -0
- data/README.md +4 -8
- data/lib/simple_active_link_to/simple_active_link_to.rb +3 -3
- data/lib/simple_active_link_to/version.rb +1 -1
- metadata +4 -4
- data/.github/workflows/gem.yml +0 -43
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c76b72044a585437ad07175a7aa395a970e25b8e402f04c5f1d585095060bc0d
|
|
4
|
+
data.tar.gz: 6495b87a880ac9bd383fac9c9db1f9a334468d1c5d37367689ced0890c644f46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd65c905895aeabfbcbcecc6ad22cb091f164ae294d9801f91d2361f8f5b4f6b4898bcebb29ab6adc1cfcfc6ed29bc7d8de83144165d3b22f698dcb8fd08b316
|
|
7
|
+
data.tar.gz: a8b95ad3bed8c8892523c46df3f66fee9738e3709c4ecbe9f7478f358b9e34db2de1eee2dd58e227b781b7ed0a27a1c09d2bf55922583af2e5b5ade9cf951359
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master, dev ]
|
|
6
|
+
paths-ignore:
|
|
7
|
+
- "**/README.md"
|
|
8
|
+
- lib/simple_active_link_to/version.rb
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ master, dev ]
|
|
11
|
+
paths-ignore:
|
|
12
|
+
- "**/README.md"
|
|
13
|
+
- lib/simple_active_link_to/version.rb
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
tests:
|
|
17
|
+
name: Tests
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
|
22
|
+
rails: ['5.0', '5.1', '5.2', '6.0', '6.1']
|
|
23
|
+
env:
|
|
24
|
+
BUNDLE_PATH: vendor/bundle
|
|
25
|
+
BUNDLE_GEMFILE: test/gemfiles/${{ matrix.rails }}.gemfile
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v2
|
|
28
|
+
- name: Set up Ruby
|
|
29
|
+
uses: ruby/setup-ruby@v1
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
|
32
|
+
bundler-cache: true
|
|
33
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
# simple_active_link_to
|
|
1
|
+
# simple_active_link_to  [](http://rubygems.org/gems/simple_active_link_to)
|
|
2
2
|
|
|
3
3
|
`simple_active_link_to` is a wrapper for [link_to](http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to), with active state by adding an extra css class `active` by default.
|
|
4
4
|
|
|
5
5
|
This gem works like [active_link_to](https://github.com/comfy/active_link_to), but with additional ```active_disable``` option and without wrap tag.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
[](http://rubygems.org/gems/simple_active_link_to)
|
|
9
|
-
|
|
10
|
-
Tested with ruby 2.5 to 2.7 and rails 5.0 to 6.1
|
|
7
|
+
Tested with ruby 2.5 to 3.0 and rails 5.0 to 6.1
|
|
11
8
|
|
|
12
9
|
## Installation
|
|
13
10
|
add `gem 'simple_active_link_to'` to Gemfile and run `bundle install`.
|
|
@@ -125,12 +122,11 @@ simple_active_link_to 'Users', users_path, active_disable: true
|
|
|
125
122
|
# => <span class="active">Users</span>
|
|
126
123
|
```
|
|
127
124
|
|
|
128
|
-
or you want to append it with hash (`#`) at the end of url
|
|
129
|
-
and don't want the link load the page content
|
|
125
|
+
or you want to append it with hash (`#`) at the end of url to make the link does not reload the page when clicked
|
|
130
126
|
|
|
131
127
|
```ruby
|
|
132
128
|
simple_active_link_to 'Users', users_path, active_disable: :hash
|
|
133
|
-
# => <a href="/users" class="active">Users</a>
|
|
129
|
+
# => <a href="/users#" class="active">Users</a>
|
|
134
130
|
```
|
|
135
131
|
|
|
136
132
|
## Helper Methods
|
|
@@ -84,9 +84,9 @@ module SimpleActiveLinkTo
|
|
|
84
84
|
case condition
|
|
85
85
|
when :exclusive, :inclusive, nil
|
|
86
86
|
url_path = url.split('#').first.split('?').first
|
|
87
|
-
url_string = URI.
|
|
88
|
-
request_uri = URI.
|
|
89
|
-
|
|
87
|
+
url_string = URI::DEFAULT_PARSER.unescape(url_path).force_encoding(Encoding::BINARY)
|
|
88
|
+
request_uri = URI::DEFAULT_PARSER.unescape(request.path).force_encoding(Encoding::BINARY)
|
|
89
|
+
|
|
90
90
|
if url_string == request_uri
|
|
91
91
|
true
|
|
92
92
|
elsif condition != :exclusive
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple_active_link_to
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fajarullah
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -103,7 +103,7 @@ executables: []
|
|
|
103
103
|
extensions: []
|
|
104
104
|
extra_rdoc_files: []
|
|
105
105
|
files:
|
|
106
|
-
- ".github/workflows/
|
|
106
|
+
- ".github/workflows/build.yml"
|
|
107
107
|
- ".gitignore"
|
|
108
108
|
- Gemfile
|
|
109
109
|
- LICENSE
|
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
140
|
version: '0'
|
|
141
141
|
requirements: []
|
|
142
|
-
rubygems_version: 3.
|
|
142
|
+
rubygems_version: 3.2.3
|
|
143
143
|
signing_key:
|
|
144
144
|
specification_version: 4
|
|
145
145
|
summary: ActionView helper to render currently active links
|
data/.github/workflows/gem.yml
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
name: Ruby Gem
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ master, dev ]
|
|
6
|
-
paths-ignore:
|
|
7
|
-
- "**/README.md"
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [ master, dev ]
|
|
10
|
-
paths-ignore:
|
|
11
|
-
- "**/README.md"
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
tests:
|
|
15
|
-
name: Tests
|
|
16
|
-
runs-on: ubuntu-latest
|
|
17
|
-
strategy:
|
|
18
|
-
matrix:
|
|
19
|
-
ruby: [2.5, 2.6, 2.7, 3.0]
|
|
20
|
-
rails: ['5.0', '5.1', '5.2', '6.0', '6.1']
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v2
|
|
23
|
-
- name: always-upload-cache
|
|
24
|
-
# You may pin to the exact commit or the version.
|
|
25
|
-
# uses: pat-s/always-upload-cache@8bf65902d2f73eea094eb913323ef6fb84f4bcb8
|
|
26
|
-
uses: pat-s/always-upload-cache@v2.1.3
|
|
27
|
-
with:
|
|
28
|
-
# A list of files, directories, and wildcard patterns to cache and restore
|
|
29
|
-
path: $(pwd)/vendor/bundle
|
|
30
|
-
key: ${{ runner.os }}-gems-${{ hashFiles('test/gemfiles/*.gemfile') }}
|
|
31
|
-
restore-keys: |
|
|
32
|
-
${{ runner.os }}-gems-
|
|
33
|
-
- name: Set up Ruby
|
|
34
|
-
uses: ruby/setup-ruby@v1
|
|
35
|
-
with:
|
|
36
|
-
ruby-version: ${{ matrix.ruby }}
|
|
37
|
-
- name: Bundle install
|
|
38
|
-
run: |
|
|
39
|
-
bundle config path $(pwd)/vendor/bundle
|
|
40
|
-
bundle install --jobs 4 --retry 3
|
|
41
|
-
env:
|
|
42
|
-
BUNDLE_GEMFILE: "test/gemfiles/${{ matrix.rails }}.gemfile"
|
|
43
|
-
- run: bundle exec rake
|