jquery-taggable-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: 286c0a6c20dd15534776896abe23d6d672914941
4
+ data.tar.gz: 90b843800fd9e6d2e4248e2c601678a87e0c3002
5
+ SHA512:
6
+ metadata.gz: eea56368664fe96228b8e7b169a9dfd9a11408b76f550bf3753c63f01bbce6eb7ace9313787c3a7344ffd51af21a603eb7364bb058fc558775a7661300542221
7
+ data.tar.gz: d5fae512858f271c031ae4d15c388b2fd29de789e45b71de849fb9eb871a1f5787c7bd1a5fa1c5229e772e226cd95a4a5ffd6b87afa30331058e547fb036912c
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jquery-taggable-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tatsuro Baba
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,29 @@
1
+ # Jquery::Taggable::Rails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'jquery-taggable-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install jquery-taggable-rails
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jquery-taggable-rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jquery-taggable-rails"
8
+ spec.version = Jquery::Taggable::Rails::VERSION
9
+ spec.authors = ["Tatsuro Baba"]
10
+ spec.email = ["harakirisoul@gmail.com"]
11
+ spec.description = %q{jquery-taggable-rails is simple javascript to make tags.}
12
+ spec.summary = %q{jquery-taggable-rails is simple javascript to make tags.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'railties', '>= 3.1.1'
21
+ end
@@ -0,0 +1,8 @@
1
+ module Jquery
2
+ module Taggable
3
+ module Rails
4
+ require 'jquery-taggable-rails/engine'
5
+ require 'jquery-taggable-rails/version'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Jquery
2
+ module Taggable
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Jquery
2
+ module Taggable
3
+ module Rails
4
+ VERSION = '0.0.1'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,45 @@
1
+ $.fn.taggable = (options) ->
2
+ inputField = $(this)
3
+ defaultOptions =
4
+ key: 13
5
+ hiddenFieldName: '#tag_list'
6
+ tagName: '.tag'
7
+
8
+ options = $.extend defaultOptions, options
9
+
10
+ inputField
11
+ .on 'keypress', (ev) ->
12
+ if ev.keyCode is options.key
13
+ ev.preventDefault()
14
+ value = ev.target.value
15
+
16
+ if value isnt ''
17
+ if $.isEmptyObject $(options.hiddenFieldName).val()
18
+ tags = []
19
+ else
20
+ tags = $(options.hiddenFieldName).val().split(',')
21
+ tags.push value
22
+ $(options.hiddenFieldName).val(tags.join())
23
+
24
+ li = "<li data-tag-name='#{value}' class='tag'>#{value}<a href='#' class='remove'>x</a></li>"
25
+ $('.tag_list').append li
26
+ inputField.val('')
27
+
28
+ $('.remove')
29
+ .on 'click', (ev) ->
30
+ ev.preventDefault()
31
+ value = $(this).parent().data 'tag-name'
32
+
33
+ tags = $(options.hiddenFieldName).val()
34
+ tags = tags.split(',')
35
+ tags = $.map tags, (n, i) ->
36
+ if n isnt value
37
+ n
38
+ else
39
+ null
40
+ $(options.hiddenFieldName).val(tags.join())
41
+
42
+ $(this).parent().remove()
43
+
44
+ $ ->
45
+ $('.taggable').taggable()
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery-taggable-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tatsuro Baba
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.1.1
27
+ description: jquery-taggable-rails is simple javascript to make tags.
28
+ email:
29
+ - harakirisoul@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - jquery-taggable-rails.gemspec
40
+ - lib/jquery-taggable-rails.rb
41
+ - lib/jquery-taggable-rails/engine.rb
42
+ - lib/jquery-taggable-rails/version.rb
43
+ - vendor/assets/javascripts/jquery.taggable.js.coffee
44
+ homepage: ''
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.0.2
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: jquery-taggable-rails is simple javascript to make tags.
68
+ test_files: []