├── .gitignore
├── .travis.yml
├── Appraisals
├── CHANGELOG.md
├── Gemfile
├── LICENSE
├── README.markdown
├── Rakefile
├── gemfiles
├── rails_3.2.gemfile
├── rails_3.2.gemfile.lock
├── rails_4.0.gemfile
├── rails_4.0.gemfile.lock
├── rails_4.1.gemfile
├── rails_4.1.gemfile.lock
├── rails_4.2.gemfile
├── rails_4.2.gemfile.lock
├── rails_5.gemfile
└── rails_5.gemfile.lock
├── lib
├── assets
│ ├── javascripts
│ │ ├── unobtrusive_flash.js
│ │ ├── unobtrusive_flash_bootstrap.js
│ │ └── unobtrusive_flash_ui.js
│ └── stylesheets
│ │ └── unobtrusive_flash_ui.css
├── unobtrusive_flash.rb
└── unobtrusive_flash
│ ├── controller_mixin.rb
│ ├── engine.rb
│ └── version.rb
├── spec
├── domain_spec.rb
├── integration
│ ├── api_spec.rb
│ ├── bootstrap_spec.rb
│ ├── turbolinks_spec.rb
│ └── ui_spec.rb
├── sanitize_flash_spec.rb
├── spec_helper.rb
└── support
│ ├── assets
│ └── javascripts
│ │ ├── ajax_caller.js
│ │ ├── api.js
│ │ ├── bootstrap.js
│ │ ├── jquery_turbolinks_application.js
│ │ ├── turbolinks_application.js
│ │ └── ui.js
│ ├── rails_app.rb
│ └── views
│ └── test
│ ├── api.html.erb
│ ├── bootstrap.html.erb
│ ├── jquery_turbolinks.html.erb
│ ├── turbolinks.html.erb
│ ├── turbolinks_target.html.erb
│ └── ui.html.erb
└── unobtrusive_flash.gemspec
/.gitignore:
--------------------------------------------------------------------------------
1 | *.gem
2 | *.rbc
3 | .bundle
4 | .config
5 | .yardoc
6 | Gemfile.lock
7 | InstalledFiles
8 | _yardoc
9 | coverage
10 | doc/
11 | lib/bundler/man
12 | pkg
13 | rdoc
14 | spec/reports
15 | test/tmp
16 | test/version_tmp
17 | tmp
18 | log
19 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: ruby
3 | rvm:
4 | - jruby-9.1.12.0
5 | - 2.3.4
6 | - 2.4.1
7 | gemfile:
8 | - gemfiles/rails_3.2.gemfile
9 | - gemfiles/rails_4.2.gemfile
10 | - gemfiles/rails_5.gemfile
11 | env:
12 | matrix:
13 | - JQUERY_VERSION=1.12.4
14 | - JQUERY_VERSION=2.2.4
15 | - JQUERY_VERSION=3.2.1
16 | matrix:
17 | exclude:
18 | - rvm: 2.4.1
19 | gemfile: gemfiles/rails_3.2.gemfile
20 |
21 | script: bundle exec rspec spec
22 |
23 | before_install:
24 | - mkdir travis-phantomjs
25 | - wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
26 | - tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs
27 | - export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH
28 |
--------------------------------------------------------------------------------
/Appraisals:
--------------------------------------------------------------------------------
1 | appraise "rails-3.2" do
2 | gem "rails", "~>3.2.22"
3 | gem 'jquery-rails', '~> 2.1'
4 | end
5 |
6 | appraise "rails-4.2" do
7 | gem "rails", "~>4.2.4"
8 | gem 'jquery-rails', '~> 2.1'
9 | gem 'turbolinks'
10 | gem 'jquery-turbolinks', '>2'
11 | end
12 |
13 | appraise "rails-5" do
14 | gem "rails", "~>5"
15 | gem 'jquery-rails', '~> 4.2.1'
16 | gem 'turbolinks'
17 | gem 'jquery-turbolinks', '>2'
18 | end
19 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 2017-06-19 3.3.2
2 |
3 | * Bugfix - Handle case when cookie is null
4 |
5 | ## 2016-11-17 3.3.1
6 |
7 | * Added `:success` and `:warning` to list of Flash keys visible by default
8 |
9 | ## 2016-11-08 3.3.0
10 |
11 | * Now compatible with jQuery 1, 2 and 3.
12 | * Now compatible with Rails 5.
13 | * Now compatible with turbolinks 5.
14 | * Make bootstrap flash mapping configurable [#31]
15 | * Do not repeat flash messages [#32]
16 | * Support AWS ELB out of the box [#33]
17 | * Only show user-facing flash messages [#21]
18 | * Tested with JRuby
19 |
20 | ## 2015-11-06 3.2.0
21 |
22 | * Support passing flash with non-successful (non-200) AJAX requests thanks to @Markwallow [#28]
23 | * Tested with Rails 4.2
24 |
25 | ## 2015-10-23 3.1.1
26 |
27 | * Fix typo that didn't clear domainless cookies thanks to @pavelgnom [#23]
28 |
29 | ## 2014-06-23 3.1.0
30 |
31 | * Extracted default flash options to `UnobtrusiveFlash.flashOptions` so you can set the message timeout.
32 | * Use `hostname` when nuking cookies by @zeppelin [#14]
33 | * Check $flashContainer dynamically by @nfedyashev [#15].
34 | * Fixed issues with applications on the .herokuapp.com domain [#16].
35 |
36 | ## 2014-03-07 3.0.0
37 |
38 | * Moved Javascript methods to an `UnobtrusiveFlash` module. This breaks calling `$.showFlashMessage`, hence another major release [#11]
39 | * Make sure that the flash events are invoked after a handler had a chance to bind [#10]
40 | * Changed default alerts to never autohide [#6]
41 | * Bootstrap handler: All conventional Rails notices are correctly styled by @conzett [#12]
42 | * Turbolinks are supported thanks to @yoyos [#13]
43 | * Fixes to cookie nuking by @asaletnik [#7]
44 |
45 | ## 2013-12-21 2.1.0
46 |
47 | * Changed message escaping logic to use the Rails html_safe conventions (Possibly breaking change)
48 |
49 | ## 2013-10-09 2.0.0
50 |
51 | * Grand refactoring
52 | * Compatibility with Rails 3 Asset Pipeline
53 | * Dropped compatibility with Rails 2
54 | * Decoupled logic from presentation
55 | * Compatibility with Bootstrap
56 | * Event-driven architecture
57 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in unobtrusive_flash.gemspec
4 | gemspec
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Leonid Shevtsov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | # Unobtrusive flash messages for Rails [](https://travis-ci.org/leonid-shevtsov/unobtrusive_flash)
2 |
3 |
4 |
5 | Ever got tired of pages that can't be cached because they contain flash messages?
6 |
7 | Ever got tired of writing custom code to handle flash messages passed in AJAX responses?
8 |
9 | Here comes the solution.
10 |
11 | `unobtrusive_flash` takes your flash messages for the backend and automagically passes them to the frontend via
12 | HTTP cookies. This works with both **regular page loads**, **jQuery AJAX requests**, and **turbolinks** (from v3), does not tamper with the page body and requires
13 | about 3 extra lines of code in your app - how's that for unobtrusive?
14 |
15 | You can pass up to 4K of text into flash this way, and you don't need to worry about cookie size since they are
16 | cleared immediately upon rendering.
17 |
18 | Tested in all major browsers, including Internet Explorer 8 and later.
19 |
20 | ## Requirements
21 |
22 | * Rails >=3 (Latest versions of 3.2, 4.0, 4.1, 4.2, and 5 are automatically tested)
23 | * jQuery (Latest versions of jQuery 1, 2 and 3 are automatically tested)
24 |
25 | ## Usage
26 |
27 | 1. Add the `unobtrusive_flash` gem to your Gemfile.
28 |
29 | ```ruby
30 | gem 'unobtrusive_flash', '>=3'
31 | ```
32 |
33 | 2. Add the following to the controllers that generate flash messages (or better, to the `ApplicationController`):
34 |
35 | ```ruby
36 | after_action :prepare_unobtrusive_flash
37 | ```
38 |
39 | Flash messages are HTML escaped in the same manner as regular Rails view code: if a message is not `html_safe`, it is escaped, otherwise not. This lets you use helpers such as `link_to` in your messages.
40 |
41 | 3. Include `require unobtrusive_flash` in your `application.js`.
42 |
43 | 4. Delete flash rendering code from your views, if there was any.
44 |
45 | 5. You have three options to render flash messages on the frontend:
46 |
47 | ### Option 1: For Bootstrap projects
48 |
49 | Also `require unobtrusive_flash_bootstrap` in your `application.js`. This file contains flash message UI based on the [Bootstrap alert component](http://getbootstrap.com/components/#alerts).
50 |
51 | Either declare a `.unobtrusive-flash-container` element somewhere on the page to contain the alerts, or Unobtrusive flash will choose the first `.container` or `.container-fluid` element on the page, or fall back to the `body`.
52 |
53 | If you want the flash messages to disappear automatically, set this in your Javascript:
54 |
55 | ```javascript
56 | UnobtrusiveFlash.flashOptions["timeout"] = 2000; // milliseconds
57 | ```
58 |
59 | You can config the resulting mapping classes like this:
60 |
61 | ```javascript
62 | UnobtrusiveFlash.flashOptions.mapping.notice = "success";
63 | ```
64 |
65 | ### Option 2: For non-Bootstrap projects
66 |
67 | Also `require unobtrusive_flash_ui` in your `application.js` and `require unobtrusive_flash_ui` in your `application.css`. These files contain a no-frills flash message UI that works out of the box.
68 |
69 | If you want the flash messages to disappear automatically, set this in your Javascript:
70 |
71 | ```javascript
72 | UnobtrusiveFlash.flashOptions["timeout"] = 2000; // milliseconds
73 | ```
74 |
75 | ### Option 3: Roll your own
76 |
77 | Unobtrusive Flash triggers jQuery events when flash is received. If you want to integrate it with your own UI, implement and bind a handler:
78 |
79 | ```javascript
80 | flashHandler = function(e, params) {
81 | alert(
82 | "Received flash message " + params.message + " with type " + params.type
83 | );
84 | };
85 |
86 | $(window).bind("rails:flash", flashHandler);
87 | ```
88 |
89 | ## Using UnobtrusiveFlash with a frontend framework that doesn't use jQuery for AJAX
90 |
91 | Call `UnobtrusiveFlash.showFlashFromCookies()` in your Javascript after a completed request.
92 |
93 | ## Bonus: show 'flash messages' from the front-end
94 |
95 | Both Bootstrap and non-Bootstrap versions contain a function to display flash messages:
96 |
97 | ```javascript
98 | // Shown for 5 seconds (default)
99 | UnobtrusiveFlash.showFlashMessage("Hello World", { type: "notice" });
100 | // Shown forever
101 | UnobtrusiveFlash.showFlashMessage("Error", { type: "error", timeout: 0 });
102 | ```
103 |
104 | ## Using custom flash keys
105 |
106 | By default, Unobtrusive Flash only displays a limited set of flash types [(see UnobtrusiveFlash::ControllerMixin#unobtrusive_flash_keys)](https://github.com/leonid-shevtsov/unobtrusive_flash/blob/master/lib/unobtrusive_flash/controller_mixin.rb#L36). This is because some libraries use `flash` to keep data that is not directed at the user; for example, [Devise](https://github.com/plataformatec/devise) uses a boolean `flash[:timedout]`. If you use other keys to store messages, override `unobtrusive_flash_keys` in your controller:
107 |
108 | ```ruby
109 | class ApplicationController
110 | def unobtrusive_flash_keys
111 | super << :success
112 | end
113 | end
114 | ```
115 |
116 | ## Issue with certain "hosted domains"
117 |
118 | There are [certain domains](https://publicsuffix.org/list/) that are considered "public" or "hosting" and specifically don't share cookies across subdomains. An example is `herokuapp.com` - a cookie set for `yourapp.herokuapp.com` will not be applied for `myapp.herokuapp.com`. This breaks the logic of `unobtrusive_flash` which is tuned for regular domains that could have internal subdomains.
119 |
120 | In this case, you should explicitly specify your domain:
121 |
122 | ```ruby
123 | class ApplicationController
124 | def unobtrusive_flash_domain
125 | request.host # last resort is hardcoding the domain here
126 | end
127 | end
128 | ```
129 |
130 | ## Running tests
131 |
132 | This plugin's test suite includes a full set of integration tests for various versions of Rails. To run them:
133 |
134 | ```shell
135 | bundle install
136 | appraisal install
137 | appraisal rake spec
138 | ```
139 |
140 | The same tests are ran on Travis CI against multiple versions of Ruby and jQuery.
141 |
142 | ---
143 |
144 | © 2010-2016 [Leonid Shevtsov](http://leonid.shevtsov.me) and [contributors](https://github.com/leonid-shevtsov/unobtrusive_flash/graphs/contributors), released under the MIT license
145 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require "bundler/gem_tasks"
2 | require 'rspec/core/rake_task'
3 |
4 | RSpec::Core::RakeTask.new(:spec)
5 |
6 | task :default => :spec
7 |
--------------------------------------------------------------------------------
/gemfiles/rails_3.2.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "rails", "~>3.2.22"
6 | gem "jquery-rails", "~> 2.1"
7 |
8 | gemspec :path => "../"
9 |
--------------------------------------------------------------------------------
/gemfiles/rails_3.2.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ../
3 | specs:
4 | unobtrusive_flash (3.3.2)
5 | railties
6 |
7 | GEM
8 | remote: https://rubygems.org/
9 | specs:
10 | actionmailer (3.2.22.5)
11 | actionpack (= 3.2.22.5)
12 | mail (~> 2.5.4)
13 | actionpack (3.2.22.5)
14 | activemodel (= 3.2.22.5)
15 | activesupport (= 3.2.22.5)
16 | builder (~> 3.0.0)
17 | erubis (~> 2.7.0)
18 | journey (~> 1.0.4)
19 | rack (~> 1.4.5)
20 | rack-cache (~> 1.2)
21 | rack-test (~> 0.6.1)
22 | sprockets (~> 2.2.1)
23 | activemodel (3.2.22.5)
24 | activesupport (= 3.2.22.5)
25 | builder (~> 3.0.0)
26 | activerecord (3.2.22.5)
27 | activemodel (= 3.2.22.5)
28 | activesupport (= 3.2.22.5)
29 | arel (~> 3.0.2)
30 | tzinfo (~> 0.3.29)
31 | activeresource (3.2.22.5)
32 | activemodel (= 3.2.22.5)
33 | activesupport (= 3.2.22.5)
34 | activesupport (3.2.22.5)
35 | i18n (~> 0.6, >= 0.6.4)
36 | multi_json (~> 1.0)
37 | addressable (2.5.1)
38 | public_suffix (~> 2.0, >= 2.0.2)
39 | appraisal (2.1.0)
40 | bundler
41 | rake
42 | thor (>= 0.14.0)
43 | arel (3.0.3)
44 | builder (3.0.4)
45 | capybara (2.14.3)
46 | addressable
47 | mime-types (>= 1.16)
48 | nokogiri (>= 1.3.3)
49 | rack (>= 1.0.0)
50 | rack-test (>= 0.5.4)
51 | xpath (~> 2.0)
52 | cliver (0.3.2)
53 | diff-lcs (1.3)
54 | erubis (2.7.0)
55 | hike (1.2.3)
56 | i18n (0.8.4)
57 | journey (1.0.4)
58 | jquery-rails (2.3.0)
59 | railties (>= 3.0, < 5.0)
60 | thor (>= 0.14, < 2.0)
61 | json (1.8.6)
62 | json (1.8.6-java)
63 | mail (2.5.5)
64 | mime-types (~> 1.16)
65 | treetop (~> 1.4.8)
66 | mime-types (1.25.1)
67 | mini_portile2 (2.2.0)
68 | multi_json (1.12.1)
69 | nokogiri (1.8.0)
70 | mini_portile2 (~> 2.2.0)
71 | nokogiri (1.8.0-java)
72 | poltergeist (1.15.0)
73 | capybara (~> 2.1)
74 | cliver (~> 0.3.1)
75 | websocket-driver (>= 0.2.0)
76 | polyglot (0.3.5)
77 | public_suffix (2.0.5)
78 | rack (1.4.7)
79 | rack-cache (1.7.0)
80 | rack (>= 0.4)
81 | rack-ssl (1.3.4)
82 | rack
83 | rack-test (0.6.3)
84 | rack (>= 1.0)
85 | rails (3.2.22.5)
86 | actionmailer (= 3.2.22.5)
87 | actionpack (= 3.2.22.5)
88 | activerecord (= 3.2.22.5)
89 | activeresource (= 3.2.22.5)
90 | activesupport (= 3.2.22.5)
91 | bundler (~> 1.0)
92 | railties (= 3.2.22.5)
93 | railties (3.2.22.5)
94 | actionpack (= 3.2.22.5)
95 | activesupport (= 3.2.22.5)
96 | rack-ssl (~> 1.3.2)
97 | rake (>= 0.8.7)
98 | rdoc (~> 3.4)
99 | thor (>= 0.14.6, < 2.0)
100 | rake (12.0.0)
101 | rdoc (3.12.2)
102 | json (~> 1.4)
103 | rspec (3.6.0)
104 | rspec-core (~> 3.6.0)
105 | rspec-expectations (~> 3.6.0)
106 | rspec-mocks (~> 3.6.0)
107 | rspec-core (3.6.0)
108 | rspec-support (~> 3.6.0)
109 | rspec-expectations (3.6.0)
110 | diff-lcs (>= 1.2.0, < 2.0)
111 | rspec-support (~> 3.6.0)
112 | rspec-mocks (3.6.0)
113 | diff-lcs (>= 1.2.0, < 2.0)
114 | rspec-support (~> 3.6.0)
115 | rspec-support (3.6.0)
116 | sprockets (2.2.3)
117 | hike (~> 1.2)
118 | multi_json (~> 1.0)
119 | rack (~> 1.0)
120 | tilt (~> 1.1, != 1.3.0)
121 | thor (0.19.4)
122 | tilt (1.4.1)
123 | treetop (1.4.15)
124 | polyglot
125 | polyglot (>= 0.3.1)
126 | tzinfo (0.3.53)
127 | websocket-driver (0.6.5)
128 | websocket-extensions (>= 0.1.0)
129 | websocket-driver (0.6.5-java)
130 | websocket-extensions (>= 0.1.0)
131 | websocket-extensions (0.1.2)
132 | xpath (2.1.0)
133 | nokogiri (~> 1.3)
134 |
135 | PLATFORMS
136 | java
137 | ruby
138 |
139 | DEPENDENCIES
140 | appraisal
141 | bundler (~> 1.3)
142 | capybara (>= 2.5)
143 | jquery-rails (~> 2.1)
144 | poltergeist (>= 1.10.0)
145 | rails (~> 3.2.22)
146 | rake
147 | rspec (~> 3)
148 | rspec-mocks (~> 3)
149 | unobtrusive_flash!
150 |
151 | BUNDLED WITH
152 | 1.13.7
153 |
--------------------------------------------------------------------------------
/gemfiles/rails_4.0.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "rails", "~>4.0.13"
6 | gem "jquery-rails", "~> 2.1"
7 | gem "turbolinks"
8 | gem "jquery-turbolinks", ">2"
9 |
10 | gemspec :path => "../"
11 |
--------------------------------------------------------------------------------
/gemfiles/rails_4.0.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ../
3 | specs:
4 | unobtrusive_flash (3.3.2)
5 | railties
6 |
7 | GEM
8 | remote: https://rubygems.org/
9 | specs:
10 | actionmailer (4.0.13)
11 | actionpack (= 4.0.13)
12 | mail (~> 2.5, >= 2.5.4)
13 | actionpack (4.0.13)
14 | activesupport (= 4.0.13)
15 | builder (~> 3.1.0)
16 | erubis (~> 2.7.0)
17 | rack (~> 1.5.2)
18 | rack-test (~> 0.6.2)
19 | activemodel (4.0.13)
20 | activesupport (= 4.0.13)
21 | builder (~> 3.1.0)
22 | activerecord (4.0.13)
23 | activemodel (= 4.0.13)
24 | activerecord-deprecated_finders (~> 1.0.2)
25 | activesupport (= 4.0.13)
26 | arel (~> 4.0.0)
27 | activerecord-deprecated_finders (1.0.4)
28 | activesupport (4.0.13)
29 | i18n (~> 0.6, >= 0.6.9)
30 | minitest (~> 4.2)
31 | multi_json (~> 1.3)
32 | thread_safe (~> 0.1)
33 | tzinfo (~> 0.3.37)
34 | appraisal (2.1.0)
35 | bundler
36 | rake
37 | thor (>= 0.14.0)
38 | arel (4.0.2)
39 | builder (3.1.4)
40 | capybara (2.5.0)
41 | mime-types (>= 1.16)
42 | nokogiri (>= 1.3.3)
43 | rack (>= 1.0.0)
44 | rack-test (>= 0.5.4)
45 | xpath (~> 2.0)
46 | cliver (0.3.2)
47 | coffee-rails (4.1.0)
48 | coffee-script (>= 2.2.0)
49 | railties (>= 4.0.0, < 5.0)
50 | coffee-script (2.4.1)
51 | coffee-script-source
52 | execjs
53 | coffee-script-source (1.9.1.1)
54 | concurrent-ruby (1.0.5)
55 | concurrent-ruby (1.0.5-java)
56 | diff-lcs (1.2.5)
57 | erubis (2.7.0)
58 | execjs (2.6.0)
59 | i18n (0.8.4)
60 | jquery-rails (2.3.0)
61 | railties (>= 3.0, < 5.0)
62 | thor (>= 0.14, < 2.0)
63 | jquery-turbolinks (2.1.0)
64 | railties (>= 3.1.0)
65 | turbolinks
66 | mail (2.6.6)
67 | mime-types (>= 1.16, < 4)
68 | mime-types (3.1)
69 | mime-types-data (~> 3.2015)
70 | mime-types-data (3.2016.0521)
71 | mini_portile (0.6.2)
72 | minitest (4.7.5)
73 | multi_json (1.12.1)
74 | nokogiri (1.6.6.2)
75 | mini_portile (~> 0.6.0)
76 | nokogiri (1.6.6.2-java)
77 | poltergeist (1.10.0)
78 | capybara (~> 2.1)
79 | cliver (~> 0.3.1)
80 | websocket-driver (>= 0.2.0)
81 | rack (1.5.5)
82 | rack-test (0.6.3)
83 | rack (>= 1.0)
84 | rails (4.0.13)
85 | actionmailer (= 4.0.13)
86 | actionpack (= 4.0.13)
87 | activerecord (= 4.0.13)
88 | activesupport (= 4.0.13)
89 | bundler (>= 1.3.0, < 2.0)
90 | railties (= 4.0.13)
91 | sprockets-rails (~> 2.0)
92 | railties (4.0.13)
93 | actionpack (= 4.0.13)
94 | activesupport (= 4.0.13)
95 | rake (>= 0.8.7)
96 | thor (>= 0.18.1, < 2.0)
97 | rake (12.0.0)
98 | rspec (3.3.0)
99 | rspec-core (~> 3.3.0)
100 | rspec-expectations (~> 3.3.0)
101 | rspec-mocks (~> 3.3.0)
102 | rspec-core (3.3.2)
103 | rspec-support (~> 3.3.0)
104 | rspec-expectations (3.3.1)
105 | diff-lcs (>= 1.2.0, < 2.0)
106 | rspec-support (~> 3.3.0)
107 | rspec-mocks (3.3.2)
108 | diff-lcs (>= 1.2.0, < 2.0)
109 | rspec-support (~> 3.3.0)
110 | rspec-support (3.3.0)
111 | sprockets (3.7.1)
112 | concurrent-ruby (~> 1.0)
113 | rack (> 1, < 3)
114 | sprockets-rails (2.3.3)
115 | actionpack (>= 3.0)
116 | activesupport (>= 3.0)
117 | sprockets (>= 2.8, < 4.0)
118 | thor (0.19.4)
119 | thread_safe (0.3.6)
120 | thread_safe (0.3.6-java)
121 | turbolinks (2.5.3)
122 | coffee-rails
123 | tzinfo (0.3.53)
124 | websocket-driver (0.6.4)
125 | websocket-extensions (>= 0.1.0)
126 | websocket-driver (0.6.4-java)
127 | websocket-extensions (>= 0.1.0)
128 | websocket-extensions (0.1.2)
129 | xpath (2.0.0)
130 | nokogiri (~> 1.3)
131 |
132 | PLATFORMS
133 | java
134 | ruby
135 |
136 | DEPENDENCIES
137 | appraisal
138 | bundler (~> 1.3)
139 | capybara (>= 2.5)
140 | jquery-rails (~> 2.1)
141 | jquery-turbolinks (> 2)
142 | poltergeist (>= 1.10.0)
143 | rails (~> 4.0.13)
144 | rake
145 | rspec (~> 3)
146 | rspec-mocks (~> 3)
147 | turbolinks
148 | unobtrusive_flash!
149 |
150 | BUNDLED WITH
151 | 1.13.7
152 |
--------------------------------------------------------------------------------
/gemfiles/rails_4.1.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "rails", "~>4.1.13"
6 | gem "jquery-rails", "~> 2.1"
7 | gem "turbolinks"
8 | gem "jquery-turbolinks", ">2"
9 |
10 | gemspec :path => "../"
11 |
--------------------------------------------------------------------------------
/gemfiles/rails_4.1.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ../
3 | specs:
4 | unobtrusive_flash (3.3.2)
5 | railties
6 |
7 | GEM
8 | remote: https://rubygems.org/
9 | specs:
10 | actionmailer (4.1.16)
11 | actionpack (= 4.1.16)
12 | actionview (= 4.1.16)
13 | mail (~> 2.5, >= 2.5.4)
14 | actionpack (4.1.16)
15 | actionview (= 4.1.16)
16 | activesupport (= 4.1.16)
17 | rack (~> 1.5.2)
18 | rack-test (~> 0.6.2)
19 | actionview (4.1.16)
20 | activesupport (= 4.1.16)
21 | builder (~> 3.1)
22 | erubis (~> 2.7.0)
23 | activemodel (4.1.16)
24 | activesupport (= 4.1.16)
25 | builder (~> 3.1)
26 | activerecord (4.1.16)
27 | activemodel (= 4.1.16)
28 | activesupport (= 4.1.16)
29 | arel (~> 5.0.0)
30 | activesupport (4.1.16)
31 | i18n (~> 0.6, >= 0.6.9)
32 | json (~> 1.7, >= 1.7.7)
33 | minitest (~> 5.1)
34 | thread_safe (~> 0.1)
35 | tzinfo (~> 1.1)
36 | appraisal (2.1.0)
37 | bundler
38 | rake
39 | thor (>= 0.14.0)
40 | arel (5.0.1.20140414130214)
41 | builder (3.2.3)
42 | capybara (2.5.0)
43 | mime-types (>= 1.16)
44 | nokogiri (>= 1.3.3)
45 | rack (>= 1.0.0)
46 | rack-test (>= 0.5.4)
47 | xpath (~> 2.0)
48 | cliver (0.3.2)
49 | coffee-rails (4.1.0)
50 | coffee-script (>= 2.2.0)
51 | railties (>= 4.0.0, < 5.0)
52 | coffee-script (2.4.1)
53 | coffee-script-source
54 | execjs
55 | coffee-script-source (1.9.1.1)
56 | concurrent-ruby (1.0.5)
57 | concurrent-ruby (1.0.5-java)
58 | diff-lcs (1.2.5)
59 | erubis (2.7.0)
60 | execjs (2.6.0)
61 | i18n (0.8.4)
62 | jquery-rails (2.3.0)
63 | railties (>= 3.0, < 5.0)
64 | thor (>= 0.14, < 2.0)
65 | jquery-turbolinks (2.1.0)
66 | railties (>= 3.1.0)
67 | turbolinks
68 | json (1.8.6)
69 | json (1.8.6-java)
70 | mail (2.6.6)
71 | mime-types (>= 1.16, < 4)
72 | mime-types (3.1)
73 | mime-types-data (~> 3.2015)
74 | mime-types-data (3.2016.0521)
75 | mini_portile (0.6.2)
76 | minitest (5.10.2)
77 | nokogiri (1.6.6.2)
78 | mini_portile (~> 0.6.0)
79 | nokogiri (1.6.6.2-java)
80 | poltergeist (1.10.0)
81 | capybara (~> 2.1)
82 | cliver (~> 0.3.1)
83 | websocket-driver (>= 0.2.0)
84 | rack (1.5.5)
85 | rack-test (0.6.3)
86 | rack (>= 1.0)
87 | rails (4.1.16)
88 | actionmailer (= 4.1.16)
89 | actionpack (= 4.1.16)
90 | actionview (= 4.1.16)
91 | activemodel (= 4.1.16)
92 | activerecord (= 4.1.16)
93 | activesupport (= 4.1.16)
94 | bundler (>= 1.3.0, < 2.0)
95 | railties (= 4.1.16)
96 | sprockets-rails (~> 2.0)
97 | railties (4.1.16)
98 | actionpack (= 4.1.16)
99 | activesupport (= 4.1.16)
100 | rake (>= 0.8.7)
101 | thor (>= 0.18.1, < 2.0)
102 | rake (12.0.0)
103 | rspec (3.3.0)
104 | rspec-core (~> 3.3.0)
105 | rspec-expectations (~> 3.3.0)
106 | rspec-mocks (~> 3.3.0)
107 | rspec-core (3.3.2)
108 | rspec-support (~> 3.3.0)
109 | rspec-expectations (3.3.1)
110 | diff-lcs (>= 1.2.0, < 2.0)
111 | rspec-support (~> 3.3.0)
112 | rspec-mocks (3.3.2)
113 | diff-lcs (>= 1.2.0, < 2.0)
114 | rspec-support (~> 3.3.0)
115 | rspec-support (3.3.0)
116 | sprockets (3.7.1)
117 | concurrent-ruby (~> 1.0)
118 | rack (> 1, < 3)
119 | sprockets-rails (2.3.3)
120 | actionpack (>= 3.0)
121 | activesupport (>= 3.0)
122 | sprockets (>= 2.8, < 4.0)
123 | thor (0.19.4)
124 | thread_safe (0.3.6)
125 | thread_safe (0.3.6-java)
126 | turbolinks (2.5.3)
127 | coffee-rails
128 | tzinfo (1.2.3)
129 | thread_safe (~> 0.1)
130 | websocket-driver (0.6.4)
131 | websocket-extensions (>= 0.1.0)
132 | websocket-driver (0.6.4-java)
133 | websocket-extensions (>= 0.1.0)
134 | websocket-extensions (0.1.2)
135 | xpath (2.0.0)
136 | nokogiri (~> 1.3)
137 |
138 | PLATFORMS
139 | java
140 | ruby
141 |
142 | DEPENDENCIES
143 | appraisal
144 | bundler (~> 1.3)
145 | capybara (>= 2.5)
146 | jquery-rails (~> 2.1)
147 | jquery-turbolinks (> 2)
148 | poltergeist (>= 1.10.0)
149 | rails (~> 4.1.13)
150 | rake
151 | rspec (~> 3)
152 | rspec-mocks (~> 3)
153 | turbolinks
154 | unobtrusive_flash!
155 |
156 | BUNDLED WITH
157 | 1.13.7
158 |
--------------------------------------------------------------------------------
/gemfiles/rails_4.2.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "rails", "~>4.2.4"
6 | gem "jquery-rails", "~> 2.1"
7 | gem "turbolinks"
8 | gem "jquery-turbolinks", ">2"
9 |
10 | gemspec :path => "../"
11 |
--------------------------------------------------------------------------------
/gemfiles/rails_4.2.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ../
3 | specs:
4 | unobtrusive_flash (3.3.2)
5 | railties
6 |
7 | GEM
8 | remote: https://rubygems.org/
9 | specs:
10 | actionmailer (4.2.8)
11 | actionpack (= 4.2.8)
12 | actionview (= 4.2.8)
13 | activejob (= 4.2.8)
14 | mail (~> 2.5, >= 2.5.4)
15 | rails-dom-testing (~> 1.0, >= 1.0.5)
16 | actionpack (4.2.8)
17 | actionview (= 4.2.8)
18 | activesupport (= 4.2.8)
19 | rack (~> 1.6)
20 | rack-test (~> 0.6.2)
21 | rails-dom-testing (~> 1.0, >= 1.0.5)
22 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
23 | actionview (4.2.8)
24 | activesupport (= 4.2.8)
25 | builder (~> 3.1)
26 | erubis (~> 2.7.0)
27 | rails-dom-testing (~> 1.0, >= 1.0.5)
28 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
29 | activejob (4.2.8)
30 | activesupport (= 4.2.8)
31 | globalid (>= 0.3.0)
32 | activemodel (4.2.8)
33 | activesupport (= 4.2.8)
34 | builder (~> 3.1)
35 | activerecord (4.2.8)
36 | activemodel (= 4.2.8)
37 | activesupport (= 4.2.8)
38 | arel (~> 6.0)
39 | activesupport (4.2.8)
40 | i18n (~> 0.7)
41 | minitest (~> 5.1)
42 | thread_safe (~> 0.3, >= 0.3.4)
43 | tzinfo (~> 1.1)
44 | addressable (2.5.1)
45 | public_suffix (~> 2.0, >= 2.0.2)
46 | appraisal (2.1.0)
47 | bundler
48 | rake
49 | thor (>= 0.14.0)
50 | arel (6.0.4)
51 | builder (3.2.3)
52 | capybara (2.14.3)
53 | addressable
54 | mime-types (>= 1.16)
55 | nokogiri (>= 1.3.3)
56 | rack (>= 1.0.0)
57 | rack-test (>= 0.5.4)
58 | xpath (~> 2.0)
59 | cliver (0.3.2)
60 | coffee-rails (4.1.0)
61 | coffee-script (>= 2.2.0)
62 | railties (>= 4.0.0, < 5.0)
63 | coffee-script (2.4.1)
64 | coffee-script-source
65 | execjs
66 | coffee-script-source (1.9.1.1)
67 | concurrent-ruby (1.0.5)
68 | concurrent-ruby (1.0.5-java)
69 | diff-lcs (1.3)
70 | erubis (2.7.0)
71 | execjs (2.6.0)
72 | globalid (0.4.0)
73 | activesupport (>= 4.2.0)
74 | i18n (0.8.4)
75 | jquery-rails (2.3.0)
76 | railties (>= 3.0, < 5.0)
77 | thor (>= 0.14, < 2.0)
78 | jquery-turbolinks (2.1.0)
79 | railties (>= 3.1.0)
80 | turbolinks
81 | loofah (2.0.3)
82 | nokogiri (>= 1.5.9)
83 | mail (2.6.6)
84 | mime-types (>= 1.16, < 4)
85 | mime-types (3.1)
86 | mime-types-data (~> 3.2015)
87 | mime-types-data (3.2016.0521)
88 | mini_portile2 (2.2.0)
89 | minitest (5.10.2)
90 | nokogiri (1.8.0)
91 | mini_portile2 (~> 2.2.0)
92 | nokogiri (1.8.0-java)
93 | poltergeist (1.15.0)
94 | capybara (~> 2.1)
95 | cliver (~> 0.3.1)
96 | websocket-driver (>= 0.2.0)
97 | public_suffix (2.0.5)
98 | rack (1.6.8)
99 | rack-test (0.6.3)
100 | rack (>= 1.0)
101 | rails (4.2.8)
102 | actionmailer (= 4.2.8)
103 | actionpack (= 4.2.8)
104 | actionview (= 4.2.8)
105 | activejob (= 4.2.8)
106 | activemodel (= 4.2.8)
107 | activerecord (= 4.2.8)
108 | activesupport (= 4.2.8)
109 | bundler (>= 1.3.0, < 2.0)
110 | railties (= 4.2.8)
111 | sprockets-rails
112 | rails-deprecated_sanitizer (1.0.3)
113 | activesupport (>= 4.2.0.alpha)
114 | rails-dom-testing (1.0.8)
115 | activesupport (>= 4.2.0.beta, < 5.0)
116 | nokogiri (~> 1.6)
117 | rails-deprecated_sanitizer (>= 1.0.1)
118 | rails-html-sanitizer (1.0.3)
119 | loofah (~> 2.0)
120 | railties (4.2.8)
121 | actionpack (= 4.2.8)
122 | activesupport (= 4.2.8)
123 | rake (>= 0.8.7)
124 | thor (>= 0.18.1, < 2.0)
125 | rake (12.0.0)
126 | rspec (3.6.0)
127 | rspec-core (~> 3.6.0)
128 | rspec-expectations (~> 3.6.0)
129 | rspec-mocks (~> 3.6.0)
130 | rspec-core (3.6.0)
131 | rspec-support (~> 3.6.0)
132 | rspec-expectations (3.6.0)
133 | diff-lcs (>= 1.2.0, < 2.0)
134 | rspec-support (~> 3.6.0)
135 | rspec-mocks (3.6.0)
136 | diff-lcs (>= 1.2.0, < 2.0)
137 | rspec-support (~> 3.6.0)
138 | rspec-support (3.6.0)
139 | sprockets (3.7.1)
140 | concurrent-ruby (~> 1.0)
141 | rack (> 1, < 3)
142 | sprockets-rails (3.2.0)
143 | actionpack (>= 4.0)
144 | activesupport (>= 4.0)
145 | sprockets (>= 3.0.0)
146 | thor (0.19.4)
147 | thread_safe (0.3.6)
148 | thread_safe (0.3.6-java)
149 | turbolinks (2.5.3)
150 | coffee-rails
151 | tzinfo (1.2.3)
152 | thread_safe (~> 0.1)
153 | websocket-driver (0.6.5)
154 | websocket-extensions (>= 0.1.0)
155 | websocket-driver (0.6.5-java)
156 | websocket-extensions (>= 0.1.0)
157 | websocket-extensions (0.1.2)
158 | xpath (2.1.0)
159 | nokogiri (~> 1.3)
160 |
161 | PLATFORMS
162 | java
163 | ruby
164 |
165 | DEPENDENCIES
166 | appraisal
167 | bundler (~> 1.3)
168 | capybara (>= 2.5)
169 | jquery-rails (~> 2.1)
170 | jquery-turbolinks (> 2)
171 | poltergeist (>= 1.10.0)
172 | rails (~> 4.2.4)
173 | rake
174 | rspec (~> 3)
175 | rspec-mocks (~> 3)
176 | turbolinks
177 | unobtrusive_flash!
178 |
179 | BUNDLED WITH
180 | 1.13.7
181 |
--------------------------------------------------------------------------------
/gemfiles/rails_5.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "rails", "~>5"
6 | gem "jquery-rails", "~> 4.2.1"
7 | gem "turbolinks"
8 | gem "jquery-turbolinks", ">2"
9 |
10 | gemspec :path => "../"
11 |
--------------------------------------------------------------------------------
/gemfiles/rails_5.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ../
3 | specs:
4 | unobtrusive_flash (3.3.2)
5 | railties
6 |
7 | GEM
8 | remote: https://rubygems.org/
9 | specs:
10 | actioncable (5.1.1)
11 | actionpack (= 5.1.1)
12 | nio4r (~> 2.0)
13 | websocket-driver (~> 0.6.1)
14 | actionmailer (5.1.1)
15 | actionpack (= 5.1.1)
16 | actionview (= 5.1.1)
17 | activejob (= 5.1.1)
18 | mail (~> 2.5, >= 2.5.4)
19 | rails-dom-testing (~> 2.0)
20 | actionpack (5.1.1)
21 | actionview (= 5.1.1)
22 | activesupport (= 5.1.1)
23 | rack (~> 2.0)
24 | rack-test (~> 0.6.3)
25 | rails-dom-testing (~> 2.0)
26 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
27 | actionview (5.1.1)
28 | activesupport (= 5.1.1)
29 | builder (~> 3.1)
30 | erubi (~> 1.4)
31 | rails-dom-testing (~> 2.0)
32 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
33 | activejob (5.1.1)
34 | activesupport (= 5.1.1)
35 | globalid (>= 0.3.6)
36 | activemodel (5.1.1)
37 | activesupport (= 5.1.1)
38 | activerecord (5.1.1)
39 | activemodel (= 5.1.1)
40 | activesupport (= 5.1.1)
41 | arel (~> 8.0)
42 | activesupport (5.1.1)
43 | concurrent-ruby (~> 1.0, >= 1.0.2)
44 | i18n (~> 0.7)
45 | minitest (~> 5.1)
46 | tzinfo (~> 1.1)
47 | addressable (2.5.1)
48 | public_suffix (~> 2.0, >= 2.0.2)
49 | appraisal (2.1.0)
50 | bundler
51 | rake
52 | thor (>= 0.14.0)
53 | arel (8.0.0)
54 | builder (3.2.3)
55 | capybara (2.14.3)
56 | addressable
57 | mime-types (>= 1.16)
58 | nokogiri (>= 1.3.3)
59 | rack (>= 1.0.0)
60 | rack-test (>= 0.5.4)
61 | xpath (~> 2.0)
62 | cliver (0.3.2)
63 | concurrent-ruby (1.0.5)
64 | concurrent-ruby (1.0.5-java)
65 | diff-lcs (1.3)
66 | erubi (1.6.0)
67 | globalid (0.4.0)
68 | activesupport (>= 4.2.0)
69 | i18n (0.8.4)
70 | jquery-rails (4.2.1)
71 | rails-dom-testing (>= 1, < 3)
72 | railties (>= 4.2.0)
73 | thor (>= 0.14, < 2.0)
74 | jquery-turbolinks (2.1.0)
75 | railties (>= 3.1.0)
76 | turbolinks
77 | loofah (2.0.3)
78 | nokogiri (>= 1.5.9)
79 | mail (2.6.6)
80 | mime-types (>= 1.16, < 4)
81 | method_source (0.8.2)
82 | mime-types (3.1)
83 | mime-types-data (~> 3.2015)
84 | mime-types-data (3.2016.0521)
85 | mini_portile2 (2.2.0)
86 | minitest (5.10.2)
87 | nio4r (2.1.0)
88 | nio4r (2.1.0-java)
89 | nokogiri (1.8.0)
90 | mini_portile2 (~> 2.2.0)
91 | nokogiri (1.8.0-java)
92 | poltergeist (1.15.0)
93 | capybara (~> 2.1)
94 | cliver (~> 0.3.1)
95 | websocket-driver (>= 0.2.0)
96 | public_suffix (2.0.5)
97 | rack (2.0.3)
98 | rack-test (0.6.3)
99 | rack (>= 1.0)
100 | rails (5.1.1)
101 | actioncable (= 5.1.1)
102 | actionmailer (= 5.1.1)
103 | actionpack (= 5.1.1)
104 | actionview (= 5.1.1)
105 | activejob (= 5.1.1)
106 | activemodel (= 5.1.1)
107 | activerecord (= 5.1.1)
108 | activesupport (= 5.1.1)
109 | bundler (>= 1.3.0, < 2.0)
110 | railties (= 5.1.1)
111 | sprockets-rails (>= 2.0.0)
112 | rails-dom-testing (2.0.3)
113 | activesupport (>= 4.2.0)
114 | nokogiri (>= 1.6)
115 | rails-html-sanitizer (1.0.3)
116 | loofah (~> 2.0)
117 | railties (5.1.1)
118 | actionpack (= 5.1.1)
119 | activesupport (= 5.1.1)
120 | method_source
121 | rake (>= 0.8.7)
122 | thor (>= 0.18.1, < 2.0)
123 | rake (12.0.0)
124 | rspec (3.6.0)
125 | rspec-core (~> 3.6.0)
126 | rspec-expectations (~> 3.6.0)
127 | rspec-mocks (~> 3.6.0)
128 | rspec-core (3.6.0)
129 | rspec-support (~> 3.6.0)
130 | rspec-expectations (3.6.0)
131 | diff-lcs (>= 1.2.0, < 2.0)
132 | rspec-support (~> 3.6.0)
133 | rspec-mocks (3.6.0)
134 | diff-lcs (>= 1.2.0, < 2.0)
135 | rspec-support (~> 3.6.0)
136 | rspec-support (3.6.0)
137 | sprockets (3.7.1)
138 | concurrent-ruby (~> 1.0)
139 | rack (> 1, < 3)
140 | sprockets-rails (3.2.0)
141 | actionpack (>= 4.0)
142 | activesupport (>= 4.0)
143 | sprockets (>= 3.0.0)
144 | thor (0.19.4)
145 | thread_safe (0.3.6)
146 | thread_safe (0.3.6-java)
147 | turbolinks (5.0.1)
148 | turbolinks-source (~> 5)
149 | turbolinks-source (5.0.3)
150 | tzinfo (1.2.3)
151 | thread_safe (~> 0.1)
152 | websocket-driver (0.6.5)
153 | websocket-extensions (>= 0.1.0)
154 | websocket-driver (0.6.5-java)
155 | websocket-extensions (>= 0.1.0)
156 | websocket-extensions (0.1.2)
157 | xpath (2.1.0)
158 | nokogiri (~> 1.3)
159 |
160 | PLATFORMS
161 | java
162 | ruby
163 |
164 | DEPENDENCIES
165 | appraisal
166 | bundler (~> 1.3)
167 | capybara (>= 2.5)
168 | jquery-rails (~> 4.2.1)
169 | jquery-turbolinks (> 2)
170 | poltergeist (>= 1.10.0)
171 | rails (~> 5)
172 | rake
173 | rspec (~> 3)
174 | rspec-mocks (~> 3)
175 | turbolinks
176 | unobtrusive_flash!
177 |
178 | BUNDLED WITH
179 | 1.13.7
180 |
--------------------------------------------------------------------------------
/lib/assets/javascripts/unobtrusive_flash.js:
--------------------------------------------------------------------------------
1 | window.UnobtrusiveFlash = {};
2 |
3 | (function() {
4 | // Delete the cookie regardless of the domain it was set from
5 | // Partial credit to http://stackoverflow.com/a/2959110/6678
6 | function nukeCookie(cookieName) {
7 | var yesterday = new Date();
8 | yesterday.setDate(yesterday.getDate() - 1);
9 | var hostParts = window.location.hostname.split('.').reverse();
10 | var expireHost = hostParts.shift();
11 | $.each(hostParts, function(i,part) {
12 | expireHost = part + '.' + expireHost;
13 | document.cookie = cookieName+'=; path=/;expires='+yesterday+'; domain='+expireHost;
14 | });
15 | document.cookie = cookieName+'=; path=/;expires='+yesterday+'; domain=';
16 | }
17 |
18 | // Extracts flash array stored in cookie and clears the cookie
19 | function extractFlashFromCookies() {
20 | var data = null;
21 | if (document.cookie && document.cookie !== '') {
22 | var cookies = document.cookie.split(';');
23 | var name = 'flash';
24 | var cookieValue = null;
25 |
26 | for (var i = 0; i < cookies.length; i++) {
27 | var cookie = jQuery.trim(cookies[i]);
28 | if (cookie.substring(0, name.length + 1) == (name + '=')) {
29 | // replace fixes problems with Rails escaping. Duh.
30 | cookieValue = decodeURIComponent(cookie.substring(name.length + 1).replace(/\+/g,'%20'));
31 | if (cookieValue.length > 0) break; // there might be empty "flash=" cookies
32 | }
33 | }
34 |
35 | try {
36 | data = $.parseJSON(cookieValue);
37 | } catch(e) {
38 | }
39 |
40 | nukeCookie('flash');
41 | }
42 |
43 | return data;
44 | }
45 |
46 | window.UnobtrusiveFlash.showFlash = function(flashMessages) {
47 | if (flashMessages !== null) {
48 | $.each(flashMessages, function(_, flashMessage) {
49 | $(window).trigger('rails:flash', {type: flashMessage[0], message: flashMessage[1]});
50 | });
51 | }
52 | };
53 |
54 | // Reads flash messages from cookies and fires corresponding events
55 | window.UnobtrusiveFlash.showFlashFromCookies = function() {
56 | UnobtrusiveFlash.showFlash(extractFlashFromCookies());
57 | };
58 |
59 | // We want to remove cookies from the flash as soon as possible, but we only want to show then after all the scripts have loaded,
60 | // including any flash handlers
61 | var pageCookies = extractFlashFromCookies();
62 | $(window).on('load', function() {
63 | UnobtrusiveFlash.showFlash(pageCookies);
64 | });
65 |
66 | $(document).on('page:change page:load', UnobtrusiveFlash.showFlashFromCookies); //TURBOLINK-CLASSIC
67 | $(document).on('turbolinks:load', UnobtrusiveFlash.showFlashFromCookies); //TURBOLINK (5)
68 | $(document).ajaxComplete(function(event,request,options) {
69 | UnobtrusiveFlash.showFlashFromCookies();
70 | });
71 | })();
72 |
--------------------------------------------------------------------------------
/lib/assets/javascripts/unobtrusive_flash_bootstrap.js:
--------------------------------------------------------------------------------
1 | // Unobtrusive flash UI implementation with Bootstrap 3
2 | // For sites that use Bootstrap http://getbootstrap.com/
3 | //
4 | // Declare a .unobtrusive-flash-container wherever you want the messages to appear
5 | // Defaults to .container, .container-fluid (core Bootstrap classes), or just the body tag, whichever is present
6 |
7 | window.UnobtrusiveFlash.flashOptions = {
8 | type: 'notice',
9 | timeout: 0,
10 | mapping: {
11 | notice: 'info',
12 | alert: 'warning',
13 | error: 'danger'
14 | }
15 | };
16 |
17 | (function() {
18 |
19 | UnobtrusiveFlash.showFlashMessage = function(message, options) {
20 | options = $.extend(UnobtrusiveFlash.flashOptions, options);
21 |
22 | // Workaround for common Rails flash type to match common Bootstrap alert type
23 | switch (options.type) {
24 | case 'notice':
25 | case 'alert':
26 | case 'error':
27 | options.type = options.mapping[options.type]
28 | }
29 |
30 | var $flash = $('