smart_tag 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/smart_tag/engine.rb +18 -0
- data/lib/smart_tag/helper.rb +27 -0
- data/lib/smart_tag/version.rb +1 -1
- data/lib/smart_tag.rb +4 -5
- data/smart_tag.gemspec +2 -0
- data/vendor/assets/stylesheets/smart_tag/jquery.tagit.css +67 -0
- metadata +23 -6
- data/bin/smart_tag +0 -2
@@ -0,0 +1,18 @@
|
|
1
|
+
require "taggingform"
|
2
|
+
require "rails"
|
3
|
+
require "action_controller"
|
4
|
+
|
5
|
+
module SmartTag
|
6
|
+
module Rails
|
7
|
+
class Engine < ::Rails::Engine
|
8
|
+
|
9
|
+
initializer "smart_tag.helper_and_builder" do
|
10
|
+
ActiveSupport.on_load :action_view do
|
11
|
+
ActionView::Base.send(:include, SmartTag::Helper)
|
12
|
+
ActionView::Helpers::FormBuilder.send(:include, SmartTag::Builder)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module SmartTag
|
2
|
+
module Helper
|
3
|
+
|
4
|
+
# def tadding_tag(name, content = nil, options = {})
|
5
|
+
# id = sanitize_to_id(name)
|
6
|
+
# input_html = { :id => id }.merge(options.delete(:input_html) || {})
|
7
|
+
# output = ActiveSupport::SafeBuffer.new
|
8
|
+
# output << text_area_tag(name, content, input_html)
|
9
|
+
# end
|
10
|
+
|
11
|
+
def smart_tag(name, method, options = {})
|
12
|
+
input_html = (options.delete(:input_html) || {})
|
13
|
+
hash = input_html.stringify_keys
|
14
|
+
instance_tag = ActionView::Base::InstanceTag.new(name, method, self, options.delete(:object))
|
15
|
+
instance_tag.send(:add_default_name_and_id, hash)
|
16
|
+
output_buffer = ActiveSupport::SafeBuffer.new
|
17
|
+
output_buffer << instance_tag.to_text_area_tag(input_html)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
module Builder
|
23
|
+
def smart_tag(method, options = {})
|
24
|
+
@template.send("smart_tag", @object_name, method, objectify_options(options))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/smart_tag/version.rb
CHANGED
data/lib/smart_tag.rb
CHANGED
data/smart_tag.gemspec
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
ul.tagit {
|
2
|
+
padding: 1px 5px;
|
3
|
+
overflow: auto;
|
4
|
+
margin-left: inherit; /* usually we don't want the regular ul margins. */
|
5
|
+
margin-right: inherit;
|
6
|
+
}
|
7
|
+
ul.tagit li {
|
8
|
+
display: block;
|
9
|
+
float: left;
|
10
|
+
margin: 2px 5px 2px 0;
|
11
|
+
}
|
12
|
+
ul.tagit li.tagit-choice {
|
13
|
+
position: relative;
|
14
|
+
line-height: inherit;
|
15
|
+
}
|
16
|
+
|
17
|
+
ul.tagit li.tagit-choice-read-only {
|
18
|
+
padding: .2em .5em .2em .5em;
|
19
|
+
}
|
20
|
+
|
21
|
+
ul.tagit li.tagit-choice-editable {
|
22
|
+
padding: .2em 18px .2em .5em;
|
23
|
+
}
|
24
|
+
|
25
|
+
ul.tagit li.tagit-new {
|
26
|
+
padding: .25em 4px .25em 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
ul.tagit li.tagit-choice a.tagit-label {
|
30
|
+
cursor: pointer;
|
31
|
+
text-decoration: none;
|
32
|
+
}
|
33
|
+
ul.tagit li.tagit-choice .tagit-close {
|
34
|
+
cursor: pointer;
|
35
|
+
position: absolute;
|
36
|
+
right: .1em;
|
37
|
+
top: 50%;
|
38
|
+
margin-top: -8px;
|
39
|
+
line-height: 17px;
|
40
|
+
}
|
41
|
+
|
42
|
+
/* used for some custom themes that don't need image icons */
|
43
|
+
ul.tagit li.tagit-choice .tagit-close .text-icon {
|
44
|
+
display: none;
|
45
|
+
}
|
46
|
+
|
47
|
+
ul.tagit li.tagit-choice input {
|
48
|
+
display: block;
|
49
|
+
float: left;
|
50
|
+
margin: 2px 5px 2px 0;
|
51
|
+
}
|
52
|
+
ul.tagit input[type="text"] {
|
53
|
+
-moz-box-sizing: border-box;
|
54
|
+
-webkit-box-sizing: border-box;
|
55
|
+
box-sizing: border-box;
|
56
|
+
|
57
|
+
-moz-box-shadow: none;
|
58
|
+
-webkit-box-shadow: none;
|
59
|
+
box-shadow: none;
|
60
|
+
|
61
|
+
border: none;
|
62
|
+
margin: 0;
|
63
|
+
padding: 0;
|
64
|
+
width: inherit;
|
65
|
+
background-color: inherit;
|
66
|
+
outline: none;
|
67
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,13 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
13
|
-
dependencies:
|
12
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jquery-ui-rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
14
30
|
description: ! 'Tag-it: a jQuery UI plugin'
|
15
31
|
email:
|
16
32
|
- info@tuliang.org
|
17
|
-
executables:
|
18
|
-
- smart_tag
|
33
|
+
executables: []
|
19
34
|
extensions: []
|
20
35
|
extra_rdoc_files: []
|
21
36
|
files:
|
@@ -24,11 +39,13 @@ files:
|
|
24
39
|
- LICENSE.txt
|
25
40
|
- README.md
|
26
41
|
- Rakefile
|
27
|
-
- bin/smart_tag
|
28
42
|
- lib/smart_tag.rb
|
43
|
+
- lib/smart_tag/engine.rb
|
44
|
+
- lib/smart_tag/helper.rb
|
29
45
|
- lib/smart_tag/version.rb
|
30
46
|
- smart_tag.gemspec
|
31
47
|
- vendor/assets/javascripts/smart_tag/tag-it.min.js
|
48
|
+
- vendor/assets/stylesheets/smart_tag/jquery.tagit.css
|
32
49
|
homepage: https://github.com/tuliang/smart_tag
|
33
50
|
licenses: []
|
34
51
|
post_install_message:
|
data/bin/smart_tag
DELETED