bootstrap-rails-helpers 0.0.4 → 0.0.5

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: 46ed54a00aa62dd90c61572ed54b8c6c834ceefe
4
- data.tar.gz: d7fa83a74a05743730b2baae40820b01085f23a9
3
+ metadata.gz: b233dcc4fe76726b446a8b64183ceb3079e0a1e1
4
+ data.tar.gz: f4f95a635457abf966ecdb1b6c7ba41656e3c432
5
5
  SHA512:
6
- metadata.gz: bff6692e1228ed46b78dfc8976beb7cf71394b29413eb33df25e2c29ad757f9b861bd707e4466ff3638f3ad70df91536b5bb11fbc312bb3c26deeb2d3ca70492
7
- data.tar.gz: 28a99e1d17e509d875580f080cef83cf8d04443d6e1faaab8026a4b77460dddae9e25c30f61d0b8f586714b2b199d6460daeab714d4506378af4f5648aa24e1a
6
+ metadata.gz: 6ac843b4bf9bfc804896a5fe0dbe785bf23c84024e602fe8eb3dabaf46eb7683b3f76d6122629d8ee56914673153ea95f8c01cede95fb6675cc336837deae906
7
+ data.tar.gz: 2ef5768d5f7485ec295a32738cb82cbf9d9619c50d3f7b1c76fa4aed79839255192c3c1dcf12ab9d6f5c6b5e1d188a7ce6b25dc55edeed2c70473d5e3ae14190
data/README.md CHANGED
@@ -86,13 +86,25 @@ en:
86
86
  edit: 'Edit'
87
87
  show: 'Show'
88
88
  new: 'New'
89
-
89
+
90
90
  examples:
91
91
  index: 'Examples'
92
92
  new: 'New Example'
93
93
  edit: 'Edit Example'
94
94
  ```
95
95
 
96
+ #### Breadcrumbs in Controllers
97
+
98
+ While I don't explicitly recommend it; it might be useful to add breadcrumbs directly from your Controllers. You can use the `add_breacrumb` tag by including `BootstrapRailsHelpers::Breadcrumbs` in your Controller, e.g.
99
+
100
+ ```ruby
101
+ class ExampleController < ApplicationController
102
+ include BootstrapRailsHelpers::Breadcrumbs
103
+
104
+ add_breadcrumb :index, :examples_url
105
+ end
106
+ ````
107
+
96
108
  ### Glyphs
97
109
 
