user closet display
This commit is contained in:
parent
1c84a4bef9
commit
d5641dddbb
14 changed files with 81 additions and 4 deletions
7
app/controllers/closet_hangers_controller.rb
Normal file
7
app/controllers/closet_hangers_controller.rb
Normal 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
|
||||||
|
|
|
@ -97,5 +97,9 @@ module ApplicationHelper
|
||||||
def title(value)
|
def title(value)
|
||||||
content_for :title, value
|
content_for :title, value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_is?(user)
|
||||||
|
user_signed_in? && user == current_user
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
2
app/helpers/closet_hangers_helper.rb
Normal file
2
app/helpers/closet_hangers_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module ClosetHangersHelper
|
||||||
|
end
|
4
app/stylesheets/closet_hangers/index.sass
Normal file
4
app/stylesheets/closet_hangers/index.sass
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
body.closet_hangers-index
|
||||||
|
#closet-hangers
|
||||||
|
text-align: center
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
@import partials/jquery.jgrowl
|
@import partials/jquery.jgrowl
|
||||||
|
|
||||||
|
@import closet_hangers/index
|
||||||
@import contributions/index
|
@import contributions/index
|
||||||
@import items
|
@import items
|
||||||
@import items/index
|
@import items/index
|
||||||
|
|
6
app/views/closet_hangers/_closet_hanger.html.haml
Normal file
6
app/views/closet_hangers/_closet_hanger.html.haml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.object
|
||||||
|
= render :partial => 'items/item_link', :locals => {:item => closet_hanger.item}
|
||||||
|
%span.quantity
|
||||||
|
= surround '(', ')' do
|
||||||
|
= closet_hanger.quantity
|
||||||
|
|
20
app/views/closet_hangers/index.html.haml
Normal file
20
app/views/closet_hangers/index.html.haml
Normal 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.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.object
|
.object
|
||||||
= link_to item_path(item, :q => @query) do
|
= render :partial => 'item_link', :locals => {:item => item}
|
||||||
= image_tag item.thumbnail_url, :alt => item.description, :title => item.description
|
|
||||||
= item.name
|
|
||||||
= nc_icon_for(item)
|
|
||||||
|
|
5
app/views/items/_item_link.html.haml
Normal file
5
app/views/items/_item_link.html.haml
Normal 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)
|
||||||
|
|
|
@ -35,6 +35,7 @@ OpenneoImpressItems::Application.routes.draw do |map|
|
||||||
|
|
||||||
resources :user, :only => [] do
|
resources :user, :only => [] do
|
||||||
resources :contributions, :only => [:index]
|
resources :contributions, :only => [:index]
|
||||||
|
resources :closet_hangers, :only => [:index], :path => 'closet'
|
||||||
end
|
end
|
||||||
match 'users/top-contributors' => 'users#top_contributors', :as => :top_contributors
|
match 'users/top-contributors' => 'users#top_contributors', :as => :top_contributors
|
||||||
match 'users/top_contributors' => redirect('/users/top-contributors')
|
match 'users/top_contributors' => redirect('/users/top-contributors')
|
||||||
|
|
4
public/stylesheets/compiled/closet_hangers/index.css
Normal file
4
public/stylesheets/compiled/closet_hangers/index.css
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/* line 2, ../../../../app/stylesheets/closet_hangers/index.sass */
|
||||||
|
body.closet_hangers-index #closet-hangers {
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -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 */
|
/* line 1, ../../../app/stylesheets/contributions/_index.sass */
|
||||||
body.contributions-index {
|
body.contributions-index {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
5
spec/controllers/closet_hangers_controller_spec.rb
Normal file
5
spec/controllers/closet_hangers_controller_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe ClosetHangersController do
|
||||||
|
|
||||||
|
end
|
15
spec/helpers/closet_hangers_helper_spec.rb
Normal file
15
spec/helpers/closet_hangers_helper_spec.rb
Normal 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
|
Loading…
Reference in a new issue