breadcrumbs 0.1.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/CODEOWNERS +4 -0
- data/.github/FUNDING.yml +4 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- data/.github/ISSUE_TEMPLATE/config.yml +5 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- data/.github/dependabot.yml +20 -0
- data/.github/workflows/ruby-tests.yml +52 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +80 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +142 -0
- data/Rakefile +15 -0
- data/breadcrumbs.gemspec +49 -0
- data/examples/myapp/.gitignore +12 -0
- data/examples/myapp/Gemfile +12 -0
- data/examples/myapp/README.rdoc +28 -0
- data/examples/myapp/Rakefile +6 -0
- data/examples/myapp/app/assets/images/.keep +0 -0
- data/examples/myapp/app/assets/stylesheets/application.css +49 -0
- data/examples/myapp/app/controllers/application_controller.rb +13 -0
- data/examples/myapp/app/controllers/concerns/.keep +0 -0
- data/examples/myapp/app/controllers/site_controller.rb +9 -0
- data/examples/myapp/app/helpers/application_helper.rb +2 -0
- data/examples/myapp/app/mailers/.keep +0 -0
- data/examples/myapp/app/models/.keep +0 -0
- data/examples/myapp/app/models/concerns/.keep +0 -0
- data/examples/myapp/app/views/layouts/application.html.erb +15 -0
- data/examples/myapp/app/views/site/contact.html.erb +1 -0
- data/examples/myapp/app/views/site/home.html.erb +1 -0
- data/examples/myapp/bin/bundle +3 -0
- data/examples/myapp/bin/rails +4 -0
- data/examples/myapp/bin/rake +4 -0
- data/examples/myapp/bin/setup +29 -0
- data/examples/myapp/config/application.rb +30 -0
- data/examples/myapp/config/boot.rb +3 -0
- data/examples/myapp/config/environment.rb +5 -0
- data/examples/myapp/config/environments/development.rb +38 -0
- data/examples/myapp/config/environments/production.rb +73 -0
- data/examples/myapp/config/environments/test.rb +39 -0
- data/examples/myapp/config/initializers/assets.rb +11 -0
- data/examples/myapp/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/myapp/config/initializers/cookies_serializer.rb +3 -0
- data/examples/myapp/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/myapp/config/initializers/inflections.rb +16 -0
- data/examples/myapp/config/initializers/mime_types.rb +4 -0
- data/examples/myapp/config/initializers/session_store.rb +3 -0
- data/examples/myapp/config/initializers/wrap_parameters.rb +9 -0
- data/examples/myapp/config/locales/en.yml +28 -0
- data/examples/myapp/config/routes.rb +5 -0
- data/examples/myapp/config/secrets.yml +22 -0
- data/examples/myapp/config.ru +4 -0
- data/examples/myapp/db/seeds.rb +7 -0
- data/examples/myapp/lib/assets/.keep +0 -0
- data/examples/myapp/lib/tasks/.keep +0 -0
- data/examples/myapp/log/.keep +0 -0
- data/examples/myapp/public/404.html +67 -0
- data/examples/myapp/public/422.html +67 -0
- data/examples/myapp/public/500.html +66 -0
- data/examples/myapp/public/favicon.ico +0 -0
- data/examples/myapp/public/robots.txt +5 -0
- data/examples/myapp/vendor/assets/stylesheets/.keep +0 -0
- data/lib/breadcrumbs/action_controller_ext.rb +3 -1
- data/lib/breadcrumbs/render/base.rb +9 -21
- data/lib/breadcrumbs/render/inline.rb +12 -8
- data/lib/breadcrumbs/render/list.rb +8 -8
- data/lib/breadcrumbs/render/ordered_list.rb +2 -0
- data/lib/breadcrumbs/render.rb +6 -4
- data/lib/breadcrumbs/version.rb +4 -2
- data/lib/breadcrumbs.rb +36 -21
- data/test/breadcrumbs_test.rb +71 -56
- data/test/{resources/pt.yml → support/pt-BR.yml} +3 -2
- data/test/test_helper.rb +11 -6
- metadata +288 -55
- data/README.rdoc +0 -113
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9469ca3bb1e994e5914e7d20dd3befc975347e06d0f139f231ecc566a90f5a89
|
4
|
+
data.tar.gz: f41ffaded5c611b2a9fc30d909d599d312bf50a6750aa0a75fdabc1c2d8b1bef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d35875762fca9091a8d2c2866202d3e381c9d466a467af04ad5e5c32b900476c4c15d472e531f288817810de136cbb8b0d9237edeefedb574ed294f2f8d7ae5a
|
7
|
+
data.tar.gz: 7db21eaa5f88683fe4f4dd3d12703d81e93d436d7b3fcafa4afaa6ea177d9ddea0433e10d24db3cd7075b576bc939203e47e31043b394511286db3442ea34c57
|
data/.github/CODEOWNERS
ADDED
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
name: "🐛 Bug Report"
|
3
|
+
about: Report a reproducible bug or regression.
|
4
|
+
title: "Bug: "
|
5
|
+
labels: "Status: Unconfirmed"
|
6
|
+
---
|
7
|
+
|
8
|
+
<!--
|
9
|
+
- Please provide a clear and concise description of what the bug is.
|
10
|
+
- If possible, add an example reproducing your issue.
|
11
|
+
- Please test using the latest version of breadcrumbs
|
12
|
+
to make sure your issue has not already been fixed.
|
13
|
+
-->
|
14
|
+
|
15
|
+
## Description
|
16
|
+
|
17
|
+
[Add bug description here]
|
18
|
+
|
19
|
+
## How to reproduce
|
20
|
+
|
21
|
+
[Add steps on how to reproduce this issue]
|
22
|
+
|
23
|
+
## What do you expect
|
24
|
+
|
25
|
+
[Describe what do you expect to happen]
|
26
|
+
|
27
|
+
## What happened instead
|
28
|
+
|
29
|
+
[Describe the actual results]
|
30
|
+
|
31
|
+
## Software:
|
32
|
+
|
33
|
+
- Gem version: [Add gem version here]
|
34
|
+
- Ruby version: [Add version here]
|
35
|
+
|
36
|
+
## Full backtrace
|
37
|
+
|
38
|
+
```text
|
39
|
+
[Paste full backtrace here]
|
40
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
name: "💡 Feature request"
|
3
|
+
about: Have an idea that may be useful? Make a suggestion!
|
4
|
+
title: 'Feature Request: '
|
5
|
+
labels: 'Feature request'
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
_A clear and concise description of what the problem is._
|
12
|
+
|
13
|
+
## Describe the solution
|
14
|
+
|
15
|
+
_A clear and concise description of what you want to happen._
|
16
|
+
|
17
|
+
## Alternatives you considered
|
18
|
+
|
19
|
+
_A clear and concise description of any alternative solutions or features you've considered._
|
20
|
+
|
21
|
+
## Additional context
|
22
|
+
|
23
|
+
_Add any other context, screenshots, links, etc about the feature request here._
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!--
|
2
|
+
If you're making a doc PR or something tiny where the below is irrelevant,
|
3
|
+
delete this template and use a short description, but in your description aim to
|
4
|
+
include both what the change is, and why it is being made, with enough context
|
5
|
+
for anyone to understand.
|
6
|
+
-->
|
7
|
+
|
8
|
+
<details>
|
9
|
+
<summary>PR Checklist</summary>
|
10
|
+
|
11
|
+
### PR Structure
|
12
|
+
|
13
|
+
- [ ] This PR has reasonably narrow scope (if not, break it down into smaller
|
14
|
+
PRs).
|
15
|
+
- [ ] This PR avoids mixing refactoring changes with feature changes (split into
|
16
|
+
two PRs otherwise).
|
17
|
+
- [ ] This PR's title starts is concise and descriptive.
|
18
|
+
|
19
|
+
### Thoroughness
|
20
|
+
|
21
|
+
- [ ] This PR adds tests for the most critical parts of the new functionality or
|
22
|
+
fixes.
|
23
|
+
- [ ] I've updated any docs, `.md` files, etc… affected by this change.
|
24
|
+
|
25
|
+
</details>
|
26
|
+
|
27
|
+
### What
|
28
|
+
|
29
|
+
[TODO: Short statement about what is changing.]
|
30
|
+
|
31
|
+
### Why
|
32
|
+
|
33
|
+
[TODO: Why this change is being made. Include any context required to understand
|
34
|
+
the why.]
|
35
|
+
|
36
|
+
### Known limitations
|
37
|
+
|
38
|
+
[TODO or N/A]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
# Documentation:
|
3
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
4
|
+
|
5
|
+
version: 2
|
6
|
+
updates:
|
7
|
+
- package-ecosystem: "github-actions"
|
8
|
+
directory: "/"
|
9
|
+
schedule:
|
10
|
+
interval: "daily"
|
11
|
+
|
12
|
+
- package-ecosystem: npm
|
13
|
+
directory: "/"
|
14
|
+
schedule:
|
15
|
+
interval: "daily"
|
16
|
+
|
17
|
+
- package-ecosystem: bundler
|
18
|
+
directory: "/"
|
19
|
+
schedule:
|
20
|
+
interval: "daily"
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
name: ruby-tests
|
3
|
+
|
4
|
+
on:
|
5
|
+
pull_request_target:
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
workflow_dispatch:
|
10
|
+
inputs: {}
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
build:
|
14
|
+
name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
|
15
|
+
runs-on: "ubuntu-latest"
|
16
|
+
if: |
|
17
|
+
github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target' ||
|
18
|
+
github.actor != 'dependabot[bot]'
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
ruby: ["2.7", "3.0", "3.1"]
|
23
|
+
gemfile:
|
24
|
+
- Gemfile
|
25
|
+
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v2.4.0
|
28
|
+
|
29
|
+
- uses: actions/cache@v2
|
30
|
+
with:
|
31
|
+
path: vendor/bundle
|
32
|
+
key: >
|
33
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
|
34
|
+
|
35
|
+
- name: Set up Ruby
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.ruby }}
|
39
|
+
|
40
|
+
- name: Install gem dependencies
|
41
|
+
env:
|
42
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
43
|
+
run: |
|
44
|
+
gem install bundler
|
45
|
+
bundle config path vendor/bundle
|
46
|
+
bundle update --jobs 4 --retry 3
|
47
|
+
|
48
|
+
- name: Run Tests
|
49
|
+
env:
|
50
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
51
|
+
run: |
|
52
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
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 me@fnando.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 [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Contributing to breadcrumbs
|
2
|
+
|
3
|
+
👍🎉 First off, thanks for taking the time to contribute! 🎉👍
|
4
|
+
|
5
|
+
The following is a set of guidelines for contributing to this project. These are
|
6
|
+
mostly guidelines, not rules. Use your best judgment, and feel free to propose
|
7
|
+
changes to this document in a pull request.
|
8
|
+
|
9
|
+
## Code of Conduct
|
10
|
+
|
11
|
+
Everyone interacting in this project's codebases, issue trackers, chat rooms and
|
12
|
+
mailing lists is expected to follow the
|
13
|
+
[code of conduct](https://github.com/fnando/breadcrumbs/blob/main/CODE_OF_CONDUCT.md).
|
14
|
+
|
15
|
+
## Reporting bugs
|
16
|
+
|
17
|
+
This section guides you through submitting a bug report. Following these
|
18
|
+
guidelines helps maintainers and the community understand your report, reproduce
|
19
|
+
the behavior, and find related reports.
|
20
|
+
|
21
|
+
- Before creating bug reports, please check the open issues; somebody may
|
22
|
+
already have submitted something similar, and you may not need to create a new
|
23
|
+
one.
|
24
|
+
- When you are creating a bug report, please include as many details as
|
25
|
+
possible, with an example reproducing the issue.
|
26
|
+
|
27
|
+
## Contributing with code
|
28
|
+
|
29
|
+
Before making any radicals changes, please make sure you discuss your intention
|
30
|
+
by [opening an issue on Github](https://github.com/fnando/breadcrumbs/issues).
|
31
|
+
|
32
|
+
When you're ready to make your pull request, follow checklist below to make sure
|
33
|
+
your contribution is according to how this project works.
|
34
|
+
|
35
|
+
1. [Fork](https://help.github.com/forking/) breadcrumbs
|
36
|
+
2. Create a topic branch - `git checkout -b my_branch`
|
37
|
+
3. Make your changes using [descriptive commit messages](#commit-messages)
|
38
|
+
4. Update CHANGELOG.md describing your changes by adding an entry to the
|
39
|
+
"Unreleased" section. If this section is not available, create one right
|
40
|
+
before the last version.
|
41
|
+
5. Push to your branch - `git push origin my_branch`
|
42
|
+
6. [Create a pull request](https://help.github.com/articles/creating-a-pull-request)
|
43
|
+
7. That's it!
|
44
|
+
|
45
|
+
## Styleguides
|
46
|
+
|
47
|
+
### Commit messages
|
48
|
+
|
49
|
+
- Use the present tense ("Add feature" not "Added feature")
|
50
|
+
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
|
51
|
+
- Limit the first line to 72 characters or less
|
52
|
+
- Reference issues and pull requests liberally after the first line
|
53
|
+
|
54
|
+
### Changelog
|
55
|
+
|
56
|
+
- Add a message describing your changes to the "Unreleased" section. The
|
57
|
+
changelog message should follow the same style as the commit message.
|
58
|
+
- Prefix your message with one of the following:
|
59
|
+
- `[Added]` for new features.
|
60
|
+
- `[Changed]` for changes in existing functionality.
|
61
|
+
- `[Deprecated]` for soon-to-be removed features.
|
62
|
+
- `[Removed]` for now removed features.
|
63
|
+
- `[Fixed]` for any bug fixes.
|
64
|
+
- `[Security]` in case of vulnerabilities.
|
65
|
+
|
66
|
+
### Ruby code
|
67
|
+
|
68
|
+
- This project uses [Rubocop](https://rubocop.org) to enforce code style. Before
|
69
|
+
submitting your changes, make sure your tests are passing and code conforms to
|
70
|
+
the expected style by running `rake`.
|
71
|
+
- Do not change the library version. This will be done by the maintainer
|
72
|
+
whenever a new version is about to be released.
|
73
|
+
|
74
|
+
### JavaScript code
|
75
|
+
|
76
|
+
- This project uses [ESLint](https://eslint.org) to enforce code style. Before
|
77
|
+
submitting your changes, make sure your tests are passing and code conforms to
|
78
|
+
the expected style by running `yarn test:ci`.
|
79
|
+
- Do not change the library version. This will be done by the maintainer
|
80
|
+
whenever a new version is about to be released.
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Nando Vieira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
# Breadcrumbs
|
2
|
+
|
3
|
+
[![ruby-tests](https://github.com/fnando/breadcrumbs/actions/workflows/ruby-tests.yml/badge.svg)](https://github.com/fnando/breadcrumbs/actions/workflows/ruby-tests.yml)
|
4
|
+
[![Gem](https://img.shields.io/gem/v/breadcrumbs.svg)](https://rubygems.org/gems/breadcrumbs)
|
5
|
+
[![Gem](https://img.shields.io/gem/dt/breadcrumbs.svg)](https://rubygems.org/gems/breadcrumbs)
|
6
|
+
|
7
|
+
Breadcrumbs is a simple plugin that adds a `breadcrumbs` object to controllers
|
8
|
+
and views.
|
9
|
+
|
10
|
+
## Instalation
|
11
|
+
|
12
|
+
Just run `gem install breadcrumbs`. Or add `gem "breadcrumbs"` to your Gemfile.
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
On your controller (optional):
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
class ApplicationController < ActionController::Base
|
20
|
+
before_filter :add_initial_breadcrumbs
|
21
|
+
|
22
|
+
private
|
23
|
+
def add_initial_breadcrumbs
|
24
|
+
breadcrumbs.add "Home", root_path
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class ThingsController < ApplicationController
|
29
|
+
def index
|
30
|
+
breadcrumbs.add "Things", things_path
|
31
|
+
end
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
You don't need to provide an URL; in that case, a span will be generated instead
|
36
|
+
of a link:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
breadcrumbs.add "Some page"
|
40
|
+
```
|
41
|
+
|
42
|
+
You can set additional HTML attributes if you need to:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
breadcrumbs.add "Home", root_path, id: "home", title: "Go to the home page"
|
46
|
+
```
|
47
|
+
|
48
|
+
On your view (possibly application.html.erb):
|
49
|
+
|
50
|
+
```erb
|
51
|
+
<%= breadcrumbs.render %>
|
52
|
+
```
|
53
|
+
|
54
|
+
You can render as ordered list.
|
55
|
+
|
56
|
+
```erb
|
57
|
+
<%= breadcrumbs.render(format: :ordered_list) %>
|
58
|
+
```
|
59
|
+
|
60
|
+
You can render as inline links.
|
61
|
+
|
62
|
+
```erb
|
63
|
+
<%= breadcrumbs.render(format: :inline) %>
|
64
|
+
```
|
65
|
+
|
66
|
+
You can set your own separator:
|
67
|
+
|
68
|
+
```erb
|
69
|
+
<p>
|
70
|
+
You are here: <%= breadcrumbs.render(format: :inline, separator: "|") %>
|
71
|
+
</p>
|
72
|
+
```
|
73
|
+
|
74
|
+
You can also define your own formatter. Just create a class that implements a
|
75
|
+
`render` instance method and you're good to go.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
class Breadcrumbs::Render::Dl
|
79
|
+
def render
|
80
|
+
# return breadcrumbs wrapped in a <dl> tag
|
81
|
+
end
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
85
|
+
To use your new format, just provide the `:format` option.
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
breadcrumbs.render(format: :dl)
|
89
|
+
```
|
90
|
+
|
91
|
+
### I18n
|
92
|
+
|
93
|
+
Breadcrumbs is integrated with I18n. You can set translations like:
|
94
|
+
|
95
|
+
```yaml
|
96
|
+
en:
|
97
|
+
breadcrumbs:
|
98
|
+
home: "Home"
|
99
|
+
```
|
100
|
+
|
101
|
+
And then you just call
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
breadcrumbs.add :home
|
105
|
+
```
|
106
|
+
|
107
|
+
In fact, you can provide any scope you want.
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
breadcrumbs.add :"titles.home"
|
111
|
+
```
|
112
|
+
|
113
|
+
If you don't want to translate a label, just pass the option `:i18n` as `false`.
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
breadcrumbs.add :home, nil, i18n: false
|
117
|
+
```
|
118
|
+
|
119
|
+
## Maintainer
|
120
|
+
|
121
|
+
- [Nando Vieira](https://github.com/fnando)
|
122
|
+
|
123
|
+
## Contributors
|
124
|
+
|
125
|
+
- https://github.com/fnando/breadcrumbs/contributors
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
For more details about how to contribute, please read
|
130
|
+
https://github.com/fnando/breadcrumbs/blob/main/CONTRIBUTING.md.
|
131
|
+
|
132
|
+
## License
|
133
|
+
|
134
|
+
The gem is available as open source under the terms of the
|
135
|
+
[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
|
136
|
+
found at https://github.com/fnando/breadcrumbs/blob/main/LICENSE.md.
|
137
|
+
|
138
|
+
## Code of Conduct
|
139
|
+
|
140
|
+
Everyone interacting in the breadcrumbs project's codebases, issue trackers,
|
141
|
+
chat rooms and mailing lists is expected to follow the
|
142
|
+
[code of conduct](https://github.com/fnando/breadcrumbs/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << "test"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
t.warning = false
|
11
|
+
end
|
12
|
+
|
13
|
+
RuboCop::RakeTask.new
|
14
|
+
|
15
|
+
task default: %i[test rubocop]
|
data/breadcrumbs.gemspec
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "./lib/breadcrumbs/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "breadcrumbs"
|
7
|
+
s.version = Breadcrumbs::Version::STRING
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Nando Vieira"]
|
10
|
+
s.email = ["fnando.vieira@gmail.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/breadcrumbs"
|
12
|
+
s.summary = "Breadcrumbs is a simple plugin that adds a `breadcrumbs` " \
|
13
|
+
"object to controllers and views."
|
14
|
+
s.description = s.summary
|
15
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
16
|
+
|
17
|
+
github_url = "https://github.com/fnando/breadcrumbs"
|
18
|
+
github_tree_url = "#{github_url}/tree/v#{s.version}"
|
19
|
+
|
20
|
+
s.metadata["homepage_uri"] = s.homepage
|
21
|
+
s.metadata["bug_tracker_uri"] = "#{github_url}/issues"
|
22
|
+
s.metadata["source_code_uri"] = github_tree_url
|
23
|
+
s.metadata["changelog_uri"] = "#{github_tree_url}/CHANGELOG.md"
|
24
|
+
s.metadata["documentation_uri"] = "#{github_tree_url}/README.md"
|
25
|
+
s.metadata["license_uri"] = "#{github_tree_url}/LICENSE.md"
|
26
|
+
s.metadata["rubygems_mfa_required"] = "true"
|
27
|
+
|
28
|
+
s.files = `git ls-files`.split("\n")
|
29
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
|
+
s.executables = `git ls-files -- bin/*`
|
31
|
+
.split("\n")
|
32
|
+
.map {|f| File.basename(f) }
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
|
35
|
+
s.add_dependency "actionview"
|
36
|
+
s.add_dependency "activesupport"
|
37
|
+
s.add_dependency "i18n"
|
38
|
+
|
39
|
+
s.add_development_dependency "actionpack"
|
40
|
+
s.add_development_dependency "bundler"
|
41
|
+
s.add_development_dependency "minitest-utils"
|
42
|
+
s.add_development_dependency "mocha"
|
43
|
+
s.add_development_dependency "nokogiri"
|
44
|
+
s.add_development_dependency "pry-meta"
|
45
|
+
s.add_development_dependency "rake"
|
46
|
+
s.add_development_dependency "rubocop"
|
47
|
+
s.add_development_dependency "rubocop-fnando"
|
48
|
+
s.add_development_dependency "simplecov"
|
49
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/log/*.log
|
12
|
+
/tmp
|
@@ -0,0 +1,12 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '4.2.0.beta1'
|
4
|
+
gem 'sass-rails', '~> 5.0.0.beta1'
|
5
|
+
gem 'uglifier', '>= 1.3.0'
|
6
|
+
gem 'rails-html-sanitizer', '~> 1.0'
|
7
|
+
gem 'breadcrumbs', path: '../..'
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
gem 'spring'
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
File without changes
|