slim_breadcrumb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.sass-cache/dee5c1696b53a5db8342d6b3792b979412cf849f/breadcrumb.css.sassc +0 -0
- data/.sass-cache/dee5c1696b53a5db8342d6b3792b979412cf849f/modifications.css.sassc +0 -0
- data/.sass-cache/dee5c1696b53a5db8342d6b3792b979412cf849f/root.css.sassc +0 -0
- data/.travis.yml +8 -0
- data/Gemfile +33 -0
- data/Guardfile +19 -0
- data/LICENSE +22 -0
- data/README.md +73 -0
- data/Rakefile +2 -0
- data/lib/assets/images/slim_breadcrumb/breadcrumb-sep.png +0 -0
- data/lib/assets/javascripts/slim_breadcrumb.js.coffee +59 -0
- data/lib/slim_breadcrumb/engine.rb +7 -0
- data/lib/slim_breadcrumb/version.rb +3 -0
- data/lib/slim_breadcrumb.rb +6 -0
- data/slim_breadcrumb.gemspec +37 -0
- data/spec/integration/slim_breadcrumb_spec.rb +51 -0
- data/spec/spec_helper.rb +24 -0
- data/test_app/.gitignore +15 -0
- data/test_app/Gemfile +52 -0
- data/test_app/README.md +73 -0
- data/test_app/Rakefile +7 -0
- data/test_app/app/assets/images/rails.png +0 -0
- data/test_app/app/assets/images/screenshot.png +0 -0
- data/test_app/app/assets/javascripts/activate_best_in_place.js +4 -0
- data/test_app/app/assets/javascripts/application.js +17 -0
- data/test_app/app/assets/stylesheets/application.css +13 -0
- data/test_app/app/assets/stylesheets/breadcrumb.css.sass +27 -0
- data/test_app/app/assets/stylesheets/modifications.css.sass +9 -0
- data/test_app/app/assets/stylesheets/nifty.css +79 -0
- data/test_app/app/assets/stylesheets/root.css.sass +3 -0
- data/test_app/app/controllers/application_controller.rb +3 -0
- data/test_app/app/controllers/root_controller.rb +4 -0
- data/test_app/app/helpers/application_helper.rb +2 -0
- data/test_app/app/helpers/error_messages_helper.rb +23 -0
- data/test_app/app/helpers/layout_helper.rb +22 -0
- data/test_app/app/mailers/.gitkeep +0 -0
- data/test_app/app/models/.gitkeep +0 -0
- data/test_app/app/views/layouts/application.html.erb +19 -0
- data/test_app/app/views/root/index.html.erb +60 -0
- data/test_app/config/application.rb +59 -0
- data/test_app/config/boot.rb +6 -0
- data/test_app/config/database.yml +25 -0
- data/test_app/config/environment.rb +5 -0
- data/test_app/config/environments/development.rb +37 -0
- data/test_app/config/environments/production.rb +67 -0
- data/test_app/config/environments/test.rb +37 -0
- data/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test_app/config/initializers/inflections.rb +15 -0
- data/test_app/config/initializers/mime_types.rb +5 -0
- data/test_app/config/initializers/secret_token.rb +7 -0
- data/test_app/config/initializers/session_store.rb +8 -0
- data/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/test_app/config/locales/en.yml +5 -0
- data/test_app/config/routes.rb +63 -0
- data/test_app/config.ru +4 -0
- data/test_app/db/schema.rb +24 -0
- data/test_app/db/seeds.rb +7 -0
- data/test_app/lib/assets/.gitkeep +0 -0
- data/test_app/lib/tasks/.gitkeep +0 -0
- data/test_app/public/404.html +26 -0
- data/test_app/public/422.html +26 -0
- data/test_app/public/500.html +25 -0
- data/test_app/public/favicon.ico +0 -0
- data/test_app/public/robots.txt +5 -0
- data/test_app/public/stylesheets/application.css +75 -0
- data/test_app/script/rails +6 -0
- data/test_app/test/fixtures/users.yml +9 -0
- data/test_app/test/functional/users_controller_test.rb +54 -0
- data/test_app/test/unit/user_test.rb +7 -0
- data/test_app/vendor/assets/javascripts/.gitkeep +0 -0
- data/test_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test_app/vendor/plugins/.gitkeep +0 -0
- metadata +347 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
Binary file
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
group :test, :development do
|
4
|
+
gem 'rspec'
|
5
|
+
gem 'rspec-core'
|
6
|
+
gem 'rspec-expectations'
|
7
|
+
gem 'rspec-mocks'
|
8
|
+
gem 'nokogiri'
|
9
|
+
|
10
|
+
gem 'capybara'
|
11
|
+
gem "capybara-webkit"
|
12
|
+
|
13
|
+
gem 'execjs'
|
14
|
+
gem 'therubyracer', :platform => :ruby
|
15
|
+
|
16
|
+
gem 'guard', '1.0.1'
|
17
|
+
gem 'rspec-rails', '2.10.0'
|
18
|
+
gem 'guard-rspec', '0.5.5'
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
group :test do
|
23
|
+
gem 'sass-rails'
|
24
|
+
end
|
25
|
+
|
26
|
+
gem 'jquery-rails'
|
27
|
+
gem 'coffee-rails'
|
28
|
+
gem 'sqlite3'
|
29
|
+
|
30
|
+
|
31
|
+
# Specify your gem's dependencies in slim_breadcrumb.gemspec
|
32
|
+
gemspec
|
33
|
+
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
require 'active_support/core_ext'
|
5
|
+
|
6
|
+
guard 'rspec', :version => 2, :all_after_pass => false do
|
7
|
+
watch(%r{^spec/.+_spec\.rb$})
|
8
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
9
|
+
watch('spec/spec_helper.rb') { "spec" }
|
10
|
+
|
11
|
+
# Rails example
|
12
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
13
|
+
# watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
14
|
+
# watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
15
|
+
|
16
|
+
# Capybara request specs
|
17
|
+
# watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
18
|
+
end
|
19
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Sebastian Fiedlschuster
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# SlimBreadcrumb
|
2
|
+
|
3
|
+
This is a **ruby on rails gem** to **slim out** certain elements of a **breadcrumb navigation** and show these elements only if the user's mouse dwells on the breadcrumb separator.
|
4
|
+
|
5
|
+
## Demo
|
6
|
+
|
7
|
+
You might want to have a look at [this demo app at heroku](http://slim-breadcrumb-test-app.herokuapp.com/).
|
8
|
+
|
9
|
+
The [code of this demo app can be found here](https://github.com/fiedl/slim_breadcrumb/tree/master/test_app).
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'slim_breadcrumb'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install slim_breadcrumb
|
24
|
+
|
25
|
+
### Include Assets
|
26
|
+
|
27
|
+
In `app/assets/javascripts/application.js`, add:
|
28
|
+
|
29
|
+
```javascript
|
30
|
+
//= require slim_breadcrumb
|
31
|
+
```
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
In order to use this gem, you may use any tool of convenience to create your breadcrumb html code. The produced html code should look something like this:
|
35
|
+
|
36
|
+
```html
|
37
|
+
<nav>
|
38
|
+
<div id="breadcrumb">
|
39
|
+
<ul>
|
40
|
+
<li class="first crumb"><a href="#">#0 (Root)</a></li>
|
41
|
+
<li class="crumb sep"> </li>
|
42
|
+
|
43
|
+
<li class="slim crumb"><a href="#">#1 (Slim Crumb)</a></li>
|
44
|
+
<li class="crumb sep"> </li>
|
45
|
+
|
46
|
+
<li class="slim crumb"><a href="#">#2 (Slim Crumb)</a></li>
|
47
|
+
<li class="crumb sep"> </li>
|
48
|
+
|
49
|
+
<li class="crumb"><a href="#">#3 (Normal Crumb)</a></li>
|
50
|
+
<li class="crumb sep"> </li>
|
51
|
+
|
52
|
+
<li class="slim crumb"><a href="#">#4 (Slim Crumb)</a></li>
|
53
|
+
<li class="crumb sep"> </li>
|
54
|
+
|
55
|
+
<li class="slim last crumb"><a href="#">#5 (Slim Crumb)</a></li>
|
56
|
+
</ul>
|
57
|
+
</div>
|
58
|
+
</nav>
|
59
|
+
```
|
60
|
+
|
61
|
+
The important parts of this example are the **css classes** and the **id `#breadcrumb`**, the script relies on.
|
62
|
+
|
63
|
+
If you'd like to have a look at the [script, which is rather simple, you can do this here](https://github.com/fiedl/slim_breadcrumb/blob/master/lib/assets/javascripts/slim_breadcrumb.js.coffee).
|
64
|
+
|
65
|
+
You also have to handle your **stylesheets** for the breadcrumb yourself. An [example stylesheet can be found here](https://github.com/fiedl/slim_breadcrumb/blob/master/test_app/app/assets/stylesheets/breadcrumb.css.sass). Note that you may use the breadcrumb separator image just as done in the example, since this gem is providing this image.
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
Binary file
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
jQuery ->
|
3
|
+
|
4
|
+
# The last element of the whole bread crumb path is not to be shown slim
|
5
|
+
# in order to not have an open end (like " A >> C > D > " if E is slim).
|
6
|
+
$( "li.slim.crumb.last" ).removeClass( "slim" )
|
7
|
+
|
8
|
+
# Initially hide all slim elements.
|
9
|
+
$( "li.slim.crumb" ).hide()
|
10
|
+
|
11
|
+
# Define some timers: The slim elements are not to be shown immediately after
|
12
|
+
# mouseover(), but a while after, that is if the user stays over the element.
|
13
|
+
breadcrumb_slim_in_timer = 0
|
14
|
+
breadcrumb_slim_out_timer = 0
|
15
|
+
|
16
|
+
# Time required to dwell.
|
17
|
+
time_to_dwell = 1000 # milliseconds
|
18
|
+
|
19
|
+
# Show the slim elements if the mouse stays over the separator.
|
20
|
+
$( "li.crumb.sep" ).mouseover( ->
|
21
|
+
hovered_sep = $( this )
|
22
|
+
breadcrumb_slim_in_timer = setTimeout( ->
|
23
|
+
show_slim_breadcrumbs( hovered_sep )
|
24
|
+
, time_to_dwell )
|
25
|
+
).mouseout( ->
|
26
|
+
clearTimeout( breadcrumb_slim_in_timer )
|
27
|
+
)
|
28
|
+
|
29
|
+
# If the mouse leaves the breadcrumb, hide the slim elements.
|
30
|
+
$( "#breadcrumb" ).mouseout( ->
|
31
|
+
breadcrumb_slim_out_timer = setTimeout( ->
|
32
|
+
hide_slim_breadcrumbs()
|
33
|
+
, time_to_dwell )
|
34
|
+
).mouseover( ->
|
35
|
+
clearTimeout( breadcrumb_slim_out_timer )
|
36
|
+
)
|
37
|
+
|
38
|
+
# show animation:
|
39
|
+
breadcrumb_slim_effect = "drop"
|
40
|
+
show_slim_breadcrumbs = ( next_to_element = null ) ->
|
41
|
+
elements_to_show = close_slim_elements( next_to_element )
|
42
|
+
for elem in elements_to_show
|
43
|
+
unless $( elem ).is( ":visible" )
|
44
|
+
$( elem ).show( breadcrumb_slim_effect )
|
45
|
+
|
46
|
+
# hide animation:
|
47
|
+
hide_slim_breadcrumbs = () ->
|
48
|
+
if $( "li.slim.crumb:visible" ).html()
|
49
|
+
$( "li.crumb" ).hide( "fade", "fast", ->
|
50
|
+
$( "li.crumb:not(.slim)" ).show( "fade" )
|
51
|
+
)
|
52
|
+
|
53
|
+
# helper function to find nearby slim elements
|
54
|
+
close_slim_elements = ( next_to_element ) ->
|
55
|
+
return $( "li.slim.crumb" ) if next_to_element is null
|
56
|
+
left_element = $( next_to_element ).prevAll( "li.crumb:not(.slim,.sep)" ).last()
|
57
|
+
right_element = $( next_to_element ).nextAll( "li.crumb:not(.slim,.sep)" ).first()
|
58
|
+
elements_between = left_element.nextUntil( right_element, "li.slim.crumb" )
|
59
|
+
return elements_between
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/slim_breadcrumb/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "slim_breadcrumb"
|
6
|
+
gem.authors = ["Sebastian Fiedlschuster"]
|
7
|
+
gem.email = ["sebastian@fiedlschuster.de"]
|
8
|
+
gem.description = %q{Slim out certain elements of a breadcrumb navigation and show these elements only if the user\'s mouse dwellls on the breadcrumb separator.}
|
9
|
+
gem.summary = %q{Slim out certain elements of a breadcrumb navigation and show these elements only if the user\'s mouse dwellls on the breadcrumb separator.}
|
10
|
+
gem.homepage = "https://github.com/fiedl/slim_breadcrumb"
|
11
|
+
|
12
|
+
gem.files = `git ls-files`.split($\)
|
13
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
+
gem.name = "slim_breadcrumb"
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.version = SlimBreadcrumb::VERSION
|
18
|
+
|
19
|
+
gem.add_dependency "rails", ">= 3.2"
|
20
|
+
gem.add_dependency "jquery-rails"
|
21
|
+
gem.add_dependency 'sass-rails'
|
22
|
+
gem.add_dependency 'coffee-rails'
|
23
|
+
|
24
|
+
gem.add_development_dependency "rake"
|
25
|
+
gem.add_development_dependency "bundler"
|
26
|
+
gem.add_development_dependency "rspec-rails", ">= 2.8.0"
|
27
|
+
gem.add_development_dependency "guard", "1.0.1"
|
28
|
+
gem.add_development_dependency "nokogiri", ">= 1.5.0"
|
29
|
+
gem.add_development_dependency "capybara"
|
30
|
+
gem.add_development_dependency 'rspec-rails', '2.10.0'
|
31
|
+
gem.add_development_dependency 'guard-rspec', '0.5.5'
|
32
|
+
|
33
|
+
gem.add_development_dependency 'execjs'
|
34
|
+
gem.add_development_dependency 'therubyracer'
|
35
|
+
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "slim_breadcrumb behaviour", js: true do
|
4
|
+
|
5
|
+
before do
|
6
|
+
visit root_path
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "slim element #1" do
|
10
|
+
|
11
|
+
it "should be invisible at first" do
|
12
|
+
page.should_not have_selector( "#crumb1", visible: true )
|
13
|
+
end
|
14
|
+
|
15
|
+
for n in [0, 1, 2]
|
16
|
+
it "should appear after hovering the separators ##{n}" do
|
17
|
+
find( "#crumb_sep#{n}" ).trigger( :mouseover )
|
18
|
+
sleep 1.2
|
19
|
+
page.should have_selector( "#crumb1", visible: true )
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should *not* appear after hovering the separator #3" do
|
24
|
+
find( "#crumb_sep3" ).trigger( :mouseover )
|
25
|
+
sleep 1.2
|
26
|
+
page.should_not have_selector( "#crumb1", visible: true )
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should disappear after moving out the mouse" do
|
30
|
+
find( "#crumb_sep1" ).trigger( :mouseover )
|
31
|
+
sleep 1.2
|
32
|
+
find( "#breadcrumb" ).trigger( :mouseout )
|
33
|
+
page.should_not have_selector( "#crumb1", visible: true )
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "root element" do
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "last element" do
|
43
|
+
|
44
|
+
it "should be always visible, even if slim" do
|
45
|
+
page.should have_selector( "#crumb5", text: "#5 (Slim Crumb)", visible: true )
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
|
5
|
+
require File.expand_path('../../test_app/config/environment', __FILE__)
|
6
|
+
|
7
|
+
require "rspec/rails"
|
8
|
+
require "nokogiri"
|
9
|
+
|
10
|
+
# Load support files
|
11
|
+
#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each{|f| require f}
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
|
15
|
+
require 'rspec/expectations'
|
16
|
+
|
17
|
+
config.include RSpec::Matchers
|
18
|
+
|
19
|
+
Capybara.javascript_driver = :webkit
|
20
|
+
|
21
|
+
config.mock_with :rspec
|
22
|
+
end
|
23
|
+
|
24
|
+
|
data/test_app/.gitignore
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# See http://help.github.com/ignore-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 the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
|
13
|
+
# Ignore all logfiles and tempfiles.
|
14
|
+
/log/*.log
|
15
|
+
/tmp
|
data/test_app/Gemfile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '3.2.3'
|
4
|
+
|
5
|
+
# Bundle edge Rails instead:
|
6
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
7
|
+
|
8
|
+
group :development, :test do
|
9
|
+
gem 'sqlite3'
|
10
|
+
end
|
11
|
+
group :production do
|
12
|
+
gem 'pg'
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
# Gems used only for assets and not required
|
17
|
+
# in production environments by default.
|
18
|
+
group :assets do
|
19
|
+
gem 'sass-rails', '~> 3.2.3'
|
20
|
+
gem 'coffee-rails', '~> 3.2.1'
|
21
|
+
|
22
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
23
|
+
gem 'therubyracer', :platform => :ruby
|
24
|
+
|
25
|
+
gem 'uglifier', '>= 1.0.3'
|
26
|
+
end
|
27
|
+
|
28
|
+
gem 'jquery-rails'
|
29
|
+
gem 'jquery-ui-rails'
|
30
|
+
|
31
|
+
group :development do
|
32
|
+
gem 'nifty-generators'
|
33
|
+
end
|
34
|
+
|
35
|
+
# To use ActiveModel has_secure_password
|
36
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
37
|
+
|
38
|
+
# To use Jbuilder templates for JSON
|
39
|
+
# gem 'jbuilder'
|
40
|
+
|
41
|
+
# Use unicorn as the app server
|
42
|
+
# gem 'unicorn'
|
43
|
+
|
44
|
+
# Deploy with Capistrano
|
45
|
+
# gem 'capistrano'
|
46
|
+
|
47
|
+
# To use debugger
|
48
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|
49
|
+
|
50
|
+
gem "mocha", :group => :test
|
51
|
+
|
52
|
+
gem "slim_breadcrumb", path: "../"
|
data/test_app/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# SlimBreadcrumb
|
2
|
+
|
3
|
+
This is a **ruby on rails gem** to **slim out** certain elements of a **breadcrumb navigation** and show these elements only if the user's mouse dwells on the breadcrumb separator.
|
4
|
+
|
5
|
+
## Demo
|
6
|
+
|
7
|
+
You might want to have a look at [this demo app at heroku](http://slim-breadcrumb-test-app.herokuapp.com/).
|
8
|
+
|
9
|
+
The [code of this demo app can be found here](https://github.com/fiedl/slim_breadcrumb/tree/master/test_app).
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'slim_breadcrumb'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install slim_breadcrumb
|
24
|
+
|
25
|
+
### Include Assets
|
26
|
+
|
27
|
+
In `app/assets/javascripts/application.js`, add:
|
28
|
+
|
29
|
+
```javascript
|
30
|
+
//= require slim_breadcrumb
|
31
|
+
```
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
In order to use this gem, you may use any tool of convenience to create your breadcrumb html code. The produced html code should look something like this:
|
35
|
+
|
36
|
+
```html
|
37
|
+
<nav>
|
38
|
+
<div id="breadcrumb">
|
39
|
+
<ul>
|
40
|
+
<li class="first crumb"><a href="#">#0 (Root)</a></li>
|
41
|
+
<li class="crumb sep"> </li>
|
42
|
+
|
43
|
+
<li class="slim crumb"><a href="#">#1 (Slim Crumb)</a></li>
|
44
|
+
<li class="crumb sep"> </li>
|
45
|
+
|
46
|
+
<li class="slim crumb"><a href="#">#2 (Slim Crumb)</a></li>
|
47
|
+
<li class="crumb sep"> </li>
|
48
|
+
|
49
|
+
<li class="crumb"><a href="#">#3 (Normal Crumb)</a></li>
|
50
|
+
<li class="crumb sep"> </li>
|
51
|
+
|
52
|
+
<li class="slim crumb"><a href="#">#4 (Slim Crumb)</a></li>
|
53
|
+
<li class="crumb sep"> </li>
|
54
|
+
|
55
|
+
<li class="slim last crumb"><a href="#">#5 (Slim Crumb)</a></li>
|
56
|
+
</ul>
|
57
|
+
</div>
|
58
|
+
</nav>
|
59
|
+
```
|
60
|
+
|
61
|
+
The important parts of this example are the **css classes** and the **id `#breadcrumb`**, the script relies on.
|
62
|
+
|
63
|
+
If you'd like to have a look at the [script, which is rather simple, you can do this here](https://github.com/fiedl/slim_breadcrumb/blob/master/lib/assets/javascripts/slim_breadcrumb.js.coffee).
|
64
|
+
|
65
|
+
You also have to handle your **stylesheets** for the breadcrumb yourself. An [example stylesheet can be found here](https://github.com/fiedl/slim_breadcrumb/blob/master/test_app/app/assets/stylesheets/breadcrumb.css.sass). Note that you may use the breadcrumb separator image just as done in the example, since this gem is providing this image.
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create new Pull Request
|
data/test_app/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
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
|
+
TestApp::Application.load_tasks
|
Binary file
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
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-ui
|
15
|
+
//= require jquery_ujs
|
16
|
+
//= require slim_breadcrumb
|
17
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
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
|
+
*/
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#breadcrumb
|
2
|
+
vertical-alignment: middle
|
3
|
+
display: inline-block
|
4
|
+
font-size: 10pt
|
5
|
+
ul
|
6
|
+
display: inline-block
|
7
|
+
list-style-type: none
|
8
|
+
padding: 0px
|
9
|
+
margin: 0px
|
10
|
+
li
|
11
|
+
float: left
|
12
|
+
margin-left: 7px
|
13
|
+
margin-right: 7px
|
14
|
+
li.first
|
15
|
+
margin-left: 0px
|
16
|
+
li.slim.crumb
|
17
|
+
font-style: italic
|
18
|
+
display: inline
|
19
|
+
li.crumb.sep
|
20
|
+
margin: 0px
|
21
|
+
width: 3px
|
22
|
+
background: image-url("slim_breadcrumb/breadcrumb-sep.png") no-repeat center center
|
23
|
+
li.last
|
24
|
+
a
|
25
|
+
color: black
|
26
|
+
* a
|
27
|
+
text-decoration: none
|