trap 2.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d9c932c31ecce9f96dbb36a22ccc91d4462164b
4
- data.tar.gz: 1882e7b6bfb7fb0daff4bfbf1f213b7156d48345
3
+ metadata.gz: d395d95cddb26cae5c79a136ae4ce809c51f0dda
4
+ data.tar.gz: 6d82661e8090caa4794f66ed6763fe71a9f356ad
5
5
  SHA512:
6
- metadata.gz: dffe666a921e2970f67a63892124eedba40089fe71e474f484acc91f1697e061f0e47c7e60129d4ed1139039dae095f111e10a058080585e3a1db47172650530
7
- data.tar.gz: f01b4e13fc51c051c6be787ef56e5d958f4e3223b5925a8422e9be56bbcf13aef7fca6faf33cae09fef2821ccd23a40c18ed220f7562d504d472fd2f96cf4ad5
6
+ metadata.gz: e269e6d919e53aa6c9b15d625844610d63c1ce0c31df09f8f61b5eebda646f89236309e2a6147c684cffc22bbd59b61684bed5abf8cc3ff7aca74567091a8235
7
+ data.tar.gz: 45fcbb7f40d2f8757bbfc6dd33893903e86f652fa64da583b9fdc02948fd83f4520e9f458878f06f5fe7710cb4e069f2680b4ef3f880299fba5bd23fcdfc8b2b
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Trap
2
2
 
3
- Bootstrap helpers
3
+ Bootstrap helpers. Bootstrap 4.x compatible.
4
+ Use `trap 1.x` for Bootstrap 3.x compatible.
4
5
 
5
6
  ## Installation
6
7
 
@@ -47,7 +48,7 @@ Using `menu_item` instead of
47
48
  </li>
48
49
  ```
49
50
 
50
- ## For Bootstrap
51
+ ## For Bootstrap 3
51
52
 
52
53
  You should use `trap-1.x` versions to include Bootstrap 3. Contributing to `bootstrap-3` branch.
53
54
 
@@ -9,6 +9,23 @@ module BootstrapHelper
9
9
  end
10
10
  end
11
11
 
12
+ def model_menu_item(model:, route:, icon: nil, number: nil)
13
+ title = model.is_a?(Class) ? model.model_name.human.pluralize(:ru) : model
14
+ if icon
15
+ menu_item route do
16
+ concat icon_element icon
17
+ concat ' '
18
+ concat title
19
+ if number && number != 0
20
+ concat ' '
21
+ concat(content_tag(:span, number.to_s, class: 'badge danger'))
22
+ end
23
+ end
24
+ else
25
+ menu_item title, route
26
+ end
27
+ end
28
+
12
29
  private
13
30
 
14
31
  def is_active?(path, options = {})
@@ -1,3 +1,3 @@
1
1
  module Trap
2
- VERSION = '2.0'
2
+ VERSION = '2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trap
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-05 00:00:00.000000000 Z
11
+ date: 2017-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler