jquery-disablewith 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ *.swp
3
+ *.swo
4
+ .bundle
5
+ Gemfile.lock
6
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in disable_with.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # jquery-disablewith
2
+
3
+ jQuery plugin for rails applications, which provides an simple method to disable
4
+ AJAX button and replace its text while the request is running.
5
+
6
+ # Example
7
+
8
+ somewhere in your views:
9
+
10
+ = link_to "Send request", url, remote: true
11
+
12
+ then in application.js you can write something like that:
13
+
14
+ $("a").disableWith({ text: "Processing..." })
15
+
16
+ It will replace "Send request" words with "Processing..." before the request start,
17
+ and turn it back on complete.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jquery/disablewith/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "jquery-disablewith"
7
+ s.version = Jquery::Disablewith::VERSION
8
+ s.authors = ["Alexander Glushkov"]
9
+ s.email = ["cutalion@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Plugin for disabling remote links}
12
+ s.description = %q{This plugin gives you an option to disable remote links during the AJAX request}
13
+
14
+ s.rubyforge_project = "jquery-disablewith"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
@@ -0,0 +1 @@
1
+ require "jquery/disablewith"
@@ -0,0 +1,9 @@
1
+ require 'jquery/disablewith/version'
2
+
3
+ module Jquery
4
+ module Disablewith
5
+ class Engine < ::Rails::Engine
6
+ # dummy engine class to add gem asseets to the assets pipeline paths
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Jquery
2
+ module Disablewith
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ (function($){
2
+ $.fn.disableWith = function(options){
3
+
4
+ var settings = $.extend({
5
+ text: 'Processing...'
6
+ }, options);
7
+
8
+ this.bind('ajax:beforeSend', function(){
9
+ $(this)._previous_text = $(this).html();
10
+ $(this).html(settings.text);
11
+ });
12
+
13
+ this.bind('ajax:complete', function(){
14
+ $(this).html($(this)._previous_text);
15
+ });
16
+
17
+ return this;
18
+ };
19
+ })(jQuery);
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery-disablewith
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Alexander Glushkov
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-12-10 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: This plugin gives you an option to disable remote links during the AJAX request
22
+ email:
23
+ - cutalion@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - README.md
34
+ - Rakefile
35
+ - jquery-disablewith.gemspec
36
+ - lib/jquery-disablewith.rb
37
+ - lib/jquery/disablewith.rb
38
+ - lib/jquery/disablewith/version.rb
39
+ - vendor/assets/javascripts/jquery.disablewith.js
40
+ homepage: ""
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ hash: 3
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ requirements: []
67
+
68
+ rubyforge_project: jquery-disablewith
69
+ rubygems_version: 1.8.6
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Plugin for disabling remote links
73
+ test_files: []
74
+