98
110
  You can easily use [Icons](http://twitter.github.com/bootstrap/base-css.html#icons) by [Glyphicons](http://glyphicons.com/) in your views by using the `glyph` tag.
@@ -0,0 +1,22 @@
1
+ module BootstrapRailsHelpers::Breadcrumbs
2
+ include BootstrapRailsHelpers::BreadcrumbsHelper
3
+
4
+ def self.included(base)
5
+ base.extend(ClassMethods)
6
+ end
7
+
8
+ def self.method_added(method_name)
9
+ puts "Adding #{method_name.inspect}"
10
+ end
11
+
12
+ module ClassMethods
13
+ def add_breadcrumb(name, url, options = {})
14
+ class_name = self.name.underscore
15
+ before_filter options do |controller|
16
+ name = controller.send :translate_breadcrumb, name, class_name if name.is_a?(Symbol)
17
+ controller.send :add_breadcrumb, name, url
18
+ end
19
+ end
20
+ end
21
+
22
+ end
@@ -13,4 +13,6 @@ module BootstrapRailsHelpers
13
13
  ActionController::Base.append_view_path File.dirname(__FILE__) + "/../../app/views"
14
14
  end
15
15
  end
16
- end
16
+ end
17
+
18
+ require 'bootstrap_rails_helpers/breadcrumbs'
@@ -1,3 +1,3 @@
1
1
  module BootstrapRailsHelpers
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,5 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapRailsHelpers::BreadcrumbsHelper do
4
- pending "write it"
4
+
5
+ context 'with dummy class' do
6
+ class DummyClass; end
7
+ before(:all) do
8
+ DummyClass.send :include, BootstrapRailsHelpers::BreadcrumbsHelper
9
+ @dummy = DummyClass.new
10
+ end
11
+ it { @dummy.should respond_to(:add_breadcrumb) }
12
+ it { @dummy.should respond_to(:translate_breadcrumb) }
13
+ it { @dummy.should respond_to(:render_breadcrumbs) }
14
+ end
15
+
5
16
  end
@@ -1,5 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapRailsHelpers::FlashHelper do
4
- pending "write it"
4
+
5
+ context 'with dummy class' do
6
+ class DummyClass; end
7
+ before(:all) do
8
+ DummyClass.send :include, BootstrapRailsHelpers::FlashHelper
9
+ @dummy = DummyClass.new
10
+ end
11
+ it { @dummy.should respond_to(:alert_message) }
12
+ it { @dummy.should respond_to(:bootstrap_flash) }
13
+ end
14
+
5
15
  end
@@ -1,5 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapRailsHelpers::GlyphHelper do
4
- pending "write it"
4
+
5
+ context 'with dummy class' do
6
+ class DummyClass; end
7
+ before(:all) do
8
+ DummyClass.send :include, BootstrapRailsHelpers::GlyphHelper
9
+ @dummy = DummyClass.new
10
+ end
11
+ it { @dummy.should respond_to(:glyph) }
12
+ end
13
+
5
14
  end
@@ -1,5 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapRailsHelpers::ModalHelper do
4
- pending "write it"
4
+
5
+ context 'with dummy class' do
6
+ class DummyClass; end
7
+ before(:all) do
8
+ DummyClass.send :include, BootstrapRailsHelpers::ModalHelper
9
+ @dummy = DummyClass.new
10
+ end
11
+ it { @dummy.should respond_to(:modal_dialog) }
12
+ it { @dummy.should respond_to(:modal_header) }
13
+ it { @dummy.should respond_to(:modal_body) }
14
+ it { @dummy.should respond_to(:modal_footer) }
15
+ it { @dummy.should respond_to(:modal_toggle) }
16
+ it { @dummy.should respond_to(:modal_cancel_button) }
17
+ end
18
+
5
19
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe BootstrapRailsHelpers::Breadcrumbs do
4
+
5
+ context 'with dummy class' do
6
+ class DummyClass; end
7
+ before(:all) do
8
+ DummyClass.send :include, BootstrapRailsHelpers::Breadcrumbs
9
+ @dummy = DummyClass.new
10
+ end
11
+ it { DummyClass.should respond_to(:add_breadcrumb) }
12
+ it { @dummy.should respond_to(:add_breadcrumb) }
13
+ it { @dummy.should respond_to(:translate_breadcrumb) }
14
+ it { @dummy.should respond_to(:render_breadcrumbs) }
15
+ end
16
+
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-rails-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - bmorrall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-19 00:00:00.000000000 Z
11
+ date: 2013-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -90,12 +90,14 @@ files:
90
90
  - app/views/bootstrap_rails_helpers/_modal_header.html.erb
91
91
  - bootstrap-rails-helpers.gemspec
92
92
  - lib/bootstrap-rails-helpers.rb
93
+ - lib/bootstrap_rails_helpers/breadcrumbs.rb
93
94
  - lib/bootstrap_rails_helpers/railtie.rb
94
95
  - lib/bootstrap_rails_helpers/version.rb
95
96
  - spec/helpers/bootstrap_rails_helpers/breadcrumbs_helper_spec.rb
96
97
  - spec/helpers/bootstrap_rails_helpers/flash_helper_spec.rb
97
98
  - spec/helpers/bootstrap_rails_helpers/glyph_helper_spec.rb
98
99
  - spec/helpers/bootstrap_rails_helpers/modal_helper_spec.rb
100
+ - spec/lib/bootstrap_rails_helpers/breadcrumbs_spec.rb
99
101
  - spec/spec_helper.rb
100
102
  homepage: https://github.com/bmorrall/bootstrap-rails-helpers
101
103
  licenses: []
@@ -125,4 +127,5 @@ test_files:
125
127
  - spec/helpers/bootstrap_rails_helpers/flash_helper_spec.rb
126
128
  - spec/helpers/bootstrap_rails_helpers/glyph_helper_spec.rb
127
129
  - spec/helpers/bootstrap_rails_helpers/modal_helper_spec.rb
130
+ - spec/lib/bootstrap_rails_helpers/breadcrumbs_spec.rb
128
131
  - spec/spec_helper.rb