acts_as_monitor 1.0.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/Gemfile +20 -0
- data/README.md +29 -13
- data/{lib/generators/acts_as_monitor/install/templates → app/assets/images}/acts_as_monitor_green.png +0 -0
- data/{lib/generators/acts_as_monitor/install/templates → app/assets/images}/acts_as_monitor_red.png +0 -0
- data/{lib/generators/acts_as_monitor/install/templates/acts_as_monitor_loading.gif → app/assets/images/acts_as_monitor_spinner.gif} +0 -0
- data/{lib/generators/acts_as_monitor/install/templates → app/assets/images}/acts_as_monitor_yellow.png +0 -0
- data/app/assets/javascripts/acts_as_monitor.js.coffee +12 -0
- data/{lib/generators/acts_as_monitor/install/templates/acts_as_monitor_javascript.js → app/assets/javascripts/acts_as_monitor_javascript.js.erb.old} +2 -1
- data/app/controllers/acts_as_monitor/monitors_controller.rb +2 -8
- data/app/helpers/acts_as_monitor_helper.rb +20 -13
- data/app/views/acts_as_monitor/monitors/_show.html.erb +28 -0
- data/app/views/acts_as_monitor/monitors/show.js.erb +2 -0
- data/config/locales/acts_as_monitor.it.yml +41 -0
- data/lib/acts_as_monitor.rb +1 -1
- data/lib/acts_as_monitor/engine.rb +1 -0
- data/lib/acts_as_monitor/exceptions.rb +16 -3
- data/lib/acts_as_monitor/monitor.rb +2 -1
- data/lib/acts_as_monitor/version.rb +1 -1
- data/lib/generators/acts_as_monitor/install/install_generator.rb +4 -31
- data/lib/generators/acts_as_monitor/install/templates/config/locales/acts_as_monitor.en.yml +13 -0
- data/lib/generators/acts_as_monitor/install/templates/{acts_as_monitor.it.yml → config/locales/acts_as_monitor.it.yml} +3 -2
- data/lib/generators/acts_as_monitor/install/templates/vendor/assets/stylesheets/acts_as_monitor.css.scss +78 -0
- metadata +52 -89
- data/app/views/acts_as_monitor/monitors/show.html.erb +0 -26
- data/lib/generators/acts_as_monitor/install/templates/acts_as_monitor.css +0 -48
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -2,3 +2,23 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in acts_as_monitor.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem "sqlite3"
|
8
|
+
gem 'ruby-prof'
|
9
|
+
gem 'sass-rails'
|
10
|
+
gem "factory_girl_rails"
|
11
|
+
gem "launchy"
|
12
|
+
gem "database_cleaner"
|
13
|
+
|
14
|
+
if RUBY_VERSION < "1.9"
|
15
|
+
gem "capybara", '2.0.3'
|
16
|
+
gem "ruby-debug"
|
17
|
+
gem "factory_girl", "~> 2.6.0"
|
18
|
+
gem "nokogiri", "1.5.5"
|
19
|
+
gem "rubyzip", "<= 0.9.9"
|
20
|
+
else
|
21
|
+
gem "capybara"
|
22
|
+
gem 'debugger', :require => 'ruby-debug'
|
23
|
+
end
|
24
|
+
end
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# ActsAsMonitor
|
2
2
|
|
3
3
|
Provide a way to monitor the status of a model.
|
4
|
-
The health of the model is checked by private/public methods, defined by user
|
4
|
+
The health of the model is checked by private/public methods, defined by user
|
5
|
+
|
6
|
+
Version 2.x.x works only with rails 3.1.x and 3.2.x with jQuery
|
7
|
+
If you need Rails 3.0.x support, please install v1.x.x
|
5
8
|
|
6
9
|
## Installation
|
7
10
|
|
@@ -17,7 +20,7 @@ Or install it yourself as:
|
|
17
20
|
|
18
21
|
$ gem install acts_as_monitor
|
19
22
|
|
20
|
-
Copy
|
23
|
+
Copy stylesheets and internationalization files
|
21
24
|
|
22
25
|
rails g acts_as_monitor:install
|
23
26
|
|
@@ -55,7 +58,7 @@ You can now check the status of your model using the following code:
|
|
55
58
|
@user.status_flag
|
56
59
|
> :red
|
57
60
|
|
58
|
-
You can query the status of
|
61
|
+
You can query the status of your model with:
|
59
62
|
|
60
63
|
User.status_flag_equals(:red) #=> Array of users with :red status
|
61
64
|
|
@@ -64,16 +67,28 @@ You can query the status of youe model with:
|
|
64
67
|
You can use the monitor_tag helper to view a red/green/yellow rapresentation:
|
65
68
|
|
66
69
|
#app/views/users/index.html.erb
|
67
|
-
<%= monitor_tag_js %> #
|
70
|
+
<%= monitor_tag_js %> #load css and javascript
|
68
71
|
...
|
69
72
|
<%= monitor_tag(@user) %>
|
70
73
|
|
71
|
-
Clicking the icon you'll receive, via Ajax, the full error/warning list
|
74
|
+
Clicking the icon you'll receive, via Ajax, the full error/warning list
|
75
|
+
|
76
|
+
If you want, you can add stylesheets and javascripts in your assets and remove monitor\_tag\_js:
|
77
|
+
|
78
|
+
#app/view/assets/javascript/application.js
|
79
|
+
...
|
80
|
+
//= require acts_as_monitor
|
81
|
+
|
72
82
|
|
83
|
+
#app/view/assets/stylesheets/application.css
|
84
|
+
..
|
85
|
+
//= require acts_as_monitor
|
86
|
+
|
73
87
|
## Internationalization
|
74
|
-
You can localize the output modifing the acts_as_monitor.
|
75
|
-
Name of models is retrived via
|
76
|
-
|
88
|
+
You can localize the output modifing the acts_as_monitor.en.yml, or cloning for the language you prefear.
|
89
|
+
Name of models is retrived via model\_name.human, so you have to localize the ActiveRecord to change names:
|
90
|
+
|
91
|
+
en:
|
77
92
|
activerecord:
|
78
93
|
models:
|
79
94
|
your_model_name: Your Model Name
|
@@ -82,12 +97,13 @@ Name of models is retrived via human_name, so yuo have to localize the ActiveRec
|
|
82
97
|
namespaced_model_name: Your Namespaced Model Name
|
83
98
|
|
84
99
|
## Personalization
|
85
|
-
Feel free to modify the fololwing files to change layouts and
|
86
|
-
|
87
|
-
-
|
100
|
+
Feel free to modify the fololwing files to change layouts and translations :
|
101
|
+
|
102
|
+
- vendor/assets/stylesheets/acts\_as\_monitor.css
|
103
|
+
- config/locales/act\_as\_monitor.en.yml
|
88
104
|
|
89
|
-
If you need a deeper personalization you can try to overload app/views/
|
90
|
-
|
105
|
+
If you need a deeper personalization you can try to overload app/views/acts\_as\_monitor/monitors/_show.html.erb
|
106
|
+
containing the page template for the error/warning list
|
91
107
|
|
92
108
|
## Contributing
|
93
109
|
|
File without changes
|
data/{lib/generators/acts_as_monitor/install/templates → app/assets/images}/acts_as_monitor_red.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
actsAsMonitorToggleSpinner = (event) -> $("#"+ event.data.spinner).toggle()
|
2
|
+
|
3
|
+
$(document).ready ->
|
4
|
+
$("div.acts_as_monitor_window").click (e) ->
|
5
|
+
$(this).hide()
|
6
|
+
e.preventDefault()
|
7
|
+
|
8
|
+
$("form[data-remote].acts_as_monitor").each (index,element) ->
|
9
|
+
$(element)
|
10
|
+
.bind('ajax:before',{spinner: $(element).data('spinner')}, actsAsMonitorToggleSpinner)
|
11
|
+
.bind('ajax:complete',{spinner: $(element).data('spinner')}, actsAsMonitorToggleSpinner)
|
12
|
+
.bind('ajax:error',{spinner: $(element).data('spinner')}, actsAsMonitorToggleSpinner)
|
@@ -26,7 +26,8 @@ document.observe('dom:loaded', function()
|
|
26
26
|
class_name: ev.target.getAttribute('data-class')
|
27
27
|
},
|
28
28
|
onLoading: function(response){
|
29
|
-
ev.target.src = application_root + '/images/acts_as_monitor_loading.gif';
|
29
|
+
//ev.target.src = application_root + '/images/acts_as_monitor_loading.gif';
|
30
|
+
ev.target.src = '<%= asset_path 'acts_as_monitor_loading.gif' %>';
|
30
31
|
},
|
31
32
|
onSuccess: function(response){
|
32
33
|
var rsp = response.responseJSON;
|
@@ -2,15 +2,9 @@ module ActsAsMonitor
|
|
2
2
|
class MonitorsController < ::ApplicationController
|
3
3
|
|
4
4
|
def show
|
5
|
-
@monitor = eval(params[:class_name]).find(params[:id]) if monitor_valid
|
6
|
-
Rails::logger.info("MonitorsController @monitor=#{@monitor.inspect}")
|
5
|
+
@monitor = eval(params[:class_name]).find(params[:id]) if monitor_valid!(params)
|
7
6
|
respond_to do |format|
|
8
|
-
format.js
|
9
|
-
view = render_to_string "show"
|
10
|
-
#render :json => {"text" => @status.status}
|
11
|
-
render :json => {"text" => view}
|
12
|
-
end
|
13
|
-
format.html
|
7
|
+
format.js
|
14
8
|
end
|
15
9
|
end
|
16
10
|
|
@@ -3,24 +3,31 @@ module ActsAsMonitorHelper
|
|
3
3
|
raise ActsAsMonitor::MissingMethod unless object.respond_to?(:status_flag)
|
4
4
|
status = object.status_flag
|
5
5
|
icon = I18n.t(status, :scope => "acts_as_monitor.icons",
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
:default => "acts_as_monitor_#{status.to_s}.png")
|
7
|
+
content_tag(:div, :class => "acts_as_monitor") do
|
8
|
+
if status == :green
|
9
|
+
image_tag(icon, :class => "acts_as_monitor_#{status.to_s}")
|
10
|
+
else
|
11
|
+
form_tag(acts_as_monitor_monitor_path(object), :method => :get, :remote => true, :class => 'acts_as_monitor', :data => {:spinner => "acts_as_monitor_spinner_#{object.id}"}) do
|
12
|
+
hidden_field_tag("class_name", object.class.name) +
|
13
|
+
image_submit_tag(icon, :class => "acts_as_monitor_#{status.to_s}") +
|
14
|
+
#submit_tag(icon, :class => "acts_as_monitor_#{status.to_s}") +
|
15
|
+
content_tag(:div, "", :class => "acts_as_monitor_window", :id => "acts_as_monitor_window_#{object.id}", :style => "display:none;") +
|
16
|
+
image_tag("acts_as_monitor_spinner.gif", :class => "acts_as_monitor_spinner",:id => "acts_as_monitor_spinner_#{object.id}", :style => "display:none;")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
11
20
|
end
|
12
21
|
|
13
22
|
def monitor_tag_js()
|
14
|
-
|
15
|
-
|
16
|
-
javascript_include_tag("acts_as_monitor_javascript.js") +
|
17
|
-
stylesheet_link_tag('acts_as_monitor.css')
|
23
|
+
javascript_include_tag(:acts_as_monitor) +
|
24
|
+
stylesheet_link_tag(:acts_as_monitor)
|
18
25
|
end
|
19
26
|
|
20
|
-
def monitor_valid
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
def monitor_valid!(params)
|
28
|
+
Rails.logger.info("Params: #{params.inspect}")
|
29
|
+
raise ActsAsMonitor::MalformedParams.new(:error => params.inspect) if params[:id].blank? || params[:class_name].blank?
|
30
|
+
raise ActsAsMonitor::MissingMethod unless eval(params[:class_name]).first.respond_to?(:status)
|
24
31
|
true
|
25
32
|
end
|
26
33
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<% if monitor %>
|
2
|
+
<fieldset>
|
3
|
+
<legend><%= monitor.class.model_name.human %></legend>
|
4
|
+
<% @status = monitor.status %>
|
5
|
+
<% @li_scope = "acts_as_monitor.messages.#{monitor.class.name.underscore.gsub('/','_')}"%>
|
6
|
+
<% unless @status[:error].blank? %>
|
7
|
+
<section class='acts_as_monitor_errors'>
|
8
|
+
<h3><%=I18n.t(:errors, :scope => "acts_as_monitor.messages") %></h3>
|
9
|
+
<ul>
|
10
|
+
<%@status[:error].each do |error| %>
|
11
|
+
<li><%=I18n.t(error, :scope=> @li_scope, :default => error.to_s) %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</section>
|
15
|
+
<% end %>
|
16
|
+
<% unless @status[:warn].blank? %>
|
17
|
+
<section class='acts_as_monitor_warnings'>
|
18
|
+
<h3><%=I18n.t(:warnings, :scope => "acts_as_monitor.messages") %></h3>
|
19
|
+
<ul>
|
20
|
+
<%@status[:warn].each do |warn| %>
|
21
|
+
<li><%=I18n.t(warn, :scope=> @li_scope, :default => warn.to_s) %></li>
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
</section>
|
25
|
+
<% end %>
|
26
|
+
<% else %>
|
27
|
+
<p><%= I18n.t(:missing_method, :scope=> "acts_as_monitor.errors", :default => "Add acts_as_monitor to monitored Class") %></p>
|
28
|
+
<% end %>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
it:
|
2
|
+
acts_as_monitor:
|
3
|
+
icons:
|
4
|
+
red: acts_as_monitor_red.png
|
5
|
+
yellow: acts_as_monitor_yellow.png
|
6
|
+
green: acts_as_monitor_green.png
|
7
|
+
alt_image: "Clicca per visualizzare i dettagli"
|
8
|
+
errors:
|
9
|
+
missing_method: "Aggiungi acts_as_monitor alla classe da monitorare"
|
10
|
+
messages:
|
11
|
+
errors: Errori
|
12
|
+
warnings: Avvisi
|
13
|
+
magazzino_document:
|
14
|
+
warn_attach: "Allegato mancante"
|
15
|
+
warn_body: "Una delle righe bolle contiene un Errore"
|
16
|
+
error_body: "Una delle righe bolla contiene un Avviso"
|
17
|
+
magazzino_product:
|
18
|
+
warn_coerent: "Prodotto non coerente nei magazzino collegati"
|
19
|
+
magazzino_documentbody:
|
20
|
+
error_sqta: "La quantità con segno è errata!"
|
21
|
+
interventi_activity:
|
22
|
+
warn_missing_attach: "Allegato mancante"
|
23
|
+
warn_missing_rapp_1: "Manca il Rapportino Nest2!"
|
24
|
+
warn_missing_rapp_2: "Manca il Rapportino cliente!"
|
25
|
+
warn_missing_photo_1: "Manca la Foto prima!"
|
26
|
+
warn_missing_photo_2: "Manca la Foto dopo!"
|
27
|
+
warn_missing_quality: "Manca la scheda qualità!"
|
28
|
+
warn_missing_supplier_billing: "BEF non presente in alcune righe"
|
29
|
+
warn_missing_customer_billing: "Consuntivazione non presente in alcune righe"
|
30
|
+
admin_attachment:
|
31
|
+
error_missing: "Allegato mancante sul server!"
|
32
|
+
consuntivazioni_billing:
|
33
|
+
warn_checks: "Controllo richiesto ma non presente!"
|
34
|
+
warn_order: "Consuntivazione non consolidata!"
|
35
|
+
error_order: "Consuntivazione consolidata senza Ordine!"
|
36
|
+
consuntivazioni_billing_body:
|
37
|
+
warn_missing_check: "Intervento non trovato nel controllo!"
|
38
|
+
produzione_order:
|
39
|
+
warn_expirating: "Ordine in scadenza"
|
40
|
+
error_expirated: "Ordine scaduto!"
|
41
|
+
|
data/lib/acts_as_monitor.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require "active_support/dependencies"
|
2
3
|
|
3
4
|
module ActsAsMonitor
|
@@ -10,6 +11,5 @@ module ActsAsMonitor
|
|
10
11
|
end
|
11
12
|
|
12
13
|
require "acts_as_monitor/engine"
|
13
|
-
#require "acts_as_monitor/version"
|
14
14
|
require "acts_as_monitor/monitor"
|
15
15
|
require "acts_as_monitor/exceptions"
|
@@ -1,9 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
#Defines Custom Exceptions
|
2
3
|
module ActsAsMonitor
|
3
|
-
|
4
|
-
|
4
|
+
class CustomError < StandardError
|
5
|
+
def initialize(*args)
|
6
|
+
@options = args.extract_options!
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
message
|
12
|
+
end
|
13
|
+
|
5
14
|
def message
|
6
|
-
|
15
|
+
@options.merge!({:default => "Error : #{@options.inspect}"})
|
16
|
+
I18n.t("#{self.class.name.gsub(/::/,'.')}", @options )
|
7
17
|
end
|
8
18
|
end
|
19
|
+
|
20
|
+
class MissingMethod < CustomError; end
|
21
|
+
class MalformedParams < CustomError;end
|
9
22
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
module ActsAsMonitor
|
2
3
|
module Monitor
|
3
4
|
def self.included(base) # :nodoc:
|
@@ -53,7 +54,7 @@ module ActsAsMonitor
|
|
53
54
|
out = {:warn => [], :error => []}
|
54
55
|
methods = self.private_methods
|
55
56
|
methods += self.methods
|
56
|
-
methods = methods.map{|m| m.match(search) }.compact
|
57
|
+
methods = methods.map{|m| m.to_s.match(search) }.compact
|
57
58
|
methods.each do |method|
|
58
59
|
out[method[1].to_sym] << method[0].gsub("?","").to_sym if send(method[0])
|
59
60
|
end
|
@@ -4,36 +4,9 @@ module ActsAsMonitor
|
|
4
4
|
desc "Install generator for ActsAsMonitor gem"
|
5
5
|
source_root File.expand_path("../templates", __FILE__)
|
6
6
|
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
copy_file icon, destination
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def copy_locales
|
16
|
-
file = "acts_as_monitor.it.yml"
|
17
|
-
destination = "config/locales/" + file
|
18
|
-
copy_file file, destination
|
19
|
-
end
|
20
|
-
|
21
|
-
def copy_javascripts
|
22
|
-
copy_file "acts_as_monitor_javascript.js", "public/javascripts/acts_as_monitor_javascript.js"
|
23
|
-
end
|
24
|
-
|
25
|
-
def copy_stylesheet
|
26
|
-
copy_file "acts_as_monitor.css", "public/stylesheets/acts_as_monitor.css"
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
def print_usage
|
31
|
-
usage = <<-START
|
32
|
-
Add acts_as_monitor to model to monitor
|
33
|
-
Add a private method warn_*? and error_*? to define warning and error status
|
34
|
-
Use monitor_tag(model_instance) in your view
|
35
|
-
START
|
36
|
-
puts(usage)
|
37
|
-
end
|
7
|
+
def copy_config
|
8
|
+
directory "."
|
9
|
+
end
|
10
|
+
|
38
11
|
end
|
39
12
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
en:
|
2
|
+
ActsAsMonitor:
|
3
|
+
MissingMethod: "Add acts_as_monitor to monitored class"
|
4
|
+
MalformedParams: "Malformed Params: %{error}"
|
5
|
+
acts_as_monitor:
|
6
|
+
icons:
|
7
|
+
red: acts_as_monitor_red.png
|
8
|
+
yellow: acts_as_monitor_yellow.png
|
9
|
+
green: acts_as_monitor_green.png
|
10
|
+
alt_image: "Show details"
|
11
|
+
messages:
|
12
|
+
errors: Errors
|
13
|
+
warnings: Warns
|
@@ -1,12 +1,13 @@
|
|
1
1
|
it:
|
2
|
+
ActsAsMonitor:
|
3
|
+
MissingMethod: "Aggiungi acts_as_monitor alla classe da monitorare"
|
4
|
+
MalformedParams: "Params malformato: %{error}"
|
2
5
|
acts_as_monitor:
|
3
6
|
icons:
|
4
7
|
red: acts_as_monitor_red.png
|
5
8
|
yellow: acts_as_monitor_yellow.png
|
6
9
|
green: acts_as_monitor_green.png
|
7
10
|
alt_image: "Clicca per visualizzare i dettagli"
|
8
|
-
errors:
|
9
|
-
missing_method: "Aggiungi acts_as_monitor alla classe da monitorare"
|
10
11
|
messages:
|
11
12
|
errors: Errori
|
12
13
|
warnings: Avvisi
|
@@ -0,0 +1,78 @@
|
|
1
|
+
$background_color: #F2F2F2;
|
2
|
+
$border_color: black;
|
3
|
+
$errors_color: red;
|
4
|
+
$warnings_color: #FACC2E;
|
5
|
+
|
6
|
+
div.acts_as_monitor {
|
7
|
+
position: relative;
|
8
|
+
width: 16px;
|
9
|
+
|
10
|
+
img.acts_as_monitor_spinner {
|
11
|
+
position: absolute;
|
12
|
+
z-index:100;
|
13
|
+
top: 0px;
|
14
|
+
left: 0px;
|
15
|
+
}
|
16
|
+
|
17
|
+
div.acts_as_monitor_window {
|
18
|
+
position: absolute;
|
19
|
+
z-index:100;
|
20
|
+
top: -50px;
|
21
|
+
left: 30px;
|
22
|
+
|
23
|
+
fieldset {
|
24
|
+
opacity: 1.0;
|
25
|
+
background-color: $background_color;
|
26
|
+
padding-left: 5px;
|
27
|
+
padding-right: 5px;
|
28
|
+
margin-left: 5px;
|
29
|
+
margin-right: 10px;
|
30
|
+
border: solid $border_color 1px;
|
31
|
+
-moz-border-radius:5px;
|
32
|
+
border-radius: 5px;
|
33
|
+
-webkit-border-radius: 5px;
|
34
|
+
|
35
|
+
legend {
|
36
|
+
-moz-border-radius:5px;
|
37
|
+
border-radius: 5px;
|
38
|
+
-webkit-border-radius: 5px;
|
39
|
+
border: solid $border_color 1px;
|
40
|
+
background-color: $border_color;
|
41
|
+
color: white;
|
42
|
+
}
|
43
|
+
|
44
|
+
h3 {
|
45
|
+
font-weight: normal;
|
46
|
+
text-align: center;
|
47
|
+
margin: 0px 0px 0px 0px;
|
48
|
+
padding-left: -5px;
|
49
|
+
padding-right: -5px;
|
50
|
+
padding-top: 3px;
|
51
|
+
padding-bottom: 3px;
|
52
|
+
}
|
53
|
+
|
54
|
+
section.acts_as_monitor_errors {
|
55
|
+
h3 {
|
56
|
+
background-color: $errors_color;
|
57
|
+
}
|
58
|
+
|
59
|
+
li{
|
60
|
+
list-style-image: url('acts_as_monitor_red.png');
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
section.acts_as_monitor_warnings {
|
65
|
+
h3 {
|
66
|
+
background-color: $warnings_color;
|
67
|
+
}
|
68
|
+
|
69
|
+
li{
|
70
|
+
list-style-image: url('acts_as_monitor_yellow.png');
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
metadata
CHANGED
@@ -1,92 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_monitor
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 1.0.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Andrea Bignozzi
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-11-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rails
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
- 14
|
33
|
-
version: 3.0.14
|
18
|
+
requirements:
|
19
|
+
- - <
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 4.0.0
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.1.0
|
34
25
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rake
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 3
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
48
|
-
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rspec
|
52
26
|
prerelease: false
|
53
|
-
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
28
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
version:
|
62
|
-
type: :development
|
63
|
-
version_requirements: *id003
|
29
|
+
requirements:
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 4.0.0
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 3.1.0
|
64
36
|
description: Monitor model via private methods warn_*? and error_*?
|
65
|
-
email:
|
37
|
+
email:
|
66
38
|
- skylord73@gmail.com
|
67
39
|
executables: []
|
68
|
-
|
69
40
|
extensions: []
|
70
|
-
|
71
41
|
extra_rdoc_files: []
|
72
|
-
|
73
|
-
|
74
|
-
- app/
|
75
|
-
- app/
|
42
|
+
files:
|
43
|
+
- app/assets/images/acts_as_monitor_green.png
|
44
|
+
- app/assets/images/acts_as_monitor_red.png
|
45
|
+
- app/assets/images/acts_as_monitor_spinner.gif
|
46
|
+
- app/assets/images/acts_as_monitor_yellow.png
|
47
|
+
- app/assets/javascripts/acts_as_monitor.js.coffee
|
48
|
+
- app/assets/javascripts/acts_as_monitor_javascript.js.erb.old
|
76
49
|
- app/controllers/acts_as_monitor/monitors_controller.rb
|
77
|
-
-
|
50
|
+
- app/helpers/acts_as_monitor_helper.rb
|
51
|
+
- app/views/acts_as_monitor/monitors/_show.html.erb
|
52
|
+
- app/views/acts_as_monitor/monitors/show.js.erb
|
78
53
|
- lib/acts_as_monitor/engine.rb
|
79
54
|
- lib/acts_as_monitor/exceptions.rb
|
80
|
-
- lib/acts_as_monitor/version.rb
|
81
55
|
- lib/acts_as_monitor/monitor.rb
|
56
|
+
- lib/acts_as_monitor/version.rb
|
57
|
+
- lib/acts_as_monitor.rb
|
82
58
|
- lib/generators/acts_as_monitor/install/install_generator.rb
|
83
|
-
- lib/generators/acts_as_monitor/install/templates/acts_as_monitor.
|
84
|
-
- lib/generators/acts_as_monitor/install/templates/
|
85
|
-
- lib/generators/acts_as_monitor/install/templates/
|
86
|
-
-
|
87
|
-
- lib/generators/acts_as_monitor/install/templates/acts_as_monitor_red.png
|
88
|
-
- lib/generators/acts_as_monitor/install/templates/acts_as_monitor.css
|
89
|
-
- lib/generators/acts_as_monitor/install/templates/acts_as_monitor_javascript.js
|
59
|
+
- lib/generators/acts_as_monitor/install/templates/config/locales/acts_as_monitor.en.yml
|
60
|
+
- lib/generators/acts_as_monitor/install/templates/config/locales/acts_as_monitor.it.yml
|
61
|
+
- lib/generators/acts_as_monitor/install/templates/vendor/assets/stylesheets/acts_as_monitor.css.scss
|
62
|
+
- config/locales/acts_as_monitor.it.yml
|
90
63
|
- config/routes.rb
|
91
64
|
- Rakefile
|
92
65
|
- Gemfile
|
@@ -95,36 +68,26 @@ files:
|
|
95
68
|
- LICENSE
|
96
69
|
homepage:
|
97
70
|
licenses: []
|
98
|
-
|
99
71
|
post_install_message:
|
100
72
|
rdoc_options: []
|
101
|
-
|
102
|
-
require_paths:
|
73
|
+
require_paths:
|
103
74
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
76
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
- 0
|
112
|
-
version: "0"
|
113
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
82
|
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
segments:
|
120
|
-
- 0
|
121
|
-
version: "0"
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
122
87
|
requirements: []
|
123
|
-
|
124
88
|
rubyforge_project:
|
125
|
-
rubygems_version: 1.8.
|
89
|
+
rubygems_version: 1.8.23
|
126
90
|
signing_key:
|
127
91
|
specification_version: 3
|
128
92
|
summary: Monitor models
|
129
93
|
test_files: []
|
130
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<% if @monitor %>
|
2
|
-
<fieldset class='acts_as_monitor_status_window'>
|
3
|
-
<legend class='acts_as_monitor_status_window'><%= @monitor.class.human_name %></legend>
|
4
|
-
<% @status = @monitor.status %>
|
5
|
-
<% @li_scope = "acts_as_monitor.messages.#{@monitor.class.name.underscore.gsub('/','_')}"%>
|
6
|
-
<% unless @status[:error].blank? %>
|
7
|
-
<h3 class="acts_as_monitor_errors_title"><%=I18n.t(:errors, :scope => "acts_as_monitor.messages") %></h3>
|
8
|
-
<ul class="acts_as_monitor_list_errors">
|
9
|
-
<%@status[:error].each do |error| %>
|
10
|
-
<li class= "acts_as_monitor_list_errors"><%=I18n.t(error, :scope=> @li_scope, :default => error.to_s) %></li>
|
11
|
-
<% end %>
|
12
|
-
</ul>
|
13
|
-
<% end %>
|
14
|
-
<% unless @status[:warn].blank? %>
|
15
|
-
<h3 class="acts_as_monitor_warnings_title"><%=I18n.t(:warnings, :scope => "acts_as_monitor.messages") %></h3>
|
16
|
-
<ul class="acts_as_monitor_list_warnings">
|
17
|
-
<%@status[:warn].each do |warn| %>
|
18
|
-
<li class="acts_as_monitor_list_warnings"><%=I18n.t(warn, :scope=> @li_scope, :default => warn.to_s) %></li>
|
19
|
-
<% end %>
|
20
|
-
</ul>
|
21
|
-
<% end %>
|
22
|
-
<% else %>
|
23
|
-
<p><%= I18n.t(:missing_method, :scope=> "acts_as_monitor.errors", :default => "Add acts_as_monitor to monitored Class") %></p>
|
24
|
-
<% end %>
|
25
|
-
|
26
|
-
|
@@ -1,48 +0,0 @@
|
|
1
|
-
.acts_as_monitor_status_window{
|
2
|
-
background-color: #F2F2F2;
|
3
|
-
border: solid black 1px;
|
4
|
-
opacity: 0.9;
|
5
|
-
width: 150px;
|
6
|
-
}
|
7
|
-
|
8
|
-
.acts_as_monitor_status_window legend{
|
9
|
-
opacity: 1.0;
|
10
|
-
background-color: #F2F2F2;
|
11
|
-
padding-left: 5px;
|
12
|
-
padding-right: 5px;
|
13
|
-
margin-left: 5px;
|
14
|
-
margin-right: 10px;
|
15
|
-
|
16
|
-
}
|
17
|
-
|
18
|
-
.acts_as_monitor_status_window h3.acts_as_monitor_errors_title{
|
19
|
-
font-weight: normal;
|
20
|
-
background-color: red;
|
21
|
-
text-align: center;
|
22
|
-
padding-left: 5px;
|
23
|
-
padding-right: 5px;
|
24
|
-
padding-top: 3px;
|
25
|
-
padding-bottom: 3px;
|
26
|
-
}
|
27
|
-
|
28
|
-
.acts_as_monitor_status_window h3.acts_as_monitor_warnings_title{
|
29
|
-
font-weight: normal;
|
30
|
-
background-color: #FACC2E;
|
31
|
-
text-align: center;
|
32
|
-
padding-left: 5px;
|
33
|
-
padding-right: 5px;
|
34
|
-
padding-top: 3px;
|
35
|
-
padding-bottom: 3px;
|
36
|
-
}
|
37
|
-
|
38
|
-
.acts_as_monitor_status_window ul{
|
39
|
-
margin-left: 10px;
|
40
|
-
}
|
41
|
-
|
42
|
-
li.acts_as_monitor_list_errors{
|
43
|
-
list-style-image: url('../images/acts_as_monitor_red.png');
|
44
|
-
}
|
45
|
-
|
46
|
-
li.acts_as_monitor_list_warnings{
|
47
|
-
list-style-image: url('../images/acts_as_monitor_yellow.png');
|
48
|
-
}
|