better handle new colors and species

This commit is contained in:
Emi Matchu 2013-02-15 23:57:06 -06:00
parent 989363f743
commit 1c0b5c743e
6 changed files with 69 additions and 43 deletions

View file

@ -11,6 +11,10 @@ class Color < ActiveRecord::Base
end
def human_name
if name
name.split(' ').map { |word| word.capitalize }.join(' ')
else
I18n.translate('colors.default_human_name')
end
end
end

View file

@ -66,17 +66,26 @@ class PetType < ActiveRecord::Base
# Probably should move the basic hashes into the database someday.
# Until then, access the hash using the English color/species names.
unless BasicHashes[species.name] && BasicHashes[species.name][color.name]
# TODO: use rainbow pool? some external service?
if species && color && BasicHashes[species.name] && BasicHashes[species.name][color.name]
BasicHashes[species.name][color.name]
else
return 'deadbeef'
end
BasicHashes[species.name][color.name]
end
end
def possibly_new_color
self.color || Color.new(id: self.color_id)
end
def possibly_new_species
self.species || Species.new(id: self.species_id)
end
def human_name
self.color.human_name + ' ' + self.species.human_name
I18n.translate('pet_types.human_name',
color_human_name: possibly_new_color.human_name,
species_human_name: possibly_new_species.human_name)
end
def needed_items

View file

@ -8,6 +8,10 @@ class Species < ActiveRecord::Base
end
def human_name
if name
name.capitalize
else
I18n.translate('species.default_human_name')
end
end
end

View file

@ -214,6 +214,9 @@ en:
unlisted_name: Not in a list
colors:
default_human_name: (a new color)
contributions:
contributed_description:
parents:
@ -725,6 +728,12 @@ en:
unconverted: Unconverted
unlabeled: Unlabeled
pet_types:
human_name: "%{color_human_name} %{species_human_name}"
species:
default_human_name: (a new species)
pets:
bulk:
needed_items:

View file

