flashlight 0.1 → 0.1.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.
- checksums.yaml +4 -4
- metadata +12 -24
- data/.gitignore +0 -17
- data/Gemfile +0 -2
- data/LICENSE.txt +0 -22
- data/README.md +0 -15
- data/Rakefile +0 -1
- data/app/assets/javascripts/flashlight.js +0 -2
- data/app/assets/javascripts/flashlight/flashlight.js.coffee +0 -43
- data/app/assets/javascripts/flashlight/jquery.cookie.js.coffee +0 -100
- data/app/assets/stylesheets/flashlight.css +0 -49
- data/flashlight.gemspec +0 -26
- data/lib/flashlight.rb +0 -5
- data/lib/flashlight/concerns/controllers/flashing.rb +0 -18
- data/lib/flashlight/engine.rb +0 -11
- data/lib/flashlight/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2106af77f5c0efffa6df861e70696f7b862574c
|
4
|
+
data.tar.gz: b1e719b6e6a96e7743e7e187fffc99a92b80d740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e77770c02ec29ba41d9affabc7e89daa8791c248c4e67e720a5b1a6523bfb95aebafe7014739c287a96ed801b63ac16739e0d641377b832a27caa3f3268f30b
|
7
|
+
data.tar.gz: ffa14242ae7b770e7c035c65ae200503f2f5e398b3fd070b1475268440049384f9d04e4c117581ff8d75e0b8ae448c2a814cc001e0713b36ff5ab6bcf75bccca
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flashlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Bayona
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,28 +52,16 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
description:
|
56
|
-
|
55
|
+
description: 'flashlight displays your rails flash messages. Works with old flashion
|
56
|
+
page loads and AJAX.
|
57
|
+
|
58
|
+
'
|
57
59
|
email:
|
58
60
|
- sbayona@martianinteractive.com
|
59
61
|
executables: []
|
60
62
|
extensions: []
|
61
63
|
extra_rdoc_files: []
|
62
|
-
files:
|
63
|
-
- ".gitignore"
|
64
|
-
- Gemfile
|
65
|
-
- LICENSE.txt
|
66
|
-
- README.md
|
67
|
-
- Rakefile
|
68
|
-
- app/assets/javascripts/flashlight.js
|
69
|
-
- app/assets/javascripts/flashlight/flashlight.js.coffee
|
70
|
-
- app/assets/javascripts/flashlight/jquery.cookie.js.coffee
|
71
|
-
- app/assets/stylesheets/flashlight.css
|
72
|
-
- flashlight.gemspec
|
73
|
-
- lib/flashlight.rb
|
74
|
-
- lib/flashlight/concerns/controllers/flashing.rb
|
75
|
-
- lib/flashlight/engine.rb
|
76
|
-
- lib/flashlight/version.rb
|
64
|
+
files: []
|
77
65
|
homepage: https://github.com/martianinteractive/flashlight
|
78
66
|
licenses: []
|
79
67
|
metadata: {}
|
@@ -93,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
81
|
version: '0'
|
94
82
|
requirements: []
|
95
83
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.5.1
|
97
85
|
signing_key:
|
98
86
|
specification_version: 4
|
99
87
|
summary: Flash messages for Rails
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 Sergio Bayona
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
flashlight
|
2
|
-
=======
|
3
|
-
|
4
|
-
Rails flash that works for ajax and old-fashion page loads. Tested on Rails 4.1 (with Turbolinks).
|
5
|
-
|
6
|
-
## Installation
|
7
|
-
|
8
|
-
1. Add ```gem 'flashlight', github: "martianinteractive/flashlight"``` to your Gemfile
|
9
|
-
|
10
|
-
2. Add ```//= require flashlight``` to your app/assets/javascripts/application.js
|
11
|
-
|
12
|
-
3. Add ```*= require flashlight``` to your app/assets/stylesheets/application.css
|
13
|
-
|
14
|
-
|
15
|
-
That's it.
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
@@ -1,43 +0,0 @@
|
|
1
|
-
jQuery ->
|
2
|
-
$.cookie.json = true
|
3
|
-
$('<div id="flashlight-container"></div>').prependTo 'body'
|
4
|
-
|
5
|
-
$(document).on 'page:load', ->
|
6
|
-
$('<div id="flashlight-container"></div>').prependTo 'body'
|
7
|
-
|
8
|
-
Flashlight.show()
|
9
|
-
|
10
|
-
$(document).on 'ajaxComplete', (event, request) ->
|
11
|
-
Flashlight.show()
|
12
|
-
|
13
|
-
Flashlight = (->
|
14
|
-
hideFlash = (flash) ->
|
15
|
-
flash.slideUp 100, ->
|
16
|
-
flash.remove()
|
17
|
-
|
18
|
-
flashMessage = (message, options) ->
|
19
|
-
options = $.extend(type: "notice", timeout: 5000, options)
|
20
|
-
|
21
|
-
flash = $("<div class='flashlight-wrapper'><div class='flash #{message['type']}'>#{message['message']}</div></div>")
|
22
|
-
$("#flashlight-container").prepend flash
|
23
|
-
flash.hide().delay(300).slideDown 100
|
24
|
-
flash.click ->
|
25
|
-
hideFlash flash
|
26
|
-
|
27
|
-
setTimeout (->
|
28
|
-
hideFlash flash
|
29
|
-
), options.timeout
|
30
|
-
|
31
|
-
getFlashFromCookies = (request) ->
|
32
|
-
if flash = $.cookie('flash')
|
33
|
-
$.removeCookie('flash');
|
34
|
-
flash
|
35
|
-
|
36
|
-
show: ->
|
37
|
-
flashMessages = getFlashFromCookies() || []
|
38
|
-
$.each flashMessages, (_, message) ->
|
39
|
-
flashMessage(type: message[0], message: message[1])
|
40
|
-
|
41
|
-
)()
|
42
|
-
|
43
|
-
|
@@ -1,100 +0,0 @@
|
|
1
|
-
#!
|
2
|
-
# * jQuery Cookie Plugin v1.4.0
|
3
|
-
# * https://github.com/carhartl/jquery-cookie
|
4
|
-
# *
|
5
|
-
# * Copyright 2013 Klaus Hartl
|
6
|
-
# * Released under the MIT license
|
7
|
-
#
|
8
|
-
((factory) ->
|
9
|
-
if typeof define is "function" and define.amd
|
10
|
-
|
11
|
-
# AMD
|
12
|
-
define ["jquery"], factory
|
13
|
-
else if typeof exports is "object"
|
14
|
-
|
15
|
-
# CommonJS
|
16
|
-
factory require("jquery")
|
17
|
-
else
|
18
|
-
|
19
|
-
# Browser globals
|
20
|
-
factory jQuery
|
21
|
-
return
|
22
|
-
) ($) ->
|
23
|
-
encode = (s) ->
|
24
|
-
(if config.raw then s else encodeURIComponent(s))
|
25
|
-
decode = (s) ->
|
26
|
-
(if config.raw then s else decodeURIComponent(s))
|
27
|
-
stringifyCookieValue = (value) ->
|
28
|
-
encode (if config.json then JSON.stringify(value) else String(value))
|
29
|
-
parseCookieValue = (s) ->
|
30
|
-
|
31
|
-
# This is a quoted cookie as according to RFC2068, unescape...
|
32
|
-
s = s.slice(1, -1).replace(/\\"/g, "\"").replace(/\\\\/g, "\\") if s.indexOf("\"") is 0
|
33
|
-
try
|
34
|
-
|
35
|
-
# Replace server-side written pluses with spaces.
|
36
|
-
# If we can't decode the cookie, ignore it, it's unusable.
|
37
|
-
# If we can't parse the cookie, ignore it, it's unusable.
|
38
|
-
s = decodeURIComponent(s.replace(pluses, " "))
|
39
|
-
return (if config.json then JSON.parse(s) else s)
|
40
|
-
return
|
41
|
-
read = (s, converter) ->
|
42
|
-
value = (if config.raw then s else parseCookieValue(s))
|
43
|
-
(if $.isFunction(converter) then converter(value) else value)
|
44
|
-
pluses = /\+/g
|
45
|
-
config = $.cookie = (key, value, options) ->
|
46
|
-
|
47
|
-
# Write
|
48
|
-
if value isnt `undefined` and not $.isFunction(value)
|
49
|
-
options = $.extend({}, config.defaults, options)
|
50
|
-
if typeof options.expires is "number"
|
51
|
-
days = options.expires
|
52
|
-
t = options.expires = new Date()
|
53
|
-
t.setTime +t + days * 864e+5
|
54
|
-
# use expires attribute, max-age is not supported by IE
|
55
|
-
return (document.cookie = [
|
56
|
-
encode(key)
|
57
|
-
"="
|
58
|
-
stringifyCookieValue(value)
|
59
|
-
(if options.expires then "; expires=" + options.expires.toUTCString() else "")
|
60
|
-
(if options.path then "; path=" + options.path else "")
|
61
|
-
(if options.domain then "; domain=" + options.domain else "")
|
62
|
-
(if options.secure then "; secure" else "")
|
63
|
-
].join(""))
|
64
|
-
|
65
|
-
# Read
|
66
|
-
result = (if key then `undefined` else {})
|
67
|
-
|
68
|
-
# To prevent the for loop in the first place assign an empty array
|
69
|
-
# in case there are no cookies at all. Also prevents odd result when
|
70
|
-
# calling $.cookie().
|
71
|
-
cookies = (if document.cookie then document.cookie.split("; ") else [])
|
72
|
-
i = 0
|
73
|
-
l = cookies.length
|
74
|
-
|
75
|
-
while i < l
|
76
|
-
parts = cookies[i].split("=")
|
77
|
-
name = decode(parts.shift())
|
78
|
-
cookie = parts.join("=")
|
79
|
-
if key and key is name
|
80
|
-
|
81
|
-
# If second argument (value) is a function it's a converter...
|
82
|
-
result = read(cookie, value)
|
83
|
-
break
|
84
|
-
|
85
|
-
# Prevent storing a cookie that we couldn't decode.
|
86
|
-
result[name] = cookie if not key and (cookie = read(cookie)) isnt `undefined`
|
87
|
-
i++
|
88
|
-
result
|
89
|
-
|
90
|
-
config.defaults = {}
|
91
|
-
$.removeCookie = (key, options) ->
|
92
|
-
return false if $.cookie(key) is `undefined`
|
93
|
-
|
94
|
-
# Must not alter options, thus extending a fresh object...
|
95
|
-
$.cookie key, "", $.extend({}, options,
|
96
|
-
expires: -1
|
97
|
-
)
|
98
|
-
not $.cookie(key)
|
99
|
-
|
100
|
-
return
|
@@ -1,49 +0,0 @@
|
|
1
|
-
#flashlight-container {
|
2
|
-
position: fixed;
|
3
|
-
top: 0;
|
4
|
-
left: 0;
|
5
|
-
z-index: 10000;
|
6
|
-
cursor: pointer;
|
7
|
-
width: 100%;
|
8
|
-
text-align: center;
|
9
|
-
}
|
10
|
-
|
11
|
-
#flashlight-container .flashlight-wrapper {
|
12
|
-
margin-top: 4px;
|
13
|
-
text-align: left;
|
14
|
-
width: 340px;
|
15
|
-
display: inline-block;
|
16
|
-
}
|
17
|
-
|
18
|
-
#flashlight-container .flashlight-wrapper .flash {
|
19
|
-
padding: 3px;
|
20
|
-
border-radius: 3px;
|
21
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
22
|
-
border: 1px solid rgba(0, 0, 0, 0);
|
23
|
-
}
|
24
|
-
|
25
|
-
#flashlight-container .flashlight-wrapper .error,
|
26
|
-
#flashlight-container .flashlight-wrapper .alert {
|
27
|
-
background: #F2DEDE;
|
28
|
-
border-color: #EBCCD1;
|
29
|
-
color: #A94442;
|
30
|
-
}
|
31
|
-
|
32
|
-
#flashlight-container .flashlight-wrapper .success {
|
33
|
-
background-color: #DFF0D8;
|
34
|
-
border-color: #D6E9C6;
|
35
|
-
color: #3C763D;
|
36
|
-
}
|
37
|
-
|
38
|
-
#flashlight-container .flashlight-wrapper .notice {
|
39
|
-
background-color: #D9EDF7;
|
40
|
-
border-color: #BCE8F1;
|
41
|
-
color: #31708F;
|
42
|
-
}
|
43
|
-
|
44
|
-
#flashlight-container .flashlight-wrapper .warning {
|
45
|
-
background-color: #FCF8E3;
|
46
|
-
border-color: #FAEBCC;
|
47
|
-
color: #8A6D3B;
|
48
|
-
}
|
49
|
-
|
data/flashlight.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'flashlight/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "flashlight"
|
8
|
-
spec.version = Flashlight::VERSION
|
9
|
-
spec.authors = ["Sergio Bayona"]
|
10
|
-
spec.email = ["sbayona@martianinteractive.com"]
|
11
|
-
spec.summary = "Flash messages for Rails"
|
12
|
-
spec.description = <<EOT
|
13
|
-
flashlight displays your rails flash messages. Works with old flashion page loads and AJAX.
|
14
|
-
EOT
|
15
|
-
spec.homepage = "https://github.com/martianinteractive/flashlight"
|
16
|
-
|
17
|
-
spec.files = `git ls-files`.split($/)
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.add_dependency "railties", "~> 3.2"
|
23
|
-
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
-
end
|
data/lib/flashlight.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Flashlight
|
2
|
-
module Concerns
|
3
|
-
module Controllers
|
4
|
-
module Flashing
|
5
|
-
|
6
|
-
def self.included(base)
|
7
|
-
base.after_filter :flash_to_cookie
|
8
|
-
end
|
9
|
-
|
10
|
-
def flash_to_cookie
|
11
|
-
cookies[:flash] = nil if flash.empty? && cookies[:flash].present?
|
12
|
-
return unless flash.any?
|
13
|
-
cookies[:flash] = {:value => flash.to_json}
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/flashlight/engine.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'flashlight'
|
2
|
-
require "flashlight/concerns/controllers/flashing"
|
3
|
-
require 'rails'
|
4
|
-
|
5
|
-
module Flashlight
|
6
|
-
class Engine < ::Rails::Engine
|
7
|
-
initializer 'flashlight.initialize', :after => :after_initialize do
|
8
|
-
ActionController::Base.send :include, Flashlight::Concerns::Controllers::Flashing
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/lib/flashlight/version.rb
DELETED