toastr_rails 2.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 789474bec8c486038978db98abe85423ce8110c5
4
+ data.tar.gz: 7e19b3d4cdbd50d204100c98f0a81b98866f6b69
5
+ SHA512:
6
+ metadata.gz: 57761eac1c9e67888cd7bcf5240b5289d8909b51e5e01cea9b83009574ea3e27221cf2b40c7ea09bff3eeb64d55d3146dba579f99510e738ab7361a4772238a2
7
+ data.tar.gz: bfd7653a6f6e13707b65865504ce976d190745091d25234d2f5a5830678a872f45dc9c3e4d3750e5bb219df09759124e31634c89dfe56a5f9a3209f52ae19f71
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+ source 'https://rails-assets.org'
3
+
4
+ # Specify your gem's dependencies in toastr_rails.gemspec
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Stjepan Hadjic
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 ADDED
@@ -0,0 +1,59 @@
1
+ # ToastrRails
2
+
3
+ This is an opninionated [toaster](http://codeseven.github.io/toastr/demo.html) asset gem.
4
+ It sets some defaults, adds support for flash messages and assumes you have a navbar.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'toastr_rails'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ ## Usage
19
+
20
+ Add to your application.js and application.css:
21
+
22
+ //= require toastr_rails
23
+
24
+ You can put this in your layout/application.html file if you want to chach flash messages in a toast:
25
+
26
+ = render 'toastr_rails/flash'
27
+
28
+ ## Defaults:
29
+
30
+ // javascript
31
+ toastr.options = {
32
+ "closeButton": true,
33
+ "debug": false,
34
+ "progressBar": true,
35
+ "positionClass": "toast-top-right",
36
+ "showDuration": "300",
37
+ "hideDuration": "1000",
38
+ "timeOut": "5000",
39
+ "extendedTimeOut": "1000",
40
+ "showEasing": "swing",
41
+ "hideEasing": "linear",
42
+ "showMethod": "fadeIn",
43
+ "hideMethod": "fadeOut"
44
+ };
45
+
46
+ // css
47
+ #toast-container{
48
+ top: 70px;
49
+ }
50
+
51
+ For all other options you can visit [http://codeseven.github.io/toastr/](http://codeseven.github.io/toastr/)
52
+
53
+ ## Contributing
54
+
55
+ 1. Fork it ( https://github.com/[my-github-username]/toastr_rails/fork )
56
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
57
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
58
+ 4. Push to the branch (`git push origin my-new-feature`)
59
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,375 @@
1
+ /*
2
+ * Toastr
3
+ * Copyright 2012-2014
4
+ * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
5
+ * All Rights Reserved.
6
+ * Use, reproduction, distribution, and modification of this code is subject to the terms and
7
+ * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
8
+ *
9
+ * ARIA Support: Greta Krafsig
10
+ *
11
+ * Project: https://github.com/CodeSeven/toastr
12
+ */
13
+ ; (function (define) {
14
+ define(['jquery'], function ($) {
15
+ return (function () {
16
+ var $container;
17
+ var listener;
18
+ var toastId = 0;
19
+ var toastType = {
20
+ error: 'error',
21
+ info: 'info',
22
+ success: 'success',
23
+ warning: 'warning'
24
+ };
25
+
26
+ var toastr = {
27
+ clear: clear,
28
+ remove: remove,
29
+ error: error,
30
+ getContainer: getContainer,
31
+ info: info,
32
+ options: {},
33
+ subscribe: subscribe,
34
+ success: success,
35
+ version: '2.1.0',
36
+ warning: warning
37
+ };
38
+
39
+ var previousToast;
40
+
41
+ return toastr;
42
+
43
+ //#region Accessible Methods
44
+ function error(message, title, optionsOverride) {
45
+ return notify({
46
+ type: toastType.error,
47
+ iconClass: getOptions().iconClasses.error,
48
+ message: message,
49
+ optionsOverride: optionsOverride,
50
+ title: title
51
+ });
52
+ }
53
+
54
+ function getContainer(options, create) {
55
+ if (!options) { options = getOptions(); }
56
+ $container = $('#' + options.containerId);
57
+ if ($container.length) {
58
+ return $container;
59
+ }
60
+ if (create) {
61
+ $container = createContainer(options);
62
+ }
63
+ return $container;
64
+ }
65
+
66
+ function info(message, title, optionsOverride) {
67
+ return notify({
68
+ type: toastType.info,
69
+ iconClass: getOptions().iconClasses.info,
70
+ message: message,
71
+ optionsOverride: optionsOverride,
72
+ title: title
73
+ });
74
+ }
75
+
76
+ function subscribe(callback) {
77
+ listener = callback;
78
+ }
79
+
80
+ function success(message, title, optionsOverride) {
81
+ return notify({
82
+ type: toastType.success,
83
+ iconClass: getOptions().iconClasses.success,
84
+ message: message,
85
+ optionsOverride: optionsOverride,
86
+ title: title
87
+ });
88
+ }
89
+
90
+ function warning(message, title, optionsOverride) {
91
+ return notify({
92
+ type: toastType.warning,
93
+ iconClass: getOptions().iconClasses.warning,
94
+ message: message,
95
+ optionsOverride: optionsOverride,
96
+ title: title
97
+ });
98
+ }
99
+
100
+ function clear($toastElement) {
101
+ var options = getOptions();
102
+ if (!$container) { getContainer(options); }
103
+ if (!clearToast($toastElement, options)) {
104
+ clearContainer(options);
105
+ }
106
+ }
107
+
108
+ function remove($toastElement) {
109
+ var options = getOptions();
110
+ if (!$container) { getContainer(options); }
111
+ if ($toastElement && $(':focus', $toastElement).length === 0) {
112
+ removeToast($toastElement);
113
+ return;
114
+ }
115
+ if ($container.children().length) {
116
+ $container.remove();
117
+ }
118
+ }
119
+ //#endregion
120
+
121
+ //#region Internal Methods
122
+
123
+ function clearContainer (options) {
124
+ var toastsToClear = $container.children();
125
+ for (var i = toastsToClear.length - 1; i >= 0; i--) {
126
+ clearToast($(toastsToClear[i]), options);
127
+ }
128
+ }
129
+
130
+ function clearToast ($toastElement, options) {
131
+ if ($toastElement && $(':focus', $toastElement).length === 0) {
132
+ $toastElement[options.hideMethod]({
133
+ duration: options.hideDuration,
134
+ easing: options.hideEasing,
135
+ complete: function () { removeToast($toastElement); }
136
+ });
137
+ return true;
138
+ }
139
+ return false;
140
+ }
141
+
142
+ function createContainer(options) {
143
+ $container = $('<div/>')
144
+ .attr('id', options.containerId)
145
+ .addClass(options.positionClass)
146
+ .attr('aria-live', 'polite')
147
+ .attr('role', 'alert');
148
+
149
+ $container.appendTo($(options.target));
150
+ return $container;
151
+ }
152
+
153
+ function getDefaults() {
154
+ return {
155
+ tapToDismiss: true,
156
+ toastClass: 'toast',
157
+ containerId: 'toast-container',
158
+ debug: false,
159
+
160
+ showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
161
+ showDuration: 300,
162
+ showEasing: 'swing', //swing and linear are built into jQuery
163
+ onShown: undefined,
164
+ hideMethod: 'fadeOut',
165
+ hideDuration: 1000,
166
+ hideEasing: 'swing',
167
+ onHidden: undefined,
168
+
169
+ extendedTimeOut: 1000,
170
+ iconClasses: {
171
+ error: 'toast-error',
172
+ info: 'toast-info',
173
+ success: 'toast-success',
174
+ warning: 'toast-warning'
175
+ },
176
+ iconClass: 'toast-info',
177
+ positionClass: 'toast-top-right',
178
+ timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
179
+ titleClass: 'toast-title',
180
+ messageClass: 'toast-message',
181
+ target: 'body',
182
+ closeHtml: '<button type="button">&times;</button>',
183
+ newestOnTop: true,
184
+ preventDuplicates: false,
185
+ progressBar: false
186
+ };
187
+ }
188
+
189
+ function publish(args) {
190
+ if (!listener) { return; }
191
+ listener(args);
192
+ }
193
+
194
+ function notify(map) {
195
+ var options = getOptions(),
196
+ iconClass = map.iconClass || options.iconClass;
197
+
198
+ if (typeof (map.optionsOverride) !== 'undefined') {
199
+ options = $.extend(options, map.optionsOverride);
200
+ iconClass = map.optionsOverride.iconClass || iconClass;
201
+ }
202
+
203
+ if (options.preventDuplicates) {
204
+ if (map.message === previousToast) {
205
+ return;
206
+ } else {
207
+ previousToast = map.message;
208
+ }
209
+ }
210
+
211
+ toastId++;
212
+
213
+ $container = getContainer(options, true);
214
+ var intervalId = null,
215
+ $toastElement = $('<div/>'),
216
+ $titleElement = $('<div/>'),
217
+ $messageElement = $('<div/>'),
218
+ $progressElement = $('<div/>'),
219
+ $closeElement = $(options.closeHtml),
220
+ progressBar = {
221
+ intervalId: null,
222
+ hideEta: null,
223
+ maxHideTime: null
224
+ },
225
+ response = {
226
+ toastId: toastId,
227
+ state: 'visible',
228
+ startTime: new Date(),
229
+ options: options,
230
+ map: map
231
+ };
232
+
233
+ if (map.iconClass) {
234
+ $toastElement.addClass(options.toastClass).addClass(iconClass);
235
+ }
236
+
237
+ if (map.title) {
238
+ $titleElement.append(map.title).addClass(options.titleClass);
239
+ $toastElement.append($titleElement);
240
+ }
241
+
242
+ if (map.message) {
243
+ $messageElement.append(map.message).addClass(options.messageClass);
244
+ $toastElement.append($messageElement);
245
+ }
246
+
247
+ if (options.closeButton) {
248
+ $closeElement.addClass('toast-close-button').attr('role', 'button');
249
+ $toastElement.prepend($closeElement);
250
+ }
251
+
252
+ if (options.progressBar) {
253
+ $progressElement.addClass('toast-progress');
254
+ $toastElement.prepend($progressElement);
255
+ }
256
+
257
+ $toastElement.hide();
258
+ if (options.newestOnTop) {
259
+ $container.prepend($toastElement);
260
+ } else {
261
+ $container.append($toastElement);
262
+ }
263
+ $toastElement[options.showMethod](
264
+ {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
265
+ );
266
+
267
+ if (options.timeOut > 0) {
268
+ intervalId = setTimeout(hideToast, options.timeOut);
269
+ progressBar.maxHideTime = parseFloat(options.timeOut);
270
+ progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
271
+ if (options.progressBar) {
272
+ progressBar.intervalId = setInterval(updateProgress, 10);
273
+ }
274
+ }
275
+
276
+ $toastElement.hover(stickAround, delayedHideToast);
277
+ if (!options.onclick && options.tapToDismiss) {
278
+ $toastElement.click(hideToast);
279
+ }
280
+
281
+ if (options.closeButton && $closeElement) {
282
+ $closeElement.click(function (event) {
283
+ if (event.stopPropagation) {
284
+ event.stopPropagation();
285
+ } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
286
+ event.cancelBubble = true;
287
+ }
288
+ hideToast(true);
289
+ });
290
+ }
291
+
292
+ if (options.onclick) {
293
+ $toastElement.click(function () {
294
+ options.onclick();
295
+ hideToast();
296
+ });
297
+ }
298
+
299
+ publish(response);
300
+
301
+ if (options.debug && console) {
302
+ console.log(response);
303
+ }
304
+
305
+ return $toastElement;
306
+
307
+ function hideToast(override) {
308
+ if ($(':focus', $toastElement).length && !override) {
309
+ return;
310
+ }
311
+ clearTimeout(progressBar.intervalId);
312
+ return $toastElement[options.hideMethod]({
313
+ duration: options.hideDuration,
314
+ easing: options.hideEasing,
315
+ complete: function () {
316
+ removeToast($toastElement);
317
+ if (options.onHidden && response.state !== 'hidden') {
318
+ options.onHidden();
319
+ }
320
+ response.state = 'hidden';
321
+ response.endTime = new Date();
322
+ publish(response);
323
+ }
324
+ });
325
+ }
326
+
327
+ function delayedHideToast() {
328
+ if (options.timeOut > 0 || options.extendedTimeOut > 0) {
329
+ intervalId = setTimeout(hideToast, options.extendedTimeOut);
330
+ progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
331
+ progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
332
+ }
333
+ }
334
+
335
+ function stickAround() {
336
+ clearTimeout(intervalId);
337
+ progressBar.hideEta = 0;
338
+ $toastElement.stop(true, true)[options.showMethod](
339
+ {duration: options.showDuration, easing: options.showEasing}
340
+ );
341
+ }
342
+
343
+ function updateProgress() {
344
+ var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
345
+ $progressElement.width(percentage + '%');
346
+ }
347
+ }
348
+
349
+ function getOptions() {
350
+ return $.extend({}, getDefaults(), toastr.options);
351
+ }
352
+
353
+ function removeToast($toastElement) {
354
+ if (!$container) { $container = getContainer(); }
355
+ if ($toastElement.is(':visible')) {
356
+ return;
357
+ }
358
+ $toastElement.remove();
359
+ $toastElement = null;
360
+ if ($container.children().length === 0) {
361
+ $container.remove();
362
+ previousToast = undefined;
363
+ }
364
+ }
365
+ //#endregion
366
+
367
+ })();
368
+ });
369
+ }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
370
+ if (typeof module !== 'undefined' && module.exports) { //Node
371
+ module.exports = factory(require('jquery'));
372
+ } else {
373
+ window['toastr'] = factory(window['jQuery']);
374
+ }
375
+ }));
@@ -0,0 +1,30 @@
1
+ //= require 'toastr'
2
+
3
+ //toastr
4
+ toastr.options = {
5
+ "closeButton": true,
6
+ "debug": false,
7
+ "progressBar": true,
8
+ "positionClass": "toast-top-right",
9
+ "showDuration": "300",
10
+ "hideDuration": "1000",
11
+ "timeOut": "5000",
12
+ "extendedTimeOut": "1000",
13
+ "showEasing": "swing",
14
+ "hideEasing": "linear",
15
+ "showMethod": "fadeIn",
16
+ "hideMethod": "fadeOut"
17
+ };
18
+
19
+ var showToast = function(flash){
20
+ for(var i = 0; i < flash.length; i++ ){
21
+ msg = flash[i];
22
+ var type = {
23
+ notice: 'success',
24
+ alert: 'error',
25
+ warning: 'warning',
26
+ info: 'info'
27
+ };
28
+ toastr[type[msg[0]]](msg[1]);
29
+ }
30
+ };
@@ -0,0 +1,199 @@
1
+ .toast-title {
2
+ font-weight: bold;
3
+ }
4
+ .toast-message {
5
+ -ms-word-wrap: break-word;
6
+ word-wrap: break-word;
7
+ }
8
+ .toast-message a,
9
+ .toast-message label {
10
+ color: #ffffff;
11
+ }
12
+ .toast-message a:hover {
13
+ color: #cccccc;
14
+ text-decoration: none;
15
+ }
16
+ .toast-close-button {
17
+ position: relative;
18
+ right: -0.3em;
19
+ top: -0.3em;
20
+ float: right;
21
+ font-size: 20px;
22
+ font-weight: bold;
23
+ color: #ffffff;
24
+ -webkit-text-shadow: 0 1px 0 #ffffff;
25
+ text-shadow: 0 1px 0 #ffffff;
26
+ opacity: 0.8;
27
+ -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
28
+ filter: alpha(opacity=80);
29
+ }
30
+ .toast-close-button:hover,
31
+ .toast-close-button:focus {
32
+ color: #000000;
33
+ text-decoration: none;
34
+ cursor: pointer;
35
+ opacity: 0.4;
36
+ -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
37
+ filter: alpha(opacity=40);
38
+ }
39
+ /*Additional properties for button version
40
+ iOS requires the button element instead of an anchor tag.
41
+ If you want the anchor version, it requires `href="#"`.*/
42
+ button.toast-close-button {
43
+ padding: 0;
44
+ cursor: pointer;
45
+ background: transparent;
46
+ border: 0;
47
+ -webkit-appearance: none;
48
+ }
49
+ .toast-top-center {
50
+ top: 0;
51
+ right: 0;
52
+ width: 100%;
53
+ }
54
+ .toast-bottom-center {
55
+ bottom: 0;
56
+ right: 0;
57
+ width: 100%;
58
+ }
59
+ .toast-top-full-width {
60
+ top: 0;
61
+ right: 0;
62
+ width: 100%;
63
+ }
64
+ .toast-bottom-full-width {
65
+ bottom: 0;
66
+ right: 0;
67
+ width: 100%;
68
+ }
69
+ .toast-top-left {
70
+ top: 12px;
71
+ left: 12px;
72
+ }
73
+ .toast-top-right {
74
+ top: 12px;
75
+ right: 12px;
76
+ }
77
+ .toast-bottom-right {
78
+ right: 12px;
79
+ bottom: 12px;
80
+ }
81
+ .toast-bottom-left {
82
+ bottom: 12px;
83
+ left: 12px;
84
+ }
85
+ #toast-container {
86
+ position: fixed;
87
+ z-index: 999999;
88
+ /*overrides*/
89
+
90
+ }
91
+ #toast-container * {
92
+ -moz-box-sizing: border-box;
93
+ -webkit-box-sizing: border-box;
94
+ box-sizing: border-box;
95
+ }
96
+ #toast-container > div {
97
+ position: relative;
98
+ overflow: hidden;
99
+ margin: 0 0 6px;
100
+ padding: 15px 15px 15px 50px;
101
+ width: 300px;
102
+ -moz-border-radius: 3px 3px 3px 3px;
103
+ -webkit-border-radius: 3px 3px 3px 3px;
104
+ border-radius: 3px 3px 3px 3px;
105
+ background-position: 15px center;
106
+ background-repeat: no-repeat;
107
+ -moz-box-shadow: 0 0 12px #999999;
108
+ -webkit-box-shadow: 0 0 12px #999999;
109
+ box-shadow: 0 0 12px #999999;
110
+ color: #ffffff;
111
+ opacity: 0.8;
112
+ -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
113
+ filter: alpha(opacity=80);
114
+ }
115
+ #toast-container > :hover {
116
+ -moz-box-shadow: 0 0 12px #000000;
117
+ -webkit-box-shadow: 0 0 12px #000000;
118
+ box-shadow: 0 0 12px #000000;
119
+ opacity: 1;
120
+ -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
121
+ filter: alpha(opacity=100);
122
+ cursor: pointer;
123
+ }
124
+ #toast-container > .toast-info {
125
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important;
126
+ }
127
+ #toast-container > .toast-error {
128
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important;
129
+ }
130
+ #toast-container > .toast-success {
131
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important;
132
+ }
133
+ #toast-container > .toast-warning {
134
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important;
135
+ }
136
+ #toast-container.toast-top-center > div,
137
+ #toast-container.toast-bottom-center > div {
138
+ width: 300px;
139
+ margin: auto;
140
+ }
141
+ #toast-container.toast-top-full-width > div,
142
+ #toast-container.toast-bottom-full-width > div {
143
+ width: 96%;
144
+ margin: auto;
145
+ }
146
+ .toast {
147
+ background-color: #030303;
148
+ }
149
+ .toast-success {
150
+ background-color: #51a351;
151
+ }
152
+ .toast-error {
153
+ background-color: #bd362f;
154
+ }
155
+ .toast-info {
156
+ background-color: #2f96b4;
157
+ }
158
+ .toast-warning {
159
+ background-color: #f89406;
160
+ }
161
+
162
+ .toast-progress {
163
+ position: absolute;
164
+ left: 0;
165
+ bottom: 0;
166
+ height: 4px;
167
+ background-color: #000000;
168
+ opacity: 0.4;
169
+ -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
170
+ filter: alpha(opacity=40);
171
+ }
172
+
173
+ /*Responsive Design*/
174
+ @media all and (max-width: 240px) {
175
+ #toast-container > div {
176
+ padding: 8px 8px 8px 50px;
177
+ width: 11em;
178
+ }
179
+ #toast-container .toast-close-button {
180
+ right: -0.2em;
181
+ top: -0.2em;
182
+ }
183
+ }
184
+ @media all and (min-width: 241px) and (max-width: 480px) {
185
+ #toast-container > div {
186
+ padding: 8px 8px 8px 50px;
187
+ width: 18em;
188
+ }
189
+ #toast-container .toast-close-button {
190
+ right: -0.2em;
191
+ top: -0.2em;
192
+ }
193
+ }
194
+ @media all and (min-width: 481px) and (max-width: 768px) {
195
+ #toast-container > div {
196
+ padding: 15px 15px 15px 50px;
197
+ width: 25em;
198
+ }
199
+ }
@@ -0,0 +1,5 @@
1
+ @import 'toastr';
2
+
3
+ #toast-container{
4
+ top: 70px;
5
+ }
@@ -0,0 +1,5 @@
1
+ <script type="text/javascript">
2
+ $(function(){
3
+ showToast(<%= flash.to_json.html_safe %>);
4
+ });
5
+ </script>
@@ -0,0 +1,2 @@
1
+ class Engine < ::Rails::Engine
2
+ end
@@ -0,0 +1,3 @@
1
+ module ToastrRails
2
+ VERSION = '2.1.0'
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'toastr_rails/engine'
2
+ require 'toastr_rails/version'
3
+
4
+ module ToastrRails
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'toastr_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'toastr_rails'
8
+ spec.version = ToastrRails::VERSION
9
+ spec.authors = ['Stjepan Hadjic']
10
+ spec.email = ['d4be4st@gmail.com']
11
+ spec.summary = 'Opinionated toastr js asset gem.'
12
+ spec.description = 'Add toastr js library and use replace ugly bootstrap flash messages'
13
+ spec.homepage = 'https://github.com/d4be4st/toastr_rails'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: toastr_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stjepan Hadjic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Add toastr js library and use replace ugly bootstrap flash messages
42
+ email:
43
+ - d4be4st@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - app/assets/javascript/toastr.js
54
+ - app/assets/javascript/toastr_rails.js
55
+ - app/assets/styleseets/toastr.scss
56
+ - app/assets/styleseets/toastr_rails.scss
57
+ - app/views/toastr_rails/_flash.html.erb
58
+ - lib/toastr_rails.rb
59
+ - lib/toastr_rails/engine.rb
60
+ - lib/toastr_rails/version.rb
61
+ - toastr_rails.gemspec
62
+ homepage: https://github.com/d4be4st/toastr_rails
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.2.2
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Opinionated toastr js asset gem.
86
+ test_files: []