gretel 3.0.9 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +11 -7
- data/.travis.yml +11 -10
- data/CHANGELOG.md +27 -0
- data/Gemfile +2 -19
- data/LICENSE.txt +1 -1
- data/README.md +43 -62
- data/Rakefile +3 -7
- data/coverage/coverage.txt +5 -0
- data/gretel.gemspec +12 -10
- data/lib/gretel.rb +2 -29
- data/lib/gretel/crumb.rb +5 -2
- data/lib/gretel/crumbs.rb +26 -7
- data/lib/gretel/railtie.rb +11 -0
- data/lib/gretel/renderer.rb +62 -30
- data/lib/gretel/version.rb +1 -1
- data/lib/gretel/view_helpers.rb +2 -0
- metadata +83 -110
- data/gemfiles/Gemfile-rails.3.1.x +0 -19
- data/gemfiles/Gemfile-rails.3.2.x +0 -19
- data/gemfiles/Gemfile-rails.4.0.x +0 -19
- data/gemfiles/Gemfile-rails.4.1.x +0 -19
- data/lib/gretel/deprecated.rb +0 -1
- data/lib/gretel/deprecated/default_style_key.rb +0 -25
- data/lib/gretel/deprecated/layout.rb +0 -15
- data/lib/gretel/deprecated/show_root_alone.rb +0 -27
- data/lib/gretel/deprecated/yield_links.rb +0 -44
- data/test/deprecated_test.rb +0 -45
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -5
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/issue.rb +0 -3
- data/test/dummy/app/models/project.rb +0 -3
- data/test/dummy/app/views/breadcrumbs/site.rb +0 -3
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -14
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/breadcrumbs.rb +0 -3
- data/test/dummy/config/breadcrumbs/test_crumbs.rb +0 -85
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -2
- data/test/dummy/config/environments/production.rb +0 -2
- data/test/dummy/config/environments/test.rb +0 -2
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -11
- data/test/dummy/db/migrate/20130122163007_create_projects.rb +0 -9
- data/test/dummy/db/migrate/20130122163051_create_issues.rb +0 -10
- data/test/dummy/db/schema.rb +0 -29
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/fixtures/issues.yml +0 -4
- data/test/fixtures/projects.yml +0 -3
- data/test/gretel_test.rb +0 -24
- data/test/helper_methods_test.rb +0 -546
- data/test/test_helper.rb +0 -15
@@ -1,19 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gem "gretel", :path => ".."
|
4
|
-
|
5
|
-
gem "rails", "~> 3.1.0"
|
6
|
-
gem "sqlite3"
|
7
|
-
|
8
|
-
# jquery-rails is used by the dummy application
|
9
|
-
gem "jquery-rails"
|
10
|
-
|
11
|
-
# Declare any dependencies that are still in development here instead of in
|
12
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
-
# your gem to rubygems.org.
|
15
|
-
|
16
|
-
# To use debugger
|
17
|
-
# gem 'debugger'
|
18
|
-
|
19
|
-
gem 'test-unit', '~> 3.0' if RUBY_VERSION >= "2.2"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gem "gretel", :path => ".."
|
4
|
-
|
5
|
-
gem "rails", "~> 3.2.0"
|
6
|
-
gem "sqlite3"
|
7
|
-
|
8
|
-
# jquery-rails is used by the dummy application
|
9
|
-
gem "jquery-rails"
|
10
|
-
|
11
|
-
# Declare any dependencies that are still in development here instead of in
|
12
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
-
# your gem to rubygems.org.
|
15
|
-
|
16
|
-
# To use debugger
|
17
|
-
# gem 'debugger'
|
18
|
-
|
19
|
-
gem 'test-unit', '~> 3.0' if RUBY_VERSION >= "2.2"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gem "gretel", :path => ".."
|
4
|
-
|
5
|
-
gem "rails", "~> 4.0.0"
|
6
|
-
gem "sqlite3"
|
7
|
-
|
8
|
-
# jquery-rails is used by the dummy application
|
9
|
-
gem "jquery-rails"
|
10
|
-
|
11
|
-
# Declare any dependencies that are still in development here instead of in
|
12
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
-
# your gem to rubygems.org.
|
15
|
-
|
16
|
-
# To use debugger
|
17
|
-
# gem 'debugger'
|
18
|
-
|
19
|
-
gem 'test-unit', '~> 3.0' if RUBY_VERSION >= "2.2"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gem "gretel", :path => ".."
|
4
|
-
|
5
|
-
gem "rails", "~> 4.1.0"
|
6
|
-
gem "sqlite3"
|
7
|
-
|
8
|
-
# jquery-rails is used by the dummy application
|
9
|
-
gem "jquery-rails"
|
10
|
-
|
11
|
-
# Declare any dependencies that are still in development here instead of in
|
12
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
-
# your gem to rubygems.org.
|
15
|
-
|
16
|
-
# To use debugger
|
17
|
-
# gem 'debugger'
|
18
|
-
|
19
|
-
gem 'test-unit', '~> 3.0' if RUBY_VERSION >= "2.2"
|
data/lib/gretel/deprecated.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Dir[File.dirname(__FILE__) + "/deprecated/*.rb"].each { |file| require file }
|
@@ -1,25 +0,0 @@
|
|
1
|
-
if RUBY_VERSION < "2.0"
|
2
|
-
Gretel::Renderer.class_eval do
|
3
|
-
def options_for_style_with_default_style_key(style_key)
|
4
|
-
if style_key == :default
|
5
|
-
Gretel.show_deprecation_warning "The :default style key is now called :inline. Please use `breadcrumbs style: :inline` instead or omit it, as it is the default."
|
6
|
-
style_key = :inline
|
7
|
-
end
|
8
|
-
options_for_style_without_default_style_key(style_key)
|
9
|
-
end
|
10
|
-
|
11
|
-
alias_method_chain :options_for_style, :default_style_key
|
12
|
-
end
|
13
|
-
else
|
14
|
-
module DeprecatedDefaultStyleKey
|
15
|
-
def options_for_style(style_key)
|
16
|
-
if style_key == :default
|
17
|
-
Gretel.show_deprecation_warning "The :default style key is now called :inline. Please use `breadcrumbs style: :inline` instead or omit it, as it is the default."
|
18
|
-
style_key = :inline
|
19
|
-
end
|
20
|
-
super(style_key)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
Gretel::Renderer.send :prepend, DeprecatedDefaultStyleKey
|
25
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Gretel::Crumbs.class_eval do
|
2
|
-
class << self
|
3
|
-
# Was used to lay out breadcrumbs in an initializer. Deprecated since v2.1.0
|
4
|
-
# and removed in v3.0.0. Will raise an exception if used. Put breadcrumbs in
|
5
|
-
# +config/breadcrumbs.rb+ instead (see
|
6
|
-
# https://github.com/lassebunk/gretel/blob/master/README.md for details).
|
7
|
-
def layout(&block)
|
8
|
-
raise (
|
9
|
-
"Gretel::Crumbs.layout was removed in Gretel version 3.0. " +
|
10
|
-
"Please put your breadcrumbs in `config/breadcrumbs.rb`. " +
|
11
|
-
"This will also automatically reload your breadcrumbs when you change them in the development environment. " +
|
12
|
-
"See https://github.com/lassebunk/gretel/blob/master/README.md for details.")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
if RUBY_VERSION < "2.0"
|
2
|
-
Gretel::Renderer.class_eval do
|
3
|
-
def options_for_render_with_show_root_alone(options = {})
|
4
|
-
options = options_for_render_without_show_root_alone(options)
|
5
|
-
if show_root_alone = options.delete(:show_root_alone)
|
6
|
-
Gretel.show_deprecation_warning "The :show_root_alone option is deprecated and will be removed in Gretel v4.0.0. Use `breadcrumbs(display_single_fragment: #{show_root_alone.inspect})` instead."
|
7
|
-
options[:display_single_fragment] = show_root_alone
|
8
|
-
end
|
9
|
-
options
|
10
|
-
end
|
11
|
-
|
12
|
-
alias_method_chain :options_for_render, :show_root_alone
|
13
|
-
end
|
14
|
-
else
|
15
|
-
module DeprecatedShowRootAlone
|
16
|
-
def options_for_render(options = {})
|
17
|
-
options = super(options)
|
18
|
-
if show_root_alone = options.delete(:show_root_alone)
|
19
|
-
Gretel.show_deprecation_warning "The :show_root_alone option is deprecated and will be removed in Gretel v4.0.0. Use `breadcrumbs(display_single_fragment: #{show_root_alone.inspect})` instead."
|
20
|
-
options[:display_single_fragment] = show_root_alone
|
21
|
-
end
|
22
|
-
options
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
Gretel::Renderer.send :prepend, DeprecatedShowRootAlone
|
27
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
if RUBY_VERSION < "2.0"
|
2
|
-
Gretel::ViewHelpers.class_eval do
|
3
|
-
|
4
|
-
def breadcrumbs_with_yield_links(options = {})
|
5
|
-
if block_given?
|
6
|
-
Gretel.show_deprecation_warning(
|
7
|
-
"Calling `breadcrumbs` with a block has been deprecated and will be removed in Gretel version 4.0. Please use `tap` instead. Example:\n" +
|
8
|
-
"\n" +
|
9
|
-
" breadcrumbs(autoroot: false).tap do |links|\n" +
|
10
|
-
" if links.any?\n" +
|
11
|
-
" # process links here\n" +
|
12
|
-
" end\n" +
|
13
|
-
" end\n"
|
14
|
-
)
|
15
|
-
yield gretel_renderer.render(options)
|
16
|
-
else
|
17
|
-
breadcrumbs_without_yield_links(options)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
alias_method_chain :breadcrumbs, :yield_links
|
22
|
-
end
|
23
|
-
else
|
24
|
-
module DeprecatedYieldLinks
|
25
|
-
def breadcrumbs(options = {})
|
26
|
-
if block_given?
|
27
|
-
Gretel.show_deprecation_warning(
|
28
|
-
"Calling `breadcrumbs` with a block has been deprecated and will be removed in Gretel version 4.0. Please use `tap` instead. Example:\n" +
|
29
|
-
"\n" +
|
30
|
-
" breadcrumbs(autoroot: false).tap do |links|\n" +
|
31
|
-
" if links.any?\n" +
|
32
|
-
" # process links here\n" +
|
33
|
-
" end\n" +
|
34
|
-
" end\n"
|
35
|
-
)
|
36
|
-
yield gretel_renderer.render(options)
|
37
|
-
else
|
38
|
-
super(options)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Gretel::ViewHelpers.send :prepend, DeprecatedYieldLinks
|
44
|
-
end
|
data/test/deprecated_test.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class DeprecatedTest < ActionView::TestCase
|
4
|
-
include Gretel::ViewHelpers
|
5
|
-
fixtures :all
|
6
|
-
helper :application
|
7
|
-
|
8
|
-
setup do
|
9
|
-
Gretel.reset!
|
10
|
-
Gretel.suppress_deprecation_warnings = true
|
11
|
-
end
|
12
|
-
|
13
|
-
test "show root alone" do
|
14
|
-
breadcrumb :root
|
15
|
-
assert_equal %{<div class="breadcrumbs"><span class="current">Home</span></div>},
|
16
|
-
breadcrumbs(show_root_alone: true).to_s
|
17
|
-
end
|
18
|
-
|
19
|
-
test "deprecated configuration block" do
|
20
|
-
assert_raises RuntimeError do
|
21
|
-
Gretel::Crumbs.layout do
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
test ":default style key" do
|
27
|
-
breadcrumb :basic
|
28
|
-
|
29
|
-
assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> › <span class="current">About</span></div>},
|
30
|
-
breadcrumbs(style: :default).to_s
|
31
|
-
end
|
32
|
-
|
33
|
-
test "yield links" do
|
34
|
-
breadcrumb :multiple_links_with_parent
|
35
|
-
|
36
|
-
out = breadcrumbs do |links|
|
37
|
-
links.map { |link| [link.key, link.text, link.url] }
|
38
|
-
end
|
39
|
-
|
40
|
-
assert_equal [[:root, "Home", "/"],
|
41
|
-
[:basic, "About", "/about"],
|
42
|
-
[:multiple_links_with_parent, "Contact", "/about/contact"],
|
43
|
-
[:multiple_links_with_parent, "Contact form", "/about/contact/form"]], out
|
44
|
-
end
|
45
|
-
end
|
data/test/dummy/Rakefile
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
-
|
5
|
-
require File.expand_path('../config/application', __FILE__)
|
6
|
-
|
7
|
-
Dummy::Application.load_tasks
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// the compiled file.
|
9
|
-
//
|
10
|
-
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require_tree .
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require_self
|
12
|
-
*= require_tree .
|
13
|
-
*/
|
File without changes
|
File without changes
|
data/test/dummy/config.ru
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
Bundler.require
|
6
|
-
require "gretel"
|
7
|
-
|
8
|
-
module Dummy
|
9
|
-
class Application < Rails::Application
|
10
|
-
config.secret_token = "secret token"
|
11
|
-
config.active_support.deprecation = :log
|
12
|
-
config.eager_load = false
|
13
|
-
end
|
14
|
-
end
|
data/test/dummy/config/boot.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
crumb :basic do
|
2
|
-
link "About", about_path
|
3
|
-
end
|
4
|
-
|
5
|
-
crumb :with_root do
|
6
|
-
link "About", about_path
|
7
|
-
parent :root
|
8
|
-
end
|
9
|
-
|
10
|
-
crumb :with_parent do
|
11
|
-
link "Contact", contact_path
|
12
|
-
parent :basic
|
13
|
-
end
|
14
|
-
|
15
|
-
crumb :object do |project|
|
16
|
-
link project.name, project
|
17
|
-
end
|
18
|
-
|
19
|
-
crumb :with_autopath do |project|
|
20
|
-
link project.name, project
|
21
|
-
end
|
22
|
-
|
23
|
-
crumb :with_parent_object do |issue|
|
24
|
-
link issue.title, project_issue_path(issue.project, issue)
|
25
|
-
parent :object, issue.project
|
26
|
-
end
|
27
|
-
|
28
|
-
crumb :multiple_links do
|
29
|
-
link "Contact", contact_path
|
30
|
-
link "Contact form", contact_form_path
|
31
|
-
end
|
32
|
-
|
33
|
-
crumb :multiple_links_with_parent do
|
34
|
-
link "Contact", contact_path
|
35
|
-
link "Contact form", contact_form_path
|
36
|
-
parent :basic
|
37
|
-
end
|
38
|
-
|
39
|
-
crumb :with_proc do
|
40
|
-
link Proc.new { "Name from proc" }, Proc.new { "URL from proc" }
|
41
|
-
end
|
42
|
-
|
43
|
-
crumb :with_multiple_arguments do |a, b, c|
|
44
|
-
link "#{a} and #{b} and #{c}", contact_path
|
45
|
-
parent :parent_with_multiple_arguments, a * 2, b * 2, c * 2
|
46
|
-
end
|
47
|
-
|
48
|
-
crumb :parent_with_multiple_arguments do |d, e, f|
|
49
|
-
link "First #{d} then #{e} then #{f}", about_path
|
50
|
-
end
|
51
|
-
|
52
|
-
crumb :with_unsafe_html do
|
53
|
-
link "Test <strong>bold text</strong>", about_path
|
54
|
-
end
|
55
|
-
|
56
|
-
crumb :with_safe_html do
|
57
|
-
link "Test <strong>bold text</strong>".html_safe, about_path
|
58
|
-
end
|
59
|
-
|
60
|
-
crumb :without_link do
|
61
|
-
link "Without link"
|
62
|
-
parent :parent_without_link
|
63
|
-
end
|
64
|
-
|
65
|
-
crumb :parent_without_link do
|
66
|
-
link "Also without link"
|
67
|
-
end
|
68
|
-
|
69
|
-
crumb :using_view_helper do
|
70
|
-
link times_two("Test"), about_path
|
71
|
-
end
|
72
|
-
|
73
|
-
crumb :project do |project|
|
74
|
-
link project.name, project
|
75
|
-
end
|
76
|
-
|
77
|
-
crumb :with_link_options do
|
78
|
-
link "Test", about_path, title: "My Title", other: "Other Option"
|
79
|
-
link "Other Link", some_option: "Test"
|
80
|
-
end
|
81
|
-
|
82
|
-
crumb :with_inferred_parent do
|
83
|
-
link "Test", about_path
|
84
|
-
parent Project.first
|
85
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
development:
|
7
|
-
adapter: sqlite3
|
8
|
-
database: db/development.sqlite3
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
|
-
test:
|
16
|
-
adapter: sqlite3
|
17
|
-
database: db/test.sqlite3
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|