i18n for closet_hangers#index search bar autocomplete
This commit is contained in:
parent
706fad0174
commit
8c9dda37d5
4 changed files with 116 additions and 81 deletions
|
@ -73,11 +73,29 @@
|
||||||
= render_unlisted_closet_hangers(owned)
|
= render_unlisted_closet_hangers(owned)
|
||||||
%span.empty-list= t '.unlisted.empty'
|
%span.empty-list= t '.unlisted.empty'
|
||||||
|
|
||||||
|
- localized_cache :action_suffix => 'autocomplete_tmpls' do
|
||||||
|
%script#autocomplete-item-tmpl{:type => 'text/x-jquery-tmpl'}
|
||||||
|
%a
|
||||||
|
= t '.autocomplete.add_item_html', :item_name => '${item_name}'
|
||||||
|
|
||||||
|
%script#autocomplete-add-to-list-tmpl{:type => 'text/x-jquery-tmpl'}
|
||||||
|
%a
|
||||||
|
= t '.autocomplete.add_to_list_html', :list_name => '${list_name}'
|
||||||
|
|
||||||
|
%script#autocomplete-add-to-group-tmpl{:type => 'text/x-jquery-tmpl'}
|
||||||
|
%a
|
||||||
|
= t '.autocomplete.add_to_group_html', :group_name => '${group_name}'
|
||||||
|
|
||||||
|
%script#autocomplete-already-in-collection-tmpl{:type => 'text/x-jquery-tmpl'}
|
||||||
|
%span
|
||||||
|
= t '.autocomplete.already_in_collection_html',
|
||||||
|
:collection_name => '${collection_name}'
|
||||||
|
|
||||||
- content_for :stylesheets do
|
- content_for :stylesheets do
|
||||||
= stylesheet_link_tag 'south-street/jquery-ui'
|
= stylesheet_link_tag 'south-street/jquery-ui'
|
||||||
|
|
||||||
- content_for :javascripts do
|
- content_for :javascripts do
|
||||||
= include_javascript_libraries :jquery
|
= include_javascript_libraries :jquery, :jquery_tmpl
|
||||||
= javascript_include_tag 'ajax_auth', 'jquery.ui', 'jquery.jgrowl',
|
= javascript_include_tag 'ajax_auth', 'jquery.ui', 'jquery.jgrowl',
|
||||||
'placeholder', 'closet_hangers/index'
|
'placeholder', 'closet_hangers/index'
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,12 @@ en-meep:
|
||||||
submit: Meep
|
submit: Meep
|
||||||
header: (Not in a meepit)
|
header: (Not in a meepit)
|
||||||
empty: There aren't any meepits here.
|
empty: There aren't any meepits here.
|
||||||
|
autocomplete:
|
||||||
|
add_item_html: Meep <strong>%{item_name}</strong>
|
||||||
|
add_to_list_html: Meep to <strong>%{list_name}</strong>
|
||||||
|
add_to_group_html: Meep to <strong>%{group_name}</strong>, no list
|
||||||
|
already_in_collection_html:
|
||||||
|
It's already meeped in <strong>%{collection_name}</strong>
|
||||||
|
|
||||||
petpage:
|
petpage:
|
||||||
title: Export to meeppage
|
title: Export to meeppage
|
||||||
|
|
|
@ -118,6 +118,12 @@ en:
|
||||||
submit: Save
|
submit: Save
|
||||||
header: (Not in a list)
|
header: (Not in a list)
|
||||||
empty: There aren't any items here.
|
empty: There aren't any items here.
|
||||||
|
autocomplete:
|
||||||
|
add_item_html: Add <strong>%{item_name}</strong>
|
||||||
|
add_to_list_html: Add to <strong>%{list_name}</strong>
|
||||||
|
add_to_group_html: Add to <strong>%{group_name}</strong>, no list
|
||||||
|
already_in_collection_html:
|
||||||
|
It's already in <strong>%{collection_name}</strong>
|
||||||
|
|
||||||
petpage:
|
petpage:
|
||||||
title: Export to petpage
|
title: Export to petpage
|
||||||
|
|
|
@ -381,20 +381,25 @@
|
||||||
autocompleter._renderItem = function( ul, item ) {
|
autocompleter._renderItem = function( ul, item ) {
|
||||||
var li = $("<li></li>").data("item.autocomplete", item);
|
var li = $("<li></li>").data("item.autocomplete", item);
|
||||||
if(item.is_item) { // these are items from the server
|
if(item.is_item) { // these are items from the server
|
||||||
li.append("<a>Add <strong>" + item.label + "</strong>");
|
$('#autocomplete-item-tmpl').tmpl({item_name: item.label}).appendTo(li);
|
||||||
} else if(item.list) { // these are list inserts
|
} else if(item.list) { // these are list inserts
|
||||||
|
var listName = item.list.label;
|
||||||
if(item.hasHanger) {
|
if(item.hasHanger) {
|
||||||
li.append("<span>It's already in <strong>" + item.list.label + "</strong>");
|
$('#autocomplete-already-in-collection-tmpl').
|
||||||
|
tmpl({collection_name: listName}).appendTo(li);
|
||||||
} else {
|
} else {
|
||||||
li.append("<a>Add to <strong>" + item.list.label + "</strong>");
|
$('#autocomplete-add-to-list-tmpl').tmpl({list_name: listName}).
|
||||||
|
appendTo(li);
|
||||||
}
|
}
|
||||||
li.addClass("closet-list-autocomplete-item");
|
li.addClass("closet-list-autocomplete-item");
|
||||||
} else { // these are group inserts
|
} else { // these are group inserts
|
||||||
var groupName = item.group.label;
|
var groupName = item.group.label;
|
||||||
if(!item.hasHanger) {
|
if(!item.hasHanger) {
|
||||||
li.append("<a>Add to <strong>" + groupName.replace(/\s+$/, '') + "</strong>, no list");
|
$('#autocomplete-add-to-group-tmpl').
|
||||||
|
tmpl({group_name: groupName.replace(/\s+$/, '')}).appendTo(li);
|
||||||
} else {
|
} else {
|
||||||
li.append("<span>It's already in <strong>" + groupName + "</strong>");
|
$('#autocomplete-already-in-collection-tmpl').
|
||||||
|
tmpl({collection_name: groupName}).appendTo(li);
|
||||||
}
|
}
|
||||||
li.addClass('closet-hangers-group-autocomplete-item');
|
li.addClass('closet-hangers-group-autocomplete-item');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue