rails-theme-helper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,12 @@
1
+ #main
2
+ margin-top: 40px
3
+
1
4
  #site-name
2
5
  h1
6
+ margin: 0
3
7
  a
8
+ margin: 0 10px 0 0
4
9
  padding: 0
5
- margin-left: 0
6
- margin-right: 10px
7
10
  h2
11
+ margin: 0
8
12
  font-size: 10px
@@ -1 +1,8 @@
1
- <%= will_paginate(collection, renderer: BootstrapLinkRenderer, inner_window: 2, outer_window: 0, class: 'pagination', previous_label: '&larr;'.html_safe, next_label: '&rarr;'.html_safe) %>
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: '&larr;'
31
+ next_label: '&rarr;'
32
+ site:
33
+ title: 'RailsTheme'
34
+ author: 'Tse-Ching Ho'
35
+ subtitle: 'helps you build themes for rails'
@@ -26,3 +26,10 @@ zh-TW:
26
26
  application:
27
27
  flash_messages:
28
28
  title: '動態訊息'
29
+ pagination:
30
+ previous_label: '&larr;'
31
+ next_label: '&rarr;'
32
+ site:
33
+ title: 'RailsTheme'
34
+ author: '何澤清'
35
+ subtitle: '幫助您建置 Rails 主題套件'
@@ -1,5 +1 @@
1
- require 'rails-theme-helper/version'
2
- require 'rails-theme-helper/engine'
3
-
4
- module RailsThemeHelper
5
- end
1
+ require 'rails_theme'
@@ -1,3 +1,3 @@
1
1
  module RailsThemeHelper
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -0,0 +1,11 @@
1
+ require 'rails-i18n'
2
+
3
+ require 'rails_theme/engine'
4
+
5
+ if defined? ::WillPaginate
6
+ require 'will_paginate/array'
7
+ require 'rails_theme/bootstrap/link_renderer'
8
+ end
9
+
10
+ module RailsTheme
11
+ end
@@ -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: '&larr;'.html_safe,
22
+ # next_label: '&rarr;'.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
@@ -19,4 +19,6 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency 'railties', '>= 3.1.1'
21
21
  gem.add_dependency 'jquery-rails'
22
+ gem.add_dependency 'rails-i18n'
23
+ # gem.add_dependency 'will_paginate', '>= 3.0.3'
22
24
  end
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.1
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-08 00:00:00.000000000 Z
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: 3919916104356732355
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: 3919916104356732355
113
+ hash: 592579811214293105
97
114
  requirements: []
98
115
  rubyforge_project:
99
116
  rubygems_version: 1.8.24
@@ -1,6 +0,0 @@
1
- app_path = File.expand_path('../../../app', __FILE__)
2
- helpers_path = "#{app_path}/helpers"
3
- $LOAD_PATH.unshift helpers_path unless $LOAD_PATH.include? helpers_path
4
-
5
- require 'rails_theme/layout_helper.rb'
6
- require 'rails_theme/bootstrap_helper.rb'