wardrobe now works with owned/wanted

This commit is contained in:
Emi Matchu 2011-07-22 17:06:21 -04:00
parent 6d155ecaf1
commit 12f5b28c94
5 changed files with 17 additions and 11 deletions

View file

@ -168,7 +168,8 @@ class Item < ActiveRecord::Base
:thumbnail_url => thumbnail_url,
:zones_restrict => zones_restrict,
:rarity_index => rarity_index,
:closeted => closeted?
:owned => owned?,
:wanted => wanted?
}
end

View file

@ -315,7 +315,7 @@ body.outfits-edit
+inline-block
&[type=submit]
margin-right: 2em
#preview-search-form-your-items
.preview-search-form-your-items
display: none
font-size: 85%
margin-right: 1em
@ -563,7 +563,7 @@ body.outfits-edit
display: block
#save-outfit, #save-current-outfit, #save-outfit-copy, #current-outfit-permalink, #shared-outfit-permalink, #share-outfit, #shared-outfit-url
display: none
#preview-search-form-your-items
.preview-search-form-your-items
+inline-block
&.user-not-signed-in

View file

@ -91,7 +91,8 @@
%h2 Add an item
%input{:name => "query", :placeholder => "Search items...", :type => "search"}/
%input{:type => "submit", :value => "Go"}/
%a#preview-search-form-your-items{:href => '#'} Your Items
%a.preview-search-form-your-items{:href => '#', 'data-search-value' => 'owns'} Items you own
%a.preview-search-form-your-items{:href => '#', 'data-search-value' => 'wants'} Items you want
#preview-search-form-pagination
%a#preview-search-form-clear{:href => "#"} clear
%dl#preview-search-form-help

View file

@ -102,8 +102,12 @@ Partial.ItemSet = function ItemSet(wardrobe, selector) {
) {
$('<div/>', {'class': 'nc-icon', text: 'NC', title: 'NC'}).appendTo(li);
}
if(item.closeted) {
$('<img/>', {'class': 'closeted-icon', alt: 'Closet', title: 'You own this', src: '/images/closeted.png'}).appendTo(li);
if(item.owned || item.wanted) {
var iconsWrapper = $('<div/>', {'class': 'closeted-icons'}).appendTo(li);
if(item.owned) {
$('<img/>', {alt: 'Own', title: 'You own this', src: '/images/owned.png'}).appendTo(iconsWrapper);
$('<img/>', {alt: 'Want', title: 'You want this', src: '/images/wanted.png'}).appendTo(iconsWrapper);
}
}
li.append(img).append(controls).append(info_link).append(item.name).appendTo(ul);
}
@ -863,7 +867,7 @@ View.Search = function (wardrobe) {
loading_el = $('#preview-search-form-loading'),
no_results_el = $('#preview-search-form-no-results'),
no_results_span = no_results_el.children('span'),
your_items_el = $('#preview-search-form-your-items'),
your_items_links = $('.preview-search-form-your-items'),
PAGINATION = {
INNER_WINDOW: 4,
OUTER_WINDOW: 1,
@ -928,9 +932,9 @@ View.Search = function (wardrobe) {
form.submit();
});
your_items_el.click(function (e) {
your_items_links.click(function (e) {
e.preventDefault();
input_el.val('user:owns');
input_el.val('user:' + this.getAttribute('data-search-value'));
form.submit();
});

View file

@ -1616,7 +1616,7 @@ body.outfits-edit #preview-search-form input[type=submit] {
margin-right: 2em;
}
/* line 318, ../../../app/stylesheets/outfits/_edit.sass */
body.outfits-edit #preview-search-form-your-items {
body.outfits-edit .preview-search-form-your-items {
display: none;
font-size: 85%;
margin-right: 1em;
@ -2555,7 +2555,7 @@ body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #save-outfit
display: none;
}
/* line 566, ../../../app/stylesheets/outfits/_edit.sass */
body.outfits-edit.user-signed-in #preview-search-form-your-items {
body.outfits-edit.user-signed-in .preview-search-form-your-items {
display: -moz-inline-box;
-moz-box-orient: vertical;
display: inline-block;