From f82d3683f58191e5367880aed40fc870af8144e1 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 10 Jan 2013 16:47:46 -0600 Subject: [PATCH] i18n for pet_query.js --- app/views/outfits/new.html.haml | 8 +++++++- config/assets.yml | 1 - config/locales/en-meep.yml | 4 ++++ config/locales/en.yml | 4 ++++ public/javascripts/pet_query.js | 15 ++++----------- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 88dc23e6..c5c0f229 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -87,7 +87,13 @@ - @newest_items.each do |item| = link_to image_tag(item.thumbnail_url), item +- localized_cache :action_suffix => 'pet_query_notice' do + %script#pet-query-notice-template{:type => 'text/x-jquery-tmpl'} + .success + %img.inline-image{:src => '${pet_image_url}'} + = t '.pet_query.notice_html', :pet_name => '${pet_name}' + - content_for :javascripts do - = include_javascript_libraries :jquery + = include_javascript_libraries :jquery, :jquery_tmpl = include_javascripts :new_outfit_package diff --git a/config/assets.yml b/config/assets.yml index 8ad06fca..612e36d5 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -4,7 +4,6 @@ embed_assets: on javascripts: bulk_pets_package: - public/javascripts/ajax_auth.js - - public/javascripts/pet_query.js - public/javascripts/pets/bulk.js edit_outfit_package: diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 9e3f3abd..f4070d2c 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -627,6 +627,10 @@ en-meep: link: OpenNeo Meep newest_items: header: New Meeps + pet_query: + notice_html: + Thanks for meeping us %{pet_name}. + Meep up the good work! show: default_outfit_name: Meeped outfit diff --git a/config/locales/en.yml b/config/locales/en.yml index 713f5afa..61d9aca5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -646,6 +646,10 @@ en: link: OpenNeo Blog newest_items: header: New Items + pet_query: + notice_html: + Thanks for showing us %{pet_name}. + Keep up the good work! show: default_outfit_name: Shared outfit diff --git a/public/javascripts/pet_query.js b/public/javascripts/pet_query.js index 77f8e7a8..a217b6fd 100644 --- a/public/javascripts/pet_query.js +++ b/public/javascripts/pet_query.js @@ -14,16 +14,9 @@ $.each(query_string.substr(1).split('&'), function () { if(PetQuery.name) { if(PetQuery.species && PetQuery.color) { - var notice = $('
', { - 'class': 'success', - 'html': "Thanks for showing us " + PetQuery.name + "! " + - "Keep up the good work!" - }), - image = $('', { - 'class': 'inline-image', - 'src': petImage('cpn/' + PetQuery.name, 1) - }); - image.prependTo(notice); - notice.prependTo('#container'); + $('#pet-query-notice-template').tmpl({ + pet_name: PetQuery.name, + pet_image_url: petImage('cpn/' + PetQuery.name, 1) + }).prependTo('#container'); } }