update current species name

This commit is contained in:
Emi Matchu 2014-04-02 21:14:49 -05:00
parent d4b65ecf62
commit ecacb44153
2 changed files with 21 additions and 2 deletions

View file

@ -1286,6 +1286,26 @@ View.Search = function (wardrobe) {
if ($('meta[name=user-signed-in]').attr('content') === 'true') { if ($('meta[name=user-signed-in]').attr('content') === 'true') {
wrapper.find('li.must-log-in input').removeAttr('disabled'); wrapper.find('li.must-log-in input').removeAttr('disabled');
} }
var speciesNamesById = null;
function updateCurrentSpeciesName() {
if (speciesNamesById !== null) {
var speciesId = wardrobe.outfits.getPetType().species_id;
var speciesName = speciesNamesById[speciesId];
$('label[for=advanced-search-species] span').text(speciesName);
}
}
wardrobe.pet_attributes.bind('update', function(petAttributes) {
speciesNamesById = {};
petAttributes.species.forEach(function(species) {
speciesNamesById[species.id] = species.name;
});
updateCurrentSpeciesName();
});
wardrobe.outfits.bind('updatePetType', updateCurrentSpeciesName);
} }
View.PrankColorMessage = function(wardrobe) { View.PrankColorMessage = function(wardrobe) {

View file

@ -145,8 +145,7 @@
%input{type: 'checkbox', id: 'advanced-search-species'} %input{type: 'checkbox', id: 'advanced-search-species'}
%label{for: 'advanced-search-species'} %label{for: 'advanced-search-species'}
Fits the Fits the
-# TODO: update to current species %span
%span Acara
(the current species) (the current species)
%li.checkbox.must-log-in %li.checkbox.must-log-in
%input{type: 'checkbox', id: 'advanced-search-owns', disabled: true} %input{type: 'checkbox', id: 'advanced-search-owns', disabled: true}