forked from OpenNeo/impress
quantity form on your items page
This commit is contained in:
parent
d782108e00
commit
437b1c052d
6 changed files with 91 additions and 18 deletions
|
@ -31,7 +31,7 @@ class ClosetHangersController < ApplicationController
|
|||
flash[:success] = "Success! You do not own #{@item.name}."
|
||||
end
|
||||
|
||||
redirect_to @item
|
||||
redirect_to params[:return_to] || @item
|
||||
end
|
||||
|
||||
alias_method :create, :update
|
||||
|
|
|
@ -32,7 +32,7 @@ module ApplicationHelper
|
|||
def flashes
|
||||
raw(flash.inject('') do |html, pair|
|
||||
key, value = pair
|
||||
html + content_tag('p', value, :class => key)
|
||||
html + content_tag('p', value, :class => "flash #{key}")
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
body.closet_hangers-index
|
||||
#title
|
||||
float: left
|
||||
margin-bottom: .5em
|
||||
|
||||
.flash
|
||||
clear: both
|
||||
|
||||
#import-link
|
||||
+awesome-button
|
||||
|
@ -13,13 +17,38 @@ body.closet_hangers-index
|
|||
clear: both
|
||||
text-align: center
|
||||
|
||||
.object .quantity
|
||||
.object
|
||||
.quantity
|
||||
+opacity(.75)
|
||||
background: white
|
||||
font-size: 16px
|
||||
font-weight: bold
|
||||
padding: 2px 4px
|
||||
position: absolute
|
||||
left: ($object-width - $object-img-size) / 2 + $object-padding
|
||||
text-align: left
|
||||
top: $object-img-size - 24px
|
||||
|
||||
form
|
||||
display: none
|
||||
|
||||
span, input[type=number]
|
||||
font-size: 16px
|
||||
font-weight: bold
|
||||
|
||||
&:hover
|
||||
.quantity
|
||||
+opacity(1)
|
||||
top: $object-img-size - 30px
|
||||
|
||||
span
|
||||
display: none
|
||||
|
||||
form
|
||||
display: inline
|
||||
|
||||
input[type=number]
|
||||
padding: 2px
|
||||
width: 2em
|
||||
|
||||
input[type=submit]
|
||||
font-size: 85%
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
.object
|
||||
= render :partial => 'items/item_link', :locals => {:item => closet_hanger.item}
|
||||
%span.quantity{:title => "You own #{pluralize closet_hanger.quantity, closet_hanger.item.name}"}= closet_hanger.quantity
|
||||
.quantity
|
||||
%span{:title => "You own #{pluralize closet_hanger.quantity, closet_hanger.item.name}"}= closet_hanger.quantity
|
||||
= form_for closet_hanger, :url => user_item_closet_hanger_path(current_user, closet_hanger.item) do |f|
|
||||
= hidden_field_tag :return_to, request.fullpath
|
||||
= f.number_field :quantity, :min => 0, :required => true, :title => "You own #{pluralize closet_hanger.quantity, closet_hanger.item.name}"
|
||||
= f.submit "Save"
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
- if user_is?(@user)
|
||||
- title 'Your Items'
|
||||
- content_for :before_flashes do
|
||||
= link_to "Import closet from Neopets", new_closet_page_path, :id => 'import-link'
|
||||
- else
|
||||
- title "#{@user.name}'s Items"
|
||||
|
|
|
@ -552,8 +552,13 @@ div.jGrowl div.jGrowl-closer {
|
|||
/* line 2, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #title {
|
||||
float: left;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
/* line 5, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
/* line 6, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index .flash {
|
||||
clear: both;
|
||||
}
|
||||
/* line 9, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #import-link {
|
||||
/* http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html */
|
||||
-moz-border-radius: 5px;
|
||||
|
@ -591,25 +596,58 @@ body.closet_hangers-index #import-link:active {
|
|||
body.closet_hangers-index #import-link:hover {
|
||||
background-color: #ee4b00;
|
||||
}
|
||||
/* line 12, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
/* line 16, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers {
|
||||
clear: both;
|
||||
text-align: center;
|
||||
}
|
||||
/* line 16, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
/* line 21, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object .quantity {
|
||||
-moz-opacity: 0.75;
|
||||
-webkit-opacity: 0.75;
|
||||
-o-opacity: 0.75;
|
||||
-khtml-opacity: 0.75;
|
||||
background: white;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
padding: 2px 4px;
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
text-align: left;
|
||||
top: 56px;
|
||||
}
|
||||
/* line 30, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object .quantity form {
|
||||
display: none;
|
||||
}
|
||||
/* line 33, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object .quantity span, body.closet_hangers-index #closet-hangers .object .quantity input[type=number] {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
/* line 38, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object:hover .quantity {
|
||||
-moz-opacity: 1;
|
||||
-webkit-opacity: 1;
|
||||
-o-opacity: 1;
|
||||
-khtml-opacity: 1;
|
||||
top: 50px;
|
||||
}
|
||||
/* line 42, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object:hover .quantity span {
|
||||
display: none;
|
||||
}
|
||||
/* line 45, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object:hover .quantity form {
|
||||
display: inline;
|
||||
}
|
||||
/* line 48, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object:hover .quantity form input[type=number] {
|
||||
padding: 2px;
|
||||
width: 2em;
|
||||
}
|
||||
/* line 52, ../../../app/stylesheets/closet_hangers/_index.sass */
|
||||
body.closet_hangers-index #closet-hangers .object:hover .quantity input[type=submit] {
|
||||
font-size: 85%;
|
||||
}
|
||||
|
||||
/* line 3, ../../../app/stylesheets/closet_pages/_new.sass */
|
||||
body.closet_pages-new #closet-page-form, body.closet_pages-create #closet-page-form {
|
||||
|
|
Loading…
Reference in a new issue