1
0
Fork 0
forked from OpenNeo/impress

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, :thumbnail_url => thumbnail_url,
:zones_restrict => zones_restrict, :zones_restrict => zones_restrict,
:rarity_index => rarity_index, :rarity_index => rarity_index,
:closeted => closeted? :owned => owned?,
:wanted => wanted?
} }
end end

View file

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

View file

@ -91,7 +91,8 @@
%h2 Add an item %h2 Add an item
%input{:name => "query", :placeholder => "Search items...", :type => "search"}/ %input{:name => "query", :placeholder => "Search items...", :type => "search"}/
%input{:type => "submit", :value => "Go"}/ %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 #preview-search-form-pagination
%a#preview-search-form-clear{:href => "#"} clear %a#preview-search-form-clear{:href => "#"} clear
%dl#preview-search-form-help %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); $('<div/>', {'class': 'nc-icon', text: 'NC', title: 'NC'}).appendTo(li);
} }
if(item.closeted) { if(item.owned || item.wanted) {
$('<img/>', {'class': 'closeted-icon', alt: 'Closet', title: 'You own this', src: '/images/closeted.png'}).appendTo(li); 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); 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'), loading_el = $('#preview-search-form-loading'),
no_results_el = $('#preview-search-form-no-results'), no_results_el = $('#preview-search-form-no-results'),
no_results_span = no_results_el.children('span'), 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 = { PAGINATION = {
INNER_WINDOW: 4, INNER_WINDOW: 4,
OUTER_WINDOW: 1, OUTER_WINDOW: 1,
@ -928,9 +932,9 @@ View.Search = function (wardrobe) {
form.submit(); form.submit();
}); });
your_items_el.click(function (e) { your_items_links.click(function (e) {
e.preventDefault(); e.preventDefault();
input_el.val('user:owns'); input_el.val('user:' + this.getAttribute('data-search-value'));
form.submit(); form.submit();
}); });

View file

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