refinerycms-tags 1.0.1 → 1.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.
- data/app/controllers/admin/tags_controller.rb +5 -0
- data/app/views/shared/admin/_tag_editor.html.erb +10 -6
- data/app/views/shared/admin/_tag_list.html.erb +18 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/lolcat.yml +2 -0
- data/config/routes.rb +1 -1
- data/lib/refinerycms-tags.rb +1 -0
- data/public/javascripts/taglist.js +32 -0
- data/public/stylesheets/jquery.tagsinput.css +9 -7
- metadata +5 -3
@@ -3,4 +3,9 @@ class Admin::TagsController < Admin::BaseController
|
|
3
3
|
@tags = ActsAsTaggableOn::Tag.named_like(params[:term]).all
|
4
4
|
render :json => @tags.map(&:name) if request.xhr?
|
5
5
|
end
|
6
|
+
|
7
|
+
def destroy
|
8
|
+
ActsAsTaggableOn::Tag.find(params[:id]).destroy
|
9
|
+
render :nothing => true
|
10
|
+
end
|
6
11
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<%=
|
1
|
+
<% field_id = "#{f.object_name}_#{field}" %>
|
2
|
+
<div class="clearfix">
|
3
|
+
<span class="label_with_help">
|
4
|
+
<%= f.label field -%>
|
5
|
+
<%= refinery_help_tag t('.tag_help') %>
|
6
|
+
</span>
|
7
|
+
<%= f.text_area field %>
|
8
|
+
<%= render :partial => '/shared/admin/tag_list', :locals => {:field_id => field_id, :tags => local_assigns[:tags]} if local_assigns[:show_tag_list] %>
|
9
|
+
</div>
|
6
10
|
<%
|
7
11
|
unless @tag_editor_included
|
8
12
|
@tag_editor_included = true
|
@@ -12,5 +16,5 @@ end
|
|
12
16
|
|
13
17
|
autocomplete_url ||= admin_tags_path if autocomplete
|
14
18
|
default_text ||= '.default_text'
|
15
|
-
content_for :javascripts, javascript_tag("$(document).ready(function() { $('##{
|
19
|
+
content_for :javascripts, javascript_tag("$(document).ready(function() { $('##{field_id}').tagsInput({defaultText: '#{t default_text}'#{', autocomplete_url: ' + autocomplete_url.to_json if autocomplete}}); })")
|
16
20
|
%>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% tags ||= ActsAsTaggableOn::Tag.order(:name).all %>
|
2
|
+
<%= content_tag :ul, :class => 'tagsinput tag_list' do %>
|
3
|
+
<% tags.each do |tag| %>
|
4
|
+
<li><span class="tag">
|
5
|
+
<%= content_tag :span, tag.name %>
|
6
|
+
<%= link_to 'x', admin_tag_path(tag) %>
|
7
|
+
</span></li>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%
|
12
|
+
unless @taglist_included
|
13
|
+
@taglist_included = true
|
14
|
+
content_for :after_javascript_libraries, javascript_include_tag("taglist.js")
|
15
|
+
end
|
16
|
+
|
17
|
+
content_for :javascripts, javascript_tag("$(document).ready(function() { $('##{field_id} ~ .tag_list').tagList($('##{field_id}'), {confirm: '#{t '.delete_tag_confirm'}'}); });")
|
18
|
+
%>
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/lolcat.yml
CHANGED
data/config/routes.rb
CHANGED
data/lib/refinerycms-tags.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Tag List for jQuery Tags Input plugin
|
4
|
+
|
5
|
+
Copyright (c) 2012 Sergio Cambra
|
6
|
+
|
7
|
+
Licensed under the MIT license:
|
8
|
+
http://www.opensource.org/licenses/mit-license.php
|
9
|
+
|
10
|
+
sergio@entrecables.com
|
11
|
+
|
12
|
+
*/
|
13
|
+
(function( $, undefined ) {
|
14
|
+
$.fn.tagList = function(tagsinput, options) {
|
15
|
+
var options = $.extend({}, options);
|
16
|
+
$(this).find('.tag').click(function(e) {
|
17
|
+
e.preventDefault();
|
18
|
+
if (!$(e.target).is('a')) tagsinput.addTag($(this).find('span').html());
|
19
|
+
});
|
20
|
+
$(this).find('.tag a').click(function(e) {
|
21
|
+
e.preventDefault();
|
22
|
+
var tag = $(this).closest('.tag');
|
23
|
+
if (!options.confirm || confirm(options.confirm)) {
|
24
|
+
$.post($(this).attr('href'), '_method=delete', function() {
|
25
|
+
tagsinput.removeTag(tag.find('span').html());
|
26
|
+
tag.remove();
|
27
|
+
});
|
28
|
+
}
|
29
|
+
});
|
30
|
+
};
|
31
|
+
})(jQuery);
|
32
|
+
|
@@ -1,12 +1,14 @@
|
|
1
|
-
div.tagsinput { border:1px solid #CCC; background: #FFF; padding:5px; width:300px; height:100px; overflow-y: auto;}
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
div.tagsinput { border:1px solid #CCC; background: #FFF; padding:5px; width:300px; height:100px; overflow-y: auto; float: left;}
|
2
|
+
.tagsinput span.tag { border: 1px solid #1C89C7; -moz-border-radius:2px; -webkit-border-radius:2px; display: block; float: left; padding: 5px; text-decoration:none; background: #22a7f2; color: #fff; margin-right: 5px; margin-bottom:5px;font-family: helvetica; font-size:13px;}
|
3
|
+
.tagsinput span.tag span { color: #fff; }
|
4
|
+
.tagsinput span.tag a { font-weight: bold; color: #fff; text-decoration:none; font-size: 11px; }
|
5
|
+
.tagsinput input { width:80px; margin:0px; font-family: helvetica; font-size: 13px; border:1px solid transparent; padding:5px; background: transparent; color: #000; outline:0px; margin-right:5px; margin-bottom:5px; }
|
6
6
|
div.tagsinput div { display:block; float: left; }
|
7
7
|
.tags_clear { clear: both; width: 100%; height: 0px; }
|
8
8
|
.not_valid {background: #FBD8DB !important; color: #90111A !important;}
|
9
|
-
#content
|
9
|
+
#content .tagsinput span.tag a { border-bottom: none; }
|
10
|
+
ul.tag_list { list-style: none; margin-left: 300px; padding-left: 20px; }
|
11
|
+
ul.tag_list li { float: left; }
|
10
12
|
/*
|
11
13
|
* jQuery UI Menu 1.8.17
|
12
14
|
*
|
@@ -57,7 +59,7 @@ div.tagsinput div { display:block; float: left; }
|
|
57
59
|
*/
|
58
60
|
.ui-autocomplete { position: absolute; cursor: default; border: 1px solid #aaaaaa; background: #ffffff; color: #222222; }
|
59
61
|
.ui-autocomplete a { color: #222222; }
|
60
|
-
.ui-
|
62
|
+
.ui-autocomplete .ui-state-hover { border: 1px solid #999999; background: #22a7f2 url(/images/refinery/ui-bg_glass_75_22a7f2_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
61
63
|
|
62
64
|
/* workarounds */
|
63
65
|
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sergio Cambra
|
@@ -44,6 +44,7 @@ extra_rdoc_files: []
|
|
44
44
|
files:
|
45
45
|
- app/controllers/admin/tags_controller.rb
|
46
46
|
- app/views/shared/admin/_tag_editor.html.erb
|
47
|
+
- app/views/shared/admin/_tag_list.html.erb
|
47
48
|
- config/locales/en.yml
|
48
49
|
- config/locales/es.yml
|
49
50
|
- config/locales/lolcat.yml
|
@@ -54,6 +55,7 @@ files:
|
|
54
55
|
- public/images/refinery/ui-bg_glass_75_22a7f2_1x400.png
|
55
56
|
- public/javascripts/jquery.tagsinput.js
|
56
57
|
- public/javascripts/jquery.tagsinput.min.js
|
58
|
+
- public/javascripts/taglist.js
|
57
59
|
- public/stylesheets/jquery.tagsinput.css
|
58
60
|
homepage: http://github.com/scambra/refinerycms-tags
|
59
61
|
licenses: []
|