tagsjs-rails 0.0.3
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +32 -0
- data/Rakefile +32 -0
- data/app/assets/javascripts/tagsjs/core.js +76 -0
- data/config/routes.rb +2 -0
- data/lib/tagsjs/rails/engine.rb +7 -0
- data/lib/tagsjs/rails/version.rb +5 -0
- data/lib/tagsjs/rails.rb +7 -0
- data/lib/tasks/tagsjs/rails_tasks.rake +4 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0e895adee19d0ce08265904cf52874bab40dfa78fc9239c0b116e3c7abcc8b47
|
4
|
+
data.tar.gz: 54daee958766e92a31bd613e374e3b544545f7261afc1fd655a54d5bb004c754
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 30aa49e965e24a26a8022020bad24a0df013669c4691affbca66d2b7eeadeccf6e34313296e8b831b60f865c3dac1829c2bc665ad03ef6bc9a6cf31cb4b2f9fc
|
7
|
+
data.tar.gz: 10682fd5b6e9e40b4453596c2ed0ad9bad81e93b61ce116fe78c32b8da48b42d1f2b4ccb97252d22692d0471810f54da54511b5aa79a139fc937c1bac58d92b8
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2019 Federico Ramirez
|
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,32 @@
|
|
1
|
+
# Tagsjs::Rails
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
In your `application.js`
|
6
|
+
|
7
|
+
```javascript
|
8
|
+
//= require tagsjs/core
|
9
|
+
```
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'tagsjs-rails'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
```bash
|
20
|
+
$ bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
```bash
|
25
|
+
$ gem install tagsjs-rails
|
26
|
+
```
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
Contribution directions go here.
|
30
|
+
|
31
|
+
## License
|
32
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Tagsjs::Rails'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
+
|
5
|
+
(function (factory) {
|
6
|
+
if (typeof define === 'function' && define.amd) {
|
7
|
+
// AMD
|
8
|
+
define([], factory);
|
9
|
+
} else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') {
|
10
|
+
// Node, CommonJS-like
|
11
|
+
module.exports = factory();
|
12
|
+
} else {
|
13
|
+
window.tag = factory();
|
14
|
+
}
|
15
|
+
})(function () {
|
16
|
+
var jstags = {
|
17
|
+
_createElement: function _createElement(tag, attributes, content) {
|
18
|
+
if (typeof attributes === 'string') {
|
19
|
+
content = attributes;
|
20
|
+
}
|
21
|
+
|
22
|
+
var element = document.createElement(tag);
|
23
|
+
|
24
|
+
this._setElementContents(content, element);
|
25
|
+
|
26
|
+
this._setElementAttributes(attributes, element);
|
27
|
+
|
28
|
+
return element;
|
29
|
+
},
|
30
|
+
_setElementAttributes: function _setElementAttributes(attributes, element) {
|
31
|
+
var _this = this;
|
32
|
+
|
33
|
+
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
34
|
+
if (_typeof(attributes) !== 'object') return;
|
35
|
+
Object.keys(attributes).forEach(function (key) {
|
36
|
+
var value = attributes[key];
|
37
|
+
|
38
|
+
if (_typeof(value) === 'object') {
|
39
|
+
var _prefix = "".concat(key, "-");
|
40
|
+
|
41
|
+
_this._setElementAttributes(value, element, _prefix);
|
42
|
+
} else {
|
43
|
+
element.setAttribute("".concat(prefix).concat(key), attributes[key]);
|
44
|
+
}
|
45
|
+
});
|
46
|
+
},
|
47
|
+
_setElementContents: function _setElementContents(content, element) {
|
48
|
+
var _this2 = this;
|
49
|
+
|
50
|
+
if (!content) return;
|
51
|
+
|
52
|
+
if (typeof content === 'function') {
|
53
|
+
content = content();
|
54
|
+
}
|
55
|
+
|
56
|
+
if (typeof content === 'string') {
|
57
|
+
element.textContent = content;
|
58
|
+
} else if (_typeof(content) === 'object') {
|
59
|
+
if (Array.isArray(content)) {
|
60
|
+
content.forEach(function (c) {
|
61
|
+
return _this2._setElementContents(c, element);
|
62
|
+
});
|
63
|
+
} else {
|
64
|
+
element.appendChild(content);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
};
|
69
|
+
var AVAILABLE_TAGS = ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'svg', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'];
|
70
|
+
AVAILABLE_TAGS.forEach(function (tag) {
|
71
|
+
jstags[tag] = function (attributes, content) {
|
72
|
+
return this._createElement(tag, attributes, content);
|
73
|
+
};
|
74
|
+
});
|
75
|
+
return jstags;
|
76
|
+
});
|
data/config/routes.rb
ADDED
data/lib/tagsjs/rails.rb
ADDED
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tagsjs-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Federico Ramirez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- fedra.arg@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/javascripts/tagsjs/core.js
|
38
|
+
- config/routes.rb
|
39
|
+
- lib/tagsjs/rails.rb
|
40
|
+
- lib/tagsjs/rails/engine.rb
|
41
|
+
- lib/tagsjs/rails/version.rb
|
42
|
+
- lib/tasks/tagsjs/rails_tasks.rake
|
43
|
+
homepage: https://github.com/gosukiwi/tagsjs-rails
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubygems_version: 3.0.3
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Human-friendly API for building DOM elements in JavaScript.
|
66
|
+
test_files: []
|