trap 1.1.2 → 2.0
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 +4 -4
- data/README.md +4 -0
- data/lib/trap/helpers/bootstrap_helper.rb +2 -41
- data/lib/trap/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d9c932c31ecce9f96dbb36a22ccc91d4462164b
|
4
|
+
data.tar.gz: 1882e7b6bfb7fb0daff4bfbf1f213b7156d48345
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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 = {})
|
data/lib/trap/version.rb
CHANGED
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:
|
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-
|
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.
|
82
|
+
rubygems_version: 2.6.11
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Bootstrap helpers
|