godmin-tags 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +8 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.md +38 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/godmin-tagger.js +39 -0
- data/godmin-tags.gemspec +26 -0
- data/lib/godmin/tags.rb +9 -0
- data/lib/godmin/tags/engine.rb +6 -0
- data/lib/godmin/tags/helper.rb +11 -0
- data/lib/godmin/tags/version.rb +5 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7acbc6fc24a84caecc4798a4e84d096941af87d8
|
4
|
+
data.tar.gz: 40fa84de37f12fd86b029095a1a9cf51ef22f370
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2f3b4a75fea54904f76b666fa63a951c0bc52243880f2effa42bf8fb6022f1b6d0a5a5472222464baa3484cefb7196431c72e0868ee726a5ec92dd1b2ac22db2
|
7
|
+
data.tar.gz: 90ac8ca9c485621a87fffdbac9f06cd2b86fa6fcff9b0608d17d5dd21c87eca210a91fd9e11ee40aba02ac71e3872e572320e756a5808c32f104685e4cb07967
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 Varvet
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Godmin Tags
|
2
|
+
|
3
|
+
[![Gem Version](http://img.shields.io/gem/v/godmin-tags.svg)](https://rubygems.org/gems/godmin-tags)
|
4
|
+
|
5
|
+
Godmin Tags is a tags component for [Godmin](https://github.com/varvet/godmin) that adds an `f.tags_field` to forms.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add the gem to the application's `Gemfile`:
|
10
|
+
```ruby
|
11
|
+
gem "godmin-tags"
|
12
|
+
```
|
13
|
+
|
14
|
+
Or to the admin engine's `gemspec`:
|
15
|
+
```ruby
|
16
|
+
s.add_dependency "godmin-tags", "~> x.x.x"
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Use the tags field in your form like so:
|
22
|
+
|
23
|
+
```erb
|
24
|
+
<%= form_for(@resource) do |f| %>
|
25
|
+
<%= f.input_field :title %>
|
26
|
+
<%= f.text_field :body %>
|
27
|
+
|
28
|
+
<%= f.tags_field :tags, data: { collection: Tag.all.pluck(:name) } %>
|
29
|
+
<% end %>
|
30
|
+
```
|
31
|
+
|
32
|
+
## Contributors
|
33
|
+
|
34
|
+
https://github.com/varvet/godmin-uploads/graphs/contributors
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
Licensed under the MIT license. See the separate MIT-LICENSE file.
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
window.Godmin = window.Godmin || {};
|
2
|
+
|
3
|
+
Godmin.Tags = (function() {
|
4
|
+
function initialize() {
|
5
|
+
initializeState();
|
6
|
+
}
|
7
|
+
|
8
|
+
function initializeState() {
|
9
|
+
initializeTagger($('[data-behavior~=tagger]'));
|
10
|
+
}
|
11
|
+
|
12
|
+
function initializeTagger($el, options) {
|
13
|
+
options = {
|
14
|
+
delimiter: ', ',
|
15
|
+
create: true,
|
16
|
+
valueField: 'name',
|
17
|
+
labelField: 'name',
|
18
|
+
searchField: 'name',
|
19
|
+
load: function(query, callback) {
|
20
|
+
if (!query.length) return callback();
|
21
|
+
callback(
|
22
|
+
$el.data('collection').map(function(tag) {
|
23
|
+
return { name: tag };
|
24
|
+
})
|
25
|
+
);
|
26
|
+
}
|
27
|
+
};
|
28
|
+
Godmin.SelectBoxes.initializeSelectBox($el, options);
|
29
|
+
}
|
30
|
+
|
31
|
+
return {
|
32
|
+
initialize: initialize,
|
33
|
+
initializeTagger: initializeTagger
|
34
|
+
};
|
35
|
+
})();
|
36
|
+
|
37
|
+
$(function() {
|
38
|
+
Godmin.Tags.initialize();
|
39
|
+
});
|
data/godmin-tags.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "godmin/tags/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |gem|
|
8
|
+
gem.name = "godmin-tags"
|
9
|
+
gem.version = Godmin::Tags::VERSION
|
10
|
+
gem.authors = ["Varvet"]
|
11
|
+
gem.email = ["info@varvet.se"]
|
12
|
+
gem.homepage = "https://github.com/varvet/godmin-tags"
|
13
|
+
gem.summary = "Tags for the Godmin admin engine for Rails 4+"
|
14
|
+
gem.description = "Tags for the Godmin admin engine for Rails 4+"
|
15
|
+
gem.license = "MIT"
|
16
|
+
|
17
|
+
gem.files = `git ls-files -z`.split("\x0")
|
18
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
|
+
gem.require_paths = ["lib"]
|
21
|
+
|
22
|
+
gem.add_dependency "godmin", "~> 0.9", ">= 0.9.7"
|
23
|
+
|
24
|
+
gem.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
gem.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
data/lib/godmin/tags.rb
ADDED
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: godmin-tags
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Varvet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: godmin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.7
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.9'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.7
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.7'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.7'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '10.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '10.0'
|
61
|
+
description: Tags for the Godmin admin engine for Rails 4+
|
62
|
+
email:
|
63
|
+
- info@varvet.se
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- ".gitignore"
|
69
|
+
- ".rubocop.yml"
|
70
|
+
- Gemfile
|
71
|
+
- MIT-LICENSE
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- app/assets/javascripts/godmin-tagger.js
|
75
|
+
- godmin-tags.gemspec
|
76
|
+
- lib/godmin/tags.rb
|
77
|
+
- lib/godmin/tags/engine.rb
|
78
|
+
- lib/godmin/tags/helper.rb
|
79
|
+
- lib/godmin/tags/version.rb
|
80
|
+
homepage: https://github.com/varvet/godmin-tags
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.2.2
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Tags for the Godmin admin engine for Rails 4+
|
104
|
+
test_files: []
|
105
|
+
has_rdoc:
|