sinatra-pretty-flash 0.0.2 → 0.0.3

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,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0b6473d9d7b7df503b7c6caac83c8342a54943c8
4
- data.tar.gz: 75e07631ec6d9a28ad71c82623de762b64235833
2
+ SHA256:
3
+ metadata.gz: 98a93346e78885c0dec3403adb71f4b44649c552e8a784c3a43dffc68971c380
4
+ data.tar.gz: 002b6f5f62e23eb3835cbb2cf9cab9cf867763297e41e7042ec41429f5b7af2d
5
5
  SHA512:
6
- metadata.gz: b646767aef7d0d0e7e21b7f7e35283c3d18e76d412f474aa12c538dc51085ec983e0d34ae5caa92c606d60f46947ee807751e832fe3637842f235714e735612c
7
- data.tar.gz: 478197e57757c318ad1abd9bc9d6181ddec36ddda2f4927481b4e5d6857ed01d49abfbb94734c12a5dd4f0d1d541a379aadc3ab3ec9390130a9034db4ce7300f
6
+ metadata.gz: b6627265067d3e8aaea8c600a7a9caba566a58ecf553e9aa41d412acb35d7d329cfb6ef283dadbf0f60ef79d273d03f46579cec37ecccda065d3e0e6b35e3c77
7
+ data.tar.gz: 785e705a2c1eaf24f5973b52fe8699acca51b5324f54d0edb83965b7de88f602c03da13fa61e19f386fb41da76cd350bc7bee45bc85f463e468808d84c7981ef
data/Gemfile.lock CHANGED
@@ -1,26 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sinatra-pretty-flash (0.0.1)
5
- rack-flash3
4
+ sinatra-pretty-flash (0.0.3)
6
5
  sinatra
6
+ sinatra-flash
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- rack (1.5.2)
12
- rack-flash3 (1.0.5)
11
+ mustermann (3.0.0)
12
+ ruby2_keywords (~> 0.0.1)
13
+ rack (2.2.6.4)
14
+ rack-protection (3.0.6)
13
15
  rack
14
- rack-protection (1.5.3)
15
- rack
16
- sinatra (1.4.5)
17
- rack (~> 1.4)
18
- rack-protection (~> 1.4)
19
- tilt (~> 1.3, >= 1.3.4)
20
- tilt (1.4.1)
16
+ ruby2_keywords (0.0.5)
17
+ sinatra (3.0.6)
18
+ mustermann (~> 3.0)
19
+ rack (~> 2.2, >= 2.2.4)
20
+ rack-protection (= 3.0.6)
21
+ tilt (~> 2.0)
22
+ sinatra-flash (0.3.0)
23
+ sinatra (>= 1.0.0)
24
+ tilt (2.1.0)
21
25
 
22
26
  PLATFORMS
23
- ruby
27
+ x86_64-linux
24
28
 
25
29
  DEPENDENCIES
26
30
  sinatra-pretty-flash!
31
+
32
+ BUNDLED WITH
33
+ 2.4.12
@@ -1,9 +1,10 @@
1
1
  require 'sinatra/base'
2
- require 'sinatra/pretty-flash'
2
+ require_relative '../lib/sinatra/pretty-flash'
3
3
 
4
4
  class ExampleApp < Sinatra::Base
5
5
  register Sinatra::PrettyFlash
6
6
 
7
+ enable :sessions
7
8
  enable :inline_templates
8
9
 
9
10
  get '/' do
@@ -23,7 +24,14 @@ __END__
23
24
  <%= pretty_flash_css %>
24
25
  </head>
25
26
  <body>
26
- <%= erb pretty_flash_html %>
27
+ <% if flash[:notice] %>
28
+ <p class="flash notice"><%= flash[:notice] %></p>
29
+ <% end %>
30
+
31
+ <% if flash[:error] %>
32
+ <p class="flash error"><%= flash[:error] %></p>
33
+ <% end %>
34
+
27
35
  <%= yield %>
28
36
  </body>
29
37
  <%= pretty_flash_js %>
@@ -1,59 +1,55 @@
1
1
  require 'sinatra/base'
2
- require 'rack-flash'
2
+ require 'sinatra/flash'
3
3
 
4
4
  module Sinatra
5
5
  module PrettyFlash
6
6
  def self.registered(app)
7
+ app.register Sinatra::Flash
7
8
  app.helpers FlashHelper
8
- app.enable :sessions
9
- app.use Rack::Flash, :sweep => true
10
9
  end
11
10
  end
12
11
 
13
12
  module FlashHelper
14
13
  def pretty_flash_css
