auto_error 0.0.3 → 0.0.4
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/app/assets/javascripts/auto_error/app_errors/views/app_errors.coffee +4 -9
- data/app/assets/javascripts/auto_error/app_errors/views/base.coffee +1 -1
- data/app/assets/javascripts/auto_error/application.js +1 -0
- data/app/assets/stylesheets/auto_error/app_errors.css.erb +28 -2
- data/app/assets/templates/auto_error/app_error.hbs +8 -4
- data/app/controllers/auto_error/app_errors_controller.rb +1 -1
- data/app/controllers/auto_error/application_controller.rb +8 -3
- data/app/controllers/auto_error/errors_controller.rb +15 -4
- data/app/decorators/auto_error/app_error_decorator.rb +22 -3
- data/app/models/auto_error/app_error.rb +13 -3
- data/app/views/auto_error/exception_notifier/_request.html.erb +5 -0
- data/app/views/auto_error/exception_notifier/_request.text.erb +5 -0
- data/lib/auto_error/config.rb +12 -5
- data/lib/auto_error/context_shorthand.rb +0 -2
- data/lib/auto_error/helper_context.rb +34 -0
- data/lib/auto_error/version.rb +1 -1
- data/lib/auto_error.rb +2 -3
- data/vendor/assets/javascripts/auto_error/foundation-reveal.js +161 -0
- metadata +6 -4
- data/lib/auto_error/auth_context.rb +0 -18
- data/lib/auto_error/view_context.rb +0 -10
@@ -6,21 +6,16 @@ class AppError extends App.Views.PolledItem
|
|
6
6
|
render: ->
|
7
7
|
json = @model.toJSON()
|
8
8
|
json.prettyData = []
|
9
|
+
json.backtrace = @model.get('backtrace').replace( /\n/g, "<br/>" )
|
9
10
|
for k, v of json.data
|
10
|
-
json.prettyData.push "#{k}:
|
11
|
-
json.prettyData = json.prettyData.join("
|
11
|
+
json.prettyData.push "#{k}: <tt>#{v}</tt>"
|
12
|
+
json.prettyData = json.prettyData.join("<br/>")
|
12
13
|
json.timestamp = moment(json.created_at).format( "YYYY-MM-DD[<br/>at] h:mma" )
|
13
14
|
@$el.html( @template( json ) )
|
14
15
|
return @
|
15
16
|
toggleBacktrace: ->
|
16
17
|
link = @$('a.show_backtrace')
|
17
|
-
|
18
|
-
if bt.is(':visible')
|
19
|
-
bt.hide()
|
20
|
-
link.text('show backtrace...')
|
21
|
-
else
|
22
|
-
bt.html( @model.get('backtrace').replace( /\n/g, "<br/>" ) ).show()
|
23
|
-
link.text('hide backtrace...')
|
18
|
+
@$('.backtrace').reveal()
|
24
19
|
destroy: ->
|
25
20
|
@model.destroy()
|
26
21
|
@remove()
|
@@ -14,7 +14,7 @@ class App.Views.PollingList extends Backbone.View
|
|
14
14
|
@emptyMessage = @body.html().replace(/[\r\n]\s+/g, '')
|
15
15
|
@collection.on 'remove', @remove, @
|
16
16
|
@collection.on 'add', @render, @
|
17
|
-
@collection.fetch( update: true )
|
17
|
+
@collection.fetch( update: true, success: _.bind(@render, @) )
|
18
18
|
@views = {}
|
19
19
|
remove: ( m ) ->
|
20
20
|
@views[m.id] = null
|
@@ -1,8 +1,15 @@
|
|
1
|
+
body {
|
2
|
+
background: transparent;
|
3
|
+
}
|
4
|
+
|
1
5
|
table.polling tr td p.loading_message {
|
2
6
|
font-size: 20px;
|
3
7
|
margin: 25px 0;
|
4
8
|
text-align: center;
|
5
9
|
}
|
10
|
+
table.polling tbody td small.time {
|
11
|
+
font-size: 12px;
|
12
|
+
}
|
6
13
|
|
7
14
|
table.polling tbody pre {
|
8
15
|
font-size: 13px;
|
@@ -35,11 +42,30 @@ table.polling tfoot .poller .spinner {
|
|
35
42
|
}
|
36
43
|
|
37
44
|
#app_errors table tbody .backtrace {
|
38
|
-
width: 530px;
|
39
|
-
height: 250px;
|
40
45
|
overflow: scroll;
|
41
46
|
font-family: monospace;
|
42
47
|
font-size: 13px;
|
43
48
|
line-height: 15px;
|
44
49
|
white-space: nowrap;
|
45
50
|
}
|
51
|
+
#app_errors table tbody .data {
|
52
|
+
font-family: monospace;
|
53
|
+
font-size: 13px;
|
54
|
+
line-height: 15px;
|
55
|
+
white-space: nowrap;
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
.reveal-modal {
|
60
|
+
top: -100px;
|
61
|
+
width: 960px;
|
62
|
+
margin-left: -480px;
|
63
|
+
display: block; /* wat? */
|
64
|
+
}
|
65
|
+
.reveal-modal h4 {
|
66
|
+
margin-top: 0;
|
67
|
+
}
|
68
|
+
.close-reveal-modal {
|
69
|
+
top: 0;
|
70
|
+
left: 5px;
|
71
|
+
}
|
@@ -2,10 +2,14 @@
|
|
2
2
|
<strong>{{message}}</strong>
|
3
3
|
<br/>
|
4
4
|
<a href="javascript:void(0);" class='show_backtrace'>show backtrace...</a>
|
5
|
-
<div class='backtrace
|
5
|
+
<div class='backtrace reveal-modal'>
|
6
|
+
<a class="close-reveal-modal">×</a>
|
7
|
+
<h4>{{message}}</h4>
|
8
|
+
<pre>{{{backtrace}}}</pre>
|
9
|
+
</div>
|
6
10
|
</td>
|
7
|
-
<td><
|
8
|
-
<td>{{{timestamp}}}</td>
|
9
|
-
<td>
|
11
|
+
<td><div class='data'>{{{prettyData}}}</div></td>
|
12
|
+
<td width='120px'><small class='time'>{{{timestamp}}}</small></td>
|
13
|
+
<td width='85px'>
|
10
14
|
<a href="javascript:void(0);" class='remove button radius tiny secondary'>resolved</a>
|
11
15
|
</td>
|
@@ -3,7 +3,7 @@ class AutoError::AppErrorsController < AutoError::ApplicationController
|
|
3
3
|
|
4
4
|
def index
|
5
5
|
@errors = AutoError::AppError.unresolved
|
6
|
-
render json: @errors.map { |ae| AutoError::AppErrorDecorator.new(ae).as_json }
|
6
|
+
render json: @errors.map { |ae| AutoError::AppErrorDecorator.new(ae).as_json( @h ) }
|
7
7
|
end
|
8
8
|
|
9
9
|
def destroy
|
@@ -1,11 +1,16 @@
|
|
1
|
-
class AutoError::ApplicationController <
|
1
|
+
class AutoError::ApplicationController < ::ApplicationController
|
2
2
|
include AutoError::ApplicationHelper
|
3
3
|
helper :all
|
4
4
|
|
5
5
|
protected
|
6
6
|
|
7
7
|
def ensure_authenticated
|
8
|
-
|
9
|
-
|
8
|
+
@h = AutoError::HelperContext.new( env )
|
9
|
+
|
10
|
+
# raise unless the auth_with helper returns a truthy value
|
11
|
+
# this way we can let the user access their own auth logic
|
12
|
+
unless AutoError::Config.auth_with.(@h)
|
13
|
+
raise AutoError::Errors::Denied
|
14
|
+
end
|
10
15
|
end
|
11
16
|
end
|
@@ -1,30 +1,41 @@
|
|
1
1
|
class AutoError::ErrorsController < AutoError::ApplicationController
|
2
2
|
|
3
3
|
def show
|
4
|
+
# fix PATH_INFO to be the actual request path, and not /500
|
5
|
+
env['PATH_INFO'] = env['ORIGINAL_FULLPATH']
|
6
|
+
|
4
7
|
# reset action_controller.instance to the original controller
|
5
8
|
# that caused the exception
|
6
9
|
env['action_controller.instance'] = env.delete('auto_error.original_controller.instance')
|
10
|
+
@controller = env['action_controller.instance']
|
7
11
|
|
8
12
|
@exception = env['action_dispatch.exception']
|
9
13
|
@status_code = ActionDispatch::ExceptionWrapper.new(env, @exception).status_code
|
10
14
|
@rescue_response = ActionDispatch::ExceptionWrapper.rescue_responses[@exception.class.name]
|
11
|
-
@params = env['action_dispatch.request.parameters'].symbolize_keys
|
12
15
|
|
13
16
|
@status_code = 500 unless [403, 404].include?(@status_code)
|
14
17
|
|
15
18
|
if @status_code == 500
|
19
|
+
@request = @controller.request
|
20
|
+
@params = @request.filtered_parameters.symbolize_keys
|
16
21
|
controller = "#{@params[:controller].camelize}Controller" rescue 'N/A'
|
17
22
|
action = @params[:action] || 'N/A'
|
18
23
|
where = { controller: controller, action: action }
|
19
24
|
data = {
|
20
|
-
path:
|
21
|
-
method:
|
22
|
-
ip:
|
25
|
+
path: @request.fullpath.split('?').first,
|
26
|
+
method: @request.method,
|
27
|
+
ip: @request.remote_ip,
|
28
|
+
params: @params.except( *(%w{
|
29
|
+
controller action format _method only_path
|
30
|
+
}.map(&:to_sym) ) )
|
23
31
|
}
|
32
|
+
# Rails.logger.error [controller,action, where, data].map(&:inspect).join("\n")
|
24
33
|
AutoError::AppError.log!( env, @exception, where, data )
|
25
34
|
end
|
26
35
|
|
27
36
|
AutoError::Config.error_template_renderer.bind(self).( @status_code )
|
37
|
+
rescue => explosion
|
38
|
+
Rails.logger.error "\nAutoError exploded while handling an exception: #{@exception.inspect}\nHere's the error: #{explosion.inspect}\n"
|
28
39
|
end
|
29
40
|
|
30
41
|
end
|
@@ -1,13 +1,32 @@
|
|
1
1
|
module AutoError
|
2
2
|
class AppErrorDecorator < Draper::Decorator
|
3
|
-
def as_json
|
3
|
+
def as_json( context )
|
4
4
|
r = source.attributes
|
5
5
|
(r['data']||{}).entries.each do |k, v|
|
6
6
|
next if v.nil?
|
7
|
-
|
8
|
-
|
7
|
+
k = k.to_sym
|
8
|
+
if k != :params || AutoError::Config.data_handlers.has_key?(k)
|
9
|
+
handler = AutoError::Config.data_handlers[k].bind(context)
|
10
|
+
processed = handler.(v)
|
11
|
+
elsif k == :params
|
12
|
+
processed = handle_params(v)
|
13
|
+
end
|
14
|
+
r['data'][k.to_s] = processed.html_safe
|
9
15
|
end
|
10
16
|
r
|
11
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def handle_params( h )
|
22
|
+
%{
|
23
|
+
<a href='javascript:void(0);' onclick='$(this).siblings(".params").reveal();'>show params...</a>
|
24
|
+
<div class='params reveal-modal'>
|
25
|
+
<a class="close-reveal-modal">×</a>
|
26
|
+
<h4>Params</h4>
|
27
|
+
<pre>#{JSON.pretty_generate(h)}</pre>
|
28
|
+
</div>
|
29
|
+
}
|
30
|
+
end
|
12
31
|
end
|
13
32
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module AutoError
|
2
2
|
class AppError < ActiveRecord::Base
|
3
|
+
attr_accessible *%w{ controller action data klass message backtrace }
|
4
|
+
|
3
5
|
before_create :generate_group
|
4
6
|
|
5
7
|
serialize :data
|
@@ -12,13 +14,15 @@ module AutoError
|
|
12
14
|
opts.merge!( {
|
13
15
|
klass: exception.class.name,
|
14
16
|
message: exception.message,
|
15
|
-
backtrace: (
|
17
|
+
backtrace: (
|
18
|
+
exception.backtrace ? clean_backtrace(exception.backtrace) : []
|
19
|
+
).join("\n")
|
16
20
|
} )
|
17
21
|
app_error = create!( opts )
|
18
22
|
|
19
23
|
if AutoError::Config.email_on_error.any?
|
20
24
|
begin
|
21
|
-
send_email!( env, exception )
|
25
|
+
send_email!( env, exception, opts[:data] )
|
22
26
|
rescue
|
23
27
|
$stderr.puts "AutoError failed to send exception notification email to #{AutoError::Config.email_on_error.inspect} -- #{$!.inspect}"
|
24
28
|
end
|
@@ -42,11 +46,12 @@ module AutoError
|
|
42
46
|
|
43
47
|
private
|
44
48
|
|
45
|
-
def self.send_email!( env, exception )
|
49
|
+
def self.send_email!( env, exception, data )
|
46
50
|
options = env['exception_notifier.options'] || {}
|
47
51
|
options[:ignore_exceptions] ||= ExceptionNotifier.default_ignore_exceptions
|
48
52
|
options[:email_prefix] ||= "[#{Rails.application.class.name.split('::').first} ERROR] "
|
49
53
|
options[:exception_recipients] = AutoError::Config.email_on_error
|
54
|
+
options[:data] = data
|
50
55
|
|
51
56
|
unless Array.wrap(options[:ignore_exceptions]).include?( exception.class )
|
52
57
|
ExceptionNotifier::Notifier.exception_notification( env, exception, options ).deliver
|
@@ -54,6 +59,11 @@ module AutoError
|
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
62
|
+
def self.clean_backtrace( backtrace )
|
63
|
+
return backtrace unless Rails.respond_to?( :backtrace_cleaner )
|
64
|
+
Rails.backtrace_cleaner.send( :filter, backtrace )
|
65
|
+
end
|
66
|
+
|
57
67
|
def generate_group
|
58
68
|
self.group = Digest::SHA1.hexdigest( [
|
59
69
|
self.klass.to_s, self.message.to_s,
|
data/lib/auto_error/config.rb
CHANGED
@@ -7,8 +7,8 @@ module AutoError
|
|
7
7
|
mattr_accessor :auth_with
|
8
8
|
@@auth_with = nil
|
9
9
|
|
10
|
-
mattr_accessor :
|
11
|
-
@@
|
10
|
+
mattr_accessor :helpers
|
11
|
+
@@helpers = nil
|
12
12
|
|
13
13
|
mattr_accessor :email_on_error
|
14
14
|
@@email_on_error = nil
|
@@ -24,15 +24,22 @@ module AutoError
|
|
24
24
|
def self.set_defaults
|
25
25
|
self.setup do |config|
|
26
26
|
config.error_template_renderer = ->( status ) do
|
27
|
-
render template: "/errors/#{status}",
|
27
|
+
render template: "/errors/#{status}",
|
28
|
+
layout: 'errors',
|
29
|
+
status: status
|
28
30
|
end
|
29
31
|
|
30
32
|
config.email_on_error = []
|
33
|
+
ExceptionNotifier::Notifier.prepend_view_path(
|
34
|
+
AutoError::Engine.root.join( *%w{app views auto_error} )
|
35
|
+
)
|
31
36
|
|
32
37
|
config.auth_with = ->( c ) { true }
|
33
|
-
config.
|
38
|
+
config.helpers = [ 'ApplicationHelper' ]
|
34
39
|
|
35
|
-
config.data_handlers = Hash.new
|
40
|
+
config.data_handlers = Hash.new do |h, k|
|
41
|
+
h[k] = ->( value ) { "<strong>#{value}</strong>" }
|
42
|
+
end
|
36
43
|
end
|
37
44
|
end
|
38
45
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module AutoError
|
2
|
-
|
3
2
|
# Convenience methods added to ApplicationController.
|
4
3
|
module ContextShorthand
|
5
4
|
def add_error_context( context )
|
@@ -11,5 +10,4 @@ module AutoError
|
|
11
10
|
end
|
12
11
|
|
13
12
|
ActionController::Base.send :include, AutoError::ContextShorthand
|
14
|
-
|
15
13
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module AutoError
|
2
|
+
class HelperContext
|
3
|
+
attr_accessor :env
|
4
|
+
|
5
|
+
def initialize( env )
|
6
|
+
@env = env
|
7
|
+
|
8
|
+
AutoError::Config.helpers.each do |mod_name|
|
9
|
+
# grab the module by name we were given
|
10
|
+
# it is available in the 'parent' Rails.application
|
11
|
+
mod = Rails.application.class.qualified_const_get(mod_name)
|
12
|
+
|
13
|
+
class_eval do
|
14
|
+
# include that module in this HelperContext
|
15
|
+
send( :include, mod )
|
16
|
+
|
17
|
+
# but go through all of its instance methods
|
18
|
+
# and alias-method-chain style twiddle them so we can bind
|
19
|
+
# them to the correct environment inside auto_error
|
20
|
+
mod.instance_methods.each do |imeth|
|
21
|
+
alias :"#{imeth}_without_env" :"#{imeth}"
|
22
|
+
send( :define_method, :"#{imeth}" ) do |*args|
|
23
|
+
method( :"#{imeth}_without_env" ).to_proc.bind( @env ).call(*args)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# also include rails helpers and ActionView helpers
|
28
|
+
send( :include, ActionView::Helpers )
|
29
|
+
send( :include, Rails.application.routes.url_helpers )
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/auto_error/version.rb
CHANGED
data/lib/auto_error.rb
CHANGED
@@ -16,8 +16,7 @@ require 'auto_error/version'
|
|
16
16
|
require 'auto_error/config'
|
17
17
|
require 'auto_error/errors'
|
18
18
|
require 'auto_error/context_shorthand'
|
19
|
-
require 'auto_error/
|
20
|
-
require 'auto_error/auth_context'
|
19
|
+
require 'auto_error/helper_context'
|
21
20
|
require 'auto_error/engine'
|
22
21
|
|
23
22
|
module AutoError
|
@@ -28,7 +27,7 @@ module AutoError
|
|
28
27
|
|
29
28
|
original_exceptions_app = app_config.exceptions_app || ActionDispatch::PublicExceptions.new(Rails.public_path)
|
30
29
|
app_config.exceptions_app = ->(env) do
|
31
|
-
|
30
|
+
puts "Handling exception for #{env['action_controller.instance'].class}"
|
32
31
|
controller_class = env['action_controller.instance'].class
|
33
32
|
if controller_class.nil? || AutoError.constants.any? { |c| AutoError.const_get(c) == controller_class }
|
34
33
|
# do not log/handle exception at all if the error is actually
|
@@ -0,0 +1,161 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Reveal Plugin 1.0
|
3
|
+
* www.ZURB.com
|
4
|
+
* Copyright 2010, ZURB
|
5
|
+
* Free to use under the MIT license.
|
6
|
+
* http://www.opensource.org/licenses/mit-license.php
|
7
|
+
*/
|
8
|
+
|
9
|
+
|
10
|
+
(function($) {
|
11
|
+
|
12
|
+
/*---------------------------
|
13
|
+
Defaults for Reveal
|
14
|
+
----------------------------*/
|
15
|
+
|
16
|
+
/*---------------------------
|
17
|
+
Listener for data-reveal-id attributes
|
18
|
+
----------------------------*/
|
19
|
+
|
20
|
+
// How about no, scott?
|
21
|
+
// $('a[data-reveal-id]').live('click', function(e) {
|
22
|
+
// e.preventDefault();
|
23
|
+
// var modalLocation = $(this).attr('data-reveal-id');
|
24
|
+
// $('#'+modalLocation).reveal($(this).data());
|
25
|
+
// });
|
26
|
+
|
27
|
+
/*---------------------------
|
28
|
+
Extend and Execute
|
29
|
+
----------------------------*/
|
30
|
+
|
31
|
+
$.fn.reveal = function(options) {
|
32
|
+
|
33
|
+
|
34
|
+
var defaults = {
|
35
|
+
animation: 'fadeAndPop', //fade, fadeAndPop, none
|
36
|
+
animationspeed: 300, //how fast animtions are
|
37
|
+
closeonbackgroundclick: true, //if you click background will modal close?
|
38
|
+
dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal
|
39
|
+
};
|
40
|
+
|
41
|
+
//Extend dem' options
|
42
|
+
var options = $.extend({}, defaults, options);
|
43
|
+
|
44
|
+
return this.each(function() {
|
45
|
+
|
46
|
+
/*---------------------------
|
47
|
+
Global Variables
|
48
|
+
----------------------------*/
|
49
|
+
var modal = $(this),
|
50
|
+
topMeasure = parseInt(modal.css('top')),
|
51
|
+
topOffset = modal.height() + topMeasure,
|
52
|
+
locked = false,
|
53
|
+
modalBG = $('.reveal-modal-bg');
|
54
|
+
|
55
|
+
/*---------------------------
|
56
|
+
Create Modal BG
|
57
|
+
----------------------------*/
|
58
|
+
if(modalBG.length == 0) {
|
59
|
+
modalBG = $('<div class="reveal-modal-bg" />').insertAfter(modal);
|
60
|
+
}
|
61
|
+
|
62
|
+
/*---------------------------
|
63
|
+
Open & Close Animations
|
64
|
+
----------------------------*/
|
65
|
+
//Entrance Animations
|
66
|
+
modal.bind('reveal:open', function () {
|
67
|
+
modalBG.unbind('click.modalEvent');
|
68
|
+
$('.' + options.dismissmodalclass).unbind('click.modalEvent');
|
69
|
+
if(!locked) {
|
70
|
+
lockModal();
|
71
|
+
if(options.animation == "fadeAndPop") {
|
72
|
+
modal.css({'top': $(document).scrollTop()-topOffset, 'opacity' : 0, 'visibility' : 'visible'});
|
73
|
+
modalBG.fadeIn(options.animationspeed/2);
|
74
|
+
modal.delay(options.animationspeed/2).animate({
|
75
|
+
"top": $(document).scrollTop()+topMeasure + 'px',
|
76
|
+
"opacity" : 1
|
77
|
+
}, options.animationspeed,unlockModal());
|
78
|
+
}
|
79
|
+
if(options.animation == "fade") {
|
80
|
+
modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+topMeasure});
|
81
|
+
modalBG.fadeIn(options.animationspeed/2);
|
82
|
+
modal.delay(options.animationspeed/2).animate({
|
83
|
+
"opacity" : 1
|
84
|
+
}, options.animationspeed,unlockModal());
|
85
|
+
}
|
86
|
+
if(options.animation == "none") {
|
87
|
+
modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure});
|
88
|
+
modalBG.css({"display":"block"});
|
89
|
+
unlockModal()
|
90
|
+
}
|
91
|
+
}
|
92
|
+
modal.unbind('reveal:open');
|
93
|
+
});
|
94
|
+
|
95
|
+
//Closing Animation
|
96
|
+
modal.bind('reveal:close', function () {
|
97
|
+
if(!locked) {
|
98
|
+
lockModal();
|
99
|
+
if(options.animation == "fadeAndPop") {
|
100
|
+
modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
|
101
|
+
modal.animate({
|
102
|
+
"top": $(document).scrollTop()-topOffset + 'px',
|
103
|
+
"opacity" : 0
|
104
|
+
}, options.animationspeed/2, function() {
|
105
|
+
modal.css({'top':topMeasure, 'opacity' : 1, 'visibility' : 'hidden'});
|
106
|
+
unlockModal();
|
107
|
+
});
|
108
|
+
}
|
109
|
+
if(options.animation == "fade") {
|
110
|
+
modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
|
111
|
+
modal.animate({
|
112
|
+
"opacity" : 0
|
113
|
+
}, options.animationspeed, function() {
|
114
|
+
modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : topMeasure});
|
115
|
+
unlockModal();
|
116
|
+
});
|
117
|
+
}
|
118
|
+
if(options.animation == "none") {
|
119
|
+
modal.css({'visibility' : 'hidden', 'top' : topMeasure});
|
120
|
+
modalBG.css({'display' : 'none'});
|
121
|
+
}
|
122
|
+
}
|
123
|
+
modal.unbind('reveal:close');
|
124
|
+
});
|
125
|
+
|
126
|
+
/*---------------------------
|
127
|
+
Open and add Closing Listeners
|
128
|
+
----------------------------*/
|
129
|
+
//Open Modal Immediately
|
130
|
+
modal.trigger('reveal:open')
|
131
|
+
|
132
|
+
//Close Modal Listeners
|
133
|
+
var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
|
134
|
+
modal.trigger('reveal:close')
|
135
|
+
});
|
136
|
+
|
137
|
+
if(options.closeonbackgroundclick) {
|
138
|
+
modalBG.css({"cursor":"pointer"})
|
139
|
+
modalBG.bind('click.modalEvent', function () {
|
140
|
+
modal.trigger('reveal:close')
|
141
|
+
});
|
142
|
+
}
|
143
|
+
$('body').keyup(function(e) {
|
144
|
+
if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key
|
145
|
+
});
|
146
|
+
|
147
|
+
|
148
|
+
/*---------------------------
|
149
|
+
Animations Locks
|
150
|
+
----------------------------*/
|
151
|
+
function unlockModal() {
|
152
|
+
locked = false;
|
153
|
+
}
|
154
|
+
function lockModal() {
|
155
|
+
locked = true;
|
156
|
+
}
|
157
|
+
|
158
|
+
});//each call
|
159
|
+
}//orbit plugin call
|
160
|
+
})(jQuery);
|
161
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_error
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -261,6 +261,8 @@ files:
|
|
261
261
|
- app/decorators/auto_error/app_error_decorator.rb
|
262
262
|
- app/helpers/auto_error/application_helper.rb
|
263
263
|
- app/models/auto_error/app_error.rb
|
264
|
+
- app/views/auto_error/exception_notifier/_request.html.erb
|
265
|
+
- app/views/auto_error/exception_notifier/_request.text.erb
|
264
266
|
- app/views/auto_error/main/index.html.haml
|
265
267
|
- app/views/errors/404.html.erb
|
266
268
|
- app/views/errors/500.html.erb
|
@@ -268,18 +270,18 @@ files:
|
|
268
270
|
- app/views/layouts/errors.html.erb
|
269
271
|
- config/routes.rb
|
270
272
|
- db/migrate/20130128004546_create_auto_error_app_errors.rb
|
271
|
-
- lib/auto_error/auth_context.rb
|
272
273
|
- lib/auto_error/config.rb
|
273
274
|
- lib/auto_error/context_shorthand.rb
|
274
275
|
- lib/auto_error/engine.rb
|
275
276
|
- lib/auto_error/errors.rb
|
277
|
+
- lib/auto_error/helper_context.rb
|
276
278
|
- lib/auto_error/version.rb
|
277
|
-
- lib/auto_error/view_context.rb
|
278
279
|
- lib/auto_error.rb
|
279
280
|
- lib/core_ext/proc_ext.rb
|
280
281
|
- lib/tasks/auto_error_tasks.rake
|
281
282
|
- lib/templates/auto_error.rb
|
282
283
|
- vendor/assets/javascripts/auto_error/backbone-0.9.10.js
|
284
|
+
- vendor/assets/javascripts/auto_error/foundation-reveal.js
|
283
285
|
- vendor/assets/javascripts/auto_error/moment.js
|
284
286
|
- vendor/assets/javascripts/auto_error/underscore-1.4.4.js
|
285
287
|
- vendor/assets/stylesheets/auto_error/foundation.css
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module AutoError
|
2
|
-
class AuthContext
|
3
|
-
def initialize( env )
|
4
|
-
AutoError::Config.auth_helpers.each do |mod_name|
|
5
|
-
mod = Rails.application.class.qualified_const_get(mod_name)
|
6
|
-
class_eval do
|
7
|
-
send( :include, mod )
|
8
|
-
mod.instance_methods.each do |imeth|
|
9
|
-
alias :"#{imeth}_without_env" :"#{imeth}"
|
10
|
-
send( :define_method, imeth ) do
|
11
|
-
method( :"#{imeth}_without_env" ).to_proc.bind( env )
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|