bootstrap-sass-extras 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 550a564e70192941701c65f0c2f260f9214a238e
|
4
|
+
data.tar.gz: 71be55dfd76ad3476b5fead050a3666693905160
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d87b9a5f91ad2dc39d345fed78f0807df9cde3f4e99da16424cd01dde79ed616bf3b05770e2bf671d30a15403c406eef52dceeb0a1ddac506784b1527a4dc28
|
7
|
+
data.tar.gz: eaf9f7312bc58f539c09b3aa4deab8b3cc96f340d124ce5487c51d1f990b6df960856334db0bb9747d72333f99cb12ebcc913bc8f920c91058e212ece3eb3cce
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module TwitterBreadcrumbsHelper
|
2
|
-
def render_breadcrumbs(divider = '/')
|
3
|
-
render :partial => 'twitter-bootstrap/breadcrumbs', :locals => { :divider => divider }
|
2
|
+
def render_breadcrumbs(divider = '/', &block)
|
3
|
+
content = render :partial => 'twitter-bootstrap/breadcrumbs', :layout => false, :locals => { :divider => divider }
|
4
|
+
if block_given?
|
5
|
+
capture(content, &block)
|
6
|
+
else
|
7
|
+
content
|
8
|
+
end
|
4
9
|
end
|
5
10
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module BootstrapSassExtras
|
2
|
+
module BreadCrumbs
|
3
|
+
def self.included(base)
|
4
|
+
base.extend(ClassMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def add_breadcrumb(name, url, options = {})
|
9
|
+
class_name = self.name
|
10
|
+
before_filter options do |controller|
|
11
|
+
name = controller.send :translate_breadcrumb, name, class_name if name.is_a?(Symbol)
|
12
|
+
controller.send :add_breadcrumb, name, url
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def add_breadcrumb(name, url = '', options = {})
|
20
|
+
@breadcrumbs ||= []
|
21
|
+
name = translate_breadcrumb(name, self.class.name) if name.is_a?(Symbol)
|
22
|
+
url = eval(url.to_s) if url =~ /_path|_url|@/
|
23
|
+
@breadcrumbs << {:name => name, :url => url, :options => options}
|
24
|
+
end
|
25
|
+
|
26
|
+
def translate_breadcrumb(name, class_name)
|
27
|
+
scope = [:breadcrumbs]
|
28
|
+
namespace = class_name.underscore.split('/')
|
29
|
+
namespace.last.sub!('_controller', '')
|
30
|
+
scope += namespace
|
31
|
+
|
32
|
+
I18n.t name, :scope => scope
|
33
|
+
end
|
34
|
+
|
35
|
+
def render_breadcrumbs(divider = '/')
|
36
|
+
s = render :partial => 'twitter-bootstrap/breadcrumbs', :locals => {:divider => divider}
|
37
|
+
s.first
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/breadcrumbs.rb'
|
1
2
|
module BootstrapSassExtras
|
2
3
|
class Engine < ::Rails::Engine
|
3
4
|
initializer 'bootstrap-sass-extras.setup_helpers' do |app|
|
@@ -6,6 +7,7 @@ module BootstrapSassExtras
|
|
6
7
|
ActionController::Base.send :helper, GlyphHelper
|
7
8
|
ActionController::Base.send :helper, ModalHelper
|
8
9
|
ActionController::Base.send :helper, TwitterBreadcrumbsHelper
|
10
|
+
ActionController::Base.send :include, BootstrapSassExtras::BreadCrumbs
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-sass-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- doabit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- app/views/twitter-bootstrap/_breadcrumbs.html.erb
|
75
75
|
- bootstrap-sass-extras.gemspec
|
76
76
|
- lib/bootstrap-sass-extras.rb
|
77
|
+
- lib/bootstrap-sass-extras/breadcrumbs.rb
|
77
78
|
- lib/bootstrap-sass-extras/engine.rb
|
78
79
|
- lib/bootstrap-sass-extras/version.rb
|
79
80
|
- lib/generators/bootstrap/install/install_generator.rb
|