alert_message 1.1.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 78138dda31a042e09fe034b061f1d815c431ffb0
4
- data.tar.gz: ae2a00cd0a854863270aeb07d1ff64c2eef63161
2
+ SHA256:
3
+ metadata.gz: 7180defcc4b15f5d74d310f4b2b3ef3f332cd01d9b869034515b091b5396dc5e
4
+ data.tar.gz: efedc77ce354c9987964efd1020142f4c01f715e1cb7a66053fe2fa2409620cb
5
5
  SHA512:
6
- metadata.gz: 0951e12225be89932266d1b982bce85fe68db030151b7590e964facc1a24712675cb4dad9bfcc9080371f6d316130968f60a0b6a5323069c7f2999e6554928bf
7
- data.tar.gz: 4f9a37d8c14f03c9395a25fcd2134f7a7ce94c71405712e0a64cdef708d9c4fb27b9960c73757b9814e6290abde427811e7b4560536b9eeacfe2714c25a3c23e
6
+ metadata.gz: d6e69b8e78001a0303b5ebfac985e74a087c19a01b5746cd1fd6ca160105ad2b02a5ff5646328eff871dbc125232c27059f30e1e67a2f65479b099e004c4f0ed
7
+ data.tar.gz: 3d45ba3e30d353c5e727b150672998d43e2c00439239858cd929246ebe9a88f61e57f96498e22028f60cd8cca6e1b5ae3bbd9a5eef0d8d880c23cf631fed2fa1
data/.gitignore CHANGED
@@ -20,3 +20,5 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ spec/dummy/db/test.sqlite3
24
+ spec/dummy/log/test.log
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
1
  --color
2
- --require spec_helper
2
+ --order=random
3
+ --drb
4
+ --format Fuubar
@@ -0,0 +1 @@
1
+ alert_message
@@ -0,0 +1 @@
1
+ 2.6.5
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.6.5
4
+ before_install: gem install bundler -v 2.1
5
+ notifications:
6
+ email:
7
+ - luizpicolo@gmail.com
data/Gemfile CHANGED
@@ -1,10 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'jquery-rails'
4
3
  gem 'sass-rails'
4
+ gem 'sqlite3'
5
5
 
6
6
  gemspec
7
7
 
8
8
  group :test do
9
9
  gem 'rspec'
