javascript_util_asset_pack 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,8 @@ jQuery(document).ajaxError (event, xhr, settings, exception) ->
|
|
5
5
|
|
6
6
|
if xhr.status is 404
|
7
7
|
friendly = "#{friendly}Page not found"
|
8
|
+
else if xhr.status is 401
|
9
|
+
friendly = "#{friendly}Access Denied"
|
8
10
|
else if xhr.status is 422
|
9
11
|
friendly = "Your submission has one or more errors. \n\nPlease correct the following issues: \n"
|
10
12
|
validationErrors = jQuery.parseJSON(xhr.responseText)
|
@@ -18,7 +20,7 @@ jQuery(document).ajaxError (event, xhr, settings, exception) ->
|
|
18
20
|
|
19
21
|
if window.Rails?.env is "DEVELOPMENT"
|
20
22
|
contentType = xhr.getResponseHeader("content-type")
|
21
|
-
if contentType
|
23
|
+
if contentType?.indexOf('html') > -1
|
22
24
|
body = "<div>#{xhr.responseText}</div>"
|
23
25
|
fragment = $(body).find "h1"
|
24
26
|
local = "#{local} \n#{fragment.text()}"
|
metadata
CHANGED
@@ -1,61 +1,113 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: javascript_util_asset_pack
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
version: 0.0.9
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Jesse House
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2012-03-01 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rails
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
19
25
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 3
|
29
|
+
- 1
|
30
|
+
version: "3.1"
|
22
31
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
26
34
|
name: javascript_safe_logger
|
27
|
-
|
28
|
-
|
29
|
-
requirements:
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
30
38
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
- 0
|
43
|
+
- 4
|
32
44
|
version: 0.0.4
|
33
45
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
46
|
+
version_requirements: *id002
|
47
|
+
description: |+
|
48
|
+
== Rails 3.1 javascript - Util asset pack
|
49
|
+
|
50
|
+
== Sets up a window.Util object which includes
|
51
|
+
|
52
|
+
* Spinner, with methods to set spinner next to element or hide the spinner
|
53
|
+
* AjaxForm, to ajax enable simple forms
|
54
|
+
* jQuery ajaxError global handler, exception data during development and friendly message in production
|
55
|
+
|
56
|
+
== Usage
|
57
|
+
|
58
|
+
spinner (js version)
|
59
|
+
|
60
|
+
window.Util.spinner.nextTo('#my_button');
|
61
|
+
window.Util.spinner.nextTo('#my_button', 3, 4); // selector, top offset, left offset
|
62
|
+
window.Util.spinner.hide();
|
63
|
+
|
64
|
+
ajax form (coffee script version)
|
65
|
+
|
66
|
+
jQuery ->
|
67
|
+
new window.Util.AjaxForm '#my_form', ->
|
68
|
+
log "my_form submit success callback"
|
69
|
+
|
70
|
+
== Install
|
71
|
+
|
72
|
+
Update the Gemfile in your rails project, add the following line
|
73
|
+
|
74
|
+
gem 'javascript_util_asset_pack'
|
75
|
+
|
76
|
+
Run the generator
|
77
|
+
|
78
|
+
rails generate javascript_util_asset_pack
|
79
|
+
|
80
|
+
does the following:
|
81
|
+
|
82
|
+
* Copy spinner.gif to /app/assets/images
|
83
|
+
* Update application.html.erb adding javascript create window.Rails.env variable
|
84
|
+
* Update application.html.erb adding image_tag for spinner.gif
|
85
|
+
* Update application.js adding util_pack
|
86
|
+
|
87
|
+
== Coming Soon
|
88
|
+
|
89
|
+
* configuration object
|
90
|
+
* text in ajaxError overrides
|
91
|
+
* spinner id override
|
92
|
+
|
93
|
+
== Resources
|
94
|
+
|
95
|
+
* spinner.gif generated using http://www.ajaxload.info
|
96
|
+
|
97
|
+
== License
|
98
|
+
|
99
|
+
The Unlicense (aka: public domain)
|
100
|
+
http://unlicense.org
|
101
|
+
|
102
|
+
email:
|
54
103
|
- jesse.house@gmail.com
|
55
104
|
executables: []
|
105
|
+
|
56
106
|
extensions: []
|
107
|
+
|
57
108
|
extra_rdoc_files: []
|
58
|
-
|
109
|
+
|
110
|
+
files:
|
59
111
|
- .gitignore
|
60
112
|
- Gemfile
|
61
113
|
- README.rdoc
|
@@ -71,29 +123,35 @@ files:
|
|
71
123
|
- vendor/assets/javascripts/util_pack/index.js
|
72
124
|
- vendor/assets/javascripts/util_pack/jquery_ajax_error.coffee
|
73
125
|
- vendor/assets/javascripts/util_pack/spinner.coffee
|
126
|
+
has_rdoc: true
|
74
127
|
homepage: https://github.com/house9/javascript_util_asset_pack
|
75
128
|
licenses: []
|
129
|
+
|
76
130
|
post_install_message:
|
77
131
|
rdoc_options: []
|
78
|
-
|
132
|
+
|
133
|
+
require_paths:
|
79
134
|
- lib
|
80
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
version: "0"
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
version: "0"
|
92
149
|
requirements: []
|
150
|
+
|
93
151
|
rubyforge_project: javascript_util_asset_pack
|
94
|
-
rubygems_version: 1.
|
152
|
+
rubygems_version: 1.3.6
|
95
153
|
signing_key:
|
96
154
|
specification_version: 3
|
97
|
-
summary: Rails 3.1 javascript Util asset pack, show hide spinner, global jquery error
|
98
|
-
handler, etc...
|
155
|
+
summary: Rails 3.1 javascript Util asset pack, show hide spinner, global jquery error handler, etc...
|
99
156
|
test_files: []
|
157
|
+
|