i18n for closet_hangers#index search bar autocomplete

This commit is contained in:
Emi Matchu 2013-01-03 13:25:14 -05:00
parent 9fca9692bf
commit 397c556c50
4 changed files with 116 additions and 81 deletions

View file

@ -73,11 +73,29 @@
= render_unlisted_closet_hangers(owned)
%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
= stylesheet_link_tag 'south-street/jquery-ui'
- content_for :javascripts do
= include_javascript_libraries :jquery
= include_javascript_libraries :jquery, :jquery_tmpl
= javascript_include_tag 'ajax_auth', 'jquery.ui', 'jquery.jgrowl',
'placeholder', 'closet_hangers/index'

View file

@ -117,6 +117,12 @@ en-meep:
submit: Meep
header: (Not in a meepit)
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:
title: Export to meeppage

View file

@ -118,6 +118,12 @@ en:
submit: Save
header: (Not in a list)
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:
title: Export to petpage

View file

@ -381,20 +381,25 @@
autocompleter._renderItem = function( ul, item ) {
var li = $("<li></li>").data("item.autocomplete", item);
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
var listName = item.list.label;
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 {
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");
} else { // these are group inserts
var groupName = item.group.label;
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 {
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');
}