growlyflash 0.1.3 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGNhYTdjMDY2NzNiMTQ0OTg2NDg2ZTg2NmNmZWNkN2NiNmMwODc2MA==
4
+ YzVlZDcwMDJhN2Y3ZWViNzA5ODkzYTUxMzg0YmUyZGM0ZGQ3NGVhNg==
5
5
  data.tar.gz: !binary |-
6
- ZTEzN2IyNDY0YTE3NDI0NjJjNWI2ZmY0YmEwYzdiYWQzMmQ5ODgzNA==
6
+ ZTI2Nzc3ZDhjODMwODlhODJkYWEyNDQ1MWI0YWQ0OTUzYjBlOGYzZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGIyMDQ5YmJkM2FlZmI0YTAzZTc3ZWU1MDMwNzA3ODYzYmFlNzYwN2ZhZTE5
10
- OGZlY2ZmMjdjMTliODAzYWJjZWI3NjMxNmUxOTM4NzNiNTIzM2ZiMGZmZTM5
11
- NGNjMTQ3YzQyZTJkOTcwOTE0MjU0NWQ4ZjI5NDQ1MWZhZDdlYzY=
9
+ MjM4OTMxNjMwNjQ2YjNjZGM1NjZkNmI4NDVjMTdiYTE0MDljZGRmMDVlN2Zj
10
+ MjE1OTkzMWE3NmM3NmI1YmJkODFlMWZiNTgyMzc3N2FjMDkxODFmNTMyYmMy
11
+ NmI1N2EwYzE2YjU3YTkzNzgyNTIzMjU3YmM5ZTk5Mzk0MjQ3YzY=
12
12
  data.tar.gz: !binary |-
13
- Y2Y0Zjk5MzVhZTdkZGY1OGQwMThhODZjY2JiZDNlYTIyNDVjY2RiYTBkMWVj
14
- MjY3Y2RmMjM2OGFmYWI5ZDcyNTJiYzA3NDFiNDk5Yzc5YjE2NWYyOWM3MmY5
15
- MzlmM2YwZWJmY2QwYWI2ZTgzY2EzOWIyNjBjNzFjMDU0MWYwOTA=
13
+ ZmNlYjVhOGIwY2NmYjJkNzcwZGMxMGI3MmE1M2ViY2I2NjNkYWZhNjc3NjZi
14
+ NDBiNTNjMjM3ZWQyMmRlMGViYWM3MDFmZTljNzQwNzMzYWQ5NjM3NjU3ODQz
15
+ ZmZjMWU0MjlmYTY5OTkxMTk2MDFjNWIwOTIzZWFlYjRmMGM1YzI=
@@ -1,3 +1,3 @@
1
1
  module Growlyflash
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -2,54 +2,63 @@
2
2
 
3
3
  $ = jQuery
4
4
 
