rails-theme-helper 0.0.5 → 0.1.0

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: f12f6ea880129fb00c40433fa950f8f046197f4b
4
- data.tar.gz: 3eece4189ca77ee4d878249deec52026f7f54a98
3
+ metadata.gz: a2d0d49950455a4edf8f9e8a589b5cba77c6ebca
4
+ data.tar.gz: b7b410d215413b1facc06640a89455df6e7a6e9d
5
5
  SHA512:
6
- metadata.gz: aff60216bb8e05fdf29a4cd67683303a934f6348e0e71d2543355a896eadda0049e737dd3e4c8b4701815db2322bbb4d6dfb6419b505351bb4d2ab37278b6dd4
7
- data.tar.gz: 1cec0d8df8caae5f1c873d5aeaadb2b7ac20231967dc0b80a2c29e8587c29fc7cc385efc2aa83de9f968cdb2c248f258327b9a05adb88679ab8059e4c7b8697c
6
+ metadata.gz: 82b2c4f7105201bc05f22446128d3cb08068ee8f1e70084b797faa695fbd6a5f96409389c0eec6815e71e3c2e4da69e6016b730e1e52c8afcafaaa03df129e0c
7
+ data.tar.gz: 3882856228868b6accb4c13b259ffab48fa3545fe2c5a56fd046d3188ea209b2c7cbd083febb44c0ca7b748e7dbb244f2e421f7434ec6c20968fc549276efb05
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Tse-Ching Ho
1
+ Copyright (c) 2012-2014 Tse-Ching Ho
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This gem helps you build themes for rails.
4
4
 
5
+ Bootstrap 3.x is supported from version 0.1.0.
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -1,12 +1,12 @@
1
1
  #main
2
- margin-top: 40px
2
+ margin-top: 60px
3
3
 
4
4
  #site-name
5
5
  h1
6
6
  margin: 0
7
7
  a
8
8
  margin: 0 10px 0 0
9
- padding: 0
9
+ padding: 0.8em 0
10
10
  h2
11
11
  margin: 0
12
12
  font-size: 10px
@@ -11,15 +11,21 @@ module RailsTheme
11
11
  link_to text, url, options
12
12
  end
13
13
 
14
- def dropdown_btn text, url = '#', options = {}
14
+ def dropdown_btn text, options = {}
15
+ text = text.html_safe << ' '
16
+ text << content_tag(:span, nil, class: 'caret')
15
17
  options = {
16
- class: 'btn dropdown-toggle'
18
+ name: nil,
19
+ type: 'button',
20
+ class: 'btn dropdown-toggle',
21
+ data: { toggle: 'dropdown' }
17
22
  }.deep_merge options
18
- dropdown_toggle text, url, options
23
+ button_tag text, options
19
24
  end
20
25
 
21
26
  def dropdown_menu options = {}, &block
22
27
  options = {
28
+ role: 'menu',
23
29
  class: 'dropdown-menu'
24
30
  }.deep_merge options
25
31
  render_list options, &block
@@ -4,7 +4,7 @@ module RailsTheme
4
4
  def submit_button f, label = nil, options = {}
5
5
  options = {
6
6
  name: nil,
7
- class: 'btn-primary'
7
+ class: 'btn btn-primary'
8
8
  }.deep_merge options
9
9
  f.button :submit, label, options
10
10
  end
@@ -8,9 +8,10 @@ module RailsTheme
8
8
  end
9
9
 
10
10
  def link_to_show url, options = {}
11
- icon_class = options.delete(:icon_class) || 'icon-eye-open'
11
+ icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-eye-open'
12
12
  options = {
13
- class: 'btn',
13
+ role: 'button',
14
+ class: 'btn btn-default',
14
15
  icon_class: icon_class,
15
16
  title: t('helpers.show')
16
17
  }.deep_merge options
@@ -19,9 +20,10 @@ module RailsTheme
19
20
  end
20
21
 
21
22
  def link_to_new url, options = {}
22
- icon_class = options.delete(:icon_class) || 'icon-plus'
23
+ icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-plus'
23
24
  options = {
24
- class: 'btn',
25
+ role: 'button',
26
+ class: 'btn btn-default',
25
27
  icon_class: icon_class,
26
28
  title: t('helpers.new')
27
29
  }.deep_merge options
@@ -29,9 +31,10 @@ module RailsTheme
29
31
  end
30
32
 
31
33
  def link_to_edit url, options = {}
32
- icon_class = options.delete(:icon_class) || 'icon-edit'
34
+ icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-edit'
33
35
  options = {
34
- class: 'btn',
36
+ role: 'button',
37
+ class: 'btn btn-default',
35
38
  icon_class: icon_class,
36
39
  title: t('helpers.edit')
37
40
  }.deep_merge options
@@ -39,11 +42,12 @@ module RailsTheme
39
42
  end
40
43
 
41
44
  def link_to_destroy url, options = {}
42
- icon_class = options.delete(:icon_class) || 'icon-trash'
45
+ icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-trash'
43
46
  options = {
44
47
  method: :delete,
45
48
  data: { confirm: t('helpers.are_you_sure') },
46
- class: 'btn',
49
+ role: 'button',
50
+ class: 'btn btn-default',
47
51
  icon_class: icon_class,
48
52
  title: t('helpers.destroy')
49
53
  }.deep_merge options
@@ -35,27 +35,30 @@ module RailsTheme
35
35
  target: modal_id,
36
36
  type: 'html'
37
37
  },
38
- class: 'modal-open btn'
38
+ class: 'modal-open btn btn-default'
39
39
  }.deep_merge options
40
40
  link_to_edit url, options
41
41
  end
42
42
 
43
43
  def link_to_close_button
44
44
  options = {
45
+ type: 'button',
46
+ name: nil,
45
47
  data: { dismiss: 'modal' },
46
- class: 'btn'
48
+ class: 'btn btn-default'
47
49
  }
48
- link_to t('helpers.close'), '#', options
50
+ button_tag t('helpers.close'), options
49
51
  end
50
52
 
51
53
  def modal_close_button
52
54
  options = {
53
55
  type: 'button',
54
56
  name: nil,
57
+ 'aria-hidden' => 'true',
55
58
  data: { dismiss: 'modal' },
56
59
  class: 'close'
57
60
  }
58
- button_tag 'x', options
61
+ button_tag '&times;'.html_safe, options
59
62
  end
60
63
  end
61
64
  end
@@ -25,5 +25,26 @@ module RailsTheme
25
25
  end
26
26
  content_tag(:ul, items, options)
27
27
  end
28
+
29
+ def flash_box key, value
30
+ alert_class = case key
31
+ when :notice
32
+ 'alert-warning'
33
+ when :error
34
+ 'alert-danger'
35
+ else
36
+ "alert-#{key}"
37
+ end
38
+ button_options = {
39
+ type: 'button',
40
+ name: nil,
41
+ class: 'close',
42
+ data: { dismiss: 'alert' },
43
+ 'aria-hidden' => 'true'
44
+ }
45
+ content_tag :div, class: "alert #{alert_class} alert-dismissable #{key}" do
46
+ button_tag('&times;'.html_safe, button_options) << value
47
+ end
48
+ end
28
49
  end
29
50
  end
@@ -4,8 +4,6 @@
4
4
 
5
5
  <div class="messages">
6
6
  <% flash.each do |key, value| %>
7
- <%= content_tag :div, class: "alert alert-#{key} #{key}" do
8
- link_to('&times;'.html_safe, '#', class: 'close', data: { dismiss: 'alert'}) << value
9
- end %>
7
+ <%= flash_box key, value %>
10
8
  <% end %>
11
9
  </div>
@@ -1,10 +1,15 @@
1
- <hgroup id="site-name">
2
- <h1><%= link_to t('site.title'), secure_root_url, class: 'brand' %></h1>
3
- <h2><%= t('site.subtitle') %></h2>
4
- </hgroup>
1
+ <div class="navbar-header">
2
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
3
+ <span class="sr-only"><%= t('site.nav_toggle') %></span>
4
+ <span class="icon-bar"></span>
5
+ <span class="icon-bar"></span>
6
+ <span class="icon-bar"></span>
7
+ </button>
8
+ <hgroup id="site-name">
9
+ <h1><%= link_to t('.site_title'), secure_root_url, class: 'navbar-brand' %></h1>
10
+ <h2><%= t('site.subtitle') %></h2>
11
+ </hgroup>
12
+ </div>
5
13
 
6
- <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
7
- <span class="icon-bar"></span>
8
- <span class="icon-bar"></span>
9
- <span class="icon-bar"></span>
10
- </a>
14
+ <div class="navbar-collapse collapse">
15
+ </div>
@@ -33,3 +33,4 @@ en:
33
33
  title: 'RailsTheme'
34
34
  author: 'Tse-Ching Ho'
35
35
  subtitle: 'helps you build themes for rails'
36
+ nav_toggle: 'Toggle navigation'
@@ -33,3 +33,4 @@ zh-TW:
33
33
  title: 'RailsTheme'
34
34
  author: '何澤清'
35
35
  subtitle: '幫助您建置 Rails 主題套件'
36
+ nav_toggle: '切換導覽列'
@@ -1,3 +1,3 @@
1
1
  module RailsThemeHelper
2
- VERSION = '0.0.5'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-theme-helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tse-Ching Ho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2014-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.1.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jquery-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails-i18n
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: This gem helps you build themes for rails
@@ -59,7 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
@@ -94,19 +94,18 @@ require_paths:
94
94
  - lib
95
95
  required_ruby_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.0.6
107
+ rubygems_version: 2.2.2
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: helps you build themes for rails
111
111
  test_files: []
112
- has_rdoc: