acts_as_monitor 0.1.1 → 0.1.2
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.
- data/CHANGELOG.md +3 -0
- data/README.md +9 -2
- data/lib/acts_as_monitor/monitor.rb +9 -3
- data/lib/acts_as_monitor/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -55,13 +55,20 @@ You can now check the status of your model using the following code:
|
|
55
55
|
@user.status_flag
|
56
56
|
> :red
|
57
57
|
|
58
|
+
You can query the status of youe model with:
|
59
|
+
|
60
|
+
User.status_flag_equals(:red) #=> Array of users with :red status
|
61
|
+
|
62
|
+
User.status_flag_not_equals(:red) #=> Array of users with status not equlas to :red
|
63
|
+
|
58
64
|
You can use the monitor_tag helper to view a red/green/yellow rapresentation:
|
65
|
+
|
59
66
|
#app/views/users/index.html.erb
|
60
67
|
<%= monitor_tag_js %> #Creates hidden div and load css and javascript
|
61
68
|
...
|
62
69
|
<%= monitor_tag(@user) %>
|
63
|
-
|
64
|
-
Clicking
|
70
|
+
|
71
|
+
Clicking the icon you'll receive via Ajax the full error/warning list
|
65
72
|
|
66
73
|
## Internationalization
|
67
74
|
You can localize the output modifing the acts_as_monitor.it.yml, or cloning for the language you prefear.
|
@@ -22,9 +22,6 @@ module ActsAsMonitor
|
|
22
22
|
# whatever you want that return true in an error condition
|
23
23
|
# end
|
24
24
|
def acts_as_monitor(options={})
|
25
|
-
#~ cattr_accessor :xlsx_i18n, :xlsx_columns
|
26
|
-
#~ self.xlsx_i18n = options.delete(:i18n) || false
|
27
|
-
#~ self.xlsx_columns = options.delete(:columns) || self.column_names.map { |c| c = c.to_sym }
|
28
25
|
extend ActsAsMonitor::Monitor::SingletonMethods
|
29
26
|
include ActsAsMonitor::Monitor::InstanceMethods
|
30
27
|
end
|
@@ -34,6 +31,15 @@ module ActsAsMonitor
|
|
34
31
|
|
35
32
|
# Singleton methods for the mixin
|
36
33
|
module SingletonMethods
|
34
|
+
#Return records with status_flag of the given symbol (:red, :green, :yellow)
|
35
|
+
def status_flag_equals(value)
|
36
|
+
select {|p| p.status_flag == value.to_sym}
|
37
|
+
end
|
38
|
+
|
39
|
+
#Return records with status flag not equals to given symbol (:red, :green, :yellow)
|
40
|
+
def status_flag_not_equals(value)
|
41
|
+
select {|p| !p.status_flag == value.to_sym}
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
45
|
#Instance methods for the mixin
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrea Bignozzi
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-06-
|
18
|
+
date: 2012-06-18 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|