5
- $.extend
6
- bootstrapGrowl: (message, options) ->
7
- settings =
8
- ele: 'body'
9
- type: null
10
- offset: from:'top', amount:20
11
- align: "right"
12
- width: 250
13
- delay: 4000
14
- allow_dismiss: true
15
- stackup_spacing: 10
16
-
17
- settings = $.extend settings, options
18
-
19
- html_attrs =
20
- class: 'bootstrap-growl alert'
21
- html: ''
22
- html_attrs.class += " alert-#{settings.type}" if settings.type?
23
- html_attrs.html += """<a class="close" data-dismiss="alert" href="#">&times;</a>""" if settings.allow_dismiss
24
- html_attrs.html += message
25
-
26
- $alert = $ '<div />', html_attrs
27
-
28
- # Prevent BC breaks
29
- if settings.top_offset?
30
- settings.offset = from:'top', amount:settings.top_offset
31
-
32
- # calculate any 'stack-up'
33
- offsetAmount = settings.offset.amount
34
- $(".bootstrap-growl").each ->
35
- offsetAmount = Math.max(offsetAmount, parseInt($(@).css(settings.offset.from)) + $(@).outerHeight() + settings.stackup_spacing)
36
-
37
- $alert.css
38
- position: (if (settings.ele == 'body') then 'fixed' else 'absolute')
39
- margin: 0
40
- zIndex: 9999
41
- display: 'none'
42
- width: (if (settings.width != 'auto') then "#{settings.width}px" else 'auto')
43
- $alert.css settings.offset.from, "#{offsetAmount}px"
44
-
45
- # have to append before we can use outerWidth()
46
- $(settings.ele).append $alert
47
- $alert.css switch settings.align
48
- when "center" then left:'50%', marginLeft:"-#{($alert.outerWidth() / 2)}px"
49
- when "left" then left:'20px'
50
- else right:'20px'
51
- $alert.fadeIn()
52
-
53
- # Only remove after delay if delay is more than 0
54
- if settings.delay > 0
55
- $alert.delay(settings.delay).fadeOut -> $(@).remove()
5
+ old = $.bootstrapGrowl
6
+
7
+ $.bootstrapGrowl = (message, options) ->
8
+ settings = $.extend {}, $.bootstrapGrowl.defaults, options
9
+
10
+ html_attrs =
11
+ class: 'bootstrap-growl alert'
12
+ html: ''
13
+ html_attrs.class += " alert-#{settings.type}" if settings.type?
14
+ html_attrs.html += """<a class="close" data-dismiss="alert" href="#">&times;</a>""" if settings.can_dismiss
15
+ html_attrs.html += message
16
+
17
+ DivAlert = $ '<div />', html_attrs
18
+
19
+ # calculate any 'stack-up'
20
+ offset = settings.offset.amount
21
+ $(".bootstrap-growl").each ->
22
+ offset_from = parseInt $(@).css settings.offset.from
23
+ height = $(@).outerHeight()
24
+ offset = Math.max offset, offset_from + height + settings.spacing
25
+
26
+ DivAlert.css
27
+ position: (if settings.target is 'body' then 'fixed' else 'absolute')
28
+ margin: 0
29
+ zIndex: 9999
30
+ display: 'none'
31
+ width: (if settings.width isnt 'auto' then "#{settings.width}px" else 'auto')
32
+
33
+ DivAlert.css settings.offset.from, "#{offset}px"
34
+
35
+ # have to append before we can use outerWidth()
36
+ $(settings.target).append DivAlert
37
+
38
+ DivAlert.css switch settings.align
39
+ when "center" then left: '50%', marginLeft:"-#{DivAlert.outerWidth() / 2}px"
40
+ when "left" then left: '20px'
41
+ else right: '20px'
42
+ DivAlert.fadeIn()
43
+
44
+ # Only remove after delay if delay is more than 0
45
+ if settings.delay > 0
46
+ DivAlert.delay(settings.delay).fadeOut -> $(@).remove()
47
+
48
+ @
49
+
50
+ $.bootstrapGrowl.defaults =
51
+ width: 250
52
+ delay: 4000
53
+ spacing: 10
54
+ target: 'body'
55
+ align: 'right'
56
+ dismiss: true
57
+ type: null
58
+ offset:
59
+ from: 'top'
60
+ amount: 20
61
+
62
+ $.bootstrapGrowl.noConflict = ->
63
+ $.bootstrapGrowl = old
64
+ @
@@ -45,12 +45,12 @@ class Growlyflash
45
45
  do callback
46
46
 
47
47
  get_log_matches: (messages) ->
48
- last_log = @flashes_log.slice -messages.length
48
+ last_log = @flash_log.slice -messages.length
49
49
  not_matches = 0
50
50
  not_matches++ for id, f of messages when (last_log[id].type isnt f.type) and (last_log[id].msg isnt f.msg)
51
51
  not_matches > 0
52
52
 
53
53
  root.Growlyflash = Growlyflash
54
54
 
55
- jQuery ->
55
+ $ ->
56
56
  new Growlyflash document
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growlyflash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tõnis Simo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-15 00:00:00.000000000 Z
11
+ date: 2013-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties