rails_bootstrap_helper 1.6.1 → 1.7.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
- SHA1:
3
- metadata.gz: 8ded8ac160ba5109fa3195a3646ae2d5672dc10f
4
- data.tar.gz: 5e48dcb06b57b4370033ee7fa0517af5c6e04df6
2
+ SHA256:
3
+ metadata.gz: 4af6430f173e645b08fff8a98f0286c5f1eaadeb3cf6183078fb85c22c99955d
4
+ data.tar.gz: 48a034bec05931e09393615cf84bd240ee71cdd0f59b7d87da151001a827d092
5
5
  SHA512:
6
- metadata.gz: 4f3ad851287e818d538200191799b4ff4d168059e20ef773de3db9598232f6aaf54c25fb57eefe664c30317e43ccb8cdcd52b5aaf6d2ac7dbdc49916514c4f9b
7
- data.tar.gz: 2657296cf0c86cdef64d96435b0727144b1617a785299c33655fe4c4fc2fe9161577a2d8a40fbad7a25656ea55e32e7bc56604e7fbe51025033a2bdf96924784
6
+ metadata.gz: 24d90670fea282c843b38bef5db914cd120aa2d8e2aea113b45c3ce650421ced50d6ea12bf71dcd39f6f9306f9882f17f685a75aab39409a41c60256ab9d9d89
7
+ data.tar.gz: 4709a255509f5d013dcecab801aa1f91644757f1245ff1b9f428606c25a91157bb6d9bb5e36021e05c2ea5356a7b708afc8033c6fa91d92fb6493c772796bbad
data/CHANGELOG.md CHANGED
@@ -1,15 +1,31 @@
1
1
  # Changelog
2
2
 
3
- ## 1.5.2
3
+ ## 1.7.0 / 2023-03-09
4
+
5
+ - Support for Bootstrap 5
6
+
7
+ ## 1.6.2 / 2018-12-30
8
+
9
+ - Support for nav link [https://getbootstrap.com/docs/4.2/components/navs/#base-nav](https://getbootstrap.com/docs/4.2/components/navs/#base-nav)
10
+
11
+ ## 1.6.1 / 2018-03-02
12
+
13
+ - Support HTML options in icon_tag helper
14
+
15
+ ## 1.6.0 / 2018-01-26
16
+
17
+ - Add support for inline SVG
18
+
19
+ ## 1.5.2 / 2017-11-21
4
20
 
5
21
  Bootstrap 4 dropped support for (glyph)icons.
6
22
  However, since icon buttons remain useful, we're now suppporting a global `icon` class.
7
23
 
8
- ## 1.5.1
24
+ ## 1.5.1 / 2017-09-06
9
25
 
10
26
  Adjust badge default's level to `secondary`
11
27
 
12
- ## 1.5.0
28
+ ## 1.5.0 / 2017-09-06
13
29
 
14
30
  Bootstrap 4 support
15
31
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Bootstrap Helpers for Ruby on Rails 4 or 5
1
+ # Bootstrap Helpers for Ruby on Rails
2
2
 
3
3
  [![Build Status](https://semaphoreci.com/api/v1/olimart/rails_bootstrap_helper/branches/bs4/badge.svg)](https://semaphoreci.com/olimart/rails_bootstrap_helper)
4
4
 
@@ -1,40 +1,25 @@
1
1
  # coding: utf-8
2
2
  module RailsBootstrapHelper
3
3
  module Helper
4
- def info_tag(text)
5
- content_tag(:i, '', class: 'icon-info-sign', rel: 'tooltip', title: text) + " "
6
- end
7
-
8
- def status_tag(status, options = {})
9
- klass = ["badge"]
10
- if options.has_key?(:level)
11
- klass << "badge-#{options.delete(:level).to_s}"
12
- else
13
- klass << "badge-secondary"
14
- end
15
- klass << options[:class].strip.split(/\s+/) unless options[:class].blank?
16
- options[:class] = klass.flatten.join(" ")
17
- content_tag(:span, status, options)
18
- end
19
-
20
4
  def badge_tag(status, options = {})
21
5
  klass = ["badge"]
22
6
  if options.has_key?(:level)
23
- klass << "badge-#{options.delete(:level).to_s}"
7
+ klass << "bg-#{options.delete(:level).to_s}"
24
8
  else
25
- klass << "badge-secondary"
9
+ klass << "bg-secondary"
26
10
  end
27
11
  klass << options[:class].strip.split(/\s+/) unless options[:class].blank?
28
12
  options[:class] = klass.flatten.join(" ")
29
13
  content_tag(:span, status, options)
30
14
  end
15
+ alias_method :status_tag, :badge_tag
31
16
 
32
17
  def pill_badge_tag(status, options = {})
33
- klass = ["badge badge-pill"]
18
+ klass = ["badge rounded-pill"]
34
19
  if options.has_key?(:level)
35
- klass << "badge-#{options.delete(:level).to_s}"
20
+ klass << "text-bg-#{options.delete(:level).to_s}"
36
21
  else
37
- klass << "badge-secondary"
22
+ klass << "text-bg-secondary"
38
23
  end
39
24
  klass << options[:class].strip.split(/\s+/) unless options[:class].blank?
40
25
  options[:class] = klass.flatten.join(" ")
@@ -48,7 +33,7 @@ module RailsBootstrapHelper
48
33
 
49
34
  def icon_link_to(text, url, options)
50
35
  icon = options.delete(:icon) if options.has_key?(:icon)
51
- icon_tag = ''
36
+ icon_tag = ""
52
37
  if icon
53
38
  icon_klass = ["icon icon-#{icon}"]
54
39
  if options.has_key?(:white)
@@ -100,12 +85,26 @@ module RailsBootstrapHelper
100
85
  klass = ["icon icon-#{icon}"]
101
86
  klass << options[:class].strip.split(/\s+/) unless options[:class].blank?
102
87
  options[:class] = klass.flatten.join(" ")
103
- content_tag(:span, '', class: options[:class], style: options[:style])
88
+ content_tag(:span, "", class: options[:class], style: options[:style])
104
89
  end
105
90
 
106
91
  def inline_svg(path)
107
92
  file = File.open("app/assets/images/#{path}", "rb")
108
93
  raw file.read
109
94
  end
95
+
96
+ def nav_link(name, path)
97
+ content_tag :li, link_to(name, path, class: "nav-link"), class: "nav-item"
98
+ end
99
+
100
+ def alert_tag(text, options = {}, &block)
101
+ klass = ["alert"]
102
+ if options.has_key?(:level)
103
+ klass << "alert-#{options.delete(:level).to_s}"
104
+ else
105
+ klass << "alert-secondary"
106
+ end
107
+ tag.div sanitize(text), class: klass, role: "alert"
108
+ end
110
109
  end
111
110
  end
@@ -1,3 +1,3 @@
1
1
  module RailsBootstrapHelper
2
- VERSION = "1.6.1"
2
+ VERSION = "1.7.0"
3
3
  end
@@ -19,9 +19,9 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency "railties", ">= 4.0"
21
21
  gem.add_dependency "simple_form", ">= 3.0"
22
- gem.add_development_dependency "thor", "~> 0.14"
23
- gem.add_development_dependency "bundler", ">= 1.0.0"
22
+ gem.add_development_dependency "thor"
23
+ gem.add_development_dependency "bundler", ">= 2"
24
24
  gem.add_development_dependency "rails", ">= 4.0.0"
25
25
  gem.add_development_dependency "sqlite3"
26
- gem.add_development_dependency "nokogiri", "~> 1.8.2"
26
+ gem.add_development_dependency "nokogiri"
27
27
  end
@@ -41,11 +41,6 @@ module Dummy
41
41
  # like if you have constraints or database-specific column types
42
42
  # config.active_record.schema_format = :sql
43
43
 
44
- # Enable the asset pipeline
45
- config.assets.enabled = true
46
-
47
- # Version of your assets, change this if you want to expire all your assets
48
- config.assets.version = '1.0'
44
+ config.active_record.legacy_connection_handling = false
49
45
  end
50
46
  end
51
-
@@ -5,30 +5,30 @@ class RailsBootstrapHelperTest < ActionView::TestCase
5
5
  tests RailsBootstrapHelper::Helper
6
6
 
7
7
  def test_status_tag
8
- assert_equal '<span class="badge badge-secondary">Default</span>', status_tag("Default")
9
- assert_equal '<span class="badge badge-success">Success</span>', status_tag("Success", level: 'success')
10
- assert_equal '<span class="badge badge-warning">Warning</span>', status_tag("Warning", level: 'warning')
11
- assert_equal '<span class="badge badge-important">Important</span>', status_tag("Important", level: 'important')
12
- assert_equal '<span class="badge badge-info">Info</span>', status_tag("Info", level: 'info')
13
- assert_equal '<span class="badge badge-inverse">Inverse</span>', status_tag("Inverse", level: 'inverse')
14
- assert_equal '<span class="badge badge-inverse custom">Custom Class</span>', status_tag("Custom Class", level: 'inverse', class: "custom")
15
- assert_equal '<span id="custom" class="badge badge-inverse">Custom ID</span>', status_tag("Custom ID", level: 'inverse', id: "custom")
8
+ assert_equal '<span class="badge bg-secondary">Default</span>', status_tag("Default")
9
+ assert_equal '<span class="badge bg-success">Success</span>', status_tag("Success", level: 'success')
10
+ assert_equal '<span class="badge bg-warning">Warning</span>', status_tag("Warning", level: 'warning')
11
+ assert_equal '<span class="badge bg-important">Important</span>', status_tag("Important", level: 'important')
12
+ assert_equal '<span class="badge bg-info">Info</span>', status_tag("Info", level: 'info')
13
+ assert_equal '<span class="badge bg-inverse">Inverse</span>', status_tag("Inverse", level: 'inverse')
14
+ assert_equal '<span class="badge bg-inverse custom">Custom Class</span>', status_tag("Custom Class", level: 'inverse', class: "custom")
15
+ assert_equal '<span id="custom" class="badge bg-inverse">Custom ID</span>', status_tag("Custom ID", level: 'inverse', id: "custom")
16
16
  end
17
17
 
18
18
  def test_badge_tag
19
- assert_equal '<span class="badge badge-secondary">Default</span>', badge_tag("Default")
20
- assert_equal '<span class="badge badge-success">Success</span>', badge_tag("Success", level: 'success')
21
- assert_equal '<span class="badge badge-warning">Warning</span>', badge_tag("Warning", level: 'warning')
22
- assert_equal '<span class="badge badge-danger">Danger</span>', badge_tag("Danger", level: 'danger')
23
- assert_equal '<span class="badge badge-info">Info</span>', badge_tag("Info", level: 'info')
24
- assert_equal '<span class="badge badge-primary">Primary</span>', badge_tag("Primary", level: 'primary')
25
- assert_equal '<span class="badge badge-primary custom">Custom Class</span>', badge_tag("Custom Class", level: 'primary', class: "custom")
26
- assert_equal '<span id="custom" class="badge badge-primary">Custom ID</span>', badge_tag("Custom ID", level: 'primary', id: "custom")
19
+ assert_equal '<span class="badge bg-secondary">Default</span>', badge_tag("Default")
20
+ assert_equal '<span class="badge bg-success">Success</span>', badge_tag("Success", level: 'success')
21
+ assert_equal '<span class="badge bg-warning">Warning</span>', badge_tag("Warning", level: 'warning')
22
+ assert_equal '<span class="badge bg-danger">Danger</span>', badge_tag("Danger", level: 'danger')
23
+ assert_equal '<span class="badge bg-info">Info</span>', badge_tag("Info", level: 'info')
24
+ assert_equal '<span class="badge bg-primary">Primary</span>', badge_tag("Primary", level: 'primary')
25
+ assert_equal '<span class="badge bg-primary custom">Custom Class</span>', badge_tag("Custom Class", level: 'primary', class: "custom")
26
+ assert_equal '<span id="custom" class="badge bg-primary">Custom ID</span>', badge_tag("Custom ID", level: 'primary', id: "custom")
27
27
  end
28
28
 
29
29
  def test_pill_badge_tag
30
- assert_equal '<span class="badge badge-pill badge-secondary">Default</span>', pill_badge_tag("Default")
31
- assert_equal '<span class="badge badge-pill badge-success">Success</span>', pill_badge_tag("Success", level: 'success')
30
+ assert_equal '<span class="badge rounded-pill text-bg-secondary">Default</span>', pill_badge_tag("Default")
31
+ assert_equal '<span class="badge rounded-pill text-bg-success">Success</span>', pill_badge_tag("Success", level: 'success')
32
32
  end
33
33
 
34
34
  def test_button_link_to
@@ -60,4 +60,15 @@ class RailsBootstrapHelperTest < ActionView::TestCase
60
60
  assert_equal '<span class="icon icon-star" style="color:white"></span>', icon_tag('star', style: 'color:white')
61
61
  assert_equal '<span class="icon icon-star text-success" style="color:white"></span>', icon_tag('star', class: 'text-success', style: 'color:white')
62
62
  end
63
+
64
+ def test_nav_link
65
+ # content_tag :li, link_to(name, path, class: 'nav-link'), class: 'nav-item'
66
+ assert_equal '<li class="nav-item"><a class="nav-link" href="http://google.com">Google</a></li>', nav_link("Google", "http://google.com")
67
+ end
68
+
69
+ def test_alert_tag
70
+ assert_equal '<div class="alert alert-secondary" role="alert">boom</div>', alert_tag("boom")
71
+ assert_equal '<div class="alert alert-success" role="alert">boom</div>', alert_tag("boom", level: "success")
72
+ assert_equal '<div class="alert alert-secondary" role="alert">boom <a href="http://google.com">here</a></div>', alert_tag("boom #{link_to 'here', 'http://google.com'}")
73
+ end
63
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_bootstrap_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hoang Nghiem
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-02 00:00:00.000000000 Z
11
+ date: 2023-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.14'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.14'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0
61
+ version: '2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.0
68
+ version: '2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rails
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: nokogiri
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.8.2
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.8.2
110
+ version: '0'
111
111
  description: Bootstrap Helpers for Ruby on Rails
112
112
  email:
113
113
  - hoangnghiem1711@gmail.com
@@ -166,7 +166,7 @@ files:
166
166
  homepage: https://github.com/olimart/rails_bootstrap_helper
167
167
  licenses: []
168
168
  metadata: {}
169
- post_install_message:
169
+ post_install_message:
170
170
  rdoc_options: []
171
171
  require_paths:
172
172
  - lib
@@ -181,9 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.6.13
186
- signing_key:
184
+ rubygems_version: 3.4.1
185
+ signing_key:
187
186
  specification_version: 4
188
187
  summary: Bootstrap Helpers for Ruby on Rails
189
188
  test_files: