maxchars 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,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in maxchars.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module Maxchars
2
+ VERSION = "0.0.1"
3
+ end
data/lib/maxchars.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "maxchars/version"
2
+
3
+ module Maxchars
4
+ # Your code goes here...
5
+ end
data/maxchars.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "maxchars/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "maxchars"
7
+ s.version = Maxchars::VERSION
8
+ s.authors = ["Alexander Presber"]
9
+ s.email = ["post@momolog.info"]
10
+ s.homepage = ""
11
+ s.summary = %q{input field character restriction}
12
+ s.description = %q{jquery plugin to restrict characters that can be put into an input field or text area. Displays remaining characters in a tipsy tooltip.}
13
+
14
+ s.rubyforge_project = "maxchars"
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
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ s.add_dependency 'jquery-rails', '>= 1.0'
25
+ end
@@ -0,0 +1,21 @@
1
+ # needs jquery + tipsy
2
+ $.fn.extend
3
+ maxChars: (setMaxLen) ->
4
+ this.each ->
5
+ $(this).tipsy({gravity: 'w', trigger: 'focus', html: true})
6
+ .each ->
7
+ el = $(this)
8
+ maxLen = setMaxLen ? el.data('maxlen')
9
+ template = el.data('maxlen-text') || 'remaining chars: %x'
10
+ hardLimit =!el.data('maxlen-soft')
11
+ el.data 'doUpdateTitle', ->
12
+ len = el.val().length
13
+ if hardLimit && (len > maxLen)
14
+ el.val(el.val().substr(0, maxLen))
15
+ len = maxLen
16
+ remaining = maxLen - len
17
+ remainingText = template.replace(/%x/, remaining)
18
+ el.attr('title', remainingText).tipsy('hide').tipsy('show')
19
+ len
20
+ .live 'keyup', ->
21
+ $(this).data('doUpdateTitle')()
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: maxchars
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alexander Presber
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-04 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jquery-rails
16
+ requirement: &70364554425300 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70364554425300
25
+ description: jquery plugin to restrict characters that can be put into an input field
26
+ or text area. Displays remaining characters in a tipsy tooltip.
27
+ email:
28
+ - post@momolog.info
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - Rakefile
36
+ - lib/maxchars.rb
37
+ - lib/maxchars/version.rb
38
+ - maxchars.gemspec
39
+ - vendor/assets/javascripts/maxChars.js.coffee
40
+ homepage: ''
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project: maxchars
60
+ rubygems_version: 1.8.15
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: input field character restriction
64
+ test_files: []