messenger-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04a1c068129c48d6864474b3a115e4a7183d3180
4
+ data.tar.gz: b133381ed2ae4d6b41e17a9188f7ee3c71e2f732
5
+ SHA512:
6
+ metadata.gz: afdb5ebbe1bf065cb5833806326a45177ab3b8d49b92d6dcf28e7edfd0617c25182c37ab9a9aebcbd33aec0add10251732aa8deb8d06e8b3fd46d7e15647612e
7
+ data.tar.gz: 77fdca27e63eb16405846fcdbb9228b59718ec4a24ab6d58fb1a217dab5d48628d631a03718fa65e46951afc1d26266732cba0019fa44958f9b228ef17b4bf2f
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Thierry Zires
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
+
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ messengerjs
2
+ ===========
3
+
4
+ Rails assets pipeline for messenger
@@ -0,0 +1 @@
1
+ require 'messenger_rails'
@@ -0,0 +1,13 @@
1
+ require 'messenger_rails/view_helper'
2
+ module MessengerRails
3
+ class Engine < ::Rails::Engine
4
+
5
+ initializer "Messenger.helpers" do
6
+ ActiveSupport.on_load :action_view do
7
+ include MessengerRails::ViewHelper
8
+ end
9
+ end
10
+
11
+ end
12
+ end
13
+
@@ -0,0 +1,24 @@
1
+ module MessengerRails
2
+ module ViewHelper
3
+ extend ActiveSupport::Concern
4
+
5
+ # @example
6
+ # <%= flash_messenger %>
7
+ def flash_messenger(opts = {})
8
+ flash.inject('') do |str, message|
9
+ type = message[0] == 'alert' ? 'error' : 'info'
10
+ str + javascript_tag("Messenger().post({message: '#{message[1]}', type: '#{type}', hideAfter: 3, hideOnNavigate: true, showCloseButton: true});")
11
+ end.html_safe
12
+ end
13
+
14
+ # @example
15
+ # <%= form_messenger(@record) %>
16
+ def form_messenger(record, opts = {})
17
+ if record.errors.any?
18
+ messages = record.errors.full_messages.join('<br />')
19
+ javascript_tag("Messenger().post({message: '#{messages}', type: 'error', hideAfter: 3, hideOnNavigate: true, showCloseButton: true});")
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ module MessengerRails
2
+ end
3
+
4
+ require 'messenger_rails/engine' if defined?(Rails)
@@ -0,0 +1,33 @@
1
+ (function() {
2
+ var $, FlatMessage, spinner_template,
3
+ __hasProp = {}.hasOwnProperty,
4
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
5
+
6
+ $ = jQuery;
7
+
8
+ spinner_template = '<div class="messenger-spinner">\n <span class="messenger-spinner-side messenger-spinner-side-left">\n <span class="messenger-spinner-fill"></span>\n </span>\n <span class="messenger-spinner-side messenger-spinner-side-right">\n <span class="messenger-spinner-fill"></span>\n </span>\n</div>';
9
+
10
+ FlatMessage = (function(_super) {
11
+
12
+ __extends(FlatMessage, _super);
13
+
14
+ function FlatMessage() {
15
+ return FlatMessage.__super__.constructor.apply(this, arguments);
16
+ }
17
+
18
+ FlatMessage.prototype.template = function(opts) {
19
+ var $message;
20
+ $message = FlatMessage.__super__.template.apply(this, arguments);
21
+ $message.append($(spinner_template));
22
+ return $message;
23
+ };
24
+
25
+ return FlatMessage;
26
+
27
+ })(window.Messenger.Message);
28
+
29
+ window.Messenger.themes.flat = {
30
+ Message: FlatMessage
31
+ };
32
+
33
+ }).call(this);
@@ -0,0 +1,33 @@
1
+ (function() {
2
+ var $, FutureMessage, spinner_template,
3
+ __hasProp = {}.hasOwnProperty,
4
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
5
+
6
+ $ = jQuery;
7
+
8
+ spinner_template = '<div class="messenger-spinner">\n <span class="messenger-spinner-side messenger-spinner-side-left">\n <span class="messenger-spinner-fill"></span>\n </span>\n <span class="messenger-spinner-side messenger-spinner-side-right">\n <span class="messenger-spinner-fill"></span>\n </span>\n</div>';
9
+
10
+ FutureMessage = (function(_super) {
11
+
12
+ __extends(FutureMessage, _super);
13
+
14
+ function FutureMessage() {
15
+ return FutureMessage.__super__.constructor.apply(this, arguments);
16
+ }
17
+
18
+ FutureMessage.prototype.template = function(opts) {
19
+ var $message;
20
+ $message = FutureMessage.__super__.template.apply(this, arguments);
21
+ $message.append($(spinner_template));
22
+ return $message;
23
+ };
24
+
25
+ return FutureMessage;
26
+
27
+ })(window.Messenger.Message);
28
+
29
+ window.Messenger.themes.future = {
30
+ Message: FutureMessage
31
+ };
32
+
33
+ }).call(this);