rails-theme-helper 0.0.1 → 0.0.2
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/app/assets/stylesheets/rails_theme/simple_layout.css.sass +6 -2
- data/app/views/application/_pagination.html.erb +8 -1
- data/config/locales/rails_theme.en.yml +8 -1
- data/config/locales/rails_theme.zh-TW.yml +7 -0
- data/lib/rails-theme-helper.rb +1 -5
- data/lib/rails-theme-helper/version.rb +1 -1
- data/lib/rails_theme.rb +11 -0
- data/lib/rails_theme/bootstrap/link_renderer.rb +63 -0
- data/lib/{rails-theme-helper → rails_theme}/engine.rb +0 -0
- data/rails-theme-helper.gemspec +2 -0
- metadata +23 -6
- data/lib/rails-theme-helper/app_helpers.rb +0 -6
@@ -1 +1,8 @@
|
|
1
|
-
<%= will_paginate(collection,
|
1
|
+
<%= will_paginate(collection, {
|
2
|
+
renderer: RailsTheme::Bootstrap::LinkRenderer,
|
3
|
+
inner_window: 2,
|
4
|
+
outer_window: 0,
|
5
|
+
class: 'pagination',
|
6
|
+
previous_label: t('.previous_label'),
|
7
|
+
next_label: t('.next_label')
|
8
|
+
}) %>
|
@@ -25,4 +25,11 @@ en:
|
|
25
25
|
posted_by: 'Posted by %{name}'
|
26
26
|
application:
|
27
27
|
flash_messages:
|
28
|
-
title: '
|
28
|
+
title: 'Flash messages'
|
29
|
+
pagination:
|
30
|
+
previous_label: '←'
|
31
|
+
next_label: '→'
|
32
|
+
site:
|
33
|
+
title: 'RailsTheme'
|
34
|
+
author: 'Tse-Ching Ho'
|
35
|
+
subtitle: 'helps you build themes for rails'
|
data/lib/rails-theme-helper.rb
CHANGED
data/lib/rails_theme.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'will_paginate/view_helpers/action_view'
|
2
|
+
|
3
|
+
# you can just use pagination with ajax or not:
|
4
|
+
#
|
5
|
+
# 1) settings for ajax pagination, ex:
|
6
|
+
#
|
7
|
+
# RailsTheme::Bootstrap::LinkRenderer.link_options = {
|
8
|
+
# 'data-remote' => true,
|
9
|
+
# 'data-type' => :html,
|
10
|
+
# 'data-toggle' => 'tab',
|
11
|
+
# 'data-target' => "##{state_name}"
|
12
|
+
# }
|
13
|
+
#
|
14
|
+
# 2) use in views:
|
15
|
+
#
|
16
|
+
# will_paginate(collection, {
|
17
|
+
# renderer: RailsTheme::Bootstrap::LinkRenderer,
|
18
|
+
# inner_window: 2,
|
19
|
+
# outer_window: 0,
|
20
|
+
# class: 'pagination',
|
21
|
+
# previous_label: '←'.html_safe,
|
22
|
+
# next_label: '→'.html_safe
|
23
|
+
# })
|
24
|
+
#
|
25
|
+
module RailsTheme
|
26
|
+
module Bootstrap
|
27
|
+
class LinkRenderer < ::WillPaginate::ActionView::LinkRenderer
|
28
|
+
cattr_accessor :link_options
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def html_container(html)
|
33
|
+
tag :div, tag(:ul, html), container_attributes
|
34
|
+
end
|
35
|
+
|
36
|
+
def page_number(page)
|
37
|
+
options = { rel: rel_value(page) }
|
38
|
+
options.deep_merge! link_options unless link_options.blank?
|
39
|
+
unless page == current_page
|
40
|
+
tag :li, link(page, page, options)
|
41
|
+
else
|
42
|
+
tag :li, link(page, '#', options), class: 'active'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def gap
|
47
|
+
tag :li, link(super, '#'), class: 'disabled'
|
48
|
+
end
|
49
|
+
|
50
|
+
def previous_or_next_page(page, text, class_name)
|
51
|
+
options = {}
|
52
|
+
options.deep_merge! link_options unless link_options.blank?
|
53
|
+
|
54
|
+
class_name = "#{class_name} #{class_name[0..3]}"
|
55
|
+
if page
|
56
|
+
tag :li, link(text, page, options), class: class_name
|
57
|
+
else
|
58
|
+
tag :li, link(text, "#", options), class: class_name + ' disabled'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
File without changes
|
data/rails-theme-helper.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-theme-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rails-i18n
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
description: This gem helps you build themes for rails
|
47
63
|
email:
|
48
64
|
- tsechingho@gmail.com
|
@@ -66,9 +82,10 @@ files:
|
|
66
82
|
- config/locales/rails_theme.en.yml
|
67
83
|
- config/locales/rails_theme.zh-TW.yml
|
68
84
|
- lib/rails-theme-helper.rb
|
69
|
-
- lib/rails-theme-helper/app_helpers.rb
|
70
|
-
- lib/rails-theme-helper/engine.rb
|
71
85
|
- lib/rails-theme-helper/version.rb
|
86
|
+
- lib/rails_theme.rb
|
87
|
+
- lib/rails_theme/bootstrap/link_renderer.rb
|
88
|
+
- lib/rails_theme/engine.rb
|
72
89
|
- rails-theme-helper.gemspec
|
73
90
|
homepage: https://github.com/tsechingho/rails-theme-helper
|
74
91
|
licenses: []
|
@@ -84,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
101
|
version: '0'
|
85
102
|
segments:
|
86
103
|
- 0
|
87
|
-
hash:
|
104
|
+
hash: 592579811214293105
|
88
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
106
|
none: false
|
90
107
|
requirements:
|
@@ -93,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
110
|
version: '0'
|
94
111
|
segments:
|
95
112
|
- 0
|
96
|
-
hash:
|
113
|
+
hash: 592579811214293105
|
97
114
|
requirements: []
|
98
115
|
rubyforge_project:
|
99
116
|
rubygems_version: 1.8.24
|