filter by user owns/wants

This commit is contained in:
Emi Matchu 2014-04-02 21:08:35 -05:00
parent afface7fa7
commit d557daadf4
4 changed files with 17 additions and 4 deletions

View file

@ -1144,10 +1144,10 @@ View.Search = function (wardrobe) {
nc: $('#advanced-search-nc').val(),
occupies: $('#advanced-search-occupies').val(),
restricts: $('#advanced-search-restricts').val(),
species: $('#advanced-search-species').is(":checked") ?
species: $('#advanced-search-species').is(':checked') ?
wardrobe.outfits.getPetType().species_id : null,
owns: $('#advanced-search-owns').val(),
wants: $('#advanced-search-wants').val()
owns: $('#advanced-search-owns').is(':checked'),
wants: $('#advanced-search-wants').is(':checked')
};
wrapper.removeClass('advanced');
loadPage(1);
@ -1282,6 +1282,10 @@ View.Search = function (wardrobe) {
appendTo(restricts);
});
});
if ($('meta[name=user-signed-in]').attr('content') === 'true') {
wrapper.find('li.must-log-in input').removeAttr('disabled');
}
}
View.PrankColorMessage = function(wardrobe) {

View file

@ -1333,6 +1333,12 @@ function Wardrobe() {
if (query.species)
filters.push({key: "species_support_id", value: query.species,
is_positive: true});
if (query.owns)
filters.push({key: "user_closet_hanger_ownership", value: true,
is_positive: true});
if (query.wants)
filters.push({key: "user_closet_hanger_ownership", value: false,
is_positive: true});
return filters;
}

View file

@ -861,6 +861,8 @@ body.outfits-edit
display: none
#preview-outfits-list
display: block
#advanced-search-log-in-link
display: none
&.user-not-signed-in
#save-outfit-not-signed-in

View file

@ -160,7 +160,8 @@
%input{type: 'checkbox', id: 'advanced-search-wants', disabled: true}
%label{for: 'advanced-search-wants'} Only include items you want
-# TODO: update return_to
= link_to 'Log in to use these filters.', login_path_with_return_to
= link_to 'Log in to use these filters.', login_path_with_return_to,
id: 'advanced-search-log-in-link'
#no-assets-full-message= t '.sidebar.closet.no_data.description'