15
- output = ''
16
- output += '<style>'
17
- output += '.flash {'
18
- output += ' position: fixed;'
19
- output += ' padding: 0;'
20
- output += ' margin: 0;'
21
- output += ' bottom: 0;'
22
- output += ' left: 0;'
23
- output += ' width: 100%;'
24
- output += ' height: 60px;'
25
- output += ' line-height: 60px;'
26
- output += ' background: rgba(0, 0, 0, 0.85);'
27
- output += ' color: rgba(255, 255, 255, 1.0);'
28
- output += ' text-align: center;'
29
- output += ' font-size: 24px;'
30
- output += '}'
31
- output += '</style>'
32
- output
33
- end
34
-
35
- def pretty_flash_html
36
- output = ''
37
- output += '<% if flash[:notice] %>'
38
- output += ' <p class="flash notice"><%= flash[:notice] %></p>'
39
- output += '<% end %>'
40
-
41
- output += '<% if flash[:error] %>'
42
- output += ' <p class="flash error"><%= flash[:error] %></p>'
43
- output += '<% end %>'
14
+ output = <<-HTML
15
+ <style>
16
+ .flash {
17
+ position: fixed;
18
+ padding: 0;
19
+ margin: 0;
20
+ bottom: 0;
21
+ left: 0;
22
+ width: 100%;
23
+ height: 60px;
24
+ line-height: 60px;
25
+ background: rgba(0, 0, 0, 0.85);
26
+ color: rgba(255, 255, 255, 1.0);
27
+ text-align: center;
28
+ font-size: 24px;
29
+ }
30
+ </style>
31
+ HTML
44
32
  output
45
33
  end
46
34
 
47
35
  def pretty_flash_js
48
- output = ''
49
- output += '<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>'
50
- output += '<script>'
51
- output += '$(function() {'
52
- output += ' $(".flash").delay(500).fadeIn("normal", function() {'
53
- output += ' $(this).delay(1500).fadeOut();'
54
- output += ' });'
55
- output += '});'
56
- output += '</script>'
36
+ output = <<-HTML
37
+ <script>
38
+ window.onload = function() {
39
+ const flash = document.querySelector(".flash");
40
+ if (flash) {
41
+ flash.style.opacity = 0;
42
+ setTimeout(function() {
43
+ flash.style.transition = "opacity 1s";
44
+ flash.style.opacity = 1;
45
+ }, 500);
46
+ setTimeout(function() {
47
+ flash.style.opacity = 0;
48
+ }, 2000);
49
+ }
50
+ };
51
+ </script>
52
+ HTML
57
53
  output
58
54
  end
59
55
  end
@@ -1,17 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sinatra-pretty-flash'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
 
5
- s.summary = "Simple decent looking flash messages"
6
- s.description = "A Sinatra extension that adds simple decent looking flash messages"
5
+ s.summary = 'Simple decent looking flash messages'
6
+ s.description = 'A Sinatra extension that adds simple decent looking flash messages'
7
7
 
8
- s.authors = ["Kevin Hughes"]
9
- s.email = "kevin.hughes@shopify.com"
10
- s.homepage = "https://github.com/pickle27/sinatra-pretty-flash/"
8
+ s.authors = ['Kevin Hughes']
9
+ s.email = 'kevinhughes27@gmail.com'
10
+ s.homepage = 'https://github.com/kevinhughes27/sinatra-pretty-flash/'
11
11
  s.license = 'MIT'
12
12
 
13
13
  s.files = `git ls-files`.split("\n")
14
14
 
15
15
  s.add_runtime_dependency 'sinatra'
16
- s.add_runtime_dependency 'rack-flash3'
16
+ s.add_runtime_dependency 'sinatra-flash'
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-pretty-flash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Hughes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-23 00:00:00.000000000 Z
11
+ date: 2023-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rack-flash3
28
+ name: sinatra-flash
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: A Sinatra extension that adds simple decent looking flash messages
42
- email: kevin.hughes@shopify.com
42
+ email: kevinhughes27@gmail.com
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
@@ -52,7 +52,7 @@ files:
52
52
  - example/example_app.rb
53
53
  - lib/sinatra/pretty-flash.rb
54
54
  - sinatra-pretty-flash.gemspec
55
- homepage: https://github.com/pickle27/sinatra-pretty-flash/
55
+ homepage: https://github.com/kevinhughes27/sinatra-pretty-flash/
56
56
  licenses:
57
57
  - MIT
58
58
  metadata: {}
@@ -71,8 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubyforge_project:
75
- rubygems_version: 2.2.2
74
+ rubygems_version: 3.1.6
76
75
  signing_key:
77
76
  specification_version: 4
78
77
  summary: Simple decent looking flash messages