trap 1.1.2 → 2.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: 6242cdc25feb12f29bc7c83766806c37ae6ad5d7
4
- data.tar.gz: f1e1288c9e0fd16841263a92364053e0e6db2a7a
3
+ metadata.gz: 1d9c932c31ecce9f96dbb36a22ccc91d4462164b
4
+ data.tar.gz: 1882e7b6bfb7fb0daff4bfbf1f213b7156d48345
5
5
  SHA512:
6
- metadata.gz: c7ac55cca6b3b4f8c722e6bff0cfad6f6de272b913cfef5dab1a396b40587cb3a2ac00da09db0c45f982430b1ff003d8e4959397ac45a2092376463c4f4d0fb2
7
- data.tar.gz: e2051c5425644d2e52a4d0b8af52905d2e94b9d800ee406abe676ca85c3993349c8cea5f4fca9bb4880965adfdba9aee12f5a41d99e2b5b4008a0feab8dd081e
6
+ metadata.gz: dffe666a921e2970f67a63892124eedba40089fe71e474f484acc91f1697e061f0e47c7e60129d4ed1139039dae095f111e10a058080585e3a1db47172650530
7
+ data.tar.gz: f01b4e13fc51c051c6be787ef56e5d958f4e3223b5925a8422e9be56bbcf13aef7fca6faf33cae09fef2821ccd23a40c18ed220f7562d504d472fd2f96cf4ad5
data/README.md CHANGED
@@ -47,6 +47,10 @@ Using `menu_item` instead of
47
47
  </li>
48
48
  ```
49
49
 
50
+ ## For Bootstrap
51
+
52
+ You should use `trap-1.x` versions to include Bootstrap 3. Contributing to `bootstrap-3` branch.
53
+
50
54
  ## Contributing
51
55
 
52
56
  1. Fork it ( https://github.com/[my-github-username]/trap/fork )
@@ -2,52 +2,13 @@ module BootstrapHelper
2
2
  def menu_item(name = nil, path = '#', *args, &block)
3
3
  path = name || path if block_given?
4
4
  options = args.extract_options!
5
- content_tag :li, class: is_active?(path, options) do
5
+ options[:class] = [options[:class], 'nav-link'].join(' ')
6
+ content_tag :li, class: "nav-item #{is_active?(path, options)}" do
6
7
  name, path = path, options if block_given?
7
8
  link_to name, path, options, &block
8
9
  end
9
10
  end
10
11
 
11
- def dropdown(text, icon = nil, &block)
12
- content_tag :li, class: :drowdown do
13
- concat(link_to('#', class: 'dropdown-toggle', data: { toggle: :dropdown }) do
14
- if icon
15
- concat icon_element icon
16
- concat ' '
17
- end
18
- concat text
19
- unless icon
20
- concat ' '
21
- concat content_tag :span, '', class: :caret
22
- end
23
- end)
24
- concat(content_tag(:ul, class: 'dropdown-menu') do
25
- yield block
26
- end)
27
- end
28
- end
29
-
30
- def icon_element(name)
31
- content_tag :i, '', class: "fa fa-#{name}"
32
- end
33
-
34
- def model_menu_item(model:, route:, icon: nil, number: nil)
35
- title = model.is_a?(Class) ? model.model_name.human.pluralize(:ru) : model
36
- if icon
37
- menu_item route do
38
- concat icon_element icon
39
- concat ' '
40
- concat title
41
- if number && number != 0
42
- concat ' '
43
- concat(content_tag(:span, number.to_s, class: 'badge danger'))
44
- end
45
- end
46
- else
47
- menu_item title, route
48
- end
49
- end
50
-
51
12
  private
52
13
 
53
14
  def is_active?(path, options = {})
@@ -1,3 +1,3 @@
1
1
  module Trap
2
- VERSION = '1.1.2'
2
+ VERSION = '2.0'
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: 1.1.2
4
+ version: '2.0'
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-07-26 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.6.8
82
+ rubygems_version: 2.6.11
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Bootstrap helpers