awesome_flags 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +16 -2
- data/VERSION +1 -1
- data/awesome_flags.gemspec +1 -1
- metadata +3 -3
data/README.markdown
CHANGED
@@ -10,13 +10,15 @@ Then get the awesome_flags gem.
|
|
10
10
|
|
11
11
|
gem 'awesome_flags'
|
12
12
|
|
13
|
-
## AwesomeFlags outputs the keys used in FlagShihTzu columns as an Array of :symbols.
|
13
|
+
## AwesomeFlags outputs the keys used in FlagShihTzu columns as an Array of :symbols, or a Hash of flag names and bit values.
|
14
14
|
|
15
15
|
Just require AwesomeFlags in your model. Don't forget to install the FlagShihTzu plugin and add that as well.
|
16
16
|
|
17
17
|
include FlagShihTzu
|
18
18
|
include AwesomeFlags
|
19
19
|
|
20
|
+
### Array Methods
|
21
|
+
|
20
22
|
Call all active flags for a variable, or add a column name to filter.
|
21
23
|
|
22
24
|
my_flags
|
@@ -30,11 +32,23 @@ Using the all_flags method will return all flags (filtered by column or not).
|
|
30
32
|
You can also send either method to a block to output formatted flags.
|
31
33
|
This can be handy to do things like generate check boxes dynamically. For example
|
32
34
|
|
33
|
-
- @
|
35
|
+
- @thing.all_flags.each do |flag|
|
34
36
|
= check_box flag, :class => 'check_box'
|
35
37
|
= label :flags, "#{flag.to_s.titleize}"
|
36
38
|
|
37
39
|
|
40
|
+
### Hash Method
|
41
|
+
|
42
|
+
There is also a method to return the hash of flag names and bit values. The keys are the flag names and the values are the bit values.
|
43
|
+
This can also be filtered by column.
|
44
|
+
|
45
|
+
get_hash_of_flags
|
46
|
+
get_hash_of_flags("column_name")
|
47
|
+
|
48
|
+
Good for creating drop downs
|
49
|
+
|
50
|
+
= select(:flags, @thing.get_hash_of_flags.collect {|key, value| ["#{key.to_s.titleize}", value]})
|
51
|
+
|
38
52
|
Copyright (c) 2011 Gabe Kessler. See LICENSE.txt for
|
39
53
|
further details.
|
40
54
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
data/awesome_flags.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_flags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 2.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gabe Kessler
|