@ -1,4 +1,4 @@
/* line 29, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 29, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
body {
line-height: 1.5;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
@ -7,12 +7,12 @@ body {
font-size: 10pt;
}
/* line 52, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 52, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
.container {
background: none;
}
/* line 54, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 54, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
hr {
background: #cccccc;
color: #cccccc;
@ -22,40 +22,40 @@ hr {
padding: 0;
border: none;
}
/* line 62, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 62, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
hr.space {
background: white;
color: white;
}
/* line 65, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 65, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* line 67, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 67, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
code {
font-size: 0.9em;
font-family: "andale mono", "lucida console", monospace;
}
/* line 72, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 72, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
a img {
border: none;
}
/* line 75, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 75, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
a:link, a:visited {
background: transparent;
font-weight: 700;
text-decoration: underline;
}
/* line 79, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 79, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
p img.top {
margin-top: 0;
}
/* line 81, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 81, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
blockquote {
margin: 1.5em;
padding: 1em;
@ -63,22 +63,22 @@ blockquote {
font-size: 0.9em;
}
/* line 86, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 86, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
.small {
font-size: 0.9em;
}
/* line 88, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 88, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
.large {
font-size: 1.1em;
}
/* line 90, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 90, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
.quiet {
color: #999999;
}
/* line 92, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
/* line 92, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
.hide {
display: none;
}

View file

@ -651,7 +651,7 @@ body.closet_hangers-index #closet-hangers-contact a, body.closet_hangers-index #
height: 100%;
padding-left: 20px;
}
/* line 4, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss */
/* line 4, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss */
body.closet_hangers-index #closet-hangers-contact a:hover, body.closet_hangers-index #closet-hangers-contact > span:hover {
text-decoration: underline;
}
@ -1338,7 +1338,7 @@ body.closet_hangers-petpage #petpage-closet-lists h4 {
*vertical-align: auto;
vertical-align: middle;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.closet_hangers-petpage #petpage-closet-lists h4 {
*display: inline;
}
@ -1363,7 +1363,7 @@ body.closet_hangers-petpage #petpage-closet-lists ul li {
margin: 0.25em 0.5em;
padding: 1px;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.closet_hangers-petpage #petpage-closet-lists ul li {
*display: inline;
}
@ -1775,7 +1775,7 @@ body.items-show #item-header div, body.items-show #item-header img {
vertical-align: middle;
*vertical-align: auto;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.items-show #item-header div, body.items-show #item-header img {
*display: inline;
}
@ -1829,7 +1829,7 @@ body.items-show #item-preview-species a {
vertical-align: middle;
*vertical-align: auto;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.items-show #item-preview-species a {
*display: inline;
}
@ -1951,17 +1951,17 @@ body.items-show #item-contributors footer {
body.items-show #item-contributors ul {
list-style-type: none;
}
/* line 5, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */
/* line 5, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */
body.items-show #item-contributors ul, body.items-show #item-contributors ul li {
margin: 0px;
padding: 0px;
display: inline;
}
/* line 24, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */
/* line 24, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */
body.items-show #item-contributors ul li:after {
content: ", ";
}
/* line 26, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */
/* line 26, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */
body.items-show #item-contributors ul li:last-child:after, body.items-show #item-contributors ul li.last:after {
content: "";
}
@ -1981,7 +1981,7 @@ body.items-show #item-preview-header h3, body.items-show #item-preview-header a
vertical-align: middle;
*vertical-align: auto;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.items-show #item-preview-header h3, body.items-show #item-preview-header a {
*display: inline;
}
@ -2077,7 +2077,7 @@ body.outfits-edit #preview-toolbar form {
*vertical-align: auto;
margin-right: 2em;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit #preview-toolbar form {
*display: inline;
}
@ -2400,7 +2400,7 @@ body.outfits-edit #preview-search-form h2 {
*vertical-align: auto;
margin: 0 1em 0 0;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit #preview-search-form h2 {
*display: inline;
}
@ -2412,7 +2412,7 @@ body.outfits-edit #preview-search-form input {
vertical-align: middle;
*vertical-align: auto;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit #preview-search-form input {
*display: inline;
}
@ -2434,7 +2434,7 @@ body.outfits-edit #preview-search-form-pagination {
vertical-align: middle;
*vertical-align: auto;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit #preview-search-form-pagination {
*display: inline;
}
@ -2531,7 +2531,7 @@ body.outfits-edit.fullscreen #preview-search-form-help div {
*vertical-align: auto;
width: 48%;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit.fullscreen #preview-search-form-help div {
*display: inline;
}
@ -2727,7 +2727,7 @@ body.outfits-edit #preview-outfits > ul > li {
position: relative;
font-size: 14px;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit #preview-outfits > ul > li {
*display: inline;
}
@ -3060,7 +3060,7 @@ body.outfits-edit #preview-sharing #preview-sharing-url-formats li {
font-size: 12px;
padding: 0 2em;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit #preview-sharing #preview-sharing-url-formats li {
*display: inline;
}
@ -3350,7 +3350,7 @@ body.outfits-edit form#save-outfit-form .outfit-star, body.outfits-edit form#sav
float: none;
vertical-align: top;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit form#save-outfit-form .outfit-star, body.outfits-edit form#save-outfit-form input, body.outfits-edit form#save-outfit-form button {
*display: inline;
}
@ -3401,7 +3401,7 @@ body.outfits-edit.user-signed-in .preview-search-form-your-items {
vertical-align: middle;
*vertical-align: auto;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-edit.user-signed-in .preview-search-form-your-items {
*display: inline;
}
@ -3442,7 +3442,7 @@ body.outfits-index #outfits > li {
position: relative;
font-size: 14px;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.outfits-index #outfits > li {
*display: inline;
}
@ -4077,7 +4077,7 @@ body.pets-bulk #needed-items-form #needed-items-pet #needed-items-reload {
margin-left: 1em;
vertical-align: middle;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.pets-bulk #needed-items-form #needed-items-pet #needed-items-reload {
*display: inline;
}
@ -4151,7 +4151,7 @@ body.pets-bulk #bulk-pets-form textarea {
overflow: hidden;
resize: none;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.pets-bulk #bulk-pets-form textarea {
*display: inline;
}
@ -4172,7 +4172,7 @@ body.pets-bulk #bulk-pets-form ul li {
min-width: 25%;
text-align: left;
}
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p385/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */
body.pets-bulk #bulk-pets-form ul li {
*display: inline;
}