bootstrap_helper 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ source 'http://rubygems.org'
3
3
  # Specify your gem's dependencies in bootstrap-rails.gemspec
4
4
  gemspec
5
5
 
6
- gem "simple_form", :require => "simple_form"
6
+ gem 'will_paginate', '3.0.pre4'
data/README.md CHANGED
@@ -99,6 +99,14 @@ write notice message in your action, will generate bootstrap style notice messag
99
99
  # ….
100
100
  redirect_to posts_path, :notice => "Create Success!"
101
101
  end
102
+
103
+ ### Pagination
104
+
105
+ Support `will_paginate`, `3.0.pre4`
106
+
107
+ in `config/application.rb`
108
+
109
+ WillPaginate::ViewHelpers.pagination_options[:renderer] = 'BootstrapHelper::PaginateRenderer'
102
110
 
103
111
  ## Example
104
112
 
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
14
  gem.name = "bootstrap_helper"
15
15
  gem.require_paths = ["lib"]
16
- gem.version = "1.4.0"
16
+ gem.version = "1.4.1"
17
17
 
18
18
  gem.add_dependency "railties", "~> 3.0"
19
19
  gem.add_dependency "thor", "~> 0.14"
@@ -1,10 +1,12 @@
1
1
  require "bootstrap_helper/helper"
2
2
  require "bootstrap_helper/breadcrumb"
3
+ require "bootstrap_helper/paginate_renderer"
3
4
  module BootstrapHelper
4
5
  module Rails
5
6
  class Engine < ::Rails::Engine
6
7
  initializer "bootstrap_helper.view_helpers" do
7
8
  ActionView::Base.send :include, BootstrapHelper::Helper
9
+
8
10
  end
9
11
 
10
12
  config.to_prepare do
@@ -0,0 +1,23 @@
1
+ require 'will_paginate/view_helpers/link_renderer'
2
+ require 'will_paginate/view_helpers/action_view'
3
+ module BootstrapHelper
4
+ class PaginateRenderer < WillPaginate::ViewHelpers::LinkRenderer
5
+ protected
6
+
7
+ def html_container(html)
8
+ tag :div, tag(:ul, html), container_attributes
9
+ end
10
+
11
+ def page_number(page)
12
+ tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
13
+ end
14
+
15
+ def previous_or_next_page(page, text, classname)
16
+ tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ')
17
+ end
18
+
19
+ def gap
20
+ tag :li, link(super, '#'), :class => 'disabled'
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_helper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 0
10
- version: 1.4.0
9
+ - 1
10
+ version: 1.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - xdite
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-14 00:00:00 +08:00
18
+ date: 2011-12-16 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -99,6 +99,7 @@ files:
99
99
  - lib/bootstrap_helper/breadcrumb.rb
100
100
  - lib/bootstrap_helper/engine.rb
101
101
  - lib/bootstrap_helper/helper.rb
102
+ - lib/bootstrap_helper/paginate_renderer.rb
102
103
  - lib/bootstrap_helper/railtie.rb
103
104
  - lib/bootstrap_helper/version.rb
104
105
  has_rdoc: true