javascript_util_asset_pack 0.1.0 → 0.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,12 @@
|
|
1
1
|
jQuery(document).ajaxError (event, xhr, settings, exception) ->
|
2
|
+
if exception == "abort"
|
3
|
+
log "request aborted, ignoring abort."
|
4
|
+
return null
|
5
|
+
|
2
6
|
baseMessage = "Error: "
|
3
7
|
friendly = baseMessage
|
4
8
|
local = "#{baseMessage}#{xhr.status}, #{xhr.statusText} #{exception}\n#{settings.url}"
|
5
|
-
|
9
|
+
|
6
10
|
if xhr.status is 404
|
7
11
|
friendly = "#{friendly}Page not found"
|
8
12
|
else if xhr.status is 401
|
@@ -21,18 +25,18 @@ jQuery(document).ajaxError (event, xhr, settings, exception) ->
|
|
21
25
|
if window.Rails?.env is "DEVELOPMENT"
|
22
26
|
contentType = xhr.getResponseHeader("content-type")
|
23
27
|
if contentType?.indexOf('html') > -1
|
24
|
-
body = "<div>#{xhr.responseText}</div>"
|
28
|
+
body = "<div>#{xhr.responseText}</div>"
|
25
29
|
fragment = $(body).find "h1"
|
26
30
|
local = "#{local} \n#{fragment.text()}"
|
27
31
|
fragment = $(body).find "pre"
|
28
|
-
|
32
|
+
|
29
33
|
if fragment.length > 0
|
30
34
|
fragment.each () -> local = "#{local}\n#{$(this).text()}"
|
31
35
|
|
32
36
|
else
|
33
37
|
# json, text, xml, etc... add specific parsing later if needed
|
34
38
|
local = "#{local}"
|
35
|
-
|
39
|
+
|
36
40
|
lengthOfVisibleErrorMessage = if local.length > 350 then 350 else local.length
|
37
41
|
message = local.substring(0, lengthOfVisibleErrorMessage)
|
38
42
|
alert "#{message}...\n\n - Check browser console for more info.\n - This message for development only."
|
metadata
CHANGED
@@ -1,162 +1,151 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: javascript_util_asset_pack
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 6
|
5
|
+
version: 0.2.0.rc1
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Jesse House
|
13
|
-
autorequire:
|
9
|
+
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rails
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.1'
|
21
|
+
none: false
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
none: false
|
22
28
|
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 3
|
29
|
-
- 1
|
30
|
-
version: "3.1"
|
31
29
|
type: :runtime
|
32
|
-
|
33
|
-
- !ruby/object:Gem::Dependency
|
30
|
+
- !ruby/object:Gem::Dependency
|
34
31
|
name: javascript_safe_logger
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
segments:
|
41
|
-
- 0
|
42
|
-
- 1
|
43
|
-
- 0
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
44
36
|
version: 0.1.0
|
37
|
+
none: false
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.1.0
|
43
|
+
none: false
|
44
|
+
prerelease: false
|
45
45
|
type: :runtime
|
46
|
-
version_requirements: *id002
|
47
46
|
description: |+
|
48
47
|
== Rails 3.1 javascript - Util asset pack
|
49
|
-
|
48
|
+
|
50
49
|
== Sets up a window.Util object which includes
|
51
|
-
|
50
|
+
|
52
51
|
* Spinner, with methods to set spinner next to element or hide the spinner
|
53
52
|
* AjaxForm, to ajax enable simple forms
|
54
53
|
* jQuery ajaxError global handler, exception data during development and friendly message in production
|
55
|
-
|
54
|
+
|
56
55
|
== Usage
|
57
|
-
|
56
|
+
|
58
57
|
spinner (js version)
|
59
|
-
|
58
|
+
|
60
59
|
window.Util.spinner.nextTo('#my_button');
|
61
60
|
window.Util.spinner.nextTo('#my_button', 3, 4); // selector, top offset, left offset
|
62
61
|
window.Util.spinner.hide();
|
63
|
-
|
62
|
+
|
64
63
|
ajax form (coffee script version)
|
65
|
-
|
64
|
+
|
66
65
|
jQuery ->
|
67
66
|
new window.Util.AjaxForm '#my_form', ->
|
68
67
|
log "my_form submit success callback"
|
69
|
-
|
68
|
+
|
70
69
|
== Install
|
71
|
-
|
70
|
+
|
72
71
|
Update the Gemfile in your rails project, add the following line
|
73
|
-
|
72
|
+
|
74
73
|
gem 'javascript_util_asset_pack'
|
75
|
-
|
74
|
+
|
76
75
|
Run the generator
|
77
|
-
|
76
|
+
|
78
77
|
rails generate javascript_util_asset_pack
|
79
|
-
|
78
|
+
|
80
79
|
does the following:
|
81
|
-
|
80
|
+
|
82
81
|
* Copy spinner.gif to /app/assets/images
|
83
82
|
* Update application.html.erb adding javascript create window.Rails.env variable
|
84
83
|
* Update application.html.erb adding image_tag for spinner.gif
|
85
84
|
* Update application.js adding util_pack
|
86
|
-
|
85
|
+
|
87
86
|
== WARNING
|
88
|
-
|
87
|
+
|
89
88
|
* 0.0.10 and 0.0.11 are bad versions, use 0.0.12 or above
|
90
|
-
|
89
|
+
|
91
90
|
== Coming Soon
|
92
|
-
|
91
|
+
|
93
92
|
* configuration object
|
94
93
|
* text in ajaxError overrides
|
95
94
|
* spinner id override
|
96
|
-
|
95
|
+
|
97
96
|
== Resources
|
98
|
-
|
97
|
+
|
99
98
|
* spinner.gif generated using http://www.ajaxload.info
|
100
|
-
|
99
|
+
|
101
100
|
== License
|
102
|
-
|
101
|
+
|
103
102
|
The Unlicense (aka: public domain)
|
104
103
|
http://unlicense.org
|
105
|
-
|
104
|
+
|
106
105
|
== Ruby Gems
|
107
|
-
|
106
|
+
|
108
107
|
* https://rubygems.org/gems/javascript_util_asset_pack
|
109
|
-
|
110
|
-
email:
|
108
|
+
|
109
|
+
email:
|
111
110
|
- jesse.house@gmail.com
|
112
111
|
executables: []
|
113
|
-
|
114
112
|
extensions: []
|
115
|
-
|
116
113
|
extra_rdoc_files: []
|
117
|
-
|
118
|
-
|
114
|
+
files:
|
115
|
+
- lib/javascript_util_asset_pack.rb
|
119
116
|
- lib/generators/javascript_util_asset_pack/javascript_util_asset_pack_generator.rb
|
120
|
-
- lib/generators/javascript_util_asset_pack/templates/spinner.gif
|
121
117
|
- lib/generators/javascript_util_asset_pack/USAGE
|
118
|
+
- lib/generators/javascript_util_asset_pack/templates/spinner.gif
|
122
119
|
- lib/javascript_util_asset_pack/engine.rb
|
123
120
|
- lib/javascript_util_asset_pack/version.rb
|
124
|
-
- lib/javascript_util_asset_pack.rb
|
125
121
|
- vendor/assets/javascripts/util_pack/ajax_form.coffee
|
126
122
|
- vendor/assets/javascripts/util_pack/index.js
|
127
123
|
- vendor/assets/javascripts/util_pack/jquery_ajax_error.coffee
|
128
124
|
- vendor/assets/javascripts/util_pack/spinner.coffee
|
129
125
|
- javascript_util_asset_pack.gemspec
|
130
126
|
- README.rdoc
|
131
|
-
has_rdoc: true
|
132
127
|
homepage: https://github.com/house9/javascript_util_asset_pack
|
133
128
|
licenses: []
|
134
|
-
|
135
|
-
post_install_message:
|
129
|
+
post_install_message:
|
136
130
|
rdoc_options: []
|
137
|
-
|
138
|
-
require_paths:
|
131
|
+
require_paths:
|
139
132
|
- lib
|
140
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- -
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
- 0
|
153
|
-
version: "0"
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
none: false
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - '>'
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 1.3.1
|
144
|
+
none: false
|
154
145
|
requirements: []
|
155
|
-
|
156
146
|
rubyforge_project: javascript_util_asset_pack
|
157
|
-
rubygems_version: 1.
|
158
|
-
signing_key:
|
147
|
+
rubygems_version: 1.8.24
|
148
|
+
signing_key:
|
159
149
|
specification_version: 3
|
160
150
|
summary: Rails 3.1 javascript Util asset pack, show hide spinner, global jquery error handler, etc...
|
161
151
|
test_files: []
|
162
|
-
|