10
+ gem 'fuubar'
10
11
  end
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # Alert Message
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/alert_message.svg)](http://badge.fury.io/rb/alert_message)
4
+ [![Build Status](https://travis-ci.org/luizpicolo/alert_message.svg?branch=master)](https://travis-ci.org/luizpicolo/alert_message)
4
5
 
5
- This is a simple gem for [alerts messages](http://rubygems.org/gems/alert_message).
6
+ This is a simple gem for [alerts messages](http://rubygems.org/gems/alert_message).
6
7
 
7
8
  ## Installation
8
9
 
9
10
  Add to your Gemfile:
10
11
 
11
- gem 'alert_message'
12
+ ```ruby
13
+ gem 'alert_message'
14
+ ```
12
15
 
13
16
  Then run:
14
17
 
@@ -20,60 +23,63 @@ Run install script:
20
23
 
21
24
  Add styles in app/assets/application.css
22
25
 
23
- *= require alert_message
24
-
26
+ ```ruby
27
+ *= require alert_message
28
+ ```
29
+ ** For less than Rails 6 **
25
30
  Add scripts in app/assets/application.js
26
31
 
27
- //= require alert_message
28
-
32
+ ```ruby
33
+ //= require alert_message
34
+ ```
35
+
36
+ For greater than Rails 6 add in `app\javascript\packs\application.js`
37
+
38
+ ```javascript
39
+ document.addEventListener('DOMContentLoaded', () => {
40
+ let alertMessage = document.getElementById('alert');
41
+
42
+ alertMessage.classList.add('alert-message--visible');
43
+
44
+ setTimeout((() => {
45
+ alertMessage.classList.remove('alert-message--visible');
46
+ }), 10000);
47
+
48
+ alertMessage.addEventListener('click', () => {
49
+ alertMessage.classList.remove('alert-message--visible');
50
+ });
51
+ });
52
+ ```
29
53
 
30
54
  ## How to use
31
55
 
32
56
  Add in app/views/layouts/application.html.erb
33
57
 
34
- <%= render "layouts/alerts" %>
58
+ ```ruby
59
+ <%= render "layouts/alerts" %>
60
+ ```
35
61
 
36
62
  To show your alerts, use:
37
63
 
38
- flash[:error] = "YOUR MESSAGE"
39
- flash[:notice] = "YOUR MESSAGE"
40
- flash[:success] = "YOUR MESSAGE"
64
+ ```ruby
65
+ flash[:error] = "YOUR MESSAGE"
66
+ flash[:notice] = "YOUR MESSAGE"
67
+ flash[:success] = "YOUR MESSAGE"
68
+ ```
41
69
 
42
70
  #### Example
43
71
 
44
- class HomeController < ApplicationController
45
- def index
46
- flash[:error] = "YOUR MESSAGE"
47
- end
48
- end
49
-
50
- ## Custom message to Devise
51
-
52
- Some devise screens do not accept Flash Messages. For this we will use a custom helper.
53
-
54
- Add in your app/views/layouts/_alerts.html.erb
55
-
56
- <%= show_messages %>
57
-
58
- Create helper alert_message_helper.rb
59
-
60
- module AlertMessageHelper
61
- def show_messages
62
- return "" if resource.errors.empty?
63
- messages = resource.errors.full_messages
64
- html = <<-HTML
65
- <div class="alert alert-danger">
66
- #{messages.first}
67
- </div>
68
- HTML
69
- html.html_safe
70
- end
71
- end
72
-
73
- ## Demo
72
+ ```ruby
73
+ class HomeController < ApplicationController
74
+ def index
75
+ flash[:error] = "YOUR MESSAGE"
76
+ end
77
+ end
78
+ ```
74
79
 
75
- [alert-message.herokuapp.com](https://alert-message.herokuapp.com/)
80
+ # Run testes
76
81
 
82
+ in progress
77
83
 
78
84
  ## Contributing
79
85
 
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
2
3
 
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -8,19 +8,23 @@ require 'version/version'
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "alert_message"
10
10
  s.version = AlertMessage::Version::VERSION
11
- s.authors = ["Luiz Picolo"]
12
- s.email = ["luizpicolo@gmail.com"]
11
+ s.authors = ["Luiz Picolo", "Gabriel Medina"]
12
+ s.email = ["luizpicolo@gmail.com", "gmedina.santos@gmail.com"]
13
13
  s.summary = "Alert Message"
14
14
  s.description = "Simple gem for alerts messages"
15
15
  s.homepage = "https://github.com/luizpicolo/alert_message"
16
16
  s.license = "MIT"
17
17
 
18
18
  s.files = `git ls-files -z`.split("\x0")
19
+ s.test_files = Dir["spec/**/*"]
19
20
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
21
  s.test_files = s.files.grep(%r{^(test|s|features)/})
21
22
  s.require_paths = ["lib"]
22
23
 
23
- s.add_development_dependency "bundler", "~> 1.6"
24
- s.add_development_dependency "rake"
25
- s.add_dependency 'jquery-rails', ['>= 3.0', '< 5']
24
+ s.add_development_dependency 'bundler', '~> 2.1'
25
+ s.add_development_dependency 'capybara', '~> 3.0', '>= 3.0.0'
26
+ s.add_development_dependency 'rake', '>= 12.3.3'
27
+ s.add_development_dependency 'rails', ['>= 6.0', '< 7']
28
+ s.add_development_dependency 'rspec-rails', '~> 4.0'
29
+ s.add_development_dependency 'selenium-webdriver', '~> 2.53', '>= 2.53.4'
26
30
  end
@@ -1,5 +1,4 @@
1
1
  require "alert_message/engine"
2
2
 
3
3
  module AlertMessage
4
- # Yor code goes here...
5
4
  end
@@ -3,5 +3,12 @@ module AlertMessage
3
3
  initializer 'alert_message.load_static_assets' do |app|
4
4
  app.middleware.use ::ActionDispatch::Static, "#{root}/vendor"
5
5
  end
6
+
7
+ config.generators do |g|
8
+ g.test_framework :rspec, :fixture => false
9
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
10
+ g.assets false
11
+ g.helper false
12
+ end
6
13
  end
7
- end
14
+ end
@@ -1,10 +1,10 @@
1
1
  <% flash.each do |key, value| %>
2
2
  <%
3
- if key != 'success' && key != 'danger' && key != 'notice'
4
- key = 'danger'
3
+ unless ['success', 'danger', 'error'].include?(key)
4
+ key = 'notice'
5
5
  end
6
6
  %>
7
- <div class="alert-message alert-message-<%= key %>">
8
- <%= value.html_safe %>
9
- </div>
7
+ <div id="alert" class="alert-message alert-message-<%= key %>">
8
+ <%= value.html_safe %>
9
+ </div>
10
10
  <% end %>
@@ -1,5 +1,5 @@
1
1
  module AlertMessage
2
2
  module Version
3
- VERSION = '1.1.5'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
@@ -1,89 +1,8 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
- # file to always be loaded, without a need to explicitly require it in any files.
5
- #
6
- # Given that it is always loaded, you are encouraged to keep this file as
7
- # light-weight as possible. Requiring heavyweight dependencies from this file
8
- # will add to the boot time of your test suite on EVERY test run, even for an
9
- # individual file that may not need all of that loaded. Instead, consider making
10
- # a separate helper file that requires the additional dependencies and performs
11
- # the additional setup, and require it from the spec files that actually need it.
12
- #
13
- # The `.rspec` file also contains a few flags that are not defaults but that
14
- # users commonly want.
15
- #
16
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
- RSpec.configure do |config|
18
- # rspec-expectations config goes here. You can use an alternate
19
- # assertion/expectation library such as wrong or the stdlib/minitest
20
- # assertions if you prefer.
21
- config.expect_with :rspec do |expectations|
22
- # This option will default to `true` in RSpec 4. It makes the `description`
23
- # and `failure_message` of custom matchers include text for helper methods
24
- # defined using `chain`, e.g.:
25
- # be_bigger_than(2).and_smaller_than(4).description
26
- # # => "be bigger than 2 and smaller than 4"
27
- # ...rather than:
28
- # # => "be bigger than 2"
29
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
30
- end
31
-
32
- # rspec-mocks config goes here. You can use an alternate test double
33
- # library (such as bogus or mocha) by changing the `mock_with` option here.
34
- config.mock_with :rspec do |mocks|
35
- # Prevents you from mocking or stubbing a method that does not exist on
36
- # a real object. This is generally recommended, and will default to
37
- # `true` in RSpec 4.
38
- mocks.verify_partial_doubles = true
39
- end
40
-
41
- # The settings below are suggested to provide a good initial experience
42
- # with RSpec, but feel free to customize to your heart's content.
43
- =begin
44
- # These two settings work together to allow you to limit a spec run
45
- # to individual examples or groups you care about by tagging them with
46
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
47
- # get run.
48
- config.filter_run :focus
49
- config.run_all_when_everything_filtered = true
50
-
51
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
52
- # For more details, see:
53
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
56
- config.disable_monkey_patching!
1
+ require 'bundler/setup'
2
+ Bundler.setup
57
3
 
58
- # This setting enables warnings. It's recommended, but in some cases may
59
- # be too noisy due to issues in dependencies.
60
- config.warnings = true
4
+ require 'alert_message' # and any other gems you need
61
5
 
62
- # Many RSpec users commonly either run the entire suite or an individual
63
- # file, and it's useful to allow more verbose output when running an
64
- # individual spec file.
65
- if config.files_to_run.one?
66
- # Use the documentation formatter for detailed output,
67
- # unless a formatter has already been configured
68
- # (e.g. via a command-line flag).
69
- config.default_formatter = 'doc'
70
- end
71
-
72
- # Print the 10 slowest examples and example groups at the
73
- # end of the spec run, to help surface which specs are running
74
- # particularly slow.
75
- config.profile_examples = 10
76
-
77
- # Run specs in random order to surface order dependencies. If you find an
78
- # order dependency and want to debug it, you can fix the order by providing
79
- # the seed, which is printed after each run.
80
- # --seed 1234
81
- config.order = :random
82
-
83
- # Seed global randomization in this process using the `--seed` CLI option.
84
- # Setting this allows you to use `--seed` to deterministically reproduce
85
- # test failures related to randomization by passing the same `--seed` value
86
- # as the one that triggered the failure.
87
- Kernel.srand config.seed
88
- =end
6
+ RSpec.configure do |config|
7
+ # some (optional) config here
89
8
  end
@@ -1,13 +1,13 @@
1
- // alerts
2
-
3
- $(function(){
4
- var alerts = $('.alert-message');
5
-
6
- setTimeout(function() {
7
- alerts.fadeOut(400);
8
- }, 4000);
9
-
10
- alerts.click(function() {
11
- alerts.fadeOut(400);
1
+ document.addEventListener('DOMContentLoaded', () => {
2
+ let alertMessage = document.getElementById('alert');
3
+
4
+ alertMessage.classList.add('alert-message--visible');
5
+
6
+ setTimeout((() => {
7
+ alertMessage.classList.remove('alert-message--visible');
8
+ }), 10000);
9
+
10
+ alertMessage.addEventListener('click', () => {
11
+ alertMessage.classList.remove('alert-message--visible');
12
12
  });
13
- })
13
+ });
@@ -0,0 +1,46 @@
1
+ .alert-message {
2
+ cursor: pointer;
3
+
4
+ position: fixed;
5
+ z-index: 9999;
6
+ top: 0;
7
+ right: 0;
8
+
9
+ box-sizing: border-box;
10
+ width: 100%;
11
+ padding: 10px;
12
+ background-color: #444;
13
+
14
+ color: #ffffff;
15
+ font-size: 13px;
16
+ text-align: center;
17
+
18
+ -webkit-transform: translateY(-100%);
19
+ -moz-transform: translateY(-100%);
20
+ transform: translateY(-100%);
21
+
22
+ -webkit-transition: .2s ease;
23
+ -moz-transition: .2s ease;
24
+ transition: .2s ease;
25
+ }
26
+
27
+ .alert-message--visible {
28
+ -webkit-transform: translateY(0);
29
+ -moz-transform: translateY(0);
30
+ transform: translateY(0);
31
+ }
32
+
33
+ .alert-message-error, .alert-message-danger {
34
+ background-color: #D33D3D;
35
+ }
36
+
37
+ .alert-message-notice,
38
+ .alert-message-success {
39
+ background-color: #67AF72;
40
+ }
41
+
42
+ @media screen and (min-width: 768px) {
43
+ .alert-message {
44
+ font-size: 15px;
45
+ }
46
+ }
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alert_message
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luiz Picolo
8
- autorequire:
8
+ - Gabriel Medina
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-11-05 00:00:00.000000000 Z
12
+ date: 2020-10-18 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -16,57 +17,115 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '1.6'
20
+ version: '2.1'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '1.6'
27
+ version: '2.1'
28
+ - !ruby/object:Gem::Dependency
29
+ name: capybara
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 3.0.0
35
+ - - "~>"
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 3.0.0
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
27
48
  - !ruby/object:Gem::Dependency
28
49
  name: rake
29
50
  requirement: !ruby/object:Gem::Requirement
30
51
  requirements:
31
52
  - - ">="
32
53
  - !ruby/object:Gem::Version
33
- version: '0'
54
+ version: 12.3.3
34
55
  type: :development
35
56
  prerelease: false
36
57
  version_requirements: !ruby/object:Gem::Requirement
37
58
  requirements:
38
59
  - - ">="
39
60
  - !ruby/object:Gem::Version
40
- version: '0'
61
+ version: 12.3.3
41
62
  - !ruby/object:Gem::Dependency
42
- name: jquery-rails
63
+ name: rails
43
64
  requirement: !ruby/object:Gem::Requirement
44
65
  requirements:
45
66
  - - ">="
46
67
  - !ruby/object:Gem::Version
47
- version: '3.0'
68
+ version: '6.0'
48
69
  - - "<"
49
70
  - !ruby/object:Gem::Version
50
- version: '5'
51
- type: :runtime
71
+ version: '7'
72
+ type: :development
52
73
  prerelease: false
53
74
  version_requirements: !ruby/object:Gem::Requirement
54
75
  requirements:
55
76
  - - ">="
56
77
  - !ruby/object:Gem::Version
57
- version: '3.0'
78
+ version: '6.0'
58
79
  - - "<"
59
80
  - !ruby/object:Gem::Version
60
- version: '5'
81
+ version: '7'
82
+ - !ruby/object:Gem::Dependency
83
+ name: rspec-rails
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '4.0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '4.0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: selenium-webdriver
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.53'
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 2.53.4
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '2.53'
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 2.53.4
61
116
  description: Simple gem for alerts messages
62
117
  email:
63
118
  - luizpicolo@gmail.com
119
+ - gmedina.santos@gmail.com
64
120
  executables: []
65
121
  extensions: []
66
122
  extra_rdoc_files: []
67
123
  files:
68
124
  - ".gitignore"
69
125
  - ".rspec"
126
+ - ".ruby-gemset"
127
+ - ".ruby-version"
128
+ - ".travis.yml"
70
129
  - Gemfile
71
130
  - LICENSE
72
131
  - README.md
@@ -77,16 +136,14 @@ files:
77
136
  - lib/generators/alert_message/install_generator.rb
78
137
  - lib/generators/alert_message/templates/_alerts.html.erb
79
138
  - lib/version/version.rb
80
- - spec/alert_message/alert_message_spec.rb
81
- - spec/alert_message/version_spec.rb
82
139
  - spec/spec_helper.rb
83
140
  - vendor/assets/javascripts/alert_message.js
84
- - vendor/assets/stylesheets/alert_message.css
141
+ - vendor/assets/stylesheets/alert_message.scss
85
142
  homepage: https://github.com/luizpicolo/alert_message
86
143
  licenses:
87
144
  - MIT
88
145
  metadata: {}
89
- post_install_message:
146
+ post_install_message:
90
147
  rdoc_options: []
91
148
  require_paths:
92
149
  - lib
@@ -101,9 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
158
  - !ruby/object:Gem::Version
102
159
  version: '0'
103
160
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.4.8
106
- signing_key:
161
+ rubygems_version: 3.0.8
162
+ signing_key:
107
163
  specification_version: 4
108
164
  summary: Alert Message
109
165
  test_files: []
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AlertMessage do
4
-
5
- path = '../../lib/generators/alert_message/templates/'
6
-
7
- it 'should return true if template exist' do
8
- expect(File.exist?("#{path}_alerts.html.erb")).to be_true
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
- require_relative '../../lib/version/version'
3
-
4
- describe AlertMessage do
5
-
6
- it "should return version correctly" do
7
- expect(AlertMessage::Version::VERSION).to be_a_kind_of(String)
8
- expect(AlertMessage::Version::VERSION).to eq '1.1.3.1'
9
- end
10
- end
@@ -1,25 +0,0 @@
1
- .alert-message {
2
- cursor: pointer;
3
-
4
- position: fixed;
5
- z-index: 9999;
6
- top: 0;
7
- left: 0;
8
-
9
- width: 100%;
10
-
11
- color: #fff;
12
- font-size: 1em;
13
- text-align: center;
14
-
15
- padding: 10px;
16
- }
17
-
18
- .alert-message-danger {
19
- background: #e74c3c;
20
- }
21
-
22
- .alert-message-notice,
23
- .alert-message-success {
24
- background: #27ae60;
25
- }