user closet display

This commit is contained in:
Emi Matchu 2011-07-12 20:03:04 -04:00
parent 1c84a4bef9
commit d5641dddbb
14 changed files with 81 additions and 4 deletions

View file

@ -0,0 +1,7 @@
class ClosetHangersController < ApplicationController
def index
@user = User.find params[:user_id]
@closet_hangers = @user.closet_hangers.alphabetical_by_item_name.includes(:item)
end
end

View file

@ -97,5 +97,9 @@ module ApplicationHelper
def title(value)
content_for :title, value
end
def user_is?(user)
user_signed_in? && user == current_user
end
end

View file

@ -0,0 +1,2 @@
module ClosetHangersHelper
end

View file

@ -0,0 +1,4 @@
body.closet_hangers-index
#closet-hangers
text-align: center

View file

@ -6,6 +6,7 @@
@import partials/jquery.jgrowl
@import closet_hangers/index
@import contributions/index
@import items
@import items/index

View file

@ -0,0 +1,6 @@
.object
= render :partial => 'items/item_link', :locals => {:item => closet_hanger.item}
%span.quantity
= surround '(', ')' do
= closet_hanger.quantity

View file

@ -0,0 +1,20 @@
- if user_is?(@user)
- title 'Your Closet'
- else
- title "#{@user.name}'s Closet"
#closet-hangers
- if !@closet_hangers.empty?
= render @closet_hangers
- else
- if user_is?(@user)
%p You don't have any items in your Dress to Impress closet.
%p
Your Dress to Impress closet is a way to keep track of what items you
have in your Neopets closet. Once you load your Neopets closet into
Dress to Impress, as you play with various outfit ideas you can keep
track of what items you already own. And, who knows? Maybe some day
you can use it as a up-for-trade list or wishlist. We'll see what
happens.
- else
%p #{@user.name} doesn't have any items in their Dress to Impress closet.

View file

@ -1,5 +1,3 @@
.object
= link_to item_path(item, :q => @query) do
= image_tag item.thumbnail_url, :alt => item.description, :title => item.description
= item.name
= nc_icon_for(item)
= render :partial => 'item_link', :locals => {:item => item}

View file

@ -0,0 +1,5 @@
= link_to item_path(item, :q => @query) do
= image_tag item.thumbnail_url, :alt => item.description, :title => item.description
= item.name
= nc_icon_for(item)

View file

@ -35,6 +35,7 @@ OpenneoImpressItems::Application.routes.draw do |map|
resources :user, :only => [] do
resources :contributions, :only => [:index]
resources :closet_hangers, :only => [:index], :path => 'closet'
end
match 'users/top-contributors' => 'users#top_contributors', :as => :top_contributors
match 'users/top_contributors' => redirect('/users/top-contributors')

View file

@ -0,0 +1,4 @@
/* line 2, ../../../../app/stylesheets/closet_hangers/index.sass */
body.closet_hangers-index #closet-hangers {
text-align: center;
}

View file

@ -538,6 +538,11 @@ div.jGrowl div.jGrowl-closer {
}
}
/* line 2, ../../../app/stylesheets/closet_hangers/index.sass */
body.closet_hangers-index #closet-hangers {
text-align: center;
}
/* line 1, ../../../app/stylesheets/contributions/_index.sass */
body.contributions-index {
text-align: center;

View file

@ -0,0 +1,5 @@
require 'spec_helper'
describe ClosetHangersController do
end

View file

@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the ClosetHangersHelper. For example:
#
# describe ClosetHangersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe ClosetHangersHelper do
pending "add some examples to (or delete) #{__FILE__}"
end