ultimate-flash 0.9.0 → 0.9.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.
@@ -1,5 +1,5 @@
|
|
1
1
|
###*
|
2
|
-
* Ultimate Flash 0.9.
|
2
|
+
* Ultimate Flash 0.9.2 - Ruby on Rails oriented jQuery plugin for smart notifications
|
3
3
|
* Copyright 2011-2013 Karpunin Dmitry (KODer) / Evrone.com
|
4
4
|
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
5
5
|
*
|
@@ -27,7 +27,7 @@
|
|
27
27
|
*
|
28
28
|
* * * USE INSTEAD
|
29
29
|
* @usage
|
30
|
-
* window.flash = new Ultimate.
|
30
|
+
* window.flash = new Ultimate.Plugins.Flash[(Object options = {})]
|
31
31
|
* flash.notice String text
|
32
32
|
###
|
33
33
|
|
@@ -159,6 +159,9 @@ class Ultimate.Plugins.Flash extends Ultimate.__FlashClass
|
|
159
159
|
clearTimeout jFlash.data('timeoutId')
|
160
160
|
@_hide jFlash.addClass('hide'), @_getOptionOverFlash('slideTime', jFlash)
|
161
161
|
|
162
|
+
_template: (type, text) ->
|
163
|
+
"<div class=\"#{@flashClass} #{type}\" style=\"display: none;\">#{text}</div>"
|
164
|
+
|
162
165
|
_append: (jFlash) ->
|
163
166
|
jFlash.appendTo @$el
|
164
167
|
|
@@ -173,7 +176,7 @@ class Ultimate.Plugins.Flash extends Ultimate.__FlashClass
|
|
173
176
|
excessFlashes = jActiveFlashes.length - (@maxFlashes - 1)
|
174
177
|
if excessFlashes > 0
|
175
178
|
@hide jActiveFlashes.slice(0, excessFlashes)
|
176
|
-
jFlash = $(
|
179
|
+
jFlash = $(@_template(type, text))
|
177
180
|
if perFlashOptions
|
178
181
|
jFlash.data(key, value) for key, value of perFlashOptions
|
179
182
|
@_show @_append(jFlash), @_getOptionOverFlash('slideTime', perFlashOptions)
|
@@ -247,7 +250,8 @@ class Ultimate.Plugins.Flash extends Ultimate.__FlashClass
|
|
247
250
|
if jqXHR.responseText
|
248
251
|
try
|
249
252
|
# try parse respose as json
|
250
|
-
|
253
|
+
parsedJSON = $.parseJSON(jqXHR.responseText)
|
254
|
+
if _.isObject(parsedJSON) and not _.isEmpty(parsedJSON)
|
251
255
|
# catch 'flash' object and call auto() method with autodetecting flash-notice type
|
252
256
|
return @auto(parsedJSON['flash']) if parsedJSON['flash']
|
253
257
|
# catch 'error' object and call alert() method
|
@@ -256,18 +260,20 @@ class Ultimate.Plugins.Flash extends Ultimate.__FlashClass
|
|
256
260
|
if @detectFormErrors is true
|
257
261
|
# show message about form with errors
|
258
262
|
return @alert(@t('formFieldsError'))
|
259
|
-
else if _.isFunction(@detectFormErrors)
|
260
|
-
# using
|
261
|
-
return @
|
263
|
+
else if _.isFunction(@detectFormErrors) and (detectedError = @detectFormErrors(parsedJSON))
|
264
|
+
# using detectFormErrors as callback
|
265
|
+
return @alert(detectedError)
|
262
266
|
else
|
263
267
|
# nothing
|
264
268
|
return false
|
265
269
|
catch e
|
266
270
|
# nop
|
271
|
+
# about 404: https://github.com/bcardarella/client_side_validations/issues/297
|
272
|
+
return false if jqXHR.status < 400 or jqXHR.status is 404
|
267
273
|
if @productionMode
|
268
274
|
thrownError = @t('defaultThrownError')
|
269
275
|
else
|
270
|
-
if jqXHR.
|
276
|
+
if jqXHR.responseText
|
271
277
|
# try detect Rails raise message
|
272
278
|
if raiseMatches = jqXHR.responseText.match(/<\/h1>\n<pre>(.+?)<\/pre>/)
|
273
279
|
thrownError = raiseMatches[1]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// NOTE: This style require usage of https://github.com/evrone/ultimate-mixins
|
1
|
+
// NOTE: This style require usage of https://github.com/evrone/ultimate-mixins or Piebone
|
2
2
|
//
|
3
3
|
// Usage:
|
4
4
|
// .l-page__flashes {
|
@@ -42,7 +42,7 @@
|
|
42
42
|
font-size: 24px;
|
43
43
|
line-height: 30px;
|
44
44
|
color: $text-color;
|
45
|
-
@include box-sizing;
|
45
|
+
@include box-sizing(border-box);
|
46
46
|
@include pie-bg($default-background);
|
47
47
|
border-bottom: 2px solid $default-border-color;
|
48
48
|
@if $opacity < 1 {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultimate-flash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
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-
|
12
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Ruby on Rails oriented jQuery plugin for smart notifications
|
15
15
|
email:
|