From bfd825d98e45d58d8fdbde8510ab65df60934436 Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 23 Jan 2013 00:25:09 -0600 Subject: [PATCH 01/66] attempt to fix new species_support_ids format. sigh. --- app/controllers/swf_assets_controller.rb | 5 +---- app/models/item.rb | 17 ++++++++++++----- app/models/static_resource.rb | 14 ++++++++++++-- app/models/swf_asset.rb | 6 +----- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/app/controllers/swf_assets_controller.rb b/app/controllers/swf_assets_controller.rb index c7b00657..8ce7c9f3 100644 --- a/app/controllers/swf_assets_controller.rb +++ b/app/controllers/swf_assets_controller.rb @@ -15,13 +15,10 @@ class SwfAssetsController < ApplicationController end elsif params[:pet_type_id] && params[:item_ids] pet_type = PetType.find(params[:pet_type_id], :select => [:body_id, :species_id]) - items = Item.find(params[:item_ids], :select => [:id, :species_support_ids]) - compatible_items = items.select { |i| i.support_species?(pet_type.species) } - compatible_item_ids = compatible_items.map(&:id) @swf_assets = SwfAsset.object_assets. fitting_body_id(pet_type.body_id). - for_item_ids(compatible_item_ids). + for_item_ids(params[:item_ids]). with_parent_ids json = @swf_assets.map { |a| a.as_json(:parent_id => a.parent_id.to_i, :for => 'wardrobe') } elsif params[:pet_state_id] diff --git a/app/models/item.rb b/app/models/item.rb index 11a5c314..f3c6e7ce 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -146,11 +146,12 @@ class Item < ActiveRecord::Base end def supported_species - @supported_species ||= species_support_ids.blank? ? Species.all : species_support_ids.sort.map { |id| Species.find(id) } - end - - def support_species?(species) - species_support_ids.blank? || species_support_ids.include?(species.id) + body_ids = swf_assets.select([:body_id]).map(&:body_id) + return Species.all if body_ids.include?(0) + + pet_types = PetType.where(:body_id => body_ids).select([:species_id]) + species_ids = pet_types.map(&:species_id).uniq + Species.find(species_ids) end def self.search(query, user=nil) @@ -230,6 +231,12 @@ class Item < ActiveRecord::Base end end end + + def body_specific? + # If there are species support IDs (it's not empty), the item is + # body-specific. If it's empty, it fits everyone the same. + !species_support_ids.empty? + end def origin_registry_info=(info) # bear in mind that numbers from registries are floats diff --git a/app/models/static_resource.rb b/app/models/static_resource.rb index 0db48d2c..8d4c7053 100644 --- a/app/models/static_resource.rb +++ b/app/models/static_resource.rb @@ -5,11 +5,21 @@ class StaticResource @objects end - def self.find(id) - @objects[id-1] + def self.find(id_or_ids) + if id_or_ids.is_a?(Array) + id_or_ids.uniq.map { |id| find_one(id) } + else + find_one(id_or_ids) + end end def self.count @objects.size end + + private + + def self.find_one(id) + @objects[id - 1] + end end diff --git a/app/models/swf_asset.rb b/app/models/swf_asset.rb index fd8f7b00..f5814a45 100644 --- a/app/models/swf_asset.rb +++ b/app/models/swf_asset.rb @@ -197,11 +197,7 @@ class SwfAsset < ActiveRecord::Base end def body_specific? - # If we already have assigned this a non-zero body id, or if the asset is - # in a body-specific zone, or if the item is explicitly labeled as - # body-specific (like Encased In Ice, which is body-specific but whose - # assets occupy Background Item), then this asset is body-specific. - (body_id? && body_id > 0) || self.zone.type_id < 3 || (@item && @item.explicitly_body_specific?) + self.zone.type_id < 3 || (@item && @item.body_specific?) end def zone From 75be12fe2eb1cac162634a467b07e4ae20334745 Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 23 Jan 2013 00:31:15 -0600 Subject: [PATCH 02/66] update fonts to use google web font api properly --- app/stylesheets/_layout.sass | 30 +--- public/stylesheets/compiled/screen.css | 183 +++++++++++-------------- 2 files changed, 82 insertions(+), 131 deletions(-) diff --git a/app/stylesheets/_layout.sass b/app/stylesheets/_layout.sass index e2e50bbc..5dd4d013 100644 --- a/app/stylesheets/_layout.sass +++ b/app/stylesheets/_layout.sass @@ -1,4 +1,7 @@ @import "partials/icon" +@import url(http://fonts.googleapis.com/css?family=Droid+Sans:400,700) +@import url(http://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic) +@import url(http://fonts.googleapis.com/css?family=Calligraffitti) /* Reset @@ -247,30 +250,3 @@ dd font-style: italic src: local("Delicious"), font-url("Delicious-Italic.otf") - -@font-face - font-family: 'Droid Serif' - font-style: normal - font-weight: normal - src: local("Droid Serif"), url("http://themes.googleusercontent.com/font?kit=70P0G8gxVDIV6F9om0DsKg") format("truetype") - - -@font-face - font-family: 'Droid Serif' - font-style: normal - font-weight: bold - src: local("Droid Serif"), url("http://themes.googleusercontent.com/font?kit=QQt14e8dY39u-eYBZmppwf5Jgr8ufe5A6KahQF76Xmg") format("truetype") - - -@font-face - font-family: 'Droid Sans' - font-style: normal - font-weight: normal - src: local("Droid Sans"), url("http://themes.googleusercontent.com/font?kit=POVDFY-UUf0WFR9DIMCU8g") format("truetype") - -@font-face - font-family: 'Calligraffitti' - font-style: normal - font-weight: normal - src: local('Calligraffiti'), url('http://themes.googleusercontent.com/font?kit=vLVN2Y-z65rVu1R7lWdvyKIZAuDcNtpCWuPSaIR0Ie8') format('woff') - diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index fdbee6e6..5e6bfc2f 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -1,6 +1,9 @@ @charset "UTF-8"; +@import url(http://fonts.googleapis.com/css?family=Droid+Sans:400,700); +@import url(http://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); +@import url(http://fonts.googleapis.com/css?family=Calligraffitti); /* Reset */ -/* line 5, ../../../app/stylesheets/_layout.sass */ +/* line 8, ../../../app/stylesheets/_layout.sass */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, @@ -16,12 +19,12 @@ caption, tbody, tfoot, thead, tr, th, td { } /* Typography */ -/* line 20, ../../../app/stylesheets/_layout.sass */ +/* line 23, ../../../app/stylesheets/_layout.sass */ html, body { height: 100%; } -/* line 23, ../../../app/stylesheets/_layout.sass */ +/* line 26, ../../../app/stylesheets/_layout.sass */ body { background: white; color: #004400; @@ -30,60 +33,60 @@ body { line-height: 1.5; } -/* line 31, ../../../app/stylesheets/_layout.sass */ +/* line 34, ../../../app/stylesheets/_layout.sass */ a { color: #226622; } -/* line 34, ../../../app/stylesheets/_layout.sass */ +/* line 37, ../../../app/stylesheets/_layout.sass */ p { font-family: "Droid Serif", Georgia, "Times New Roman", Times, serif; } -/* line 37, ../../../app/stylesheets/_layout.sass */ +/* line 40, ../../../app/stylesheets/_layout.sass */ input, button, select { font-family: inherit; font-size: 100%; } -/* line 42, ../../../app/stylesheets/_layout.sass */ +/* line 45, ../../../app/stylesheets/_layout.sass */ p { margin-bottom: 1em; } -/* line 45, ../../../app/stylesheets/_layout.sass */ +/* line 48, ../../../app/stylesheets/_layout.sass */ h1, h2, h3 { font-family: Delicious, Helvetica, Arial, Verdana, sans-serif; } -/* line 48, ../../../app/stylesheets/_layout.sass */ +/* line 51, ../../../app/stylesheets/_layout.sass */ h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; } -/* line 53, ../../../app/stylesheets/_layout.sass */ +/* line 56, ../../../app/stylesheets/_layout.sass */ h2 { font-size: 2em; margin-bottom: 0.75em; } -/* line 57, ../../../app/stylesheets/_layout.sass */ +/* line 60, ../../../app/stylesheets/_layout.sass */ h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; } -/* line 62, ../../../app/stylesheets/_layout.sass */ +/* line 65, ../../../app/stylesheets/_layout.sass */ .inline-image, body.pets-bulk #bulk-pets-form ul img { margin-right: 1em; vertical-align: middle; } /* Main */ -/* line 70, ../../../app/stylesheets/_layout.sass */ +/* line 73, ../../../app/stylesheets/_layout.sass */ #container { margin: 1em auto; padding-top: 3em; @@ -91,12 +94,12 @@ h3 { width: 800px; } -/* line 76, ../../../app/stylesheets/_layout.sass */ +/* line 79, ../../../app/stylesheets/_layout.sass */ input, button, select, label { cursor: pointer; } -/* line 79, ../../../app/stylesheets/_layout.sass */ +/* line 82, ../../../app/stylesheets/_layout.sass */ input[type=text], body.pets-bulk #bulk-pets-form textarea, input[type=password], input[type=search], input[type=number], select, textarea { -moz-border-radius: 3px; -webkit-border-radius: 3px; @@ -105,17 +108,17 @@ input[type=text], body.pets-bulk #bulk-pets-form textarea, input[type=password], color: #448844; padding: 0.25em; } -/* line 85, ../../../app/stylesheets/_layout.sass */ +/* line 88, ../../../app/stylesheets/_layout.sass */ input[type=text]:focus, body.pets-bulk #bulk-pets-form textarea:focus, input[type=text]:active, body.pets-bulk #bulk-pets-form textarea:active, input[type=password]:focus, input[type=password]:active, input[type=search]:focus, input[type=search]:active, input[type=number]:focus, input[type=number]:active, select:focus, select:active, textarea:focus, textarea:active { color: inherit; } -/* line 88, ../../../app/stylesheets/_layout.sass */ +/* line 91, ../../../app/stylesheets/_layout.sass */ textarea { font: inherit; } -/* line 91, ../../../app/stylesheets/_layout.sass */ +/* line 94, ../../../app/stylesheets/_layout.sass */ a.button, input[type=submit], button { /* http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html */ -moz-border-radius: 5px; @@ -146,7 +149,7 @@ a.button:hover, input[type=submit]:hover, button:hover { a.button:active, input[type=submit]:active, button:active { top: 1px; } -/* line 93, ../../../app/stylesheets/_layout.sass */ +/* line 96, ../../../app/stylesheets/_layout.sass */ a.button.loud, input[type=submit].loud, button.loud { background: #ff5c00 url('/images/alert-overlay.png?1344550430') repeat-x; font-size: 125%; @@ -157,21 +160,21 @@ a.button.loud:hover, input[type=submit].loud:hover, button.loud:hover { background-color: #ee4b00; } -/* line 96, ../../../app/stylesheets/_layout.sass */ +/* line 99, ../../../app/stylesheets/_layout.sass */ ul.buttons { margin-bottom: 1em; } -/* line 98, ../../../app/stylesheets/_layout.sass */ +/* line 101, ../../../app/stylesheets/_layout.sass */ ul.buttons li { list-style: none; margin: 0 0.5em; } -/* line 101, ../../../app/stylesheets/_layout.sass */ +/* line 104, ../../../app/stylesheets/_layout.sass */ ul.buttons li, ul.buttons li form { display: inline; } -/* line 104, ../../../app/stylesheets/_layout.sass */ +/* line 107, ../../../app/stylesheets/_layout.sass */ #footer { clear: both; font-size: 75%; @@ -179,65 +182,65 @@ ul.buttons li, ul.buttons li form { padding-top: 2em; text-align: center; } -/* line 110, ../../../app/stylesheets/_layout.sass */ +/* line 113, ../../../app/stylesheets/_layout.sass */ #footer ul, #footer div { display: inline; margin: 0 1em; } -/* line 113, ../../../app/stylesheets/_layout.sass */ +/* line 116, ../../../app/stylesheets/_layout.sass */ #footer li, #footer div ul { display: inline; margin: 0 0.5em; } -/* line 117, ../../../app/stylesheets/_layout.sass */ +/* line 120, ../../../app/stylesheets/_layout.sass */ .success, .alert, .warning { margin-bottom: 1em; padding: 0.25em 0.5em; text-align: center; } -/* line 122, ../../../app/stylesheets/_layout.sass */ +/* line 125, ../../../app/stylesheets/_layout.sass */ .success { background: #e6efc2; border: 1px solid #c6d880; color: #264409; } -/* line 125, ../../../app/stylesheets/_layout.sass */ +/* line 128, ../../../app/stylesheets/_layout.sass */ .alert { background: #fbe3e4; border: 1px solid #fbc2c4; color: #8a1f11; } -/* line 128, ../../../app/stylesheets/_layout.sass */ +/* line 131, ../../../app/stylesheets/_layout.sass */ .warning { background: #fff6bf; border: 1px solid #ffd324; color: #514721; } -/* line 131, ../../../app/stylesheets/_layout.sass */ +/* line 134, ../../../app/stylesheets/_layout.sass */ #userbar { font-family: Delicious, Helvetica, Arial, Verdana, sans-serif; position: absolute; right: 0; top: 0; } -/* line 136, ../../../app/stylesheets/_layout.sass */ +/* line 139, ../../../app/stylesheets/_layout.sass */ #userbar > * { display: inline; margin: 0 0.25em; } -/* line 140, ../../../app/stylesheets/_layout.sass */ +/* line 143, ../../../app/stylesheets/_layout.sass */ #userbar-image-mode { font-weight: bold; margin-right: 1em; text-decoration: none; } -/* line 144, ../../../app/stylesheets/_layout.sass */ +/* line 147, ../../../app/stylesheets/_layout.sass */ #userbar-image-mode img { bottom: -2px; height: 16px; @@ -245,25 +248,25 @@ ul.buttons li, ul.buttons li form { width: 16px; } -/* line 147, ../../../app/stylesheets/_layout.sass */ +/* line 150, ../../../app/stylesheets/_layout.sass */ #userbar-log-in { text-decoration: none; } -/* line 149, ../../../app/stylesheets/_layout.sass */ +/* line 152, ../../../app/stylesheets/_layout.sass */ #userbar-log-in img { margin-bottom: -4px; margin-right: 0.25em; } -/* line 153, ../../../app/stylesheets/_layout.sass */ +/* line 156, ../../../app/stylesheets/_layout.sass */ #userbar-log-in span { text-decoration: underline; } -/* line 155, ../../../app/stylesheets/_layout.sass */ +/* line 158, ../../../app/stylesheets/_layout.sass */ #userbar-log-in:hover span { text-decoration: none; } -/* line 158, ../../../app/stylesheets/_layout.sass */ +/* line 161, ../../../app/stylesheets/_layout.sass */ .object { display: -moz-inline-box; -moz-box-orient: vertical; @@ -278,32 +281,32 @@ ul.buttons li, ul.buttons li form { vertical-align: top; width: 100px; } -/* line 166, ../../../app/stylesheets/_layout.sass */ +/* line 169, ../../../app/stylesheets/_layout.sass */ .object a { text-decoration: none; } -/* line 168, ../../../app/stylesheets/_layout.sass */ +/* line 171, ../../../app/stylesheets/_layout.sass */ .object a img { -moz-opacity: 0.75; -webkit-opacity: 0.75; -o-opacity: 0.75; -khtml-opacity: 0.75; } -/* line 170, ../../../app/stylesheets/_layout.sass */ +/* line 173, ../../../app/stylesheets/_layout.sass */ .object img { display: block; height: 80px; margin: 0 auto; width: 80px; } -/* line 175, ../../../app/stylesheets/_layout.sass */ +/* line 178, ../../../app/stylesheets/_layout.sass */ .object:hover img, .object a:hover img { -moz-opacity: 1; -webkit-opacity: 1; -o-opacity: 1; -khtml-opacity: 1; } -/* line 181, ../../../app/stylesheets/_layout.sass */ +/* line 184, ../../../app/stylesheets/_layout.sass */ .object .nc-icon, .object .closeted-icons { -moz-opacity: 1; -webkit-opacity: 1; @@ -314,7 +317,7 @@ ul.buttons li, ul.buttons li form { position: absolute; top: 64px; } -/* line 187, ../../../app/stylesheets/_layout.sass */ +/* line 190, ../../../app/stylesheets/_layout.sass */ .object .nc-icon:hover, .object .closeted-icons:hover { -moz-opacity: 0.5; -webkit-opacity: 0.5; @@ -322,32 +325,32 @@ ul.buttons li, ul.buttons li form { -khtml-opacity: 0.5; background: transparent; } -/* line 191, ../../../app/stylesheets/_layout.sass */ +/* line 194, ../../../app/stylesheets/_layout.sass */ .object .nc-icon, .object .closeted-icons img { display: inline; height: 16px; width: 16px; } -/* line 196, ../../../app/stylesheets/_layout.sass */ +/* line 199, ../../../app/stylesheets/_layout.sass */ .object .nc-icon { right: 18px; } -/* line 200, ../../../app/stylesheets/_layout.sass */ +/* line 203, ../../../app/stylesheets/_layout.sass */ .object .closeted-icons { left: 18px; } -/* line 203, ../../../app/stylesheets/_layout.sass */ +/* line 206, ../../../app/stylesheets/_layout.sass */ dt { font-weight: bold; } -/* line 206, ../../../app/stylesheets/_layout.sass */ +/* line 209, ../../../app/stylesheets/_layout.sass */ dd { margin: 0 0 1.5em 1em; } -/* line 209, ../../../app/stylesheets/_layout.sass */ +/* line 212, ../../../app/stylesheets/_layout.sass */ #home-link { font-family: Delicious, Helvetica, Arial, Verdana, sans-serif; font-size: 175%; @@ -358,21 +361,21 @@ dd { position: absolute; top: 0; } -/* line 219, ../../../app/stylesheets/_layout.sass */ +/* line 222, ../../../app/stylesheets/_layout.sass */ #home-link:hover { background: #eeffee; text-decoration: none; } -/* line 222, ../../../app/stylesheets/_layout.sass */ +/* line 225, ../../../app/stylesheets/_layout.sass */ #home-link span:before { content: "<< "; } -/* line 226, ../../../app/stylesheets/_layout.sass */ +/* line 229, ../../../app/stylesheets/_layout.sass */ .pagination a, .pagination span { margin: 0 0.5em; } -/* line 228, ../../../app/stylesheets/_layout.sass */ +/* line 231, ../../../app/stylesheets/_layout.sass */ .pagination .current { font-weight: bold; } @@ -396,34 +399,6 @@ dd { src: local("Delicious"), url('/fonts/Delicious-Italic.otf'); } -@font-face { - font-family: "Droid Serif"; - font-style: normal; - font-weight: normal; - src: local("Droid Serif"), url("http://themes.googleusercontent.com/font?kit=70P0G8gxVDIV6F9om0DsKg") format("truetype"); -} - -@font-face { - font-family: "Droid Serif"; - font-style: normal; - font-weight: bold; - src: local("Droid Serif"), url("http://themes.googleusercontent.com/font?kit=QQt14e8dY39u-eYBZmppwf5Jgr8ufe5A6KahQF76Xmg") format("truetype"); -} - -@font-face { - font-family: "Droid Sans"; - font-style: normal; - font-weight: normal; - src: local("Droid Sans"), url("http://themes.googleusercontent.com/font?kit=POVDFY-UUf0WFR9DIMCU8g") format("truetype"); -} - -@font-face { - font-family: "Calligraffitti"; - font-style: normal; - font-weight: normal; - src: local("Calligraffiti"), url("http://themes.googleusercontent.com/font?kit=vLVN2Y-z65rVu1R7lWdvyKIZAuDcNtpCWuPSaIR0Ie8") format("woff"); -} - /* line 2, ../../../app/stylesheets/partials/_jquery.jgrowl.sass */ div.jGrowl { padding: 10px; @@ -672,7 +647,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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss */ +/* line 4, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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; } @@ -1360,7 +1335,7 @@ body.closet_hangers-petpage #petpage-closet-lists h4 { width: 8em; vertical-align: middle; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.closet_hangers-petpage #petpage-closet-lists h4 { *display: inline; } @@ -1385,7 +1360,7 @@ body.closet_hangers-petpage #petpage-closet-lists ul li { margin: 0.25em 0.5em; padding: 1px; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.closet_hangers-petpage #petpage-closet-lists ul li { *display: inline; } @@ -1797,7 +1772,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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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; } @@ -1851,7 +1826,7 @@ body.items-show #item-preview-species a { vertical-align: middle; *vertical-align: auto; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.items-show #item-preview-species a { *display: inline; } @@ -1970,17 +1945,17 @@ body.items-show #item-contributors footer { body.items-show #item-contributors ul { list-style-type: none; } -/* line 5, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */ +/* line 5, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */ +/* line 24, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss */ +/* line 26, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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: ""; } @@ -2000,7 +1975,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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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; } @@ -2096,7 +2071,7 @@ body.outfits-edit #preview-toolbar form { *vertical-align: auto; margin-right: 2em; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.outfits-edit #preview-toolbar form { *display: inline; } @@ -2471,7 +2446,7 @@ body.outfits-edit #preview-search-form h2 { *vertical-align: auto; margin: 0 1em 0 0; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.outfits-edit #preview-search-form h2 { *display: inline; } @@ -2483,7 +2458,7 @@ body.outfits-edit #preview-search-form input { vertical-align: middle; *vertical-align: auto; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.outfits-edit #preview-search-form input { *display: inline; } @@ -2505,7 +2480,7 @@ body.outfits-edit #preview-search-form-pagination { vertical-align: middle; *vertical-align: auto; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.outfits-edit #preview-search-form-pagination { *display: inline; } @@ -2610,7 +2585,7 @@ body.outfits-edit.fullscreen #preview-search-form-help div { *vertical-align: auto; width: 48%; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.outfits-edit.fullscreen #preview-search-form-help div { *display: inline; } @@ -2776,7 +2751,7 @@ body.outfits-edit #preview-outfits > ul > li { position: relative; font-size: 14px; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.outfits-edit #preview-outfits > ul > li { *display: inline; } @@ -3109,7 +3084,7 @@ body.outfits-edit #preview-sharing #preview-sharing-url-formats li { font-size: 12px; padding: 0 2em; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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; } @@ -3399,7 +3374,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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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; } @@ -3450,7 +3425,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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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; } @@ -3491,7 +3466,7 @@ body.outfits-index #outfits > li { position: relative; font-size: 14px; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.outfits-index #outfits > li { *display: inline; } @@ -4122,7 +4097,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.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/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; } @@ -4196,7 +4171,7 @@ body.pets-bulk #bulk-pets-form textarea { overflow: hidden; resize: none; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.pets-bulk #bulk-pets-form textarea { *display: inline; } @@ -4217,7 +4192,7 @@ body.pets-bulk #bulk-pets-form ul li { min-width: 25%; text-align: left; } -/* line 7, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ +/* line 7, ../../../../../../.rvm/gems/ruby-1.9.3-p362/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/css3/_inline-block.scss */ body.pets-bulk #bulk-pets-form ul li { *display: inline; } From 132a49d30b38305c02c1d1c559cf3ca07b7297ec Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 01:46:36 -0500 Subject: [PATCH 03/66] i18n for outfits#new (and layouts#application), including caching --- app/controllers/application_controller.rb | 20 +++++ app/controllers/outfits_controller.rb | 10 +-- app/helpers/application_helper.rb | 16 ++++ app/helpers/contribution_helper.rb | 16 +++- app/helpers/outfits_helper.rb | 8 ++ app/models/contribution_observer.rb | 12 +-- app/models/fragment_expiration.rb | 18 +++++ app/models/fragment_localization.rb | 11 +++ app/models/item_observer.rb | 16 ++-- app/stylesheets/outfits/_new.sass | 3 + app/views/layouts/application.html.haml | 47 +++++------- app/views/outfits/new.html.haml | 90 ++++++++++------------- config/environments/development.rb | 2 +- config/locales/en-meep.yml | 67 +++++++++++++++++ config/locales/en.yml | 71 +++++++++++++++++- public/stylesheets/compiled/screen.css | 4 + 16 files changed, 297 insertions(+), 114 deletions(-) create mode 100644 app/models/fragment_expiration.rb create mode 100644 app/models/fragment_localization.rb create mode 100644 config/locales/en-meep.yml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7072396b..50ebfdf7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,11 @@ class ApplicationController < ActionController::Base + include FragmentLocalization + protect_from_forgery helper_method :can_use_image_mode?, :user_is? + + before_filter :set_locale def authenticate_user! # too lazy to change references to login_path redirect_to(login_path) unless user_signed_in? @@ -15,6 +19,18 @@ class ApplicationController < ActionController::Base true end + # This locale-inferrence method is designed for debugging. Once we're ready + # for production, we'll probably start inferring from domain. + def infer_locale + inference = params[:locale] + inference if inference && I18n.available_locales.include?(inference.to_sym) + end + + def localized_fragment_exist?(key) + localized_key = localize_fragment_key(key, locale) + fragment_exist?(localized_key) + end + def not_found(record_name='record') raise ActionController::RoutingError.new("#{record_name} not found") end @@ -30,6 +46,10 @@ class ApplicationController < ActionController::Base def redirect_back!(default=:back) redirect_to(params[:return_to] || default) end + + def set_locale + I18n.locale = infer_locale || I18n.default_locale + end def user_is?(user) user_signed_in? && user == current_user diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 2404e243..7bd48327 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -48,20 +48,16 @@ class OutfitsController < ApplicationController end def new - unless fragment_exist?(:action_suffix => 'start_from_scratch_form_content') + unless localized_fragment_exist?(:action_suffix => 'start_from_scratch_form_content') @colors = Color.all_ordered_by_name @species = Species.all_ordered_by_name end - unless fragment_exist?(:action_suffix => 'top_contributors') - @top_contributors = User.top_contributors.limit(User::PreviewTopContributorsCount) - end - - unless fragment_exist?('outfits#new newest_items') + unless localized_fragment_exist?('outfits#new newest_items') @newest_items = Item.newest.select([:id, :name, :thumbnail_url]).limit(9) end - unless fragment_exist?('outfits#new latest_contribution') + unless localized_fragment_exist?('outfits#new latest_contribution') @latest_contribution = Contribution.recent.first Contribution.preload_contributeds_and_parents([@latest_contribution]) end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 21ccfecd..411fe7e1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,6 @@ module ApplicationHelper + include FragmentLocalization + def absolute_url(path_or_url) if path_or_url.include?('://') # already an absolute URL path_or_url @@ -96,6 +98,11 @@ module ApplicationHelper html + javascript_include_tag(JAVASCRIPT_LIBRARIES[name]) end) end + + def localized_cache(key, &block) + localized_key = localize_fragment_key(key, locale) + cache(localized_key, &block) + end def login_path_with_return_to login_path :return_to => request.fullpath @@ -150,5 +157,14 @@ module ApplicationHelper def title(value) content_for :title, value end + + def userbar_contributions_summary(user) + contributions_link_content = translate('.userbar.contributions_link_content', + :user_points => user.points) + contributions_link = link_to(contributions_link_content, + user_contributions_path(user)) + translate '.userbar.contributions_summary_html', + :contributions_link => contributions_link + end end diff --git a/app/helpers/contribution_helper.rb b/app/helpers/contribution_helper.rb index ec9cbc94..a59afd06 100644 --- a/app/helpers/contribution_helper.rb +++ b/app/helpers/contribution_helper.rb @@ -2,13 +2,17 @@ module ContributionHelper def contributed_description(contributed, image = true) case contributed when Item - contributed_item(contributed, image, 'for the first time') + suffix = translate_contributed_description('item_suffix') + contributed_item(contributed, image, suffix) when SwfAsset - contributed_item(contributed.item, image, 'on a new body type') + suffix = translate_contributed_description('swf_asset_suffix') + contributed_item(contributed.item, image, suffix) when PetType - contributed_pet_type(contributed, image, :after => 'for the first time') + suffix = translate_contributed_description('pet_type_suffix') + contributed_pet_type(contributed, image, :after => suffix) when PetState - contributed_pet_type(contributed.pet_type, image, :before => 'a new pose for') + prefix = translate_contributed_description('pet_state_prefix') + contributed_pet_type(contributed.pet_type, image, :before => prefix) end end @@ -41,4 +45,8 @@ module ContributionHelper def output(&block) raw([].tap(&block).join(' ')) end + + def translate_contributed_description(key) + translate "contributions.contributed_description.#{key}" + end end diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index e1f87339..be0d95eb 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -2,6 +2,14 @@ module OutfitsHelper def destination_tag(value) hidden_field_tag 'destination', value, :id => nil end + + def latest_contribution_description(contribution) + user = contribution.user + contributed = contribution.contributed + t 'outfits.new.latest_contribution_description_html', + :user_link => link_to(user.name, user_contributions_path(user)), + :contributed_description => contributed_description(contributed, false) + end def link_to_edit_outfit(content_or_outfit, outfit_or_options, options={}) if block_given? diff --git a/app/models/contribution_observer.rb b/app/models/contribution_observer.rb index 8fd87b3b..50ddb798 100644 --- a/app/models/contribution_observer.rb +++ b/app/models/contribution_observer.rb @@ -1,16 +1,12 @@ class ContributionObserver < ActiveRecord::Observer + include FragmentExpiration + def after_create(contribution) - controller.expire_fragment('outfits#new latest_contribution') + expire_fragment_in_all_locales('outfits#new latest_contribution') if contribution.contributed_type == 'SwfAsset' item = contribution.contributed.item - controller.expire_fragment("items/#{item.id} contributors") + expire_fragment("items/#{item.id} contributors") end end - - private - - def controller - @controller ||= ActionController::Base.new - end end diff --git a/app/models/fragment_expiration.rb b/app/models/fragment_expiration.rb new file mode 100644 index 00000000..f124c8c2 --- /dev/null +++ b/app/models/fragment_expiration.rb @@ -0,0 +1,18 @@ +module FragmentExpiration + include FragmentLocalization + + delegate :expire_fragment, :to => :controller + + def expire_fragment_in_all_locales(key) + I18n.available_locales.each do |locale| + localized_key = localize_fragment_key(key, locale) + expire_fragment(localized_key) + end + end + + private + + def controller + @controller ||= ActionController::Base.new + end +end diff --git a/app/models/fragment_localization.rb b/app/models/fragment_localization.rb new file mode 100644 index 00000000..012e14a4 --- /dev/null +++ b/app/models/fragment_localization.rb @@ -0,0 +1,11 @@ +module FragmentLocalization + def localize_fragment_key(key, locale) + if key.is_a?(Hash) + {:locale => locale}.merge(key) + elsif key.is_a?(String) + "#{key} #{locale}" + else + raise TypeError, "unexpected fragment key type: #{key.class}" + end + end +end diff --git a/app/models/item_observer.rb b/app/models/item_observer.rb index fb259f84..204da4d9 100644 --- a/app/models/item_observer.rb +++ b/app/models/item_observer.rb @@ -1,4 +1,6 @@ class ItemObserver < ActionController::Caching::Sweeper + include FragmentExpiration + def after_create(item) Rails.logger.debug "Item #{item.id} was just created" expire_newest_items @@ -16,18 +18,14 @@ class ItemObserver < ActionController::Caching::Sweeper private - def controller - @controller ||= ActionController::Base.new - end - def expire_cache_for(item) - controller.expire_fragment("items/#{item.id}#item_link_partial") - controller.expire_fragment("items/#{item.id} header") - controller.expire_fragment("items/#{item.id} info") + expire_fragment("items/#{item.id}#item_link_partial") + expire_fragment("items/#{item.id} header") + expire_fragment("items/#{item.id} info") end def expire_newest_items - controller.expire_fragment('outfits#new newest_items') - controller.expire_fragment('items#index newest_items') + expire_fragment_in_all_locales('outfits#new newest_items') + expire_fragment('items#index newest_items') end end diff --git a/app/stylesheets/outfits/_new.sass b/app/stylesheets/outfits/_new.sass index ef873876..2e760c8e 100644 --- a/app/stylesheets/outfits/_new.sass +++ b/app/stylesheets/outfits/_new.sass @@ -203,6 +203,9 @@ body.outfits-new #recent-contributions-link font-weight: bold margin-right: .5em + + &::after + content: ":" #latest-contribution-created-at color: $soft-text-color diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 2c5437c3..72ece6a0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -8,7 +8,7 @@ - if content_for? :title_category = yield :title_category - else - Dress to Impress: Preview customized Neopets' clothing and wearables + #{t 'app_name'}: #{t '.title_tagline'} /[if IE] = include_javascript_libraries :html5 = yield :stylesheets @@ -34,45 +34,34 @@ - if home_link? %a#home-link{:href => root_path} - %span Dress to Impress + %span= t 'app_name' #userbar - if user_signed_in? %span - Hey, #{current_user.name}! - You have - = succeed '.' do - = link_to "#{current_user.points} points", user_contributions_path(current_user) - = link_to 'Items', user_closet_hangers_path(current_user), :id => 'userbar-items-link' - = link_to 'Outfits', current_user_outfits_path - = link_to 'Settings', Openneo::Auth.remote_settings_url - = link_to 'Log out', logout_path_with_return_to + = t '.userbar.greeting', :user_name => current_user.name + = userbar_contributions_summary(current_user) + = link_to t('.userbar.items'), user_closet_hangers_path(current_user), :id => 'userbar-items-link' + = link_to t('.userbar.outfits'), current_user_outfits_path + = link_to t('.userbar.settings'), Openneo::Auth.remote_settings_url + = link_to t('.userbar.logout'), logout_path_with_return_to - else = link_to login_path_with_return_to, :id => 'userbar-log-in' do = image_tag auth_server_icon_url - %span Log in + %span= t('.userbar.login') #footer %ul - %li - %a{:href => "http://openneo.net/", :target => "_blank"} OpenNeo - %li - %a{:href => "http://blog.openneo.net/", :target => "_blank"} Blog - %li - %a{:href => "http://forum.openneo.net/", :target => "_blank"} Forum - %li - %a{:href => "http://github.com/matchu/openneo-impress-rails"} Source Code - %li - %a{:href => terms_path} Terms of Use + %li= link_to t('organization_name'), 'http://openneo.net/' + %li= link_to t('.footer.blog'), 'http://blog.openneo.net/' + %li= link_to t('.footer.source_code'), + 'http://github.com/matchu/openneo-impress-rails' + %li= link_to t('.footer.terms'), terms_path %div - Contact: + #{t('.footer.contact')}: %ul - %li - %a{:href => feedback_url} Suggestions - %li - %a{:href => "mailto:#{contact_email}"} Questions, comments, bugs - %p - Images © 2000–#{Date.today.year} Neopets, Inc. All Rights Reserved. - Used With Permission + %li= link_to t('.footer.suggestions'), feedback_url + %li= mail_to contact_email, t('.footer.email') + %p= t '.footer.copyright', :year => Date.today.year = yield(:javascripts) diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 2f319032..1847d36e 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -3,100 +3,86 @@ = campaign_progress #outfit-forms - - cache :action_suffix => 'outfit_forms_intro' do + - localized_cache :action_suffix => 'outfit_forms_intro' do #pet-preview = image_tag 'default_preview.png', :alt => '' %span - %h1 Dress to Impress - %h2 Neopets wearables made easy! + %h1= t 'app_name' + %h2= t '.tagline' = form_tag load_pet_path, :id => 'load-pet-to-wardrobe' do - - cache :action_suffix => 'main_load_pet_form_content' do + - localized_cache :action_suffix => 'main_load_pet_form_content' do = origin_tag root_path = destination_tag 'wardrobe' %fieldset - %legend Enter your pet's name + %legend= t '.load_pet_legend' = pet_name_tag :id => 'main-pet-name' %button{:type => "submit"} - Plan my outfit! + = t '.load_pet_submit' = form_tag wardrobe_path, :method => 'get', :id => 'start-from-scratch' do - - cache :action_suffix => 'start_from_scratch_form_content' do + - localized_cache :action_suffix => 'start_from_scratch_form_content' do %fieldset - %legend Or start from scratch + %legend= t '.start_from_scratch_legend' = pet_attribute_select 'color', @colors, 8 = pet_attribute_select 'species', @species - %input{:type => "submit", :value => "Go"} + %input{:type => "submit", :value => t('.start_from_scratch_submit')} %ul#sections - - cache :action_suffix => 'your_items_module' do + - localized_cache :action_suffix => 'your_items_module' do %li#your-items-module = link_to image_tag('your_items.png'), your_items_path - %h3 - = link_to 'Your Items', your_items_path + %h3= link_to t('your_items'), your_items_path %div - %h4 Track and trade! - %p - Make lists of the items you own and want, and share them with the - world. + %h4= t '.your_items_tagline' + %p= t '.your_items_description' = form_tag users_path, :method => 'get' do - = text_field_tag 'name', '', :placeholder => raw('find a user…'), :type => 'search' - = submit_tag 'search' + = text_field_tag 'name', '', :type => 'search', + :placeholder => t('.your_items_user_search_placeholder') + = submit_tag t('.your_items_user_search_submit') - - cache :action_suffix => 'infinite_closet_module' do + - localized_cache :action_suffix => 'infinite_closet_module' do %li - %a{:href => items_path} - = image_tag 'items.png' - %h3 - %a{:href => items_path} - Infinite Closet + = link_to image_tag('items.png'), items_path + %h3= link_to t('infinite_closet'), items_path %div - %h4 Looking for something? - %p - Take a look through our wearables database! + %h4= t '.infinite_closet_tagline' + %p= t '.infinite_closet_description' = form_tag items_path, :method => 'get' do - = text_field_tag 'q', '', :placeholder => raw('find an item…'), :type => 'search' - = submit_tag 'search' + = text_field_tag 'q', '', :type => 'search', + :placeholder => t('.infinite_closet_item_search_placeholder') + = submit_tag t('.infinite_closet_item_search_submit') %li - %a{:href => bulk_pets_path} + = link_to bulk_pets_path do = image_tag 'http://images.neopets.com/items/mall_ac_garland_spotlight.gif' - %h3 - %a{:href => bulk_pets_path} - Modeling Hub + %h3= link_to t('modeling_hub'), bulk_pets_path %div - %h4 Found something? - %p - Enter a pet's name here and we'll keep a copy of what it's wearing. - Thanks so much! + %h4= t '.modeling_hub_tagline' + %p= t '.modeling_hub_description' = form_tag load_pet_path do = origin_tag root_path - = pet_name_tag :placeholder => raw('model a pet…') - = submit_tag 'submit' + = pet_name_tag :placeholder => t('.modeling_hub_load_pet_placeholder') + = submit_tag t('.modeling_hub_load_pet_submit') -- cache 'outfits#new latest_contribution' do +- localized_cache 'outfits#new latest_contribution' do #latest-contribution - = link_to 'Contributions:', contributions_path, :id => 'recent-contributions-link' - = link_to @latest_contribution.user.name, user_contributions_path(@latest_contribution.user) - showed us - = succeed '.' do - = contributed_description @latest_contribution.contributed, false - Thanks, - = succeed '!' do - = link_to @latest_contribution.user.name, user_contributions_path(@latest_contribution.user) + = link_to t('.latest_contribution_header'), contributions_path, :id => 'recent-contributions-link' + = latest_contribution_description(@latest_contribution) %abbr#latest-contribution-created-at{:title => @latest_contribution.created_at.getutc.iso8601} #whats-new - - cache :action_suffix => 'blog_preview' do + - localized_cache :action_suffix => 'blog_preview' do #blog-preview %h2 %div - %a#blog-preview-linkback{:href => 'http://blog.openneo.net/'} OpenNeo Blog + %a#blog-preview-linkback{:href => 'http://blog.openneo.net/'} + = t '.blog_linkback' - - cache 'outfits#new newest_items' do + - localized_cache 'outfits#new newest_items' do #newest-items - %h2 New Items + %h2= t '.newest_items_header' %ul - @newest_items.each do |item| = link_to image_tag(item.thumbnail_url), item diff --git a/config/environments/development.rb b/config/environments/development.rb index 03ae1808..4380159b 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -12,7 +12,7 @@ OpenneoImpressItems::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true config.action_view.debug_rjs = true - config.action_controller.perform_caching = false + config.action_controller.perform_caching = true # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml new file mode 100644 index 00000000..1edebc6f --- /dev/null +++ b/config/locales/en-meep.yml @@ -0,0 +1,67 @@ +en-meep: + app_name: Dreep to Impreep + organization_name: OpenMeep + your_items: Your Meeps + infinite_closet: Infinite Meepit + modeling_hub: Meepiting Hub + + layouts: + application: + title_tagline: Preview customized Neopets' meeps and meepits + + userbar: + greeting: Meep, %{user_name}! + contributions_summary_html: You have %{contributions_link}. + contributions_link_content: "%{user_points} meeps" + items: Iteeps + outfits: Outfeeps + settings: Setteeps + logout: Meep out + login: Meep in + + footer: + blog: Bleep + source_code: Source Meep + terms: Terms of Meep + contact: Meeptact + suggestions: Suggesteeps + email: Questions, comments, meepits + copyright: + Images © 2000–%{year} Neopets, Inc. All Rights Reserved. + Used With Permission. Meep. + + outfits: + new: + tagline: Meeps made meepy! + load_pet_legend: Enter your pet's meep + load_pet_submit: Meep my outfit! + start_from_scratch_legend: Or meep from scratch + start_from_scratch_submit: Meep + your_items_tagline: Meep and meep! + your_items_description: + Meep lists of the items you own and want, and meep them with the world. + your_items_user_search_placeholder: meep a user… + your_items_user_search_submit: meep + infinite_closet_tagline: Meeping for something? + infinite_closet_description: Take a meep through our wearables meep! + infinite_closet_item_search_placeholder: meep an item… + infinite_closet_item_search_submit: meep + modeling_hub_tagline: Found somemeep? + modeling_hub_description: + Meep a pet's meep here and we'll meep a meep of what it's wearing. + Thanks so meep! + modeling_hub_load_pet_placeholder: meep a pet… + modeling_hub_load_pet_submit: meep + latest_contribution_header: Contribumeeps + latest_contribution_description_html: + "%{user_link} meeped us %{contributed_description}. + Meep, %{user_link}!" + blog_linkback: OpenNeo Meep + newest_items_header: New Meeps + + contributions: + contributed_description: + item_suffix: "for the first meep" + swf_asset_suffix: "on a new body meep" + pet_type_suffix: "for the first meep" + pet_state_prefix: "a new meep for" diff --git a/config/locales/en.yml b/config/locales/en.yml index a747bfa6..cfeea61e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,5 +1,68 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - en: - hello: "Hello world" + app_name: Dress to Impress + organization_name: OpenNeo + your_items: Your Items + infinite_closet: Infinite Closet + modeling_hub: Modeling Hub + + layouts: + application: + title_tagline: Preview customized Neopets' clothing and wearables + + userbar: + greeting: Hey, %{user_name}! + contributions_summary_html: You have %{contributions_link}. + contributions_link_content: "%{user_points} points" + items: Items + outfits: Outfits + settings: Settings + logout: Log out + login: Log in + + footer: + blog: Blog + source_code: Source Code + terms: Terms of Use + contact: Contact + suggestions: Suggestions + email: Questions, comments, bugs + copyright: + Images © 2000–%{year} Neopets, Inc. All Rights Reserved. + Used With Permission + + outfits: + new: + tagline: Neopets wearables made easy! + load_pet_legend: Enter your pet's name + load_pet_submit: Plan my outfit! + start_from_scratch_legend: Or start from scratch + start_from_scratch_submit: Go + your_items_tagline: Track and trade! + your_items_description: + Make lists of the items you own and want, + and share them with the world. + your_items_user_search_placeholder: find a user… + your_items_user_search_submit: search + infinite_closet_tagline: Looking for something? + infinite_closet_description: Take a look through our wearables database! + infinite_closet_item_search_placeholder: find an item… + infinite_closet_item_search_submit: search + modeling_hub_tagline: Found something? + modeling_hub_description: + Enter a pet's name here and we'll keep a copy of what it's wearing. + Thanks so much! + modeling_hub_load_pet_placeholder: model a pet… + modeling_hub_load_pet_submit: submit + latest_contribution_header: Contributions + latest_contribution_description_html: + "%{user_link} showed us %{contributed_description}. + Thanks, %{user_link}!" + blog_linkback: OpenNeo Blog + newest_items_header: New Items + + contributions: + contributed_description: + item_suffix: "for the first time" + swf_asset_suffix: "on a new body type" + pet_type_suffix: "for the first time" + pet_state_prefix: "a new pose for" diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index 5e6bfc2f..dee2bedc 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -3967,6 +3967,10 @@ body.outfits-new #latest-contribution #recent-contributions-link { margin-right: 0.5em; } /* line 207, ../../../app/stylesheets/outfits/_new.sass */ +body.outfits-new #latest-contribution #recent-contributions-link::after { + content: ":"; +} +/* line 210, ../../../app/stylesheets/outfits/_new.sass */ body.outfits-new #latest-contribution #latest-contribution-created-at { color: #448844; margin-left: 0.5em; From fea0b42a17f2d950e246f4d611a92218564e931f Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 01:56:58 -0500 Subject: [PATCH 04/66] i18n for outfits#show --- app/helpers/outfits_helper.rb | 10 ++++++++++ app/views/outfits/show.html.haml | 15 +++++++-------- config/locales/en-meep.yml | 6 ++++++ config/locales/en.yml | 6 ++++++ 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index be0d95eb..1c561363 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -24,6 +24,16 @@ module OutfitsHelper query << "&outfit=#{outfit.id}" if user_signed_in? && outfit.user_id == current_user.id link_to content, wardrobe_path(:anchor => query), options end + + def outfit_creation_summary(outfit) + user = outfit.user + user_link = link_to(user.name, user_contributions_path(user)) + created_at_ago = content_tag(:abbr, time_ago_in_words(@outfit.created_at), + :title => @outfit.created_at) + translate 'outfits.show.creation_summary_html', + :user_link => user_link, + :created_at_ago => created_at_ago + end def outfit_li_for(outfit) class_name = outfit.starred? ? 'starred' : nil diff --git a/app/views/outfits/show.html.haml b/app/views/outfits/show.html.haml index 207285bd..e06fa93d 100644 --- a/app/views/outfits/show.html.haml +++ b/app/views/outfits/show.html.haml @@ -1,4 +1,4 @@ -- title(@outfit.name || "Shared outfit") +- title(@outfit.name || t('.default_outfit_name')) - content_for :before_title, campaign_progress - open_graph :type => 'openneo-impress:outfit', :title => yield(:title), @@ -7,15 +7,14 @@ - open_graph :image => absolute_url(@outfit.image.url) = link_to_edit_outfit(@outfit, :class => 'button', :id => 'outfit-wardrobe-link') do - Edit - - unless user_signed_in? && @outfit.user == current_user - a copy + - if user_signed_in? && @outfit.user == current_user + = t '.edit' + - else + = t '.clone' + - if @outfit.user_id #outfit-user - Created by - == #{link_to @outfit.user.name, user_contributions_path(@outfit.user)}, - %span{:title => @outfit.created_at}= time_ago_in_words @outfit.created_at - ago + = outfit_creation_summary(@outfit) #preview-wrapper #preview-swf #outfit-items= render @outfit.worn_items diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 1edebc6f..53a0551f 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -58,6 +58,12 @@ en-meep: Meep, %{user_link}!" blog_linkback: OpenNeo Meep newest_items_header: New Meeps + + show: + default_outfit_name: Meeped outfit + edit: Meep + clone: Meep a copy + creation_summary_html: Meeped by %{user_link}, %{created_at_ago} ago contributions: contributed_description: diff --git a/config/locales/en.yml b/config/locales/en.yml index cfeea61e..299fafb0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -59,6 +59,12 @@ en: Thanks, %{user_link}!" blog_linkback: OpenNeo Blog newest_items_header: New Items + + show: + default_outfit_name: Shared outfit + edit: Edit + clone: Edit a copy + creation_summary_html: Created by %{user_link}, %{created_at_ago} ago contributions: contributed_description: From 1356fdaa0cb29e9428621b14d49e5b83770880a8 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 01:59:40 -0500 Subject: [PATCH 05/66] i18n for users#top_contributors --- app/views/users/top_contributors.html.haml | 8 ++++---- config/locales/en-meep.yml | 7 +++++++ config/locales/en.yml | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/views/users/top_contributors.html.haml b/app/views/users/top_contributors.html.haml index 8b04129a..def20f2e 100644 --- a/app/views/users/top_contributors.html.haml +++ b/app/views/users/top_contributors.html.haml @@ -1,11 +1,11 @@ -- title 'Top Contributors' +- title t('.header') = will_paginate @users %table#top-contributors %thead %tr - %th{:scope => 'column'} Rank - %th{:scope => 'column'} User - %th{:scope => 'column'} Points + %th{:scope => 'column'}= t('.rank') + %th{:scope => 'column'}= t('.user') + %th{:scope => 'column'}= t('.points') %tbody - @users.each_with_index do |user, rank| %tr diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 53a0551f..9865b526 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -71,3 +71,10 @@ en-meep: swf_asset_suffix: "on a new body meep" pet_type_suffix: "for the first meep" pet_state_prefix: "a new meep for" + + users: + top_contributors: + header: Top Conmeeputors + rank: Reep + user: Meepit + points: Peeps diff --git a/config/locales/en.yml b/config/locales/en.yml index 299fafb0..0e22e668 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -72,3 +72,10 @@ en: swf_asset_suffix: "on a new body type" pet_type_suffix: "for the first time" pet_state_prefix: "a new pose for" + + users: + top_contributors: + header: Top Contributors + rank: Rank + user: User + points: Points From 34d919179a1a8ded5f16bfcb63771d3f5af64f8e Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 02:13:58 -0500 Subject: [PATCH 06/66] i18n for broken_image_reports#new --- app/helpers/application_helper.rb | 4 ++++ app/helpers/broken_image_reports_helper.rb | 9 ++++++++ app/views/broken_image_reports/new.html.haml | 23 +++++--------------- config/locales/en-meep.yml | 14 ++++++++++++ config/locales/en.yml | 15 +++++++++++++ 5 files changed, 48 insertions(+), 17 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 411fe7e1..80205215 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -153,6 +153,10 @@ module ApplicationHelper def signed_in_meta_tag %().html_safe end + + def labeled_time_ago_in_words(time) + content_tag :abbr, time_ago_in_words(time), :title => time + end def title(value) content_for :title, value diff --git a/app/helpers/broken_image_reports_helper.rb b/app/helpers/broken_image_reports_helper.rb index a0337f99..3c52fe26 100644 --- a/app/helpers/broken_image_reports_helper.rb +++ b/app/helpers/broken_image_reports_helper.rb @@ -1,2 +1,11 @@ module BrokenImageReportsHelper + def format_converted_at(converted_at) + translate 'broken_image_reports.new.converted_at_html', + :converted_at_ago => labeled_time_ago_in_words(converted_at) + end + + def format_reported_at(reported_at) + translate 'broken_image_reports.new.reported_at_html', + :reported_at_ago => labeled_time_ago_in_words(reported_at) + end end diff --git a/app/views/broken_image_reports/new.html.haml b/app/views/broken_image_reports/new.html.haml index 42205509..39378815 100644 --- a/app/views/broken_image_reports/new.html.haml +++ b/app/views/broken_image_reports/new.html.haml @@ -1,13 +1,8 @@ -- title 'Report broken image' +- title t('.title') -%p - Thanks for helping us find broken image! Sometimes the converters don't get - things quite right, and sometimes that can be fixed by just trying the - conversion again. If reconversion doesn't seem to solve the issue, consider - sending us a bug report at #{mail_to 'webmaster@openneo.net'}. Thanks! +%p= t '.explanation_html', :contact_link => mail_to(contact_email) -%p - Which of these images looked broken? We'll put it in line for reconversion. +%p= t '.call_to_action' %ul#report-assets - @swf_assets.each do |swf_asset| @@ -17,16 +12,10 @@ = form_tag(:action => :create) do = hidden_field_tag 'swf_asset_remote_id', swf_asset.remote_id = hidden_field_tag 'swf_asset_type', swf_asset.type - = submit_tag 'Report as broken' + = submit_tag t('.submit') - if swf_asset.converted_at? - %span.converted-at - Converted - = time_ago_in_words swf_asset.converted_at - ago + %span.converted-at= format_converted_at(swf_asset.converted_at) - else - %span.reported-broken-at - Reported - = time_ago_in_words swf_asset.reported_broken_at - ago + %span.reported-broken-at= format_reported_at(swf_asset.reported_broken_at) diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 9865b526..4b94559c 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -30,6 +30,20 @@ en-meep: Images © 2000–%{year} Neopets, Inc. All Rights Reserved. Used With Permission. Meep. + broken_image_reports: + new: + title: Meep broken image + explanation_html: + Thanks for helping us find broken meeps! Sometimes the meepits don't + get things quite right, and sometimes that can be meeped by just + meeping the conversion again. If reconversion doesn't seem to meep the + meep, consider sending us a meep at %{contact_link}. Meep! + call_to_action: + Which of these meeps looked meeped? We'll put it in line for remeeping. + submit: Meep as broken + converted_at_html: Conveeped %{converted_at_ago} ago + reported_at_html: Repeeped %{reported_at_ago} ago + outfits: new: tagline: Meeps made meepy! diff --git a/config/locales/en.yml b/config/locales/en.yml index 0e22e668..4e2a421f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -30,6 +30,21 @@ en: Images © 2000–%{year} Neopets, Inc. All Rights Reserved. Used With Permission + broken_image_reports: + new: + title: Report broken image + explanation_html: + Thanks for helping us find broken images! Sometimes the converters + don't get things quite right, and sometimes that can be fixed by just + trying the conversion again. If reconversion doesn't seem to solve the + issue, consider sending us a bug report at %{contact_link}. Thanks! + call_to_action: + Which of these images looked broken? + We'll put it in line for reconversion. + submit: Report as broken + converted_at_html: Converted %{converted_at_ago} ago + reported_at_html: Reported %{reported_at_ago} ago + outfits: new: tagline: Neopets wearables made easy! From 5e89e2b947f64c12f531a18553bf6c26629bf5ab Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 02:40:30 -0500 Subject: [PATCH 07/66] i18n for items#index (and layouts#items) --- app/controllers/items_controller.rb | 2 +- app/models/item_observer.rb | 2 +- app/views/items/index.html.haml | 54 +++++++++++++---------------- app/views/layouts/items.html.haml | 6 ++-- config/locales/en-meep.yml | 37 ++++++++++++++++++++ config/locales/en.yml | 37 ++++++++++++++++++++ 6 files changed, 103 insertions(+), 35 deletions(-) diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index c26b7919..df0ce18e 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -34,7 +34,7 @@ class ItemsController < ApplicationController else respond_to do |format| format.html { - unless fragment_exist?('items#index newest_items') + unless localized_fragment_exist?('items#index newest_items') @newest_items = Item.newest.limit(18) end } diff --git a/app/models/item_observer.rb b/app/models/item_observer.rb index 204da4d9..ab8e0c76 100644 --- a/app/models/item_observer.rb +++ b/app/models/item_observer.rb @@ -26,6 +26,6 @@ class ItemObserver < ActionController::Caching::Sweeper def expire_newest_items expire_fragment_in_all_locales('outfits#new newest_items') - expire_fragment('items#index newest_items') + expire_fragment_in_all_locales('items#index newest_items') end end diff --git a/app/views/items/index.html.haml b/app/views/items/index.html.haml index 4d911ee7..e4ba0094 100644 --- a/app/views/items/index.html.haml +++ b/app/views/items/index.html.haml @@ -1,48 +1,42 @@ - if @items - - title "Searching Infinite Closet for \"#{@query}\"" + - title t('.title_with_query', :query => @query) - if @items.empty? - :markdown - We couldn't find any wearables that matched **#{h @query}**. Sorry! - - Are we missing something? To add an item to our database, just - [show us a pet who is wearing it][1]. That's it! - - [1]: / + %p= t '.no_results_html', :query_html => content_tag(:strong, @query) + %p= t '.modeling_request_html', + :modeling_link => link_to(t('.modeling_link_content'), root_path) - else = will_paginate @items = render @items = will_paginate @items - else #search-info - - cache :action_suffix => 'search_help' do + - localized_cache :action_suffix => 'search_help' do #search-help - %h2 Find what you're looking for + %h2= t '.search_help_header' %dl - %dt kreludor "altador cup" -background + %dt= t '.basic_example_query' + %dd= t '.basic_example_description' + %dt= t '.user_items_example_query' %dd - returns any item with the word "kreludor" and the phrase "altador cup" - in it, but not the word "background" - %dt hat user:owns - %dd - returns - = link_to 'items that you own', your_items_path - with the word "hat" - %dt blue is:nc - %dd returns any NC Mall item with the word "blue" in it - %dt collar -is:pb - %dd returns any item with the word "collar" in it that isn't from a paint brush - %dt species:shoyru - %dd returns any item a Shoyru can wear - %dt type:hat - %dd returns any item that fills a "hat" zone + = t '.user_items_example_description_html', + :user_items_link => link_to(t('.user_items_example_link_content'), + your_items_path) + %dt= t '.nc_example_query' + %dd= t '.nc_example_description' + %dt= t '.pb_example_query' + %dd= t '.pb_example_description' + %dt= t '.species_example_query' + %dd= t '.species_example_description' + %dt= t '.type_example_query' + %dd= t '.type_example_description' - - cache 'items#index newest_items' do + - localized_cache 'items#index newest_items' do #search-new-items - %h2 Newest items + %h2= t '.newest_items_header' = render @newest_items - - cache :action_suffix => 'species_search_links' do + - localized_cache :action_suffix => 'species_search_links' do #species-search-links - %h2 Can't decide? Search by species + %h2= t '.species_search_header' = standard_species_search_links diff --git a/app/views/layouts/items.html.haml b/app/views/layouts/items.html.haml index d9591497..1629adec 100644 --- a/app/views/layouts/items.html.haml +++ b/app/views/layouts/items.html.haml @@ -1,15 +1,15 @@ - content_for :before_title, campaign_progress - content_for :title_category do - Infinite Closet: Neopets customization clothing and wearables database + #{t 'infinite_closet'}: #{t '.title_tagline'} - content_for :before_flashes do %h1 = link_to items_path do = image_tag 'http://images.neopets.com/items/mall_floatingneggfaerie.gif' - %span Infinite Closet + %span= t 'infinite_closet' - content_for :content do = form_tag items_path, :method => :get do = text_field_tag :q, @query - = submit_tag 'Search', :name => nil + = submit_tag t('.search'), :name => nil = yield = render :file => 'layouts/application' diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 4b94559c..94421d3c 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -29,6 +29,10 @@ en-meep: copyright: Images © 2000–%{year} Neopets, Inc. All Rights Reserved. Used With Permission. Meep. + + items: + title_tagline: Neopets customization meep and meepits database + search: Meep broken_image_reports: new: @@ -43,6 +47,39 @@ en-meep: submit: Meep as broken converted_at_html: Conveeped %{converted_at_ago} ago reported_at_html: Repeeped %{reported_at_ago} ago + + items: + index: + title_with_query: Searching Infinite Meepit for "%{query}" + no_results_html: + We couldn't meep any wearables that meeped %{query_html}. + Meep! + modeling_request_html: + Are we meeping something? To meep an item to our database, just + %{modeling_link}, and we'll meep our database instantly. Meep! + modeling_link_content: meep us a pet who is meeping it + search_help_header: Find what you're meeping for + basic_example_query: kreludor "altador cup" -background + basic_example_description: + returns any item with the meep "kreludor" and the meep "altador cup" + in it, but not the meep "background" + user_items_example_query: hat user:owns + user_items_example_description_html: + returns %{user_items_link} with the meep "hat" + user_items_example_link_content: items that you meep + nc_example_query: blue is:nc + nc_example_description: + returns any NC Meep item with the meep "blue" in it + pb_example_query: collar -is:pb + pb_example_description: + returns any item with the meep "collar" in it that isn't from a paint + brush + species_example_query: species:shoyru + species_example_description: returns any item a Shoyru can meep + type_example_query: type:hat + type_example_description: returns any item that fills a "hat" meep + newest_items_header: New Meeps + species_search_header: Can't decide? Meep by species outfits: new: diff --git a/config/locales/en.yml b/config/locales/en.yml index 4e2a421f..d8e613a6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -29,6 +29,10 @@ en: copyright: Images © 2000–%{year} Neopets, Inc. All Rights Reserved. Used With Permission + + items: + title_tagline: Neopets customization clothing and wearables database + search: Search broken_image_reports: new: @@ -45,6 +49,39 @@ en: converted_at_html: Converted %{converted_at_ago} ago reported_at_html: Reported %{reported_at_ago} ago + items: + index: + title_with_query: Searching Infinite Closet for "%{query}" + no_results_html: + We couldn't find any wearables that matched %{query_html}. + Sorry! + modeling_request_html: + Are we missing something? To add an item to our database, just + %{modeling_link}, and we'll update our database instantly. Thanks! + modeling_link_content: show us a pet who is wearing it + search_help_header: Find what you're looking for + basic_example_query: kreludor "altador cup" -background + basic_example_description: + returns any item with the word "kreludor" and the phrase "altador cup" + in it, but not the word "background" + user_items_example_query: hat user:owns + user_items_example_description_html: + returns %{user_items_link} with the word "hat" + user_items_example_link_content: items that you own + nc_example_query: blue is:nc + nc_example_description: + returns any NC Mall item with the word "blue" in it + pb_example_query: collar -is:pb + pb_example_description: + returns any item with the word "collar" in it that isn't from a paint + brush + species_example_query: species:shoyru + species_example_description: returns any item a Shoyru can wear + type_example_query: type:hat + type_example_description: returns any item that fills a "hat" zone + newest_items_header: Newest items + species_search_header: Can't decide? Search by species + outfits: new: tagline: Neopets wearables made easy! From b69793c008aabd043371a651f14f04062eb1bee2 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 02:57:23 -0500 Subject: [PATCH 08/66] i18n for contributions#index --- app/stylesheets/contributions/_index.sass | 11 ++++---- .../contributions/_contribution.html.haml | 15 +++++------ app/views/contributions/index.html.haml | 16 ++++++------ app/views/users/top_contributors.html.haml | 2 +- config/locales/en-meep.yml | 25 +++++++++++++------ config/locales/en.yml | 25 +++++++++++++------ public/stylesheets/compiled/screen.css | 8 +++--- 7 files changed, 59 insertions(+), 43 deletions(-) diff --git a/app/stylesheets/contributions/_index.sass b/app/stylesheets/contributions/_index.sass index 6319c5e6..020bc186 100644 --- a/app/stylesheets/contributions/_index.sass +++ b/app/stylesheets/contributions/_index.sass @@ -30,9 +30,8 @@ body.contributions-index top: 0 width: 80px z-index: 2 - span - &.username, &.contributed-name - font-weight: bold - &.time-ago - display: block - font-size: 75% + .username, .contributed-name + font-weight: bold + .time-ago + display: block + font-size: 75% diff --git a/app/views/contributions/_contribution.html.haml b/app/views/contributions/_contribution.html.haml index 59873b8b..3e37c748 100644 --- a/app/views/contributions/_contribution.html.haml +++ b/app/views/contributions/_contribution.html.haml @@ -1,10 +1,11 @@ - contributed = contribution.contributed = content_tag_for :li, contribution do %span.point-value= contribution.point_value - %span.username - = link_to contribution.user.name, user_contributions_path(contribution.user) - showed us - = contributed_description contributed - %span.time-ago{:title => contribution.created_at.to_s} - = time_ago_in_words(contribution.created_at) - ago + = t 'contributions.contribution.description_html', + :user_link => link_to(contribution.user.name, + user_contributions_path(contribution.user), + :class => 'username'), + :contributed_description => contributed_description(contributed) + .time-ago + = t 'contributions.contribution.created_at_html', + :created_at_ago => labeled_time_ago_in_words(contribution.created_at) diff --git a/app/views/contributions/index.html.haml b/app/views/contributions/index.html.haml index 7de1fd3a..b236deb8 100644 --- a/app/views/contributions/index.html.haml +++ b/app/views/contributions/index.html.haml @@ -1,19 +1,17 @@ -- title 'Recent Contributions' +- title t('.title') - if @user - canonical_path user_contributions_path(@user) %ul.buttons - if @user - %li= link_to 'Recent Contributions', contributions_path, :class => 'button' - %li= link_to 'Top Contributors', top_contributors_path, :class => 'button' + %li= link_to t('.title'), contributions_path, :class => 'button' + %li + = link_to t('users.top_contributors.title'), top_contributors_path, + :class => 'button' - if @user - %p - = @user.name - currently has - = @user.points - points + %p= t('.user_summary', :user_name => @user.name, :user_points => @user.points) - if @contributions.empty? - %p No contributions to see here! + %p= t('.no_contributions') - else = will_paginate @contributions %ul.contributions= render @contributions diff --git a/app/views/users/top_contributors.html.haml b/app/views/users/top_contributors.html.haml index def20f2e..c4bcb33f 100644 --- a/app/views/users/top_contributors.html.haml +++ b/app/views/users/top_contributors.html.haml @@ -1,4 +1,4 @@ -- title t('.header') +- title t('.title') = will_paginate @users %table#top-contributors %thead diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 94421d3c..dc53737c 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -47,7 +47,23 @@ en-meep: submit: Meep as broken converted_at_html: Conveeped %{converted_at_ago} ago reported_at_html: Repeeped %{reported_at_ago} ago + + contributions: + contributed_description: + item_suffix: for the first meep + swf_asset_suffix: on a new body meep + pet_type_suffix: for the first meep + pet_state_prefix: a new meep for + contribution: + description_html: "%{user_link} meeped us %{contributed_description}" + created_at_html: "%{created_at_ago} ameep" + + index: + title: Recent Contribeeptions + user_summary: "%{user_name} currently has %{user_points} meeps" + no_contributions: There are no contribeeptions here. + items: index: title_with_query: Searching Infinite Meepit for "%{query}" @@ -116,16 +132,9 @@ en-meep: clone: Meep a copy creation_summary_html: Meeped by %{user_link}, %{created_at_ago} ago - contributions: - contributed_description: - item_suffix: "for the first meep" - swf_asset_suffix: "on a new body meep" - pet_type_suffix: "for the first meep" - pet_state_prefix: "a new meep for" - users: top_contributors: - header: Top Conmeeputors + title: Top Conmeeputors rank: Reep user: Meepit points: Peeps diff --git a/config/locales/en.yml b/config/locales/en.yml index d8e613a6..fac24ccf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -49,6 +49,22 @@ en: converted_at_html: Converted %{converted_at_ago} ago reported_at_html: Reported %{reported_at_ago} ago + contributions: + contributed_description: + item_suffix: for the first time + swf_asset_suffix: on a new body type + pet_type_suffix: for the first time + pet_state_prefix: a new pose for + + contribution: + description_html: "%{user_link} showed us %{contributed_description}" + created_at_html: "%{created_at_ago} ago" + + index: + title: Recent Contributions + user_summary: "%{user_name} currently has %{user_points} points" + no_contributions: There are no contributions here. + items: index: title_with_query: Searching Infinite Closet for "%{query}" @@ -118,16 +134,9 @@ en: clone: Edit a copy creation_summary_html: Created by %{user_link}, %{created_at_ago} ago - contributions: - contributed_description: - item_suffix: "for the first time" - swf_asset_suffix: "on a new body type" - pet_type_suffix: "for the first time" - pet_state_prefix: "a new pose for" - users: top_contributors: - header: Top Contributors + title: Top Contributors rank: Rank user: User points: Points diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index dee2bedc..6d9af8e0 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -1614,12 +1614,12 @@ body.contributions-index .contributions img { width: 80px; z-index: 2; } -/* line 34, ../../../app/stylesheets/contributions/_index.sass */ -body.contributions-index .contributions span.username, body.contributions-index .contributions span.contributed-name { +/* line 33, ../../../app/stylesheets/contributions/_index.sass */ +body.contributions-index .contributions .username, body.contributions-index .contributions .contributed-name { font-weight: bold; } -/* line 36, ../../../app/stylesheets/contributions/_index.sass */ -body.contributions-index .contributions span.time-ago { +/* line 35, ../../../app/stylesheets/contributions/_index.sass */ +body.contributions-index .contributions .time-ago { display: block; font-size: 75%; } From ac0490dc1d9e7be715b9041385747dd558c03ba3 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 14:15:55 -0500 Subject: [PATCH 09/66] i18n for items#show (including javascripts/items/show.js) --- app/controllers/items_controller.rb | 2 +- app/helpers/closet_hangers_helper.rb | 10 +++ app/helpers/items_helper.rb | 5 ++ app/models/contribution_observer.rb | 2 +- app/models/item_observer.rb | 4 +- app/views/items/show.html.haml | 97 ++++++++++++---------------- config/locales/en-meep.yml | 47 ++++++++++++++ config/locales/en.yml | 48 ++++++++++++++ public/javascripts/items/show.js | 51 +++------------ 9 files changed, 167 insertions(+), 99 deletions(-) diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index df0ce18e..b753dfd6 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -48,7 +48,7 @@ class ItemsController < ApplicationController respond_to do |format| format.html do - unless fragment_exist?("items/#{@item.id} contributors") + unless localized_fragment_exist?("items/#{@item.id} contributors") @contributors_with_counts = @item.contributors_with_counts end diff --git a/app/helpers/closet_hangers_helper.rb b/app/helpers/closet_hangers_helper.rb index fa9c5d37..a80364f8 100644 --- a/app/helpers/closet_hangers_helper.rb +++ b/app/helpers/closet_hangers_helper.rb @@ -137,5 +137,15 @@ module ClosetHangersHelper hangers = @unlisted_closet_hangers_by_owned[owned] hangers ? hangers.size : 0 end + + def closet_lists_group_name(subject, owned) + ownership_key = owned ? 'owned_by' : 'wanted_by' + if subject == :you + translate "closet_lists.groups.#{ownership_key}.you" + else + translate "closet_lists.groups.#{ownership_key}.another_user", + :user_name => subject.name + end + end end diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index 07e2d1a9..2aeafae4 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -102,6 +102,11 @@ module ItemsHelper def auction_genie_url_for(item) "http://www.neopets.com/genie.phtml?type=process_genie&criteria=exact&auctiongenie=#{CGI::escape item.name}" end + + def trading_closet_hangers_header(owned, count) + ownership_key = owned ? 'owned' : 'wanted' + translate ".trading_closet_hangers.header.#{ownership_key}", :count => count + end def render_trading_closet_hangers(owned) @trading_closet_hangers_by_owned[owned].map do |hanger| diff --git a/app/models/contribution_observer.rb b/app/models/contribution_observer.rb index 50ddb798..2c232cdc 100644 --- a/app/models/contribution_observer.rb +++ b/app/models/contribution_observer.rb @@ -6,7 +6,7 @@ class ContributionObserver < ActiveRecord::Observer if contribution.contributed_type == 'SwfAsset' item = contribution.contributed.item - expire_fragment("items/#{item.id} contributors") + expire_fragment_in_all_locales("items/#{item.id} contributors") end end end diff --git a/app/models/item_observer.rb b/app/models/item_observer.rb index ab8e0c76..167581ca 100644 --- a/app/models/item_observer.rb +++ b/app/models/item_observer.rb @@ -20,8 +20,8 @@ class ItemObserver < ActionController::Caching::Sweeper def expire_cache_for(item) expire_fragment("items/#{item.id}#item_link_partial") - expire_fragment("items/#{item.id} header") - expire_fragment("items/#{item.id} info") + expire_fragment_in_all_locales("items/#{item.id} header") + expire_fragment_in_all_locales("items/#{item.id} info") end def expire_newest_items diff --git a/app/views/items/show.html.haml b/app/views/items/show.html.haml index f42b738c..3358ce08 100644 --- a/app/views/items/show.html.haml +++ b/app/views/items/show.html.haml @@ -1,31 +1,32 @@ - title @item.name - canonical_path @item -- cache "items/#{@item.id} header" do +- localized_cache "items/#{@item.id} header" do %header#item-header = image_tag @item.thumbnail_url, :id => 'item-thumbnail' %div %h2#item-name= @item.name = nc_icon_for(@item) - unless @item.rarity.blank? - == Rarity: #{@item.rarity_index} (#{@item.rarity}) - = link_to 'JN Items', jn_items_url_for(@item) + == #{t '.rarity'}: #{@item.rarity_index} (#{@item.rarity}) + = link_to t('.jn_items'), jn_items_url_for(@item) - unless @item.nc? - = link_to 'Shop Wizard', shop_wizard_url_for(@item) - = link_to 'Super Wizard', super_shop_wizard_url_for(@item) - = link_to 'Trades', trading_post_url_for(@item) - = link_to 'Auctions', auction_genie_url_for(@item) + = link_to t('.shop_wizard'), shop_wizard_url_for(@item) + = link_to t('.super_shop_wizard'), super_shop_wizard_url_for(@item) + = link_to t('.trading_post'), trading_post_url_for(@item) + = link_to t('.auction_genie'), auction_genie_url_for(@item) - if user_signed_in? #closet-hangers %h3 - Track this in - = link_to 'Your Items', user_closet_hangers_path(current_user) + = t '.hangers_header_html', + :user_items_link => link_to(t('your_items'), + user_closet_hangers_path(current_user)) = form_tag update_quantities_user_item_closet_hangers_path(:user_id => current_user, :item_id => @item), :method => :put do #closet-hangers-ownership-groups - @current_user_lists.each do |owned, lists| %div - %h4 Items you #{closet_list_verb(owned)} + %h4= closet_lists_group_name(:you, owned) %ul - lists.each do |list| %li @@ -38,81 +39,69 @@ @current_user_quantities[owned], :min => 0 - unless lists.empty? - = label_tag "quantity[#{owned}]", :class => 'unlisted' do - Not in a list + = label_tag "quantity[#{owned}]", + t('closet_lists.unlisted_name'), + :class => 'unlisted' - else - = label_tag "quantity[#{owned}]" do - How many? - = submit_tag 'Save to Your Items' + = label_tag "quantity[#{owned}]", t('.quantity_label') + = submit_tag t('.submit_hangers') -- cache "items/#{@item.id} info" do +- localized_cache "items/#{@item.id} info" do %p= @item.description #item-zones %p - %strong Occupies: + %strong #{t '.occupied_zones_header'}: = list_zones @item.occupied_zones, :uncertain_label %p - %strong Restricts: + %strong #{t '.restricted_zones_header'}: - if @item.restricted_zones.empty? - None + = t '.no_restricted_zones' - else = list_zones @item.restricted_zones #trade-hangers - [true, false].each do |owned| %p - - unless @trading_closet_hangers_by_owned[owned].empty? - %strong - = pluralize @trading_closet_hangers_by_owned[owned].size, 'user' - - if owned - - if @trading_closet_hangers_by_owned[owned].size == 1 - has - - else - have - this item up for trade: - - else - - if @trading_closet_hangers_by_owned[owned].size == 1 - wants - - else - want - this item: - = render_trading_closet_hangers(owned) - - else - %strong - We don't know anyone who - - if owned - has this item up for trade. - - else - wants this item. + %strong + = trading_closet_hangers_header(owned, @trading_closet_hangers_by_owned[owned].size) + = render_trading_closet_hangers(owned) %span.toggle - %span.more more - %span.less less + %span.more= t '.trading_closet_hangers.show_more' + %span.less= t '.trading_closet_hangers.show_less' -- cache 'items#show preview_header' do +- localized_cache 'items#show preview_header' do #item-preview-header - %h3 Preview - %a#customize-more.button{:href => '/'} Customize more + %h3= t '.preview_header' + = link_to t('.customize_more'), root_path, :id => 'customize-more', + :class => 'button' #item-preview #item-preview-species= standard_species_images_for(@item) #item-preview-error - #item-preview-swf - Javascript and Flash are required to preview wearables. Sorry! + #item-preview-swf= t '.preview_requirements_not_met' -- cache "items/#{@item.id} contributors" do +- localized_cache "items/#{@item.id} contributors" do - unless @contributors_with_counts.empty? #item-contributors - %header Brought to you by: + %header #{t '.contributors_header'}: %ul - @contributors_with_counts.each do |contributor, count| %li= link_to(contributor.name, user_contributions_path(contributor)) + format_contribution_count(count) - %footer Thanks! + %footer= t '.contributors_footer' :javascript var CURRENT_ITEM_ZONES_RESTRICT = #{@item.zones_restrict.inspect}, IMPRESS_HOST = #{RemoteImpressHost.inspect}; -= include_javascript_libraries :jquery, :swfobject -= javascript_include_tag 'items/show' +%script#swf-assets-not-found-template{:type => 'text/x-jquery-tmpl'} + = t '.swf_assets_not_found_html', :item_name => h(@item.name), + :species_name => '${species_name}', + :color_name => '${color_name}', + :modeling_link => link_to(t('.swf_assets_not_found_modeling_link_content'), + root_path) + +- content_for :javascripts do + = include_javascript_libraries :jquery, :swfobject, :jquery_tmpl + = javascript_include_tag 'items/show' diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index dc53737c..78c075e4 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -48,6 +48,16 @@ en-meep: converted_at_html: Conveeped %{converted_at_ago} ago reported_at_html: Repeeped %{reported_at_ago} ago + closet_lists: + unlisted_name: Not in a meep + groups: + owned_by: + you: Meeps you own + another_user: Meeps %{user_name} owns + wanted_by: + you: Meeps you want + another_user: Meeps %{user_name} wants + contributions: contributed_description: item_suffix: for the first meep @@ -96,6 +106,43 @@ en-meep: type_example_description: returns any item that fills a "hat" meep newest_items_header: New Meeps species_search_header: Can't decide? Meep by species + + show: + rarity: Meepity + jn_items: JN Meepits + shop_wizard: Meep Wizard + super_shop_wizard: Meeper Wizard + trading_post: Treeps + auction_genie: Aucteeps + hangers_header_html: Meep this in %{user_items_link} + quantity_label: How meepy? + submit_hangers: Save to Your Meeps + occupied_zones_header: Occupeeps + restricted_zones_header: Restreeps + no_restricted_zones: Meepless + trading_closet_hangers: + header: + owned: + zero: We don't know anymeep who has this item meep for trade. + one: "1 user has this item meep for trade:" + other: "%{count} users have this item meep for trade:" + wanted: + zero: "We don't know anymeep who meeps this item." + one: "1 user meeps this item:" + other: "%{count} users meep this item:" + show_more: meep more + show_less: meep less + preview_header: Meepview + customize_more: Customize meep + preview_requirements_not_met: + Javascript and Flash are required to preview meepits. Meep! + contributors_header: Meeped to you by + contributors_footer: Meep! + swf_assets_not_found_html: + We've never meeped the %{item_name} on the %{color_name} + %{species_name} before. Have you? If so, please %{modeling_link} and + we'll meep our datameep instantly. Meep! + swf_assets_not_found_modeling_link_content: meep it for us outfits: new: diff --git a/config/locales/en.yml b/config/locales/en.yml index fac24ccf..cd2a2852 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -49,6 +49,17 @@ en: converted_at_html: Converted %{converted_at_ago} ago reported_at_html: Reported %{reported_at_ago} ago + closet_lists: + unlisted_name: Not in a list + groups: + owned_by: + you: Items you own + another_user: Items %{user_name} owns + wanted_by: + you: Items you want + another_user: Items %{user_name} wants + + contributions: contributed_description: item_suffix: for the first time @@ -97,6 +108,43 @@ en: type_example_description: returns any item that fills a "hat" zone newest_items_header: Newest items species_search_header: Can't decide? Search by species + + show: + rarity: Rarity + jn_items: JN Items + shop_wizard: Shop Wizard + super_shop_wizard: Super Wizard + trading_post: Trades + auction_genie: Auctions + hangers_header_html: Track this in %{user_items_link} + quantity_label: How many? + submit_hangers: Save to Your Items + occupied_zones_header: Occupies + restricted_zones_header: Restricts + no_restricted_zones: None + trading_closet_hangers: + header: + owned: + zero: We don't know anyone who has this item up for trade. + one: "1 user has this item up for trade:" + other: "%{count} users have this item up for trade:" + wanted: + zero: "We don't know anyone who wants this item." + one: "1 user wants this item:" + other: "%{count} users want this item:" + show_more: more + show_less: less + preview_header: Preview + customize_more: Customize more + preview_requirements_not_met: + Javascript and Flash are required to preview wearables. Sorry! + contributors_header: Brought to you by + contributors_footer: Thanks! + swf_assets_not_found_html: + We've never seen the %{item_name} on the %{color_name} + %{species_name} before. Have you? If so, please %{modeling_link} and + we'll update our database instantly. Thanks! + swf_assets_not_found_modeling_link_content: model it for us outfits: new: diff --git a/public/javascripts/items/show.js b/public/javascripts/items/show.js index e02d8a48..bc5548a3 100644 --- a/public/javascripts/items/show.js +++ b/public/javascripts/items/show.js @@ -16,56 +16,29 @@ String.prototype.capitalize = function () { return this.charAt(0).toUpperCase() + this.substr(1); } -String.prototype.article = function () { - return 'aeiou'.indexOf(this.charAt(0).toLowerCase()) == -1 ? 'a' : 'an' -} - function impressUrl(path) { return 'http://' + IMPRESS_HOST + path; } -function LoadError(base_msg) { - this.render = function (args) { - var msg = base_msg, token, article_token; - for(var i in args) { - token = "$" + i; - article_token = token + "_article"; - if(msg.indexOf(article_token) != -1) { - msg = msg.replace(article_token, args[i].article()); - } - msg = msg.replace(token, args[i]); - } - return "Whoops - we've never seen " + msg + " before! If you have, please " + - "submit that pet's name as soon as you " + - "get the chance! Thanks!"; - } -} - function PetType() { var pet_type = this, loaded_data = false, loaded_assets = false; this.activated = true; this.assets = []; - this.deactivate = function (error, args) { + this.deactivate = function () { var msg; this.activated = false; - if(typeof args == 'undefined') args = {}; - args.color = this.color_name.capitalize(); - args.species = this.species_name.capitalize(); - this.deactivation_msg = error.render(args); + this.deactivation_msg = $('#swf-assets-not-found-template').tmpl({ + color_name: this.color_name.capitalize(), + species_name: this.species_name.capitalize() + }); if(this == PetType.current) showDeactivationMsg(); var img = this.link.children('img').get(0); this.link.addClass('deactivated'); img.src = img.src.replace('/1/', '/2/'); } - this.deactivateWithItem = function (item) { - pet_type.deactivate(Item.LOAD_ERROR, { - item: item.name - }); - } - this.load = function () { Item.current.load(this); loadAssets(); @@ -108,8 +81,6 @@ function PetType() { } PetType.all = {}; - -PetType.LOAD_ERROR = new LoadError("$color_article $color $species"); PetType.DASH_REGEX = /-/g; PetType.createFromLink = function (link) { @@ -148,7 +119,7 @@ function Item(id) { }); $.each(PetType.all, function () { if(item.getAssetsForPetType(this).length == 0) { - this.deactivateWithItem(item); + this.deactivate(); } }); }); @@ -167,13 +138,11 @@ function Item(id) { this.assets_by_body_id[pet_type.body_id] = assets; pet_type.onUpdate(); } else { - pet_type.deactivateWithItem(this); + pet_type.deactivate(); } } } -Item.LOAD_ERROR = new LoadError("$species_article $species wear a $item"); - Item.createFromLocation = function () { var item = new Item(parseInt(document.location.pathname.substr(7), 10)), z = CURRENT_ITEM_ZONES_RESTRICT, zl = z.length; @@ -197,7 +166,7 @@ Preview = new function Preview() { this.update = function (assets) { var assets; - if(swf) { + if(swf && typeof swf.setAssets == 'function') { log('now doing update'); assets = PetType.current.assets.concat( Item.current.getAssetsForPetType(PetType.current) @@ -228,9 +197,9 @@ Preview = new function Preview() { ); } - this.disable = function (msg) { + this.disable = function (errorMessage) { $('#' + swf_id).hide(); - $('#item-preview-error').html(msg).show(); + $('#item-preview-error').empty().append(errorMessage).show(); } this.enable = function () { From 9488a279167ecd7c0bb4aef406a95a0519904090 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 14:25:30 -0500 Subject: [PATCH 10/66] i18n for neopets_users#new --- app/views/neopets_users/new.html.haml | 16 +++++----------- config/locales/en-meep.yml | 10 ++++++++++ config/locales/en.yml | 10 ++++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/app/views/neopets_users/new.html.haml b/app/views/neopets_users/new.html.haml index 5b3e6f41..9fc52c6e 100644 --- a/app/views/neopets_users/new.html.haml +++ b/app/views/neopets_users/new.html.haml @@ -1,17 +1,11 @@ -- title 'Import from pets' +- title t('.title') - secondary_nav do - = link_to 'Back to Your Items', user_closet_hangers_path(current_user), :class => 'button' + = link_to t('.your_items_link'), user_closet_hangers_path(current_user), :class => 'button' = form_for @neopets_user, :html => {:id => 'neopets-user-form'} do |f| - %p - Since the items your pets are wearing don't show up in the Neopets closet, - we have this tool to help you import those items without a second thought. + %p= t '.explanation' - %p - Just enter your Neopets username in the box below, then we'll load all - your pets and import what they're wearing. Have fun! - - = f.label :username, 'Neopets Username' + = f.label :username, t('.username_label') = f.text_field :username - = f.submit "Import pets" + = f.submit t('.submit') diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 78c075e4..8a1d1042 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -144,6 +144,16 @@ en-meep: we'll meep our datameep instantly. Meep! swf_assets_not_found_modeling_link_content: meep it for us + neopets_users: + new: + title: Meemport from pets + your_items_link: Back to Your Meeps + explanation: + Meep your Neopets username below, and we'll meemport all the wearables + from all your pets. It's meepy! + username_label: Meopets Username + submit: Meemport all pets + outfits: new: tagline: Meeps made meepy! diff --git a/config/locales/en.yml b/config/locales/en.yml index cd2a2852..fdde6d37 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -146,6 +146,16 @@ en: we'll update our database instantly. Thanks! swf_assets_not_found_modeling_link_content: model it for us + neopets_users: + new: + title: Import from pets + your_items_link: Back to Your Items + explanation: + Enter your Neopets username below, and we'll import all the wearables + from all your pets. It's easy! + username_label: Neopets Username + submit: Import all pets + outfits: new: tagline: Neopets wearables made easy! From 5498a739f2dbe375d9897dd0cb0b762cac6967d2 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 16:02:57 -0500 Subject: [PATCH 11/66] i18n for pets#bulk --- app/stylesheets/pets/_bulk.sass | 15 ++++---- app/views/pets/bulk.html.haml | 52 ++++++++++++++------------ config/locales/en-meep.yml | 24 ++++++++++++ config/locales/en.yml | 24 ++++++++++++ public/javascripts/pets/bulk.js | 39 +++++++++---------- public/stylesheets/compiled/screen.css | 31 +++++++-------- 6 files changed, 121 insertions(+), 64 deletions(-) diff --git a/app/stylesheets/pets/_bulk.sass b/app/stylesheets/pets/_bulk.sass index a8de64ea..085d3448 100644 --- a/app/stylesheets/pets/_bulk.sass +++ b/app/stylesheets/pets/_bulk.sass @@ -83,6 +83,14 @@ body.pets-bulk margin: 0 auto min-width: 25% text-align: left + .waiting-message, .loading-message, .response + display: none + font: + size: 75% + style: italic + margin-left: 75px + &.waiting .waiting-message, &.loading .loading-message, &.loaded .response, &.failed .response + display: block &.loaded background: $notice-bg-color &.failed @@ -92,13 +100,6 @@ body.pets-bulk float: left height: 50px width: 50px - span - display: block - .response - font: - size: 75% - style: italic - margin-left: 75px &.js .noscript diff --git a/app/views/pets/bulk.html.haml b/app/views/pets/bulk.html.haml index 966a2ac3..e47133d6 100644 --- a/app/views/pets/bulk.html.haml +++ b/app/views/pets/bulk.html.haml @@ -1,53 +1,45 @@ -- title 'Modeling Hub' +- title t('modeling_hub') = form_tag load_pet_path, :id => 'needed-items-form' do - - cache :action_suffix => 'needed_items_content' do - %h3 Looking for ways to contribute? + - localized_cache :action_suffix => 'needed_items_content' do + %h3= t '.needed_items.header' - %p - Enter your pet's name below and we'll tell you what items you can help us - model. Thanks for your help! + %p= t '.needed_items.explanation' = origin_tag bulk_pets_path = destination_tag 'needed_items' %input#needed-items-pet-name-field{:type => "text", :name => "name"}/ - %input{:type => "submit", :value => "Submit"}/ + %input{:type => "submit", :value => t('.needed_items.submit')}/ #needed-items-alert.alert #needed-items-pet.script-only %h4 %img#needed-items-pet-thumbnail.inline-image - Items - %span#needed-items-pet-name - can model - - %button#needed-items-reload Reload + %span#needed-items-pet-header + %button#needed-items-reload= t '.needed_items.reload' %ul#needed-items-pet-items = form_tag load_pet_path, :id => 'bulk-pets-form' do - - cache :action_suffix => 'bulk_pets_content' do - %h3 Model pets in bulk + - localized_cache :action_suffix => 'bulk_pets_content' do + %h3= t '.bulk_pets.header' - %p - Got a lot of pets to model? Just keep typing them into the box below, or - even paste in a whole list of names, one name per line. Thanks for your - help! + %p= t '.bulk_pets.explanation' = origin_tag bulk_pets_path %div.noscript %input{:name => "name", :type => "text"}/ - %input{:type => "submit", :value => "Load pet"}/ + %input{:type => "submit", :value => t('.bulk_pets.submit')}/ %div.script-only %textarea - %button#bulk-pets-form-add{:type => "button"} Add - %button#bulk-pets-form-clear{:type => "button"} Clear + %button#bulk-pets-form-add{:type => "button"}= t '.bulk_pets.add' + %button#bulk-pets-form-clear{:type => "button"}= t '.bulk_pets.clear' %ul -- cache :action_suffix => 'item_template' do +- localized_cache :action_suffix => 'templates' do %script#item-template{:type => 'text/x-jquery-tmpl'} %li{:class => 'object{{if owned}} owned{{/if}}'} = link_to item_path(':id').sub(':id', '${id}') do @@ -68,8 +60,22 @@ {{/if}} {{if owned}} - %span.object-owned You own this item + %span.object-owned= t '.needed_items.item_owned' {{/if}} + + %script#needed-items-pet-header-template{:type => 'text/x-jquery/tmpl'} + = t '.needed_items.pet_header', :pet_name => '${pet_name}' + + %script#bulk-pets-submission-template{:type => 'text/x-jquery/tmpl'} + %li.waiting + %img{:src => 'http://pets.neopets.com/cpn/${pet_name}/1/1.png'} + %span.name ${pet_name} + %span.waiting-message= t '.bulk_pets.waiting' + %span.loading-message= t '.bulk_pets.loading' + %span.response + + %script#bulk-pets-submission-success-template{:type => 'text/x-jquery/tmpl'} + = t '.bulk_pets.submission_success', :points => '${points}' - content_for :javascripts do = include_javascript_libraries :jquery, :jquery_tmpl diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 8a1d1042..1e1bce72 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -189,6 +189,30 @@ en-meep: clone: Meep a copy creation_summary_html: Meeped by %{user_link}, %{created_at_ago} ago + pets: + bulk: + needed_items: + header: Looking for ways to contreepute? + explanation: + Meep your pet's name below and we'll tell you what items you can + meep. Thanks for your meep! + submit: Meep + pet_header: Items %{pet_name} can meep + reload: Remeep + item_owned: You own this meepit + bulk_pets: + header: Meep pets in bulk + explanation: + Got a lot of pets to meep? Just keep meeping them into the box below, + or even meep in a whole list of names, one name per line. Thanks for + your meep! + submit: Meep pet + add: Meep + clear: Cleer + waiting: Weeting… + loading: Leeding… + submission_success: "%{points} peeps" + users: top_contributors: title: Top Conmeeputors diff --git a/config/locales/en.yml b/config/locales/en.yml index fdde6d37..995d5cfa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -192,6 +192,30 @@ en: clone: Edit a copy creation_summary_html: Created by %{user_link}, %{created_at_ago} ago + pets: + bulk: + needed_items: + header: Looking for ways to contribute? + explanation: + Enter your pet's name below and we'll tell you what items you can + model. Thanks for your help! + submit: Submit + pet_header: Items %{pet_name} can model + reload: Reload + item_owned: You own this item + bulk_pets: + header: Model pets in bulk + explanation: + Got a lot of pets to model? Just keep typing them into the box below, + or even paste in a whole list of names, one name per line. Thanks for + your help! + submit: Load pet + add: Add + clear: Clear + waiting: Waiting… + loading: Loading… + submission_success: "%{points} points" + users: top_contributors: title: Top Contributors diff --git a/public/javascripts/pets/bulk.js b/public/javascripts/pets/bulk.js index 7b9bd7dd..b3838659 100644 --- a/public/javascripts/pets/bulk.js +++ b/public/javascripts/pets/bulk.js @@ -1,4 +1,4 @@ -var DEBUG = (document.location.search == '?debug'); +var DEBUG = (document.location.search.substr(0, 6) == '?debug'); /* Needed items form */ (function () { @@ -7,7 +7,7 @@ var DEBUG = (document.location.search == '?debug'); UI.alert = $('#needed-items-alert'); UI.pet_name_field = $('#needed-items-pet-name-field'); UI.pet_thumbnail = $('#needed-items-pet-thumbnail'); - UI.pet_name = $('#needed-items-pet-name'); + UI.pet_header = $('#needed-items-pet-header'); UI.reload = $('#needed-items-reload'); UI.pet_items = $('#needed-items-pet-items'); UI.item_template = $('#item-template'); @@ -24,6 +24,8 @@ var DEBUG = (document.location.search == '?debug'); /* Pet */ + var last_successful_pet_name = null; + function loadPet(pet_name) { // If there is a request in progress, kill it. Our new pet request takes // priority, and, if I submit a name while the previous name is loading, I @@ -52,8 +54,11 @@ var DEBUG = (document.location.search == '?debug'); } function petSuccess(data, pet_name) { + last_successful_pet_name = pet_name; UI.pet_thumbnail.attr('src', petThumbnailUrl(pet_name)); - UI.pet_name.text(pet_name); + UI.pet_header.empty(); + $('#needed-items-pet-header-template').tmpl({pet_name: pet_name}). + appendTo(UI.pet_header); loadItems(data.query); } @@ -92,8 +97,9 @@ var DEBUG = (document.location.search == '?debug'); loadPet(UI.pet_name_field.val()); }); - UI.reload.click(function () { - loadPet(UI.pet_name.text()); + UI.reload.click(function (e) { + e.preventDefault(); + loadPet(last_successful_pet_name); }); })(); @@ -109,20 +115,15 @@ var DEBUG = (document.location.search == '?debug'); $(document.body).addClass('js'); bulk_load_queue = new (function BulkLoadQueue() { - var pets = [], - standard_pet_el = $('
  • '), - url = form.attr('action') + '.json'; - standard_pet_el.append('').append($('', {'class': 'name'})) - .append($('', {'class': 'response', text: 'Waiting...'})); + var pets = [], url = form.attr('action') + '.json'; function Pet(name) { - var el = standard_pet_el.clone() - .children('img').attr('src', petImage('cpn/' + name, 1)).end() - .children('span.name').text(name).end(); - el.appendTo(queue_el); + var el = $('#bulk-pets-submission-template').tmpl({pet_name: name}). + appendTo(queue_el); this.load = function () { - var response_el = el.children('span.response').text('Loading...'); + el.removeClass('waiting').addClass('loading'); + var response_el = el.find('span.response'); $.ajax({ complete: function (data) { pets.shift(); @@ -133,14 +134,14 @@ var DEBUG = (document.location.search == '?debug'); data: {name: name}, dataType: 'json', error: function (xhr) { - el.addClass('failed'); + el.removeClass('loading').addClass('failed'); response_el.text(xhr.responseText); }, success: function (data) { var points = data.points; - var response = (points === true) ? 'Thanks!' : points + ' points'; - el.addClass('loaded'); - response_el.text(response); + el.removeClass('loading').addClass('loaded'); + $('#bulk-pets-submission-success-template').tmpl({points: points}). + appendTo(response_el); }, type: 'post', url: url diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index 6d9af8e0..f88f89e2 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -4201,38 +4201,39 @@ body.pets-bulk #bulk-pets-form ul li { *display: inline; } /* line 86, ../../../app/stylesheets/pets/_bulk.sass */ +body.pets-bulk #bulk-pets-form ul li .waiting-message, body.pets-bulk #bulk-pets-form ul li .loading-message, body.pets-bulk #bulk-pets-form ul li .response { + display: none; + font-size: 75%; + font-style: italic; + margin-left: 75px; +} +/* line 92, ../../../app/stylesheets/pets/_bulk.sass */ +body.pets-bulk #bulk-pets-form ul li.waiting .waiting-message, body.pets-bulk #bulk-pets-form ul li.loading .loading-message, body.pets-bulk #bulk-pets-form ul li.loaded .response, body.pets-bulk #bulk-pets-form ul li.failed .response { + display: block; +} +/* line 94, ../../../app/stylesheets/pets/_bulk.sass */ body.pets-bulk #bulk-pets-form ul li.loaded { background: #e6efc2; } -/* line 88, ../../../app/stylesheets/pets/_bulk.sass */ +/* line 96, ../../../app/stylesheets/pets/_bulk.sass */ body.pets-bulk #bulk-pets-form ul li.failed { background: #fbe3e4; } -/* line 90, ../../../app/stylesheets/pets/_bulk.sass */ +/* line 98, ../../../app/stylesheets/pets/_bulk.sass */ body.pets-bulk #bulk-pets-form ul img { float: left; height: 50px; width: 50px; } -/* line 95, ../../../app/stylesheets/pets/_bulk.sass */ -body.pets-bulk #bulk-pets-form ul span { - display: block; -} -/* line 97, ../../../app/stylesheets/pets/_bulk.sass */ -body.pets-bulk #bulk-pets-form ul .response { - font-size: 75%; - font-style: italic; - margin-left: 75px; -} -/* line 104, ../../../app/stylesheets/pets/_bulk.sass */ +/* line 105, ../../../app/stylesheets/pets/_bulk.sass */ body.pets-bulk.js .noscript { display: none; } -/* line 106, ../../../app/stylesheets/pets/_bulk.sass */ +/* line 107, ../../../app/stylesheets/pets/_bulk.sass */ body.pets-bulk.js .script-only { display: block; } -/* line 109, ../../../app/stylesheets/pets/_bulk.sass */ +/* line 110, ../../../app/stylesheets/pets/_bulk.sass */ body.pets-bulk .script-only { display: none; } From c32425bc14d403eaf8553c61095faa553bdda170 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 30 Dec 2012 17:07:29 -0500 Subject: [PATCH 12/66] i18n for neopets_pages#new --- app/models/closet_page.rb | 2 +- app/models/safety_deposit_page.rb | 2 +- app/views/neopets_pages/new.html.haml | 107 +++++++++++++++----------- config/locales/en-meep.yml | 74 ++++++++++++++++++ config/locales/en.yml | 74 ++++++++++++++++++ 5 files changed, 210 insertions(+), 49 deletions(-) diff --git a/app/models/closet_page.rb b/app/models/closet_page.rb index f58a466f..08e9ba99 100644 --- a/app/models/closet_page.rb +++ b/app/models/closet_page.rb @@ -27,7 +27,7 @@ class ClosetPage end def name - 'closet' + I18n.translate('neopets_pages.names.closet') end def persisted? diff --git a/app/models/safety_deposit_page.rb b/app/models/safety_deposit_page.rb index 09619fdf..ccf16526 100644 --- a/app/models/safety_deposit_page.rb +++ b/app/models/safety_deposit_page.rb @@ -10,7 +10,7 @@ class SafetyDepositPage < ClosetPage } def name - 'SDB' + I18n.translate('neopets_pages.names.safety_deposit') end def url diff --git a/app/views/neopets_pages/new.html.haml b/app/views/neopets_pages/new.html.haml index 2850f517..d375738f 100644 --- a/app/views/neopets_pages/new.html.haml +++ b/app/views/neopets_pages/new.html.haml @@ -1,57 +1,70 @@ -- title "Import from #{@neopets_page.name}, Page #{@neopets_page.index}" +- title t('.title', :name => @neopets_page.name, :index => @neopets_page.index) - content_for :before_flashes do - = link_to 'Back to Your Items', user_closet_hangers_path(current_user), :id => 'back-to-items' + = link_to t('.your_items_link'), user_closet_hangers_path(current_user), :id => 'back-to-items' = form_for @neopets_page, :html => {:id => 'closet-page-form'} do |f| = f.hidden_field :index #closet-page-frame-wrapper %span - %strong Page #{@neopets_page.index} - of your #{@neopets_page.name} + %strong + = t '.frame_header', :name => @neopets_page.name, + :index => @neopets_page.index %iframe#closet-page-frame{:src => @neopets_page.url} #closet-page-source - = f.label :source, "Paste source code below" + = f.label :source, t('.source_header') = f.text_area :source - = f.submit 'Import items' - -:markdown - **Welcome to the bulk #{@neopets_page.name} importer!** We're going to make it as - easy as possible to import your Neopets.com #{@neopets_page.name} data into your Dress to - Impress items list. Here's how it works. - - 1. Check the framed Neopets.com window on the left, pointing to - [page #{@neopets_page.index} of your #{@neopets_page.name}][cp]. - * **Confirm that you're logged in.** If you're logged into - Neopets, but the above frame says that you're not, try enabling - "third-party cookies" in your browser. (Most have that on by default.) - * **If you haven't logged in, #{link_to_neopets_login "do so in another window"}.** - It's never a good idea to log in inside of a frame, unless you're a - web programmer pro who can check that the frame does, in fact, point - to Neopets.com. To be safe, - #{link_to_neopets_login "pull up another window, check the URL, and log in safely"}. - * **Confirm that the page is, in fact, your #{@neopets_page.name}.** Similarly, don't - just trust a website when they tell you to copy-paste the source code - of another site. Instead, check that the page is what it is supposed to - be and does not contain any information you didn't mean to give out. - - 2. View the frame's source code. - * **In Google Chrome,** right-click the frame and choose **View Frame Source**. - * **In Firefox,** right-click the frame, choose **This Frame**, then **View Frame Source**. - * In other browsers, right-click, and look for something similar. If you're - still having trouble, try - #{link_to "viewing the page in a new window", @neopets_page.url, :target => "_blank"}, - right-clicking, and choosing View Source. - - 3. Highlight the entire source code, and copy-paste it into the box on the right. - * Some nifty shortcuts: Ctrl-A to select all the text, Ctrl-C to copy it, - Ctrl-V to paste it in. - - 4. Submit! - * We'll analyze the code you sent us, grab exclusively the identity and - quantity of items in your #{@neopets_page.name}, and add that to your Dress to Impress - items list. I promise it's all safe, but, if you're concerned, find a - programmer buddy and [check out the source code to be sure][source]. - - [cp]: #{@neopets_page.url} - [source]: http://github.com/matchu/openneo-impress-rails + = f.submit t('.submit') +- localized_cache :action_suffix => 'explanation' do + %p + = t '.help.welcome', :name => @neopets_page.name + = t '.help.intro', :name => @neopets_page.name + + %ol + %li + = t '.help.check_frame.header_html', + :page_link => link_to(t('.help.check_frame.page_link_content', + :name => @neopets_page.name, + :index => @neopets_page.index), + @neopets_page.url) + %ul + %li + %strong= t '.help.check_frame.check_login.summary' + = t '.help.check_frame.check_login.details' + %li + %strong + = t '.help.check_frame.login.summary_html', + :login_link => link_to_neopets_login(t('.help.check_frame.login.summary_login_link_content')) + = t '.help.check_frame.login.details_html', + :login_link => link_to_neopets_login(t('.help.check_frame.login.details_login_link_content')) + %li + %strong + = t '.help.check_frame.check_content.summary', + :name => @neopets_page.name + = t '.help.check_frame.check_content.details' + + %li + = t '.help.view_source.header' + %ul + %li + = t '.help.view_source.chrome_html' + %li + = t '.help.view_source.firefox_html' + %li + = t '.help.view_source.other_html' + %li + = t '.help.view_source.troubleshooting_html', + :page_link => link_to(t('.help.view_source.troubleshooting_page_link_content'), + @neopets_page.url) + + %li + = t '.help.copy_source.header' + %ul + %li + = t '.help.copy_source.shortcuts' + + %li + = t '.help.submit.header' + %ul + %li + = t '.help.submit.description', :name => @neopets_page.name diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 1e1bce72..468cd4d8 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -144,6 +144,80 @@ en-meep: we'll meep our datameep instantly. Meep! swf_assets_not_found_modeling_link_content: meep it for us + neopets_pages: + names: + closet: meepit + safety_deposit: safety demeepit + + new: + title: Meeport from %{name}, Page %{index} + your_items_link: Back to Your Meeps + frame_header: Meep %{index} of your %{name} + source_header: Meep source code below + submit: Meep items + help: + welcome: Welcome to the bulk %{name} meeporter! + intro: + We're going to meep it as easy as possible to meeport your + Neopets.com %{name} data into your Dress to Impress meepit list. + Here's how it meeps. + check_frame: + header_html: + Check the framed Neopets.com meep on the left, + meeping to %{page_link}. + page_link_content: + meep %{index} of your %{name} + check_login: + summary: Confirm that you're meeped in. + details: + If you're meeped into Neopets, but the above frame says that + you're not, try enabling "third-party cookies" in your browser. + (Most have meeped on by default.) + login: + summary_html: If you haven't meeped in, %{login_link}. + summary_login_link_content: do so in another meepit + details_html: + It's never a good idea to meep in inside of a frame, unless + you're a web programmer pro who can meep that the frame does, in + fact, meep to Neopets.com. To be safe, %{login_link}. + details_login_link_content: + meep up another window, meep the URL, and meep in safely + check_content: + summary: Meep that the page is, in fact, your %{name}. + details: + Don't just meep a website when they tell you to meepy-paste the + source code of another site. Instead, check that the meep is what + it is supposed to be and doesn't meep any private information. + view_source: + header: Meep the frame's source code. + chrome_html: + In Google Chrome, right-meep the frame and choose + View Frame Source. + firefox_html: + In Firefox, right-meep the frame, choose + This Frame, then View Frame + Source. + other_html: + In other meepits, right-meep and look for something similar. + troubleshooting_html: + If you're still having trouble, try %{page_link}, right-meeping, + and meeping View Source. + troubleshooting_page_link_content: meeping the page in a new window + copy_source: + header: + Meeplight the entire source code, + and meepy-paste it into the box on the right. + shortcuts: + "Some meepy shortcuts: Ctrl-A to select all the text, Ctrl-C to + copy it, Ctrl-V to paste it in." + submit: + header: Submeep! + description: + We'll analyze the meep you sent us, grab exclusively the identity + and quantity of meepits in your %{name}, and add that to your Dress + to Impress meepit list. I meep that it's all safe, but, if you're + concerned, find a meepit and meep out the source code to be sure. + neopets_users: new: title: Meemport from pets diff --git a/config/locales/en.yml b/config/locales/en.yml index 995d5cfa..1394679b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -146,6 +146,80 @@ en: we'll update our database instantly. Thanks! swf_assets_not_found_modeling_link_content: model it for us + neopets_pages: + names: + closet: closet + safety_deposit: safety deposit + new: + title: Import from %{name}, Page %{index} + your_items_link: Back to Your Items + frame_header: Page %{index} of your %{name} + source_header: Paste source code below + submit: Import items + help: + welcome: Welcome to the bulk %{name} importer! + intro: + We're going to make it as easy as possible to import your Neopets.com + %{name} data into your Dress to Impress items list. Here's how it + works. + check_frame: + header_html: + Check the framed Neopets.com window on the left, + pointing to %{page_link}. + page_link_content: + page %{index} of your %{name} + check_login: + summary: Confirm that you're logged in. + details: + If you're logged into Neopets, but the above frame says that + you're not, try enabling "third-party cookies" in your browser. + (Most have that on by default.) + login: + summary_html: If you haven't logged in, %{login_link}. + summary_login_link_content: do so in another window + details_html: + It's never a good idea to log in inside of a frame, unless you're + a web programmer pro who can check that the frame does, in fact, + point to Neopets.com. To be safe, %{login_link}. + details_login_link_content: + pull up another window, check the URL, and log in safely + check_content: + summary: Confirm that the page is, in fact, your %{name}. + details: + Don't just trust a website when they tell you to copy-paste the + source code of another site. Instead, check that the page is what + it is supposed to be and doesn't contain any private information. + view_source: + header: View the frame's source code. + chrome_html: + In Google Chrome, right-click the frame and choose + View Frame Source. + firefox_html: + In Firefox, right-click the frame, choose + This Frame, then View Frame + Source. + other_html: + In other browsers, right-click and look for something similar. + troubleshooting_html: + If you're still having trouble, try %{page_link}, right-clicking, + and choosing View Source. + troubleshooting_page_link_content: opening the page in a new window + copy_source: + header: + Highlight the entire source code, + and copy-paste it into the box on the right. + shortcuts: + "Some nifty shortcuts: Ctrl-A to select all the text, Ctrl-C to + copy it, Ctrl-V to paste it in." + submit: + header: Submit! + description: + We'll analyze the code you sent us, grab exclusively the identity + and quantity of items in your %{name}, and add that to your Dress + to Impress items list. I promise it's all safe, but, if you're + concerned, find a programmer buddy and check out the source code to + be sure. + neopets_users: new: title: Import from pets From b213f6d0ba19ccfae24637b2dfdb99f13ee87e46 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jan 2013 21:42:58 -0500 Subject: [PATCH 13/66] i18n for closet_hangers#index, closet_lists#edit, closet_lists#new, and maybe some more closet-related things - this was a biggie --- app/helpers/closet_hangers_helper.rb | 26 ++--- app/helpers/closet_lists_helper.rb | 18 ++-- app/models/closet_visibility.rb | 19 ++-- .../closet_hangers/_closet_hanger.html.haml | 6 +- .../closet_hangers/_help.en-meep.html.haml | 35 +++++++ app/views/closet_hangers/_help.en.html.haml | 35 +++++++ app/views/closet_hangers/index.html.haml | 97 ++++++------------ app/views/closet_lists/_closet_list.html.haml | 11 ++- app/views/closet_lists/_form.html.haml | 25 ++--- app/views/closet_lists/edit.html.haml | 2 +- app/views/closet_lists/new.html.haml | 2 +- config/locales/en-meep.yml | 97 +++++++++++++++++- config/locales/en.yml | 98 ++++++++++++++++++- 13 files changed, 337 insertions(+), 134 deletions(-) create mode 100644 app/views/closet_hangers/_help.en-meep.html.haml create mode 100644 app/views/closet_hangers/_help.en.html.haml diff --git a/app/helpers/closet_hangers_helper.rb b/app/helpers/closet_hangers_helper.rb index a80364f8..97b6c420 100644 --- a/app/helpers/closet_hangers_helper.rb +++ b/app/helpers/closet_hangers_helper.rb @@ -1,8 +1,8 @@ require 'cgi' module ClosetHangersHelper - def closet_hangers_help_class - 'hidden' unless @user.closet_hangers.empty? + def closet_hangers_help_class(user) + 'hidden' unless user.closet_hangers.empty? end def closet_hanger_partial_class(hanger) @@ -12,18 +12,10 @@ module ClosetHangersHelper end end - def closet_hanger_verb(owned, positive=true) - ClosetHanger.verb(closet_hanger_subject, owned, positive) - end - def send_neomail_url(user) "http://www.neopets.com/neomessages.phtml?type=send&recipient=#{CGI.escape @user.neopets_username}" end - def closet_hanger_subject - public_perspective? ? @user.name : :you - end - def hangers_group_visibility_field_name(owned) owned ? :owned_closet_hangers_visibility : :wanted_closet_hangers_visibility end @@ -34,7 +26,7 @@ module ClosetHangersHelper end end - def closet_visibility_descriptions(subject='these items') + def closet_visibility_descriptions(subject=:items) content = '' ClosetVisibility.levels.each do |level| content << content_tag(:li, level.description(subject), 'data-id' => level.id) @@ -71,6 +63,12 @@ module ClosetHangersHelper :closet_list => {:hangers_owned => owned} link_to(content, path, options) end + + def long_closet_visibility_choices(subject) + ClosetVisibility.levels.map do |level| + ["#{level.human_name}: #{level.description(subject)}", level.id] + end + end def nc_icon_url "http://#{request.host}#{image_path 'nc.png'}" @@ -144,8 +142,12 @@ module ClosetHangersHelper translate "closet_lists.groups.#{ownership_key}.you" else translate "closet_lists.groups.#{ownership_key}.another_user", - :user_name => subject.name + :user_name => subject end end + + def closet_hangers_subject(user) + public_perspective? ? user.name : :you + end end diff --git a/app/helpers/closet_lists_helper.rb b/app/helpers/closet_lists_helper.rb index e03c6b95..c112069c 100644 --- a/app/helpers/closet_lists_helper.rb +++ b/app/helpers/closet_lists_helper.rb @@ -1,12 +1,8 @@ module ClosetListsHelper def closet_list_delete_confirmation(closet_list) - "Are you sure you want to delete \"#{closet_list.name}\"?".tap do |msg| - unless closet_list.hangers.empty? - msg << " Even if you do, we'll remember that you " + - ClosetHanger.verb(:you, closet_list.hangers_owned) + - " these items." - end - end + ownership_key = closet_list.hangers_owned? ? 'owned' : 'wanted' + translate("closet_lists.closet_list.delete_confirmation.#{ownership_key}", + :list_name => closet_list.name) end def closet_list_description_format(list) @@ -15,10 +11,10 @@ module ClosetListsHelper end def hangers_owned_options - @hangers_owned_options ||= [true, false].map do |owned| - verb = ClosetHanger.verb(:i, owned) - ["items I #{verb}", owned] - end + [ + [translate("closet_lists.form.hangers_owned_options.owned"), true], + [translate("closet_lists.form.hangers_owned_options.wanted"), false] + ] end def render_sorted_hangers(list, show_controls) diff --git a/app/models/closet_visibility.rb b/app/models/closet_visibility.rb index 4cbc0e9a..bdaa3ade 100644 --- a/app/models/closet_visibility.rb +++ b/app/models/closet_visibility.rb @@ -9,34 +9,27 @@ module ClosetVisibility end end - def description(subject=nil) - if subject - @description.sub('$SUBJECT', subject).capitalize - else - @description - end + def description(subject=:items) + I18n.translate "closet_hangers.visibility.#{name}.description.#{subject}" end def human_name - name.to_s.humanize + I18n.translate "closet_hangers.visibility.#{name}.name" end end LEVELS = [ Level.new( :id => 0, - :name => :private, - :description => "Only you can see $SUBJECT" + :name => :private ), Level.new( :id => 1, - :name => :public, - :description => "Anyone who visits this page can see $SUBJECT" + :name => :public ), Level.new( :id => 2, - :name => :trading, - :description => "$SUBJECT will be publicly listed for trades" + :name => :trading ) ] diff --git a/app/views/closet_hangers/_closet_hanger.html.haml b/app/views/closet_hangers/_closet_hanger.html.haml index 9f5bee40..8ed2079a 100644 --- a/app/views/closet_hangers/_closet_hanger.html.haml +++ b/app/views/closet_hangers/_closet_hanger.html.haml @@ -8,11 +8,11 @@ = return_to_field_tag = f.hidden_field :list_id = f.hidden_field :owned - = f.number_field :quantity, :min => 0, :required => true, :title => "You own #{pluralize closet_hanger.quantity, closet_hanger.item.name}" - = f.submit "Save" + = f.number_field :quantity, :min => 0, :required => true + = f.submit t('.submit') - if show_controls = form_tag [current_user, closet_hanger], :method => :delete, :class => 'closet-hanger-destroy' do = return_to_field_tag = hidden_field_tag 'closet_hanger[owned]', closet_hanger.owned - = submit_tag "Remove" + = submit_tag t('.delete') diff --git a/app/views/closet_hangers/_help.en-meep.html.haml b/app/views/closet_hangers/_help.en-meep.html.haml new file mode 100644 index 00000000..a93c6c1e --- /dev/null +++ b/app/views/closet_hangers/_help.en-meep.html.haml @@ -0,0 +1,35 @@ +#closet-hangers-help{:class => closet_hangers_help_class(user)} + :markdown + **These are your meepits! You can meep what items you want and own, and + share [this page](#{request.fullpath}) with the world**. Just meep up an + item in the search form above to get started. + + **You can also meep your items into lists.** + [Building an Up For Trade list is a good meep to start][uft]. You can + make lists for trade items with different market values, a private list of + what you meep for that next outfit, or whatever you like. You can also + drag-and-drop items in and out of lists. It's pretty fun. + + **Your meepits also have privacy settings.** + Items can be **private**, so only you can meep them. They can be **public**, + so you can meep this page with friends. They can even be **trading**, + meaning that we'll meepit on the item's [Infinite Closet][ic] page that + you own or want that item. + + **We try to meep trading easy.** If there's some meepit you want, you can + pull up that item's [Infinite Closet][ic] page to see if anyone is offering + it, and see what *that* user wants + in exchange. It's all pretty spiffy. Also, if you plan to trade, your should + meep your Neopets username so that + when other users come here they know how to contact you. + + **Have fun!** If you have any [neat ideas][suggestions] or [general praise and + bug reports][mail], we love to meep them. And, if you enjoy this feature, + [please consider donating to keep Dress to Impress meeping and feeping][donate]. + Meep! + + [donate]: #{donate_path} + [ic]: #{items_path} + [mail]: mailto:#{contact_email} + [suggestions]: #{feedback_url} + [uft]: #{new_user_closet_list_path(user, :closet_list => {:hangers_owned => true, :name => 'Up For Trade', :visibility => ClosetVisibility[:trading].id})} diff --git a/app/views/closet_hangers/_help.en.html.haml b/app/views/closet_hangers/_help.en.html.haml new file mode 100644 index 00000000..e9840bdd --- /dev/null +++ b/app/views/closet_hangers/_help.en.html.haml @@ -0,0 +1,35 @@ +#closet-hangers-help{:class => closet_hangers_help_class(user)} + :markdown + **These are your items! You can track what items you want and own, and + share [this page](#{request.fullpath}) with the world**. Just look up an + item in the search form above to get started. + + **You can also sort your items into lists.** + [Building an Up For Trade list is a good place to start][uft]. You can + make lists for trade items with different market values, a private list of + what you need for that next outfit, or whatever you like. You can also + drag-and-drop items in and out of lists. It's pretty fun. + + **Your items also have privacy settings.** + Items can be **private**, so only you can see them. They can be **public**, + so you can share this page with friends. They can even be **trading**, + meaning that we'll mention on the item's [Infinite Closet][ic] page that + you own or want that item. + + **We try to make trading easy.** If there's some item you want, you can + pull up that item's [Infinite Closet][ic] page to see if anyone is offering + it, and see what *that* user wants + in exchange. It's all pretty spiffy. Also, if you plan to trade, your should + add your Neopets username so that + when other users come here they know how to contact you. + + **Have fun!** If you have any [neat ideas][suggestions] or [general praise and + bug reports][mail], we love to hear them. And, if you enjoy this feature, + [please consider donating to keep Dress to Impress running and improving][donate]. + Thanks! + + [donate]: #{donate_path} + [ic]: #{items_path} + [mail]: mailto:#{contact_email} + [suggestions]: #{feedback_url} + [uft]: #{new_user_closet_list_path(user, :closet_list => {:hangers_owned => true, :name => 'Up For Trade', :visibility => ClosetVisibility[:trading].id})} diff --git a/app/views/closet_hangers/index.html.haml b/app/views/closet_hangers/index.html.haml index e4431b72..6fb56f24 100644 --- a/app/views/closet_hangers/index.html.haml +++ b/app/views/closet_hangers/index.html.haml @@ -1,13 +1,13 @@ - unless public_perspective? - - title 'Your Items' + - title t('.title_for.you') - add_body_class 'current-user' - secondary_nav do - %span#toggle-help Need help? + %span#toggle-help= t('.toggle_help') = form_tag items_path, :method => :get, :id => 'closet-hangers-items-search', 'data-current-user-id' => current_user.id do - = text_field_tag :q, nil, :placeholder => "Find items to add" - = submit_tag 'Search', :name => nil + = text_field_tag :q, nil, :placeholder => t('.item_search_placeholder') + = submit_tag t('.item_search_submit'), :name => nil - else - - title "#{@user.name}'s Items" + - title t('.title_for.another_user', :user_name => @user.name) - secondary_nav do %span#toggle-compare Compare with Your Items @@ -17,82 +17,44 @@ #closet-hangers-contact - if public_perspective? - if @user.neopets_username? - = link_to "Neomail #{@user.neopets_username}", send_neomail_url(@user) + = link_to t('.send_neomail', :neopets_username => @user.neopets_username), + send_neomail_url(@user) - else %span#edit-contact-link-to-replace-form.edit-contact-link{:class => @user.neopets_username? ? 'has-value' : nil} - %span#contact-link-no-value - Add your Neopets username + %span#contact-link-no-value= t '.neopets_username.add' %span#contact-link-has-value - Edit - = surround '"' do - Neomail - %span= @user.neopets_username + = t '.neopets_username.edit', + :neopets_username => @user.neopets_username = form_for @user do |f| = f.label :neopets_username = f.text_field :neopets_username - = f.submit "Save" - %span#cancel-contact-link cancel - -- unless public_perspective? - #closet-hangers-help{:class => closet_hangers_help_class} - :markdown - **These are your items! You can track what items you want and own, and - share [this page](#{request.fullpath}) with the world**. Just look up an - item in the search form above to get started. - - **You can also sort your items into lists.** - [Building an Up For Trade list is a good place to start][uft]. You can - make lists for trade items with different market values, a private list of - what you need for that next outfit, or whatever you like. You can also - drag-and-drop items in and out of lists. It's pretty fun. - - **Your items also have privacy settings.** - Items can be **private**, so only you can see them. They can be **public**, - so you can share this page with friends. They can even be **trading**, - meaning that we'll mention on the item's [Infinite Closet][ic] page that - you own or want that item. - - **We try to make trading easy.** If there's some item you want, you can - pull up that item's [Infinite Closet][ic] page to see if anyone is offering - it, and see what *that* user wants - in exchange. It's all pretty spiffy. Also, if you plan to trade, your should - add your Neopets username so that - when other users come here they know how to contact you. - - **Have fun!** If you have any [neat ideas][suggestions] or [general praise and - bug reports][mail], we love to hear them. And, if you enjoy this feature, - [please consider donating to keep Dress to Impress running and improving][donate]. - Thanks! - - [donate]: #{donate_path} - [ic]: #{items_path} - [mail]: mailto:#{contact_email} - [suggestions]: #{feedback_url} - [uft]: #{new_user_closet_list_path(@user, :closet_list => {:hangers_owned => true, :name => 'Up For Trade', :visibility => ClosetVisibility[:trading].id})} + = f.submit t('.neopets_username.submit') + %span#cancel-contact-link= t('.neopets_username.cancel') - unless public_perspective? + = render :partial => 'help', :locals => {:user => @user} + #closet-hangers-extras #closet-hangers-share - %label{:for => 'closet-hangers-share-box'} Public URL: - %input#closet-hangers-share-box{:type => 'text', :value => user_closet_hangers_url(@user), :readonly => true} - - = link_to "Import from closet", new_closet_page_path - = link_to "Import from SDB", new_safety_deposit_page_path - = link_to "Import from pets", new_neopets_user_path - = link_to "Export to petpage", petpage_user_closet_hangers_path(@user) - + %label{:for => 'closet-hangers-share-box'}= t '.public_url_label' + %input#closet-hangers-share-box{:type => 'text', + :value => user_closet_hangers_url(@user), + :readonly => true} + = link_to t('.import_from.closet'), new_closet_page_path + = link_to t('.import_from.safety_deposit'), new_safety_deposit_page_path + = link_to t('.import_from.neopets_user'), new_neopets_user_path + = link_to t('.export_to.petpage'), petpage_user_closet_hangers_path(@user) #closet-hangers{:class => public_perspective? ? nil : 'current-user'} - [true, false].each do |owned| .closet-hangers-group{'data-owned' => owned.to_s, :id => "closet-hangers-group-#{owned}"} %header - %h3 - Items #{closet_hanger_subject} #{closet_hanger_verb(owned)} - %span.toggle.show show - %span.toggle.hide hide + %h3= closet_lists_group_name(closet_hangers_subject(@user), owned) + %span.toggle.show= t '.toggle_group.show' + %span.toggle.hide= t '.toggle_group.hide' - unless public_perspective? - = link_to_add_closet_list 'Add new list', :owned => owned, :class => 'add-closet-list' + = link_to_add_closet_list t('.add_list'), :owned => owned, :class => 'add-closet-list' .closet-hangers-group-content = render_closet_lists(@closet_lists_by_owned[owned]) - if !public_perspective? || unlisted_hangers_count(owned) > 0 @@ -102,15 +64,14 @@ = form_for @user, :html => {:class => 'visibility-form'} do |f| = f.select hangers_group_visibility_field_name(owned), closet_visibility_choices(:human_name) - = f.submit "Save" + = f.submit t('.unlisted.submit') = closet_visibility_descriptions - if has_lists?(owned) - %h4 (Not in a list) + %h4= t '.unlisted.header' .closet-list-content .closet-list-hangers = render_unlisted_closet_hangers(owned) - %span.empty-list - There aren't any items here. + %span.empty-list= t '.unlisted.empty' - content_for :stylesheets do = stylesheet_link_tag 'south-street/jquery-ui' diff --git a/app/views/closet_lists/_closet_list.html.haml b/app/views/closet_lists/_closet_list.html.haml index 077d927a..488982fb 100644 --- a/app/views/closet_lists/_closet_list.html.haml +++ b/app/views/closet_lists/_closet_list.html.haml @@ -3,12 +3,12 @@ - if show_controls = form_for [current_user, closet_list], :html => {:class => 'visibility-form'} do |f| = f.select :visibility, closet_visibility_choices(:human_name) - = f.submit "Save" - = closet_visibility_descriptions('items in this list') + = f.submit t('.submit') + = closet_visibility_descriptions(:list) .closet-list-controls - = link_to 'Edit', edit_user_closet_list_path(closet_list.user_id, closet_list) + = link_to t('.edit'), edit_user_closet_list_path(closet_list.user_id, closet_list) = form_tag user_closet_list_path(closet_list.user_id, closet_list), :method => 'delete' do - = submit_tag 'Delete', :confirm => closet_list_delete_confirmation(closet_list) + = submit_tag t('.delete'), :confirm => closet_list_delete_confirmation(closet_list) %h4= closet_list.name .closet-list-content @@ -18,5 +18,6 @@ .closet-list-hangers - unless closet_list.hangers.empty? = render_sorted_hangers(closet_list, show_controls) - %span.empty-list This list is empty. + + %span.empty-list= t('.empty') diff --git a/app/views/closet_lists/_form.html.haml b/app/views/closet_lists/_form.html.haml index fb84c0d2..af8e4317 100644 --- a/app/views/closet_lists/_form.html.haml +++ b/app/views/closet_lists/_form.html.haml @@ -1,31 +1,22 @@ - secondary_nav do - = link_to 'Back to Your Items', user_closet_hangers_path(current_user), :class => 'button' + = link_to t('.your_items_link'), user_closet_hangers_path(current_user), :class => 'button' = form_for [@closet_list.user, @closet_list] do |f| %ul.fields %li = f.label :name - %span.hint Like "up for trade" or "NC wishlist" + %span.hint= t '.name_hint' = f.text_field :name, :required => true %li - = f.label :hangers_owned, 'This is a list for…'.html_safe + = f.label :hangers_owned, t('.hangers_owned_label') = f.select :hangers_owned, hangers_owned_options %li - = f.label :visibility, 'Who can see this list?' - = f.select :visibility, closet_visibility_choices(:description, 'Items in this list') + = f.label :visibility, t('.visibility_label') + = f.select :visibility, long_closet_visibility_choices(:list) %li = f.label :description - %span.hint - Why are these items in a list? What are your terms for trading? - Or you can leave this blank. + %span.hint= t '.description_hint' = f.text_area :description - %span.hint - We - = surround '_' do - %em support - = surround '**' do - %strong Markdown - and - some HTML. - = f.submit 'Save list' + %span.hint= t '.description_markup_hint_html' + = f.submit t('.submit') diff --git a/app/views/closet_lists/edit.html.haml b/app/views/closet_lists/edit.html.haml index d5ed6893..04a1bd7d 100644 --- a/app/views/closet_lists/edit.html.haml +++ b/app/views/closet_lists/edit.html.haml @@ -1,3 +1,3 @@ -- title "Editing list \"#{@closet_list.name}\"" +- title t('.title', :list_name => @closet_list.name) = render 'form' diff --git a/app/views/closet_lists/new.html.haml b/app/views/closet_lists/new.html.haml index af941cfe..381b2e1b 100644 --- a/app/views/closet_lists/new.html.haml +++ b/app/views/closet_lists/new.html.haml @@ -1,3 +1,3 @@ -- title 'Create an items list' +- title t('.title') = render 'form' diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 468cd4d8..9760028d 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -5,6 +5,15 @@ en-meep: infinite_closet: Infinite Meepit modeling_hub: Meepiting Hub + activerecord: + attributes: + closet_list: + name: Nameep + description: Descreeption + + user: + neopets_username: Neopets usermeep + layouts: application: title_tagline: Preview customized Neopets' meeps and meepits @@ -48,8 +57,89 @@ en-meep: converted_at_html: Conveeped %{converted_at_ago} ago reported_at_html: Repeeped %{reported_at_ago} ago + closet_hangers: + closet_hanger: + submit: Submeep + delete: Deleep + + index: + title_for: + you: Your Meeps + another_user: "%{user_name}'s meeps" + toggle_help: Need meep? + item_search_placeholder: Find meeps to add + item_search_submit: Meep + send_neomail: Neomeep %{neopets_username} + neopets_username: + add: Add your Neopets usermeep + edit: Edit "Neomeep %{neopets_username}" + submit: Meep + cancel: Unmeep + public_url_label: "Public Meepit:" + import_from: + closet: Impeep from closet + safety_deposit: Impeep from SDB + neopets_user: Impeep from pets + export_to: + petpage: Expeep to petpage + toggle_group: + show: meep + hide: unmeep + add_list: Meep new list + unlisted: + submit: Meep + header: (Not in a meepit) + empty: There aren't any meepits here. + + visibility: + private: + name: Preevate + description: + items: Only you can meep these items + list: Only you can meep this list + public: + name: Publeek + description: + items: Anyone who looks up your items can meep these items + list: Anyone who looks up your items can meep this list + trading: + name: Tradeeng + description: + items: These items will be publicly meeped for trades + list: Items in this list will be publicly meeped for trades + closet_lists: - unlisted_name: Not in a meep + closet_list: + submit: Submeep + edit: Meepit + delete: Deleep + delete_confirmation: + owned: + Are you sure you want to deleep "%{list_name}"? Even if you do, we'll + remember that you own these items. + wanted: + Are you sure you want to deleep "%{list_name}"? Even if you do, we'll + remember that you want these items. + empty: This meep is empty. + + edit: + title: Meepiting list "%{list_name}" + + form: + your_items_link: Back to Your Meeps + name_hint: Like "meep for trade" or "NC meeplist" + hangers_owned_label: This is a meep for… + hangers_owned_options: + owned: Meepits you own + wanted: Meepits you want + visibility_label: Who can meep this list? + description_hint: + Why are these meepits in the same meep? What are your terms for meeping? + Or you can meep this blank. + description_markup_hint_html: + We _support_ **Meepdown** and some HTML. + submit: Meep list + groups: owned_by: you: Meeps you own @@ -57,6 +147,11 @@ en-meep: wanted_by: you: Meeps you want another_user: Meeps %{user_name} wants + + new: + title: Meep an items list + + unlisted_name: Not in a meep contributions: contributed_description: diff --git a/config/locales/en.yml b/config/locales/en.yml index 1394679b..106b0346 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5,6 +5,15 @@ en: infinite_closet: Infinite Closet modeling_hub: Modeling Hub + activerecord: + attributes: + closet_list: + name: Name + description: Description + + user: + neopets_username: Neopets username + layouts: application: title_tagline: Preview customized Neopets' clothing and wearables @@ -49,8 +58,89 @@ en: converted_at_html: Converted %{converted_at_ago} ago reported_at_html: Reported %{reported_at_ago} ago + closet_hangers: + closet_hanger: + submit: Save + delete: Remove + + index: + title_for: + you: Your Items + another_user: "%{user_name}'s items" + toggle_help: Need help? + item_search_placeholder: Find items to add + item_search_submit: Search + send_neomail: Neomail %{neopets_username} + neopets_username: + add: Add your Neopets username + edit: Edit "Neomail %{neopets_username}" + submit: Save + cancel: Cancel + public_url_label: "Public URL:" + import_from: + closet: Import from closet + safety_deposit: Import from SDB + neopets_user: Import from pets + export_to: + petpage: Export to petpage + toggle_group: + show: show + hide: hide + add_list: Add new list + unlisted: + submit: Save + header: (Not in a list) + empty: There aren't any items here. + + visibility: + private: + name: Private + description: + items: Only you can see these items + list: Only you can see this list + public: + name: Public + description: + items: Anyone who looks up your items can see these items + list: Anyone who looks up your items can see this list + trading: + name: Trading + description: + items: These items will be publicly listed for trades + list: Items in this list will be publicly listed for trades + closet_lists: - unlisted_name: Not in a list + closet_list: + submit: Save + edit: Edit + delete: Delete + delete_confirmation: + owned: + Are you sure you want to delete "%{list_name}"? Even if you do, we'll + remember that you own these items. + wanted: + Are you sure you want to delete "%{list_name}"? Even if you do, we'll + remember that you want these items. + empty: This list is empty. + + edit: + title: Editing list "%{list_name}" + + form: + your_items_link: Back to Your Items + name_hint: Like "up for trade" or "NC wishlist" + hangers_owned_label: This is a list for… + hangers_owned_options: + owned: Items you own + wanted: Items you want + visibility_label: Who can see this list? + description_hint: + Why are these items in the same list? What are your terms for trading? + Or you can leave this blank. + description_markup_hint_html: + We _support_ **Markdown** and some HTML. + submit: Save list + groups: owned_by: you: Items you own @@ -58,7 +148,11 @@ en: wanted_by: you: Items you want another_user: Items %{user_name} wants - + + new: + title: Create an items list + + unlisted_name: Not in a list contributions: contributed_description: From 30cdbface5da5a12421722699e550ba9eabe42b1 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jan 2013 22:10:49 -0500 Subject: [PATCH 14/66] i18n for closet_hangers#petpage and items#_item (NC icon) --- app/helpers/items_helper.rb | 4 +-- app/stylesheets/closet_hangers/_petpage.sass | 1 - .../closet_hangers/_petpage_content.html.haml | 7 +++--- .../closet_hangers/_petpage_hanger.html.haml | 3 ++- app/views/closet_hangers/petpage.html.haml | 25 +++++++------------ config/locales/en-meep.yml | 25 ++++++++++++++++++- config/locales/en.yml | 23 +++++++++++++++++ public/stylesheets/compiled/screen.css | 17 ++++++------- 8 files changed, 71 insertions(+), 34 deletions(-) diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index 2aeafae4..a8aef737 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -75,8 +75,8 @@ module ItemsHelper end def nc_icon - image_tag 'nc.png', :title => 'NC Mall Item', :alt => 'NC', - :class => 'nc-icon' + image_tag 'nc.png', :title => t('items.item.nc.description'), + :alt => t('items.item.nc.abbr'), :class => 'nc-icon' end def nc_icon_for(item) diff --git a/app/stylesheets/closet_hangers/_petpage.sass b/app/stylesheets/closet_hangers/_petpage.sass index bd61bf32..fe2dac2c 100644 --- a/app/stylesheets/closet_hangers/_petpage.sass +++ b/app/stylesheets/closet_hangers/_petpage.sass @@ -19,7 +19,6 @@ body.closet_hangers-petpage h4 +inline-block - width: 8em vertical-align: middle &::after diff --git a/app/views/closet_hangers/_petpage_content.html.haml b/app/views/closet_hangers/_petpage_content.html.haml index 0fa65278..a0ab5a8b 100644 --- a/app/views/closet_hangers/_petpage_content.html.haml +++ b/app/views/closet_hangers/_petpage_content.html.haml @@ -77,7 +77,7 @@ - [true, false].each do |owned| - lists = lists_by_owned[owned] - if lists || unlisted_hangers_by_owned[owned] - %h2.dti-item-group-header Items #OWNER #{ClosetHanger.verb(:someone, owned)} + %h2.dti-item-group-header= closet_lists_group_name '#OWNER', true %ul.dti-item-group - if lists - lists.each do |list| @@ -92,10 +92,9 @@ - if unlisted_hangers_by_owned[owned] %li.dti-unlisted-items - unless lists.blank? - %h3 (Not in a list) + %h3= t '.unlisted_header' %div = render_batched_petpage_hangers(unlisted_hangers_by_owned[owned]) -#dti-item-footer - I made this list on Dress to Impress. You can, too! +#dti-item-footer= t '.footer' diff --git a/app/views/closet_hangers/_petpage_hanger.html.haml b/app/views/closet_hangers/_petpage_hanger.html.haml index 683620f1..617d349f 100644 --- a/app/views/closet_hangers/_petpage_hanger.html.haml +++ b/app/views/closet_hangers/_petpage_hanger.html.haml @@ -1,6 +1,7 @@ %div.dti-item = image_tag petpage_item_thumbnail_url(hanger.item), :alt => nil, :class => 'dti-item-thumbnail' - if hanger.item.nc? - = image_tag nc_icon_url, :alt => 'NC', :class => 'dti-item-nc', :title => 'This is an NC Mall item' + = image_tag nc_icon_url, :alt => t('items.item.nc.abbr'), + :class => 'dti-item-nc', :title => t('items.item.nc.description') %span= petpage_item_name hanger.item diff --git a/app/views/closet_hangers/petpage.html.haml b/app/views/closet_hangers/petpage.html.haml index c04b0e06..e2c75267 100644 --- a/app/views/closet_hangers/petpage.html.haml +++ b/app/views/closet_hangers/petpage.html.haml @@ -1,25 +1,18 @@ -- title 'Export to petpage' +- title t('.title') - secondary_nav do - = link_to 'Back to Your Items', user_closet_hangers_path(current_user), :class => 'button' + = link_to t('.your_items_link'), user_closet_hangers_path(current_user), :class => 'button' #intro - %p - We took your public lists and created a nice, simple HTML file for your - Neopet's petpage. By default it's styled as a table, but it doesn't have to - be. The HTML is flexible, so, if you're the artsy type, you're free to mess - with the styles all you want! - - %p - Copy the HTML from the box below, then paste it into - = succeed '.' do - = link_to "your pet's page", 'http://www.neopets.com/edithomepage.phtml' - Then head to the Neoboards to show off! Have fun! + %p= t '.description' + %p= t '.instructions_html', + :edit_petpage_link => link_to(t('.instructions_edit_petpage_link_content'), + 'http://www.neopets.com/edithomepage.phtml') = form_tag petpage_user_closet_hangers_path(@user), :method => :get, :id => 'petpage-closet-lists' do = hidden_field_tag 'filter', '1' - @closet_lists_by_owned.each do |owned, closet_lists| %div - %h4 Items you #{closet_list_verb(owned)} + %h4= closet_lists_group_name(:you, owned) %ul - closet_lists.each do |closet_list| %li @@ -29,8 +22,8 @@ %li.unlisted = label_tag do = check_box_tag "groups[#{owned}]", '1', petpage_group_checked(owned) - Not in a list - = submit_tag 'Export checked lists to petpage' + = t 'closet_lists.unlisted_name' + = submit_tag t('.submit') %textarea#petpage-output = '' + render('petpage_content', diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 9760028d..6fd9022e 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -90,7 +90,25 @@ en-meep: submit: Meep header: (Not in a meepit) empty: There aren't any meepits here. - + + petpage: + title: Export to meeppage + your_items_link: Back to Your Meeps + submit: Export meeped lists to meeppage + description: + We took your public lists and meeped a nice, simple HTML file for your + Neopet's petpage. By default it's meeped as a table, but it doesn't + have to meep. The HTML is flexible, so, if you're the artsy type, you're + free to meep with the styles all you want! + instructions_html: + Meep the HTML from the box below, then paste it into + %{edit_petpage_link}. Then meep to the Neoboards to show off! Have fun! + instructions_edit_petpage_link_content: your meepit's page + + petpage_content: + unlisted_header: (Not in a meep) + footer: I meeped this list on Dreep to Impreep. You can, too! + visibility: private: name: Preevate @@ -202,6 +220,11 @@ en-meep: newest_items_header: New Meeps species_search_header: Can't decide? Meep by species + item: + nc: + abbr: MC + description: This is a MC Meep item + show: rarity: Meepity jn_items: JN Meepits diff --git a/config/locales/en.yml b/config/locales/en.yml index 106b0346..01942ecc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -92,6 +92,24 @@ en: header: (Not in a list) empty: There aren't any items here. + petpage: + title: Export to petpage + your_items_link: Back to Your Items + submit: Export checked lists to petpage + description: + We took your public lists and created a nice, simple HTML file for your + Neopet's petpage. By default it's styled as a table, but it doesn't + have to be. The HTML is flexible, so, if you're the artsy type, you're + free to mess with the styles all you want! + instructions_html: + Copy the HTML from the box below, then paste it into + %{edit_petpage_link}. Then head to the Neoboards to show off! Have fun! + instructions_edit_petpage_link_content: your pet's page + + petpage_content: + unlisted_header: (Not in a list) + footer: I made this list on Dress to Impress. You can, too! + visibility: private: name: Private @@ -203,6 +221,11 @@ en: newest_items_header: Newest items species_search_header: Can't decide? Search by species + item: + nc: + abbr: NC + description: This is an NC Mall item + show: rarity: Rarity jn_items: JN Items diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index f88f89e2..802b109e 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -1332,24 +1332,23 @@ body.closet_hangers-petpage #petpage-closet-lists h4 { display: inline-block; vertical-align: middle; *vertical-align: auto; - width: 8em; 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 */ body.closet_hangers-petpage #petpage-closet-lists h4 { *display: inline; } -/* line 25, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 24, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-closet-lists h4::after { content: ":"; } -/* line 28, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 27, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-closet-lists ul { list-style: none; margin: 0; padding: 0; } -/* line 33, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 32, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-closet-lists ul li { display: -moz-inline-box; -moz-box-orient: vertical; @@ -1364,11 +1363,11 @@ body.closet_hangers-petpage #petpage-closet-lists ul li { body.closet_hangers-petpage #petpage-closet-lists ul li { *display: inline; } -/* line 39, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 38, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-closet-lists ul li label { padding: 0.25em 0.75em 0.25em 0.25em; } -/* line 42, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 41, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-closet-lists ul li.checked { background: #eeffee; -moz-border-radius: 3px; @@ -1380,15 +1379,15 @@ body.closet_hangers-petpage #petpage-closet-lists ul li.checked { border: 1px solid #006600; padding: 0; } -/* line 48, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 47, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-closet-lists ul li.unlisted { font-style: italic; } -/* line 51, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 50, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-closet-lists input[type=submit] { float: right; } -/* line 54, ../../../app/stylesheets/closet_hangers/_petpage.sass */ +/* line 53, ../../../app/stylesheets/closet_hangers/_petpage.sass */ body.closet_hangers-petpage #petpage-output { display: block; height: 30em; From 99e3bba72fc4ce70b9192af5fab90e8fa421c03f Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jan 2013 22:15:17 -0500 Subject: [PATCH 15/66] i18n for closet icons --- app/helpers/items_helper.rb | 6 ++++-- config/locales/en-meep.yml | 6 ++++++ config/locales/en.yml | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index a8aef737..47662b54 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -54,11 +54,13 @@ module ItemsHelper end def owned_icon - image_tag 'owned.png', :title => 'You own this', :alt => 'Own' + image_tag 'owned.png', :title => t('items.item.owned.description'), + :alt => t('items.item.owned.abbr') end def wanted_icon - image_tag 'wanted.png', :title => 'You want this', :alt => 'Want' + image_tag 'wanted.png', :title => t('items.item.wanted.description'), + :alt => t('items.item.wanted.abbr') end def closeted_icons_for(item) diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 6fd9022e..4d8123ea 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -224,6 +224,12 @@ en-meep: nc: abbr: MC description: This is a MC Meep item + owned: + abbr: Meened + description: You own this meepit + wanted: + abbr: Weented + description: You want this meepit show: rarity: Meepity diff --git a/config/locales/en.yml b/config/locales/en.yml index 01942ecc..87e85176 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -225,6 +225,12 @@ en: nc: abbr: NC description: This is an NC Mall item + owned: + abbr: Owned + description: You own this item + wanted: + abbr: Wanted + description: You want this item show: rarity: Rarity From 3c9e37f614f8b1aa79a0ec7c6711d6a45f908ef5 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jan 2013 22:23:25 -0500 Subject: [PATCH 16/66] i18n for broken_image_reports#create flashes --- app/controllers/broken_image_reports_controller.rb | 7 ++----- config/locales/en-meep.yml | 8 ++++++++ config/locales/en.yml | 8 ++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/controllers/broken_image_reports_controller.rb b/app/controllers/broken_image_reports_controller.rb index f71da60c..088e6141 100644 --- a/app/controllers/broken_image_reports_controller.rb +++ b/app/controllers/broken_image_reports_controller.rb @@ -12,14 +12,11 @@ class BrokenImageReportsController < ApplicationController def create swf_asset = SwfAsset.where(:type => params[:swf_asset_type]). find_by_remote_id(params[:swf_asset_remote_id]) - if swf_asset.report_broken - flash[:success] = "Thanks! This image will be reconverted soon. If it " + - "looks the same after conversion, please consider sending a bug report." + flash[:success] = t('broken_image_reports.create.success') else - flash[:alert] = "This image is already in line for reconversion. We'll " + - "get to it soon, don't worry." + flash[:alert] = t('broken_image_reports.create.already_reported') end redirect_to :back diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 4d8123ea..aea8ad42 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -44,6 +44,14 @@ en-meep: search: Meep broken_image_reports: + create: + success: + Thanks! This image will be remeeped soon. If it looks the same after + meeping, please consider sending a bug report. + already_reported: + This image is already in line for remeeping. We'll get to it soon, + don't worry. + new: title: Meep broken image explanation_html: diff --git a/config/locales/en.yml b/config/locales/en.yml index 87e85176..18a5fa9f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -44,6 +44,14 @@ en: search: Search broken_image_reports: + create: + success: + Thanks! This image will be reconverted soon. If it looks the same after + conversion, please consider sending a bug report. + already_reported: + This image is already in line for reconversion. We'll get to it soon, + don't worry. + new: title: Report broken image explanation_html: From 7bc255e9c897dd7e2b0a0924bf08c514e0f02433 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jan 2013 22:34:30 -0500 Subject: [PATCH 17/66] i18n for users#index, users#update flashes --- app/controllers/users_controller.rb | 7 ++++--- config/locales/en-meep.yml | 7 +++++++ config/locales/en.yml | 7 +++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e8b69d32..b542d502 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -7,7 +7,7 @@ class UsersController < ApplicationController if @user redirect_to user_closet_hangers_path(@user) else - flash[:alert] = "We don't have a user named \"#{name}\". Did you spell it correctly?" + flash[:alert] = t('users.index.not_found', :name => name) redirect_to root_path end end @@ -21,10 +21,11 @@ class UsersController < ApplicationController respond_to do |format| format.html { if success - flash[:success] = "Settings successfully saved" + flash[:success] = t('users.update.success') redirect_back! user_closet_hangers_path(@user) else - flash[:alert] = "Error saving user settings: #{@user.errors.full_messages.to_sentence}" + flash[:alert] = t('users.update.invalid', + :errors => @user.errors.full_messages.to_sentence) end } diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index aea8ad42..8cf00623 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -420,8 +420,15 @@ en-meep: submission_success: "%{points} peeps" users: + index: + not_found: We don't have a meepit named %{name}. Is it meeped correctly? + top_contributors: title: Top Conmeeputors rank: Reep user: Meepit points: Peeps + + update: + success: Settings successfully meeped. + invalid: "Could not meep settings: %{errors}" diff --git a/config/locales/en.yml b/config/locales/en.yml index 18a5fa9f..bde414b8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -422,8 +422,15 @@ en: submission_success: "%{points} points" users: + index: + not_found: We don't have a user named %{name}. Is it spelled correctly? + top_contributors: title: Top Contributors rank: Rank user: User points: Points + + update: + success: Settings successfully saved. + invalid: "Could not save settings: %{errors}" From 0f52ba5b4e3e33b191bb821e38b7c90833d9b0fb Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jan 2013 22:45:15 -0500 Subject: [PATCH 18/66] i18n for neopets_users#create flashes --- app/controllers/neopets_users_controller.rb | 14 +++++--------- config/locales/en-meep.yml | 11 +++++++++++ config/locales/en.yml | 11 +++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/controllers/neopets_users_controller.rb b/app/controllers/neopets_users_controller.rb index e9c4fc2d..265ab4f3 100644 --- a/app/controllers/neopets_users_controller.rb +++ b/app/controllers/neopets_users_controller.rb @@ -12,14 +12,9 @@ class NeopetsUsersController < ApplicationController @neopets_user.load! @neopets_user.save_hangers! - message = "Success! We loaded user \"#{@neopets_user.username}\"" - unless @neopets_user.hangers.empty? - message << " and added #{@neopets_user.hangers.size} items." - else - message << ", but already had all of this data recorded." - end - - flash[:success] = message + flash[:success] = t('neopets_users.create.success', + :user_name => @neopets_user.username, + :count => @neopets_user.hangers.size) redirect_to user_closet_hangers_path(current_user) end @@ -30,7 +25,8 @@ class NeopetsUsersController < ApplicationController end def not_found - flash.now[:alert] = "Could not find user \"#{@neopets_user.username}\". Did you spell it correctly?" + flash.now[:alert] = t('neopets_users.create.not_found', + :user_name => @neopets_user.username) render :action => :new end end diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 8cf00623..cfd6ac30 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -351,6 +351,17 @@ en-meep: concerned, find a meepit and meep out the source code to be sure. neopets_users: + create: + success: + zero: + Okay. We meeped %{user_name}'s pets, but already had these items + meeped to your account. + one: + Success! We meeped %{user_name}'s pets, and meeped 1 item. + other: + Success! We meeped %{user_name}'s pets, and meeped %{count} items. + not_found: Could not meep user %{user_name}. Is it meeped correctly? + new: title: Meemport from pets your_items_link: Back to Your Meeps diff --git a/config/locales/en.yml b/config/locales/en.yml index bde414b8..1a2d443c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -352,6 +352,17 @@ en: be sure. neopets_users: + create: + success: + zero: + Okay. We loaded %{user_name}'s pets, but already had these items + recorded to your account. + one: + Success! We loaded %{user_name}'s pets, and added 1 item. + other: + Success! We loaded %{user_name}'s pets, and added %{count} items. + not_found: Could not find user %{user_name}. Is it spelled correctly? + new: title: Import from pets your_items_link: Back to Your Items From e55d407d636363dbdfd5265ef15ca239974fcbda Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 1 Jan 2013 23:40:37 -0500 Subject: [PATCH 19/66] i18n for neopets_pages#create (flashes - holy snap, that was nasty) --- app/controllers/neopets_pages_controller.rb | 52 ++++++++++++--------- config/locales/en-meep.yml | 37 +++++++++++++++ config/locales/en.yml | 37 +++++++++++++++ 3 files changed, 103 insertions(+), 23 deletions(-) diff --git a/app/controllers/neopets_pages_controller.rb b/app/controllers/neopets_pages_controller.rb index a930789d..5bf908d0 100644 --- a/app/controllers/neopets_pages_controller.rb +++ b/app/controllers/neopets_pages_controller.rb @@ -10,40 +10,48 @@ class NeopetsPagesController < ApplicationController @neopets_page.index = @page_params[:index] @neopets_page.source = @page_params[:source] - saved_counts = @neopets_page.save_hangers! + messages = [t('neopets_pages.create.success', + :index => @neopets_page.index)] + saved_counts = @neopets_page.save_hangers! any_created = saved_counts[:created] > 0 any_updated = saved_counts[:updated] > 0 - if any_created || any_updated - message = "Page #{@neopets_page.index} saved! We " - message << "added " + pluralize(saved_counts[:created], 'item') + " to the items you own" if any_created - message << " and " if any_created && any_updated - message << "updated the count on " + pluralize(saved_counts[:updated], 'item') if any_updated - message << ". " - elsif @neopets_page.hangers.size > 1 - message = "Success! We checked that page, and we already had all this data recorded. " - else - message = "Success! We checked that page, and there were no wearables to add. " + if any_created && any_updated + created_msg = t('neopets_pages.create.created_and_updated_hangers.created_msg', + :count => saved_counts[:created]) + updated_msg = t('neopets_pages.create.created_and_updated_hangers.updated_msg', + :count => saved_counts[:updated]) + messages << t('neopets_pages.create.created_and_updated_hangers.text', + :created_msg => created_msg, + :updated_msg => updated_msg) + elsif any_created + messages << t('neopets_pages.create.created_hangers', + :count => saved_counts[:created]) + elsif any_updated + messages << t('neopets_pages.create.updated_hangers', + :count => saved_counts[:updated]) + elsif @neopets_page.hangers.size > 1 # saw items, but at same quantities + messages << t('neopets_pages.create.no_changes') + else # no items recognized + messages << t('neopets_pages.create.no_data') end unless @neopets_page.unknown_item_names.empty? - message << "We also found " + - pluralize(@neopets_page.unknown_item_names.size, 'item') + - " we didn't recognize: " + - @neopets_page.unknown_item_names.to_sentence + - ". Please put each item on your pet and type its name in on the " + - "home page so we can have a record of it. Thanks! " + messages << t('neopets_pages.create.unknown_items', + :item_names => @neopets_page.unknown_item_names.to_sentence, + :count => @neopets_page.unknown_item_names.size) end if @neopets_page.last? - message << "That was the last page of your Neopets #{@neopets_page.name}." + messages << t('neopets_pages.create.done', :name => @neopets_page.name) destination = user_closet_hangers_path(current_user) else - message << "Now the frame should contain page #{@neopets_page.index + 1}. Paste that source code over, too." + messages << t('neopets_pages.create.next_page', + :next_index => (@neopets_page.index + 1)) destination = {:action => :new, :index => (@neopets_page.index + 1)} end - flash[:success] = message + flash[:success] = messages.join(' ') redirect_to destination else redirect_to :action => :new @@ -70,9 +78,7 @@ class NeopetsPagesController < ApplicationController def on_parse_error(e) Rails.logger.info "Neopets page parse error: #{e.message}" - flash[:alert] = "We had trouble reading your source code. Is it a valid " + - "HTML document? Make sure you pasted the computery-looking result of " + - "clicking View Frame Source, and not the pretty page itself. " + flash[:alert] = t('neopets_pages.create.parse_error') render :action => :new end end diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index cfd6ac30..78bee665 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -277,6 +277,43 @@ en-meep: swf_assets_not_found_modeling_link_content: meep it for us neopets_pages: + create: + success: Page %{index} meeped! + created_and_updated_hangers: + text: "%{created_msg} meep %{updated_msg}." + created_msg: + one: We added 1 meepit + other: We added %{count} meepit + updated_msg: + one: updated the meepity for 1 more + other: updated the meepity for %{count} more + created_hangers: + one: We added 1 new meepit to the list of meepits you own. + other: We added %{count} new meepits to the list of meepits you own. + updated_hangers: + one: We updated the quantity for 1 of your meepits. + other: We updated the quantity for %{count} of your meepits. + no_changes: + We already had this data meeped to your account, + so we didn't meep any changes. + no_data: We didn't meep any wearables, so we didn't meep any changes. + unknown_items: + one: + "We also meeped an item we didn't recognize: %{item_names}. Please + meep it for us and we'll update our database instantly. Thanks!" + other: + "We also meeped %{count} items we didn't recognize: %{item_names}. + Please meep them for us and we'll update our database instantly. + Thanks!" + next_page: + Now the frame should contain page %{next_index}. + Meep that source code over, too. + done: That was the last meepit of your Neopets %{name}. + parse_error: + We had trouble meeping your source code. Is it a valid HTML document? + Make sure you meeped the computery-looking result of clicking View + Frame Source, and not the pretty-looking page itself. + names: closet: meepit safety_deposit: safety demeepit diff --git a/config/locales/en.yml b/config/locales/en.yml index 1a2d443c..2c36da51 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -278,9 +278,46 @@ en: swf_assets_not_found_modeling_link_content: model it for us neopets_pages: + create: + success: Page %{index} saved! + created_and_updated_hangers: + text: "%{created_msg} and %{updated_msg}." + created_msg: + one: We added 1 item + other: We added %{count} items + updated_msg: + one: updated the quantity for 1 more + other: updated the quantity for %{count} more + created_hangers: + one: We added 1 new item to the list of items you own. + other: We added %{count} new items to the list of items you own. + updated_hangers: + one: We updated the quantity for 1 of your items. + other: We updated the quantity for %{count} of your items. + no_changes: + We already had this data recorded to your account, so we didn't make any changes. + no_data: We didn't see any wearables, so we didn't make any changes. + unknown_items: + one: + "We also found an item we didn't recognize: %{item_names}. Please + model it for us and we'll update our database instantly. Thanks!" + other: + "We also found %{count} items we didn't recognize: %{item_names}. + Please model them for us and we'll update our database instantly. + Thanks!" + next_page: + Now the frame should contain page %{next_index}. + Paste that source code over, too. + done: That was the last page of your Neopets %{name}. + parse_error: + We had trouble reading your source code. Is it a valid HTML document? + Make sure you pasted the computery-looking result of clicking View + Frame Source, and not the pretty-looking page itself. + names: closet: closet safety_deposit: safety deposit + new: title: Import from %{name}, Page %{index} your_items_link: Back to Your Items From 467fb24c4234018777bfbcff1638bce17213a9c7 Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 2 Jan 2013 22:03:45 -0500 Subject: [PATCH 20/66] i18n for closet_hangers#create, closet_hangers#destroy, closet_hangers#update, closet_hangers#update_quantities (flashes, largely intertwined) --- app/controllers/closet_hangers_controller.rb | 114 ++++++++++--------- config/locales/en-meep.yml | 23 ++++ config/locales/en.yml | 23 ++++ 3 files changed, 105 insertions(+), 55 deletions(-) diff --git a/app/controllers/closet_hangers_controller.rb b/app/controllers/closet_hangers_controller.rb index f3b104d2..b8849ac3 100644 --- a/app/controllers/closet_hangers_controller.rb +++ b/app/controllers/closet_hangers_controller.rb @@ -7,10 +7,7 @@ class ClosetHangersController < ApplicationController @closet_hanger = current_user.closet_hangers.find params[:id] @closet_hanger.destroy @item = @closet_hanger.item - respond_to do |format| - format.html { redirect_after_destroy! } - format.json { render :json => true } - end + closet_hanger_destroyed end def index @@ -85,26 +82,9 @@ class ClosetHangersController < ApplicationController @closet_hanger.item = @item if @closet_hanger.save - respond_to do |format| - format.html { - message = "Success! You #{@closet_hanger.verb(:you)} #{@closet_hanger.quantity} " - message << ((@closet_hanger.quantity > 1) ? @item.name.pluralize : @item.name) - message << " in the \"#{@closet_hanger.list.name}\" list" if @closet_hanger.list - flash[:success] = "#{message}." - redirect_back!(@item) - } - - format.json { render :json => true } - end + closet_hanger_saved else - respond_to do |format| - format.html { - flash[:alert] = "We couldn't save how many of this item you #{@closet_hanger.verb(:you)}: #{@closet_hanger.errors.full_messages.to_sentence}" - redirect_back!(@item) - } - - format.json { render :json => {:errors => @closet_hanger.errors.full_messages}, :status => :unprocessable_entity } - end + closet_hanger_invalid end end @@ -115,34 +95,13 @@ class ClosetHangersController < ApplicationController unless @closet_hanger.quantity == 0 # save the hanger, new record or not if @closet_hanger.save - respond_to do |format| - format.html { - message = "Success! You #{@closet_hanger.verb(:you)} #{@closet_hanger.quantity} " - message << ((@closet_hanger.quantity > 1) ? @item.name.pluralize : @item.name) - message << " in the \"#{@closet_hanger.list.name}\" list" if @closet_hanger.list - flash[:success] = "#{message}." - redirect_back!(@item) - } - - format.json { render :json => true } - end + closet_hanger_saved else - respond_to do |format| - format.html { - flash[:alert] = "We couldn't save how many of this item you #{@closet_hanger.verb(:you)}: #{@closet_hanger.errors.full_messages.to_sentence}" - redirect_back!(@item) - } - - format.json { render :json => {:errors => @closet_hanger.errors.full_messages}, :status => :unprocessable_entity } - end + closet_hanger_invalid end else # delete the hanger since the user doesn't want it @closet_hanger.destroy - respond_to do |format| - format.html { redirect_after_destroy! } - - format.json { render :json => true } - end + closet_hanger_destroyed end end @@ -153,15 +112,65 @@ class ClosetHangersController < ApplicationController ClosetHanger.set_quantity!(quantity, :user_id => @user.id, :item_id => @item.id, :key => key) end - flash[:success] = "Successfully saved how many #{@item.name} you own and want." + flash[:success] = t('closet_hangers.update_quantities.success', + :item_name => @item.name) end rescue ActiveRecord::RecordInvalid => e - flash[:alert] = "We couldn't save those quantities. #{e.message}" + flash[:alert] = t('closet_hangers.update_quantities.invalid', + :errors => e.message) end redirect_to @item end - protected + private + + def closet_hanger_destroyed + respond_to do |format| + format.html { + ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted' + flash[:success] = t("closet_hangers.destroy.success.#{ownership_key}", + :item_name => @item.name) + redirect_back!(@item) + } + + format.json { render :json => true } + end + end + + def closet_hanger_invalid + respond_to do |format| + format.html { + ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted' + flash[:alert] = t("closet_hangers.create.invalid.#{ownership_key}", + :item_name => @item.name, + :errors => @closet_hanger.errors.full_messages.to_sentence) + redirect_back!(@item) + } + + format.json { render :json => {:errors => @closet_hanger.errors.full_messages}, :status => :unprocessable_entity } + end + end + + def closet_hanger_saved + respond_to do |format| + format.html { + ownership_key = @closet_hanger.owned? ? 'owned' : 'wanted' + if @closet_hanger.list + flash[:success] = t("closet_hangers.create.success.#{ownership_key}.in_list", + :item_name => @item.name, + :list_name => @closet_hanger.list.name, + :count => @closet_hanger.quantity) + else + flash[:success] = t("closet_hangers.create.success.#{ownership_key}.unlisted", + :item_name => @item.name, + :count => @closet_hanger.quantity) + end + redirect_back!(@item) + } + + format.json { render :json => true } + end + end def find_item @item = Item.find params[:item_id] @@ -202,10 +211,5 @@ class ClosetHangersController < ApplicationController end end end - - def redirect_after_destroy! - flash[:success] = "Success! You do not #{@closet_hanger.verb(:you)} #{@item.name}." - redirect_back!(@item) - end end diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 78bee665..2ed67406 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -70,6 +70,25 @@ en-meep: submit: Submeep delete: Deleep + create: + success: + owned: + in_list: + Meep! You own %{count} of the %{item_name} in the %{list_name} list. + unlisted: eep! You own of the %{count} %{item_name}. + wanted: + in_list: + Meep! You want %{count} of the %{item_name} in the %{list_name} list. + unlisted: Meep! You want %{count} of the %{item_name}. + invalid: + owned: "We couldn't meep how many %{item_name} you own: %{errors}" + wanted: "We couldn't meep how many %{item_name} you want: %{errors}" + + destroy: + success: + owned: Meep! You do not own the %{item_name}. + wanted: Meep! You do not want the %{item_name}. + index: title_for: you: Your Meeps @@ -133,6 +152,10 @@ en-meep: description: items: These items will be publicly meeped for trades list: Items in this list will be publicly meeped for trades + + update_quantities: + success: Successfully meeped how many of the %{item_name} you own and want. + invalid: "We couldn't meep those quantities: %{errors}" closet_lists: closet_list: diff --git a/config/locales/en.yml b/config/locales/en.yml index 2c36da51..f4797888 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -71,6 +71,25 @@ en: submit: Save delete: Remove + create: + success: + owned: + in_list: + Success! You own %{count} of the %{item_name} in the %{list_name} list. + unlisted: Success! You own of the %{count} %{item_name}. + wanted: + in_list: + Success! You want %{count} of the %{item_name} in the %{list_name} list. + unlisted: Success! You want %{count} of the %{item_name}. + invalid: + owned: "We couldn't save how many %{item_name} you own: %{errors}" + wanted: "We couldn't save how many %{item_name} you want: %{errors}" + + destroy: + success: + owned: Success! You do not own the %{item_name}. + wanted: Success! You do not want the %{item_name}. + index: title_for: you: Your Items @@ -134,6 +153,10 @@ en: description: items: These items will be publicly listed for trades list: Items in this list will be publicly listed for trades + + update_quantities: + success: Successfully saved how many of the %{item_name} you own and want. + invalid: "We couldn't save those quantities: %{errors}" closet_lists: closet_list: From 706fad01746efdad6e07822289891147acfb5cc8 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 3 Jan 2013 13:06:22 -0500 Subject: [PATCH 21/66] localize items#item_link cache --- app/views/items/_item_link.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/items/_item_link.html.haml b/app/views/items/_item_link.html.haml index a4a68d83..a0869fce 100644 --- a/app/views/items/_item_link.html.haml +++ b/app/views/items/_item_link.html.haml @@ -1,4 +1,4 @@ -- cache "items/#{item.id}#item_link_partial" do +- localized_cache "items/#{item.id}#item_link_partial" do = link_to item_path(item, :q => @query) do = image_tag item.thumbnail_url, :alt => item.description, :title => item.description %span.name= item.name From 8c9dda37d59685d23dfde1e21ca9491ddd2792f1 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 3 Jan 2013 13:25:14 -0500 Subject: [PATCH 22/66] i18n for closet_hangers#index search bar autocomplete --- app/views/closet_hangers/index.html.haml | 20 ++- config/locales/en-meep.yml | 6 + config/locales/en.yml | 6 + public/javascripts/closet_hangers/index.js | 165 +++++++++++---------- 4 files changed, 116 insertions(+), 81 deletions(-) diff --git a/app/views/closet_hangers/index.html.haml b/app/views/closet_hangers/index.html.haml index 6fb56f24..2d68af13 100644 --- a/app/views/closet_hangers/index.html.haml +++ b/app/views/closet_hangers/index.html.haml @@ -73,11 +73,29 @@ = render_unlisted_closet_hangers(owned) %span.empty-list= t '.unlisted.empty' +- localized_cache :action_suffix => 'autocomplete_tmpls' do + %script#autocomplete-item-tmpl{:type => 'text/x-jquery-tmpl'} + %a + = t '.autocomplete.add_item_html', :item_name => '${item_name}' + + %script#autocomplete-add-to-list-tmpl{:type => 'text/x-jquery-tmpl'} + %a + = t '.autocomplete.add_to_list_html', :list_name => '${list_name}' + + %script#autocomplete-add-to-group-tmpl{:type => 'text/x-jquery-tmpl'} + %a + = t '.autocomplete.add_to_group_html', :group_name => '${group_name}' + + %script#autocomplete-already-in-collection-tmpl{:type => 'text/x-jquery-tmpl'} + %span + = t '.autocomplete.already_in_collection_html', + :collection_name => '${collection_name}' + - content_for :stylesheets do = stylesheet_link_tag 'south-street/jquery-ui' - content_for :javascripts do - = include_javascript_libraries :jquery + = include_javascript_libraries :jquery, :jquery_tmpl = javascript_include_tag 'ajax_auth', 'jquery.ui', 'jquery.jgrowl', 'placeholder', 'closet_hangers/index' diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 2ed67406..6b147421 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -117,6 +117,12 @@ en-meep: submit: Meep header: (Not in a meepit) empty: There aren't any meepits here. + autocomplete: + add_item_html: Meep %{item_name} + add_to_list_html: Meep to %{list_name} + add_to_group_html: Meep to %{group_name}, no list + already_in_collection_html: + It's already meeped in %{collection_name} petpage: title: Export to meeppage diff --git a/config/locales/en.yml b/config/locales/en.yml index f4797888..9f582407 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -118,6 +118,12 @@ en: submit: Save header: (Not in a list) empty: There aren't any items here. + autocomplete: + add_item_html: Add %{item_name} + add_to_list_html: Add to %{list_name} + add_to_group_html: Add to %{group_name}, no list + already_in_collection_html: + It's already in %{collection_name} petpage: title: Export to petpage diff --git a/public/javascripts/closet_hangers/index.js b/public/javascripts/closet_hangers/index.js index fda15b2a..dc8a489e 100644 --- a/public/javascripts/closet_hangers/index.js +++ b/public/javascripts/closet_hangers/index.js @@ -19,36 +19,36 @@ var hangerGroups = []; - $('div.closet-hangers-group').each(function () { - var el = $(this); - var lists = []; + $('div.closet-hangers-group').each(function () { + var el = $(this); + var lists = []; - el.find('div.closet-list').each(function () { - var el = $(this); - var id = el.attr('data-id'); - if(id) { - lists[lists.length] = { - id: parseInt(id, 10), - label: el.find('h4').text() - } - } - }); + el.find('div.closet-list').each(function () { + var el = $(this); + var id = el.attr('data-id'); + if(id) { + lists[lists.length] = { + id: parseInt(id, 10), + label: el.find('h4').text() + } + } + }); - hangerGroups[hangerGroups.length] = { - label: el.find('h3').text(), - lists: lists, - owned: (el.attr('data-owned') == 'true') - }; - }); + hangerGroups[hangerGroups.length] = { + label: el.find('h3').text(), + lists: lists, + owned: (el.attr('data-owned') == 'true') + }; + }); - $('div.closet-hangers-group span.toggle').live('click', function () { - $(this).closest('.closet-hangers-group').toggleClass('hidden'); - }); + $('div.closet-hangers-group span.toggle').live('click', function () { + $(this).closest('.closet-hangers-group').toggleClass('hidden'); + }); - var hangersElQuery = '#closet-hangers'; + var hangersElQuery = '#closet-hangers'; var hangersEl = $(hangersElQuery); - /* + /* Compare with Your Items @@ -381,85 +381,90 @@ autocompleter._renderItem = function( ul, item ) { var li = $("
  • ").data("item.autocomplete", item); if(item.is_item) { // these are items from the server - li.append("Add " + item.label + ""); + $('#autocomplete-item-tmpl').tmpl({item_name: item.label}).appendTo(li); } else if(item.list) { // these are list inserts + var listName = item.list.label; if(item.hasHanger) { - li.append("It's already in " + item.list.label + ""); + $('#autocomplete-already-in-collection-tmpl'). + tmpl({collection_name: listName}).appendTo(li); } else { - li.append("Add to " + item.list.label + ""); + $('#autocomplete-add-to-list-tmpl').tmpl({list_name: listName}). + appendTo(li); } li.addClass("closet-list-autocomplete-item"); } else { // these are group inserts var groupName = item.group.label; if(!item.hasHanger) { - li.append("Add to " + groupName.replace(/\s+$/, '') + ", no list"); + $('#autocomplete-add-to-group-tmpl'). + tmpl({group_name: groupName.replace(/\s+$/, '')}).appendTo(li); } else { - li.append("It's already in " + groupName + ""); + $('#autocomplete-already-in-collection-tmpl'). + tmpl({collection_name: groupName}).appendTo(li); } - li.addClass('closet-hangers-group-autocomplete-item'); - } - return li.appendTo(ul); - } + li.addClass('closet-hangers-group-autocomplete-item'); + } + return li.appendTo(ul); + } - /* + /* - Contact Neopets username form + Contact Neopets username form - */ + */ - var contactEl = $('#closet-hangers-contact'); - var editContactLink = $('.edit-contact-link'); - var contactForm = contactEl.children('form'); - var cancelContactLink = $('#cancel-contact-link'); - var contactFormUsername = contactForm.children('input[type=text]'); - var editContactLinkUsername = $('#contact-link-has-value span'); + var contactEl = $('#closet-hangers-contact'); + var editContactLink = $('.edit-contact-link'); + var contactForm = contactEl.children('form'); + var cancelContactLink = $('#cancel-contact-link'); + var contactFormUsername = contactForm.children('input[type=text]'); + var editContactLinkUsername = $('#contact-link-has-value span'); - function closeContactForm() { - contactEl.removeClass('editing'); - } + function closeContactForm() { + contactEl.removeClass('editing'); + } - editContactLink.click(function () { - contactEl.addClass('editing'); - contactFormUsername.focus(); - }); + editContactLink.click(function () { + contactEl.addClass('editing'); + contactFormUsername.focus(); + }); - cancelContactLink.click(closeContactForm); + cancelContactLink.click(closeContactForm); - contactForm.submit(function (e) { - var data = contactForm.serialize(); - contactForm.disableForms(); - $.ajax({ - url: contactForm.attr('action') + '.json', - type: 'post', - data: data, - dataType: 'json', - complete: function () { - contactForm.enableForms(); - }, - success: function () { - var newName = contactFormUsername.val(); - if(newName.length > 0) { - editContactLink.addClass('has-value'); - editContactLinkUsername.text(newName); - } else { - editContactLink.removeClass('has-value'); - } - closeContactForm(); + contactForm.submit(function (e) { + var data = contactForm.serialize(); + contactForm.disableForms(); + $.ajax({ + url: contactForm.attr('action') + '.json', + type: 'post', + data: data, + dataType: 'json', + complete: function () { + contactForm.enableForms(); }, - error: function (xhr) { - handleSaveError(xhr, 'saving Neopets username'); - } - }); - e.preventDefault(); - }); + success: function () { + var newName = contactFormUsername.val(); + if(newName.length > 0) { + editContactLink.addClass('has-value'); + editContactLinkUsername.text(newName); + } else { + editContactLink.removeClass('has-value'); + } + closeContactForm(); + }, + error: function (xhr) { + handleSaveError(xhr, 'saving Neopets username'); + } + }); + e.preventDefault(); + }); - /* + /* - Hanger list controls + Hanger list controls - */ + */ - $('input[type=submit][data-confirm]').live('click', function (e) { + $('input[type=submit][data-confirm]').live('click', function (e) { if(!confirm(this.getAttribute('data-confirm'))) e.preventDefault(); }); From 029373addd4087d66c13741a3ca765654ed3f9ca Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 3 Jan 2013 20:32:17 -0500 Subject: [PATCH 23/66] i18n for outfits#destroy flashes --- app/controllers/outfits_controller.rb | 25 +++++++++---------------- config/locales/en-meep.yml | 3 +++ config/locales/en.yml | 3 +++ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 7bd48327..6c16f28f 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -28,22 +28,15 @@ class OutfitsController < ApplicationController end def destroy - if @outfit.destroy - respond_to do |format| - format.html { - flash[:success] = "Outfit #{@outfit.name} successfully deleted" - redirect_to current_user_outfits_path - } - format.json { render :json => true } - end - else - respond_to do |format| - format.html { - flash[:alert] = "Error deleting outfit. Try again?" - redirect_to current_user_outfits_path, :status => :bad_request - } - format.json { render :json => false, :status => :bad_request } - end + @outfit.destroy + + respond_to do |format| + format.html { + flash[:success] = t('outfits.destroy.success', + :outfit_name => @outfit.name) + redirect_to current_user_outfits_path + } + format.json { render :json => true } end end diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index 6b147421..bfbde555 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -438,6 +438,9 @@ en-meep: submit: Meemport all pets outfits: + destroy: + success: Outfit "%{outfit_name}" succeessfully demeeped. + new: tagline: Meeps made meepy! load_pet_legend: Enter your pet's meep diff --git a/config/locales/en.yml b/config/locales/en.yml index 9f582407..dab1c900 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -439,6 +439,9 @@ en: submit: Import all pets outfits: + destroy: + success: Outfit "%{outfit_name}" successfully deleted. + new: tagline: Neopets wearables made easy! load_pet_legend: Enter your pet's name From b346bcc6d964fc6aff9b0cbe89cac9403d9a9614 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 4 Jan 2013 18:58:25 -0500 Subject: [PATCH 24/66] i18n for outfits#index - plus the translate_with_links helper, which can be used for refactoring other stuff --- app/helpers/application_helper.rb | 26 ++++++++++++++++++++++++++ app/views/outfits/index.html.haml | 21 +++++---------------- config/locales/en.yml | 18 ++++++++++++++++++ 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 80205215..a2fb0905 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -162,6 +162,32 @@ module ApplicationHelper content_for :title, value end + def translate_with_links(key, options={}) + nonlink_options = {} + link_urls = {} + + options.each do |key, value| + str_key = key.to_s + if str_key.end_with? '_link_url' + link_key = str_key[0..-5] # "abcdef_link_url" => "abcdef_link" + link_urls[link_key] = value + else + nonlink_options[key] = value + end + end + + link_options = {} + link_urls.each do |link_key, url| + content = translate("#{key}.#{link_key}_content", nonlink_options) + link_options[link_key.to_sym] = link_to(content, url) + end + + converted_options = link_options.merge(nonlink_options) + translate("#{key}.main_html", converted_options) + end + + alias_method :twl, :translate_with_links + def userbar_contributions_summary(user) contributions_link_content = translate('.userbar.contributions_link_content', :user_points => user.points) diff --git a/app/views/outfits/index.html.haml b/app/views/outfits/index.html.haml index bd5bd07e..1858c578 100644 --- a/app/views/outfits/index.html.haml +++ b/app/views/outfits/index.html.haml @@ -1,22 +1,11 @@ -- title 'Your outfits' -%p - These are the outfits that you've saved to Dress to Impress so far. To save - some more, head to the wardrobe and click Save Outfit in the top right - corner. -%p - The link for each outfit is totally public, so please feel free to share the - URL with the whole wide world. +- title t('.title') + - unless @outfits.empty? + %p= t '.intro.saving' + %p= t '.intro.linking' %ul#outfits= render @outfits - else - %p - You haven't saved any outfits yet. - - succeed ',' do - = link_to 'Start at the home page', root_path - enter a pet name or choose a color combination, create the outfit of your - dreams, and click "Save Outfit" in the top right corner. - %p - It'll be fantastic. Promise. + %p= twl '.no_outfits', :start_link_url => root_path - content_for :javascripts do = include_javascript_libraries :jquery diff --git a/config/locales/en.yml b/config/locales/en.yml index dab1c900..0ae2d958 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -442,6 +442,24 @@ en: destroy: success: Outfit "%{outfit_name}" successfully deleted. + index: + title: Your Outfits + intro: + saving: + These are the outfits that you've saved to Dress to Impress so far. + When you design an outfit you like, click Save Outfit in the top + right corner and it'll appear in this list. + linking: + The link for each outfit is totally public, so feel free to share + them with the world. + no_outfits: + main_html: + You haven't saved any outfits yet. %{start_link}, enter a pet's name + or choose a color combination, create the outfit of your dreams, and + click "Save Outfit" in the top right corner. It'll be great, I + promise. + start_link_content: Start at the home page + new: tagline: Neopets wearables made easy! load_pet_legend: Enter your pet's name From 2b1cb2fe7fd203e03063c8c148526dd198d6f8d9 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 4 Jan 2013 20:28:00 -0500 Subject: [PATCH 25/66] i18n for outfits#edit base template - dynamic content in outfits/edit.js still needs examined --- app/helpers/application_helper.rb | 8 +- app/helpers/outfits_helper.rb | 18 ++ app/stylesheets/outfits/_edit.sass | 4 - app/views/outfits/edit.html.haml | 186 ++++++++------------ config/locales/en-meep.yml | 118 +++++++++++++ config/locales/en.yml | 118 +++++++++++++ public/javascripts/outfits/edit.js | 25 +-- public/stylesheets/compiled/screen.css | 234 ++++++++++++------------- 8 files changed, 453 insertions(+), 258 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a2fb0905..460ca226 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -99,7 +99,7 @@ module ApplicationHelper end) end - def localized_cache(key, &block) + def localized_cache(key={}, &block) localized_key = localize_fragment_key(key, locale) cache(localized_key, &block) end @@ -162,6 +162,12 @@ module ApplicationHelper content_for :title, value end + def translate_markdown(key, options={}) + RDiscount.new(translate(key, options)).to_html.html_safe + end + + alias_method :tmd, :translate_markdown + def translate_with_links(key, options={}) nonlink_options = {} link_urls = {} diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index 1c561363..67a6c482 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -25,6 +25,24 @@ module OutfitsHelper link_to content, wardrobe_path(:anchor => query), options end + def search_helper(filter) + key = translate("#{filter}.key") + default_value = translate("#{filter}.default_value") + content_tag :span, default_value, :class => 'search-helper', + 'data-search-filter' => key + end + + def search_query_description(base) + translate "#{base}.description_html", + :default_value => search_helper("#{base}.filter") + end + + def search_query_with_helper(base) + translate "#{base}.query_html", + :filter_key => content_tag(:span, translate("#{base}.filter.key")), + :filter_value => search_helper("#{base}.filter") + end + def outfit_creation_summary(outfit) user = outfit.user user_link = link_to(user.name, user_contributions_path(user)) diff --git a/app/stylesheets/outfits/_edit.sass b/app/stylesheets/outfits/_edit.sass index 5a5c7fc5..d201e7bd 100644 --- a/app/stylesheets/outfits/_edit.sass +++ b/app/stylesheets/outfits/_edit.sass @@ -289,8 +289,6 @@ body.outfits-edit .possible-error @extend .error display: none - #fullscreen-copyright - display: none &.fullscreen $fullscreen-search-border: 1px 1px 0 height: 100% @@ -302,8 +300,6 @@ body.outfits-edit padding-top: 2.5em position: relative width: 80% - h1 - display: none #short-url-response position: static #preview diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index 1983c745..6fd720bb 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -1,162 +1,126 @@ - add_body_class 'fullscreen' -- cache :action_suffix => "image_mode_#{can_use_image_mode?}" do - %a#home-link{:href => "/"} - %span Dress to Impress - %h1#title Planning an outfit +- localized_cache do #pet-type-not-found.possible-error - We haven't seen that combination before. Have you? - Submit the pet's name if you have! + = t '.pet_type.not_found' #preview-toolbar %form#pet-type-form %select{:name => "color"} %select{:name => "species"} - %input{:type => "submit", :value => "Go"}/ + %input{:type => "submit", :value => t('.pet_type.form.submit')} %form#pet-state-form - Gender/Emotions: + = t '.pet_state_form.header' %ul #save-outfit-wrapper %a#current-outfit-permalink{:target => '_blank'} - = image_tag 'link_go.png', :alt => 'Permalink', :title => 'Permalink to current outfit' - %button#save-outfit Save outfit - %button#save-outfit-not-signed-in Log in to save - %button#save-outfit-copy Save as… - %button#save-current-outfit Save "current outfit" + = image_tag 'link_go.png', :alt => t('.outfit.permalink.name'), + :title => t('.outfit.permalink.description') + %button#save-outfit= t '.outfit.save' + %button#save-outfit-not-signed-in= t '.outfit.sign_in_to_save' + %button#save-outfit-copy= t '.outfit.save_copy' + %button#save-current-outfit + = t '.outfit.save_current_outfit.main_html', + :outfit_name => content_tag(:span, t('.outfit.save_current_outfit.default_outfit_name')) %form#save-outfit-form .outfit-star - %input#save-outfit-name{:type => 'text', :placeholder => 'Outfit name'} - %button#save-outfit-finish{:type => 'submit'} Save - %button#save-outfit-cancel{:type => 'button'} Cancel + %input#save-outfit-name{:type => 'text', :placeholder => t('.outfit.form.name_placeholder')} + %button#save-outfit-finish{:type => 'submit'}= t '.outfit.form.submit' + %button#save-outfit-cancel{:type => 'button'}= t '.outfit.form.cancel' #preview #preview-swf #preview-swf-container - %p Flash and Javascript (but not Java!) are required to preview outfits. - %p If this message stays after the page is done loading, check those first. + %p= t '.preview.requirements' #preview-image-container #preview-mode %ul#preview-mode-toggle - %li#preview-mode-flash.active Flash - - if can_use_image_mode? - %li#preview-mode-image Image - - if can_use_image_mode? - = link_to 'Image mode FAQ', image_mode_path, - :id => 'preview-mode-note', :target => '_blank' - = link_to 'Broken image?', '#', :id => 'report-broken-image', - :target => '_blank', 'data-base-url' => new_broken_image_report_path - #preview-download-image - %h3 Download - %ul - %li - %button{'data-download-size' => 'small'} Small - %li - %button{'data-download-size' => 'medium'} Medium - %li - %button{'data-download-size' => 'large'} Large - - else - = link_to(donate_path, :id => 'preview-mode-note', :target => '_blank') do - %strong Image mode - is available for early beta testing to users who - %em donate - at least $5 to help upgrade the server. Thanks! + %li#preview-mode-flash.active= t '.preview.mode.flash.name' + %li#preview-mode-image= t '.preview.mode.image.name' + = link_to t('.preview.mode.image.faq'), image_mode_path, + :id => 'preview-mode-note', :target => '_blank' + = link_to t('.preview.mode.image.report_broken'), '#', + :id => 'report-broken-image', :target => '_blank', 'data-base-url' => new_broken_image_report_path #preview-sidebar %nav#preview-sidebar-navbar - #preview-sidebar-navbar-closet Closet - #preview-sidebar-navbar-sharing Sharing - #preview-sidebar-navbar-outfits Outfits + #preview-sidebar-navbar-closet= t '.sidebar.nav.closet' + #preview-sidebar-navbar-sharing= t '.sidebar.nav.sharing' + #preview-sidebar-navbar-outfits= t '.sidebar.nav.outfits' #preview-sidebar-content - #outfit-not-found Outfit not found - #save-success Outfit successfully saved + #outfit-not-found= t '.sidebar.notifications.outfits.not_found' + #save-success= t '.sidebar.notifications.outfits.save.success' #save-error #preview-closet.sidebar-view %ul - %p#fullscreen-copyright - Images © 2000-2010 Neopets, Inc. All Rights Reserved. - Used With Permission #preview-outfits.sidebar-view %ul#preview-outfits-list #preview-outfits-not-logged-in %figure = image_tag 'outfits_welcome.png' - %figcaption Ready to become a pro designer? - :markdown - We know how hard it can be to keep track of your ideas, - especially if you end up having a lot of them. - **But Dress to Impress makes it easy.** - - Once you have an idea for an outfit, you can **build it, - save it, and view it again later**, either to update your - design or finally make your dream a reality. - - **Thousands of users have already saved tens of thousands of - outfits — will you be next?** - - = link_to 'Log in to save this outfit', login_path_with_return_to, :id => 'preview-outfits-log-in' + %figcaption= t '.sidebar.outfits.not_signed_in.header' + = tmd '.sidebar.outfits.not_signed_in.pitch_markdown' + = link_to t('.sidebar.outfits.not_signed_in.sign_in'), + login_path_with_return_to, :id => 'preview-outfits-log-in' #preview-sharing.sidebar-view #preview-sharing-thumbnail-wrapper #preview-sharing-thumbnail-loading = image_tag 'outfits/small_loading.gif' - %span#preview-sharing-thumbnail-saving Saving… - %span#preview-sharing-thumbnail-generating Generating… + %span#preview-sharing-thumbnail-saving + = t '.sidebar.sharing.thumbnail.saving' + %span#preview-sharing-thumbnail-generating + = t '.sidebar.sharing.thumbnail.generating' %img#preview-sharing-thumbnail %ul#preview-sharing-urls %li - %label{:for => 'preview-sharing-permalink-url'} Outfit page + %label{:for => 'preview-sharing-permalink-url'} + = t '.sidebar.sharing.links.permalink' %input#preview-sharing-permalink-url.outfit-url{:type => 'text'} %li - %label{:for => 'preview-sharing-large-image-url'} Large image + %label{:for => 'preview-sharing-large-image-url'} + = t '.sidebar.sharing.links.images.large' %input#preview-sharing-large-image-url.outfit-url{:type => 'text'} %li - %label{:for => 'preview-sharing-medium-image-url'} Medium image + %label{:for => 'preview-sharing-medium-image-url'} + = t '.sidebar.sharing.links.images.medium' %input#preview-sharing-medium-image-url.outfit-url{:type => 'text'} %li - %label{:for => 'preview-sharing-small-image-url'} Small image + %label{:for => 'preview-sharing-small-image-url'} + = t '.sidebar.sharing.links.images.small' %input#preview-sharing-small-image-url.outfit-url{:type => 'text'} %ul#preview-sharing-url-formats - %li.active{'data-format' => 'plain'} Plain - %li{'data-format' => 'html'} HTML - %li{'data-format' => 'bbcode'} BBCode + %li.active{'data-format' => 'plain'} + = t '.sidebar.sharing.formats.plain' + %li{'data-format' => 'html'} + = t '.sidebar.sharing.formats.html' + %li{'data-format' => 'bbcode'} + =t '.sidebar.sharing.formats.bbcode' %form#preview-search-form %header - %h2 Add an item - %input{:name => "query", :placeholder => "Search items...", :type => "search"}/ - %input{:type => "submit", :value => "Go"}/ - %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 + %h2= t '.search.header' + %input{:name => "query", :placeholder => t('.search.form.query_placeholder'), :type => "search"}/ + %input{:type => "submit", :value => t('.search.form.submit')}/ + %a.preview-search-form-your-items{:href => '#', 'data-search-value' => 'owns'} + = closet_lists_group_name :you, true + %a.preview-search-form-your-items{:href => '#', 'data-search-value' => 'wants'} + = closet_lists_group_name :you, false #preview-search-form-pagination - %a#preview-search-form-clear{:href => "#"} clear + %a#preview-search-form-clear{:href => "#"}= t '.search.form.clear' %dl#preview-search-form-help %div - %dt kreludor "altador cup" -background - %dd - returns any item with the word "kreludor" and the phrase "altador cup" - in it, but not the word "background" + %dt= t '.search.examples.basic.query' + %dd= t '.search.examples.basic.description' %div - %dt collar -is:nc -is:pb - %dd - returns any item with the word "collar" in it, but is not from the NC - mall, and is not from a deluxe paint brush set + %dt= t '.search.examples.flags.query' + %dd= t '.search.examples.flags.description' %div - %dt - %span species: - %span.search-helper{"data-search-filter" => "species"} Acara - %dd - returns any item a - %span.search-helper{"data-search-filter" => "species"} Acara - can wear + %dt= search_query_with_helper '.search.examples.species' + %dd= search_query_description '.search.examples.species' %div - %dt - %span type: - %span.search-helper{"data-search-filter" => "type"} background - %dd - returns any item that fills a - %span.search-helper{"data-search-filter" => "type"} background - zone - #preview-search-form-loading Loading... + %dt= search_query_with_helper '.search.examples.type' + %dd= search_query_description '.search.examples.type' + #preview-search-form-loading= '.search.loading' #preview-search-form-error.possible-error #preview-search-form-no-results - No results for "" + = t '.search.no_results_html', :query => content_tag(:span) %ul - #no-assets-full-message - We haven't seen this item on this body type before. Have you? Submit its name on the home page if you have! + #no-assets-full-message= t '.sidebar.closet.no_data.description' %script#outfit-template{:type => 'text/x-jquery-tmpl'}
  • %header @@ -165,15 +129,19 @@ %form.outfit-rename-form %input.outfit-rename-field{:type => 'text'} %footer - %a.outfit-rename-button{:href => '#'} rename - %a.outfit-delete{:href => '#'} delete + %a.outfit-rename-button{:href => '#'} + = t '.sidebar.outfits.outfit.rename' + %a.outfit-delete{:href => '#'} + = t '.sidebar.outfits.outfit.delete' .outfit-thumbnail-wrapper %img.outfit-thumbnail .outfit-delete-confirmation - %span Delete? - %a.outfit-delete-confirmation-yes{:href => '#'} yes + %span= t '.sidebar.outfits.outfit.delete_confirmation.header' + %a.outfit-delete-confirmation-yes{:href => '#'} + = t '.sidebar.outfits.outfit.delete_confirmation.delete' \/ - %a.outfit-delete-confirmation-no{:href => '#'} no + %a.outfit-delete-confirmation-no{:href => '#'} + = t '.sidebar.outfits.outfit.delete_confirmation.cancel'
  • - content_for :javascripts do = include_javascript_libraries :jquery, :swfobject, :jquery_tmpl diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index bfbde555..ea5c6b75 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -441,6 +441,124 @@ en-meep: destroy: success: Outfit "%{outfit_name}" succeessfully demeeped. + edit: + pet_type: + not_found: + We haven't meeped that combination before. Have you? + Meep the pet's name if you have! + form: + submit: Meep + pet_state_form: + header: "Gender/Emeepshuns:" + outfit: + permalink: + name: Permameep + description: Permameep to current outfeet + save: Meep outfit + sign_in_to_save: Log in to meep + save_copy: Meep as… + save_current_outfit: + main_html: Meep "%{outfit_name}" + default_outfit_name: current outfeet + form: + name_placeholder: Outfeet name + submit: Meep + cancel: Unmeep + preview: + requirements: + Flash and Javascript (but not Java!) are required to meep outfeets. + mode: + flash: + name: Fleesh + image: + name: Imeege + faq: Imeege Mode FAQ + report_broken: Broken imeege? + sidebar: + nav: + closet: Closeet + sharing: Sheering + outfits: Outfeets + notifications: + outfits: + not_found: Outfeet not found + save: + success: Outfeet successfully meeped + closet: + no_data: + description: + We haven't meeped this item on this body type before. Have you? + Meep it for us on the home page if you have! + outfits: + not_signed_in: + header: Ready to become a professional meepit? + pitch_markdown: | + We know how hard it can be to meep track of your ideas, + especially if you end up having a lot of them. + **But Dress to Impress makes it meepy.** + + Once you have an idea for an outfit, you can **meep it, meep it, + and meep it again later**, either to update your design or + finally make your dream a reality. + + **Thousands of users have already meeped tens of thousands of + outfits. Will you be next?** + sign_in: Log in to meep this outfit + outfit: + rename: remeep + delete: unmeep + delete_confirmation: + header: Unmeep? + delete: ja + cancel: nü + sharing: + thumbnail: + saving: Seeving… + generating: Genereeting… + links: + permalink: Outfeet page + images: + large: Leerge + medium: Meedium + small: Smeell + formats: + plain: Pleen + html: HTMeepL + bbcode: BBMeep + search: + header: Meep an item + form: + query_placeholder: Meep items… + submit: Meep + clear: unmeep + loading: Meeping… + no_results_html: No meepits for "%{query}" + examples: + basic: + query: kreludor "altador cup" -background + description: + meeps any item with the word "kreludor" and the phrase "altador + cup" in it, but not the word "background" + flags: + query: collar -is:nc -is:pb + description: + meeps any item with the word "collar" in it, but is not from + the NC mall, and is not from a deluxe paint brush set + species: + filter: + key: species + default_value: Acara + query_html: "%{filter_key}:%{filter_value}" + description_html: + meeps any item a %{default_value} can wear + type: + filter: + key: type + default_value: background + query_html: "%{filter_key}:%{filter_value}" + description_html: + meeps any item that occupies a %{default_value} zone + new: tagline: Meeps made meepy! load_pet_legend: Enter your pet's meep diff --git a/config/locales/en.yml b/config/locales/en.yml index 0ae2d958..3c836420 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -442,6 +442,124 @@ en: destroy: success: Outfit "%{outfit_name}" successfully deleted. + edit: + pet_type: + not_found: + We haven't seen that combination before. Have you? + Submit the pet's name if you have! + form: + submit: Go + pet_state_form: + header: "Gender/Emotions:" + outfit: + permalink: + name: Permalink + description: Permalink to current outfit + save: Save outfit + sign_in_to_save: Log in to save + save_copy: Save as… + save_current_outfit: + main_html: Save "%{outfit_name}" + default_outfit_name: current outfit + form: + name_placeholder: Outfit name + submit: Save + cancel: Cancel + preview: + requirements: + Flash and Javascript (but not Java!) are required to preview outfits. + mode: + flash: + name: Flash + image: + name: Image + faq: Image mode FAQ + report_broken: Broken image? + sidebar: + nav: + closet: Closet + sharing: Sharing + outfits: Outfits + notifications: + outfits: + not_found: Outfit not found + save: + success: Outfit successfully saved + closet: + no_data: + description: + We haven't seen this item on this body type before. Have you? + Model it for us on the home page if you have! + outfits: + not_signed_in: + header: Ready to become a pro designer? + pitch_markdown: | + We know how hard it can be to keep track of your ideas, + especially if you end up having a lot of them. + **But Dress to Impress makes it easy.** + + Once you have an idea for an outfit, you can **build it, save it, + and view it again later**, either to update your design or + finally make your dream a reality. + + **Thousands of users have already saved tens of thousands of + outfits. Will you be next?** + sign_in: Log in to save this outfit + outfit: + rename: rename + delete: delete + delete_confirmation: + header: Delete? + delete: "yes" + cancel: "no" + sharing: + thumbnail: + saving: Saving… + generating: Generating… + links: + permalink: Outfit page + images: + large: Large + medium: Medium + small: Small + formats: + plain: Plain + html: HTML + bbcode: BBCode + search: + header: Add an item + form: + query_placeholder: Search items… + submit: Search + clear: clear + loading: Loading… + no_results_html: No results for "%{query}" + examples: + basic: + query: kreludor "altador cup" -background + description: + returns any item with the word "kreludor" and the phrase "altador + cup" in it, but not the word "background" + flags: + query: collar -is:nc -is:pb + description: + returns any item with the word "collar" in it, but is not from + the NC mall, and is not from a deluxe paint brush set + species: + filter: + key: species + default_value: Acara + query_html: "%{filter_key}:%{filter_value}" + description_html: + returns any item a %{default_value} can wear + type: + filter: + key: type + default_value: background + query_html: "%{filter_key}:%{filter_value}" + description_html: + returns any item that occupies a %{default_value} zone + index: title: Your Outfits intro: diff --git a/public/javascripts/outfits/edit.js b/public/javascripts/outfits/edit.js index 0f6682bc..8370daa0 100644 --- a/public/javascripts/outfits/edit.js +++ b/public/javascripts/outfits/edit.js @@ -1063,22 +1063,6 @@ View.PreviewAdapterForm = function (wardrobe) { if(preview.usingImageAdapter()) { activate(imageToggle, 'image', 'flash'); } - - var DOWNLOAD_SIZES = { - 'small': [150, 150], - 'medium': [300, 300], - 'large': [600, 600] - }; - - $('#preview-download-image button').click(function () { - var size = DOWNLOAD_SIZES[this.getAttribute('data-download-size')]; - preview.adapter.saveImage(size); - }); - - if(document.createElement('canvas').getContext) { - // If browser supports canvas - modeWrapper.addClass('can-download'); - } } View.ReportBrokenImage = function (wardrobe) { @@ -1280,13 +1264,14 @@ View.Search = function (wardrobe) { }); help_el.find('dt a').live('click', function (e) { - var el = $(this), siblings = el.parent().children(), query; + var el = $(this), siblings = el.parent().contents(), query; e.preventDefault(); if(siblings.length > 1) { query = siblings.map(function () { var el = $(this); return el[el.is('select') ? 'val' : 'text'](); }).get().join(''); + query = $.trim(query); } else { query = el.text(); } @@ -1324,12 +1309,6 @@ View.Search = function (wardrobe) { //wardrobe.pet_attributes.bind('update', prepBuildHelper('only', getSpecies)); } -View.Title = function (wardrobe) { - wardrobe.base_pet.bind('updateName', function (name) { - $('#title').text("Planning " + name + "'s outfit"); - }); -} - var userbar_sessions_link = $('#userbar a:last'), userbar_message_verb = userbar_sessions_link.text() == 'Log out' ? 'logged out' : 'sent to the login page', userbar_message_el = $('', { diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index 802b109e..b5ca060a 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -2522,14 +2522,10 @@ body.outfits-edit .possible-error { display: none; } /* line 292, ../../../app/stylesheets/outfits/_edit.sass */ -body.outfits-edit #fullscreen-copyright { - display: none; -} -/* line 294, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen { height: 100%; } -/* line 297, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 295, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #container { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -2542,31 +2538,27 @@ body.outfits-edit.fullscreen #container { position: relative; width: 80%; } -/* line 305, ../../../app/stylesheets/outfits/_edit.sass */ -body.outfits-edit.fullscreen h1 { - display: none; -} -/* line 307, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 303, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #short-url-response { position: static; } -/* line 309, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 305, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #preview { width: 100%; } -/* line 311, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 307, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #preview-sidebar { float: right; margin: 0; position: relative; width: 400px; } -/* line 316, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 312, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #preview-sidebar.viewing-saving-outfit { height: auto; max-height: 100%; } -/* line 319, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 315, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #preview-search-form { bottom: 1.5em; left: 0; @@ -2575,7 +2567,7 @@ body.outfits-edit.fullscreen #preview-search-form { position: absolute; width: 100%; } -/* line 327, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 323, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #preview-search-form-help div { display: -moz-inline-box; -moz-box-orient: vertical; @@ -2588,27 +2580,27 @@ body.outfits-edit.fullscreen #preview-search-form-help div { body.outfits-edit.fullscreen #preview-search-form-help div { *display: inline; } -/* line 330, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 326, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #footer { bottom: 0; left: 0; position: absolute; width: 100%; } -/* line 335, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 331, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #footer ul, body.outfits-edit.fullscreen #footer p, body.outfits-edit.fullscreen #footer li { display: inline; } -/* line 337, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 333, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.fullscreen #footer ul { margin-right: 2em; } -/* line 340, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 336, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object { padding: 6px; position: relative; } -/* line 343, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 339, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object ul { display: none; left: 0; @@ -2616,11 +2608,11 @@ body.outfits-edit .object ul { position: absolute; top: 0; } -/* line 349, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 345, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object ul li { margin-bottom: 0.25em; } -/* line 351, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 347, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object ul li a { /* http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html */ -moz-border-radius: 5px; @@ -2665,11 +2657,11 @@ body.outfits-edit .object ul li a:active { body.outfits-edit .object ul li a:hover { background-color: #999999; } -/* line 354, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 350, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object:hover ul, body.outfits-edit .object:hover .object-info { display: block; } -/* line 361, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 357, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .nc-icon { background: url('/images/nc.png?1344550430') no-repeat; height: 16px; @@ -2679,14 +2671,14 @@ body.outfits-edit .nc-icon { top: 64px; width: 16px; } -/* line 369, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 365, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .nc-icon:hover { -moz-opacity: 0.5; -webkit-opacity: 0.5; -o-opacity: 0.5; -khtml-opacity: 0.5; } -/* line 372, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 368, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object-info { -moz-border-radius: 12px; -webkit-border-radius: 12px; @@ -2707,26 +2699,26 @@ body.outfits-edit .object-info { top: 0; width: 16px; } -/* line 383, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 379, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object-info span { font-family: "Droid Serif", Georgia, "Times New Roman", Times, serif; font-weight: bold; position: relative; top: -2px; } -/* line 389, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 385, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .object-info:hover { -moz-opacity: 1; -webkit-opacity: 1; -o-opacity: 1; -khtml-opacity: 1; } -/* line 392, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 388, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits { display: none; text-align: left; } -/* line 399, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 395, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul { font-size: 0; list-style: none; @@ -2797,23 +2789,23 @@ body.outfits-edit #preview-outfits > ul > li footer { body.outfits-edit #preview-outfits > ul > li a { color: white; } -/* line 409, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 405, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul.loaded { background: transparent; } -/* line 412, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 408, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li { height: 110px; margin: 1px; width: 110px; } -/* line 422, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 418, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li header, body.outfits-edit #preview-outfits > ul > li footer, body.outfits-edit #preview-outfits > ul > li .outfit-delete-confirmation { font-size: 12px; padding: 2px 4px; width: 102px; } -/* line 427, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 423, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li header { -moz-opacity: 0.75; -webkit-opacity: 0.75; @@ -2822,11 +2814,11 @@ body.outfits-edit #preview-outfits > ul > li header { bottom: 0; cursor: pointer; } -/* line 432, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 428, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li footer, body.outfits-edit #preview-outfits > ul > li .outfit-delete-confirmation { display: none; } -/* line 435, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 431, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-delete-confirmation { color: white; left: 0; @@ -2837,11 +2829,11 @@ body.outfits-edit #preview-outfits > ul > li .outfit-delete-confirmation { text-align: center; top: 0; } -/* line 441, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 437, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-delete-confirmation span { font-weight: bold; } -/* line 447, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 443, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-thumbnail-wrapper { -moz-opacity: 0.5; -webkit-opacity: 0.5; @@ -2858,61 +2850,61 @@ body.outfits-edit #preview-outfits > ul > li .outfit-thumbnail-wrapper { width: 150px; z-index: 1; } -/* line 461, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 457, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-thumbnail { display: none; } -/* line 464, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 460, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-star { bottom: 0; margin-right: 4px; } -/* line 468, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 464, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-delete { float: right; } -/* line 471, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 467, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-rename-button { float: left; } -/* line 474, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 470, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-rename-button, body.outfits-edit #preview-outfits > ul > li .outfit-delete { font-size: 85%; text-decoration: none; } -/* line 478, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 474, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-rename-button:hover, body.outfits-edit #preview-outfits > ul > li .outfit-delete:hover { text-decoration: underline; } -/* line 481, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 477, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-rename-form { display: none; } -/* line 484, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 480, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li .outfit-rename-form input { background: transparent; border: 1px solid white; width: 6em; } -/* line 490, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 486, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li:hover header { -moz-opacity: 1; -webkit-opacity: 1; -o-opacity: 1; -khtml-opacity: 1; } -/* line 493, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 489, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li:hover .outfit-thumbnail-wrapper { -moz-opacity: 0.75; -webkit-opacity: 0.75; -o-opacity: 0.75; -khtml-opacity: 0.75; } -/* line 496, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 492, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li:hover footer { display: block; } -/* line 500, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 496, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.active header { -moz-opacity: 1; -webkit-opacity: 1; @@ -2920,74 +2912,74 @@ body.outfits-edit #preview-outfits > ul > li.active header { -khtml-opacity: 1; font-weight: bold; } -/* line 504, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 500, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.active .outfit-thumbnail-wrapper { -moz-opacity: 1; -webkit-opacity: 1; -o-opacity: 1; -khtml-opacity: 1; } -/* line 508, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 504, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.confirming-deletion footer { display: none; } -/* line 511, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 507, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.confirming-deletion .outfit-delete-confirmation { display: block; } -/* line 515, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 511, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.renaming .outfit-name { display: none; } -/* line 518, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 514, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.renaming .outfit-rename-form { display: inline; } -/* line 521, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 517, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.thumbnail-available { background: transparent; } -/* line 524, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 520, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.thumbnail-available .outfit-thumbnail-wrapper { background-image: none; } -/* line 527, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 523, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.thumbnail-available .outfit-thumbnail { display: block; } -/* line 531, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 527, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits > ul > li.loading .outfit-star { background-image: url('/images/loading_outfit_pane.gif?1344550430'); } -/* line 534, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 530, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits #preview-outfits-not-logged-in { text-align: center; overflow-x: hidden; } -/* line 538, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 534, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits #preview-outfits-not-logged-in img { border-color: #006600; border-style: solid; border-width: 1px 0; } -/* line 544, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 540, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits #preview-outfits-not-logged-in figure { display: block; margin: 0 0 1em 0; padding: 0; } -/* line 549, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 545, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits #preview-outfits-not-logged-in figcaption { display: block; font-weight: bold; } -/* line 553, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 549, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits #preview-outfits-not-logged-in p { margin-left: 24px; margin-right: 24px; font-size: 85%; } -/* line 557, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 553, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-outfits #preview-outfits-not-logged-in #preview-outfits-log-in { /* http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html */ -moz-border-radius: 5px; @@ -3027,11 +3019,11 @@ body.outfits-edit #preview-outfits #preview-outfits-not-logged-in #preview-outfi body.outfits-edit #preview-outfits #preview-outfits-not-logged-in #preview-outfits-log-in:hover { background-color: #ee4b00; } -/* line 561, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 557, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing { display: none; } -/* line 564, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 560, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-urls { margin-left: 24px; margin-right: 24px; @@ -3039,23 +3031,23 @@ body.outfits-edit #preview-sharing #preview-sharing-urls { margin-bottom: 1em; margin-top: 1em; } -/* line 571, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 567, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-urls li { display: block; padding: 0.25em 0; width: 100%; } -/* line 576, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 572, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-urls li label { display: block; font-weight: bold; } -/* line 580, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 576, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-urls li input { display: block; width: 100%; } -/* line 584, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 580, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-url-formats { margin-left: 24px; margin-right: 24px; @@ -3068,7 +3060,7 @@ body.outfits-edit #preview-sharing #preview-sharing-url-formats { font-size: 0; text-align: center; } -/* line 592, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 588, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-url-formats li { display: -moz-inline-box; -moz-box-orient: vertical; @@ -3087,13 +3079,13 @@ body.outfits-edit #preview-sharing #preview-sharing-url-formats li { body.outfits-edit #preview-sharing #preview-sharing-url-formats li { *display: inline; } -/* line 603, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 599, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-url-formats li.active { background: #eeffee; color: inherit; font-weight: bold; } -/* line 608, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 604, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-url-formats li:first-child { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; @@ -3109,7 +3101,7 @@ body.outfits-edit #preview-sharing #preview-sharing-url-formats li:first-child { border-bottom-left-radius: 5px; border-left-width: 1px; } -/* line 613, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 609, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-url-formats li:last-child { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; @@ -3125,7 +3117,7 @@ body.outfits-edit #preview-sharing #preview-sharing-url-formats li:last-child { border-bottom-right-radius: 5px; border-right-color: #006600; } -/* line 618, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 614, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-thumbnail-wrapper { border: 1px solid #aaddaa; display: block; @@ -3134,7 +3126,7 @@ body.outfits-edit #preview-sharing #preview-sharing-thumbnail-wrapper { position: relative; width: 150px; } -/* line 626, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 622, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-thumbnail-loading { height: 100%; left: 0; @@ -3142,7 +3134,7 @@ body.outfits-edit #preview-sharing #preview-sharing-thumbnail-loading { top: 0; width: 100%; } -/* line 633, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 629, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-thumbnail-loading span { color: #448844; font-size: 85%; @@ -3152,11 +3144,11 @@ body.outfits-edit #preview-sharing #preview-sharing-thumbnail-loading span { top: 50%; width: 100%; } -/* line 642, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 638, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-thumbnail, body.outfits-edit #preview-sharing #preview-sharing-thumbnail-generating { display: none; } -/* line 645, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 641, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing #preview-sharing-beta-note { margin-left: 24px; margin-right: 24px; @@ -3167,59 +3159,59 @@ body.outfits-edit #preview-sharing #preview-sharing-beta-note { margin-top: 1em; text-align: center; } -/* line 653, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 649, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing.urls-loaded #preview-sharing-thumbnail-saving { display: none; } -/* line 656, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 652, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing.urls-loaded #preview-sharing-urls, body.outfits-edit #preview-sharing.urls-loaded #preview-sharing-url-formats, body.outfits-edit #preview-sharing.urls-loaded #preview-sharing-thumbnail-generating { display: block; } -/* line 660, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 656, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing.urls-loaded.thumbnail-loaded #preview-sharing-thumbnail-loading { display: none; } -/* line 663, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 659, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing.urls-loaded.thumbnail-loaded #preview-sharing-thumbnail { display: block; } -/* line 667, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 663, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing.urls-loaded.thumbnail-available #preview-sharing-thumbnail-loading { -moz-opacity: 0.85; -webkit-opacity: 0.85; -o-opacity: 0.85; -khtml-opacity: 0.85; } -/* line 670, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 666, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sharing.urls-loaded.thumbnail-available #preview-sharing-thumbnail { display: block; } -/* line 673, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 669, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .preview-sidebar-nav { float: right; font-size: 85%; margin-right: 24px; margin-top: 1em; } -/* line 685, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 681, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar #preview-sidebar-navbar-closet { background: white; border-bottom-color: white; font-weight: bold; } -/* line 689, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 685, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar.viewing-outfits #preview-sidebar-navbar-closet, body.outfits-edit #preview-sidebar.sharing #preview-sidebar-navbar-closet { background: transparent; border-bottom: 1px solid #aaddaa; font-weight: normal; } -/* line 692, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 688, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar.viewing-outfits #preview-sidebar-navbar-outfits, body.outfits-edit #preview-sidebar.sharing #preview-sidebar-navbar-sharing { background: white; border-bottom-color: white; font-weight: bold; } -/* line 695, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 691, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar-navbar { -moz-border-radius: 10px 10px 0 0; -webkit-border-radius: 10px 10px 0 0; @@ -3239,7 +3231,7 @@ body.outfits-edit #preview-sidebar-navbar { body.outfits-edit #preview-sidebar-navbar { display: block; } -/* line 704, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 700, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar-navbar > div { background: transparent; border-bottom: 1px solid #aaddaa; @@ -3251,11 +3243,11 @@ body.outfits-edit #preview-sidebar-navbar > div { text-align: center; width: 132px; } -/* line 713, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 709, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar-navbar > div:first-child { border-left: 0; } -/* line 716, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 712, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar-content { -moz-border-radius: 0 0 10px 10px; -webkit-border-radius: 0 0 10px 10px; @@ -3268,7 +3260,7 @@ body.outfits-edit #preview-sidebar-content { height: 300px; overflow: auto; } -/* line 723, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 719, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #save-success, body.outfits-edit #save-error, body.outfits-edit #outfit-not-found, body.outfits-edit #preview-sidebar-donation-request { margin-left: 24px; margin-right: 24px; @@ -3276,7 +3268,7 @@ body.outfits-edit #save-success, body.outfits-edit #save-error, body.outfits-edi margin-top: 1em; text-align: center; } -/* line 730, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 726, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar-donation-request { background: #e6efc2; border: 1px solid #c6d880; @@ -3284,23 +3276,23 @@ body.outfits-edit #preview-sidebar-donation-request { font-size: 85%; padding: 1em; } -/* line 735, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 731, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar-donation-request-no-thanks { margin-left: 1em; } -/* line 738, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 734, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #save-success { background: #e6efc2; border: 1px solid #c6d880; color: #264409; } -/* line 741, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 737, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #save-error, body.outfits-edit #outfit-not-found { background: #fbe3e4; border: 1px solid #fbc2c4; color: #8a1f11; } -/* line 744, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 740, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #userbar-message { -moz-opacity: 0.5; -webkit-opacity: 0.5; @@ -3308,16 +3300,16 @@ body.outfits-edit #userbar-message { -khtml-opacity: 0.5; display: none; } -/* line 748, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 744, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #new-outfit-name { font: inherit; line-height: 1; } -/* line 752, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 748, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #pet-type-form, body.outfits-edit #pet-state-form, body.outfits-edit #preview-swf, body.outfits-edit #preview-search-form { position: relative; } -/* line 755, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 751, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .control-overlay { height: 100%; left: 0; @@ -3326,11 +3318,11 @@ body.outfits-edit .control-overlay { width: 100%; z-index: 5; } -/* line 763, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 759, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-sidebar-nav-outfits, body.outfits-edit #save-outfit-signed-in { display: none; } -/* line 766, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 762, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit form#save-outfit-form { display: none; margin-right: 0; @@ -3363,7 +3355,7 @@ body.outfits-edit form#save-outfit-form .outfit-star { margin-left: -24px; margin-right: 0; } -/* line 772, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 768, ../../../app/stylesheets/outfits/_edit.sass */ 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: -moz-inline-box; -moz-box-orient: vertical; @@ -3377,46 +3369,46 @@ body.outfits-edit form#save-outfit-form .outfit-star, body.outfits-edit form#sav 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; } -/* line 777, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 773, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit form#save-outfit-form .outfit-star { margin-top: 0.25em; } -/* line 780, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 776, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .outfit-url { font-size: 75%; } -/* line 783, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 779, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #preview-search-form-error { background: #fbe3e4; border: 1px solid #fbc2c4; color: #8a1f11; padding: 0.25em 0.5em; } -/* line 788, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 784, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #preview-sidebar-nav-outfits { display: block; } -/* line 790, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 786, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #save-outfit { display: inline-block; } -/* line 794, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 790, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #save-outfit-wrapper.active-outfit #save-outfit { display: none; } -/* line 796, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 792, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #save-outfit-wrapper.active-outfit #save-current-outfit, body.outfits-edit.user-signed-in #save-outfit-wrapper.active-outfit #save-outfit-copy { display: inline-block; } -/* line 804, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 800, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #save-outfit-form { display: block; } -/* line 806, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 802, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #save-outfit, body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #save-current-outfit, body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #save-outfit-copy, body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #current-outfit-permalink, body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #shared-outfit-permalink, body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #share-outfit, body.outfits-edit.user-signed-in #save-outfit-wrapper.saving-outfit #shared-outfit-url { display: none; } -/* line 808, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 804, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in .preview-search-form-your-items { display: -moz-inline-box; -moz-box-orient: vertical; @@ -3428,23 +3420,23 @@ body.outfits-edit.user-signed-in .preview-search-form-your-items { body.outfits-edit.user-signed-in .preview-search-form-your-items { *display: inline; } -/* line 810, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 806, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #preview-outfits-not-logged-in { display: none; } -/* line 812, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 808, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-signed-in #preview-outfits-list { display: block; } -/* line 816, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 812, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit.user-not-signed-in #save-outfit-not-signed-in { display: inline-block; } -/* line 820, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 816, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #save-outfit-wrapper.shared-outfit #shared-outfit-permalink, body.outfits-edit #save-outfit-wrapper.shared-outfit #shared-outfit-url { display: inline-block; } -/* line 822, ../../../app/stylesheets/outfits/_edit.sass */ +/* line 818, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit #save-outfit-wrapper.shared-outfit #current-outfit-permalink { display: none !important; } From ec6c7b550dd52ff9de87302fd73f5b4dcdb1cc59 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 4 Jan 2013 20:48:47 -0500 Subject: [PATCH 26/66] i18n for outfits/edit.js sharing urls --- app/views/outfits/edit.html.haml | 10 ++++++- public/javascripts/outfits/edit.js | 47 +++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index 6fd720bb..a6506dd8 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -115,12 +115,20 @@ %div %dt= search_query_with_helper '.search.examples.type' %dd= search_query_description '.search.examples.type' - #preview-search-form-loading= '.search.loading' + #preview-search-form-loading= t '.search.loading' #preview-search-form-error.possible-error #preview-search-form-no-results = t '.search.no_results_html', :query => content_tag(:span) %ul #no-assets-full-message= t '.sidebar.closet.no_data.description' + %script#sharing-html-image-template{:type => 'text/x-jquery-tmpl'} + = link_to image_tag('${image_url}'), '${permalink}' + %script#sharing-html-text-template{:type => 'text/x-jquery-tmpl'} + = link_to t('app_name'), '${permalink}' + %script#sharing-bbcode-image-template{:type => 'text/x-jquery-tmpl'} + [URL=${permalink}][IMG]${image_url}[/IMG][/URL] + %script#sharing-bbcode-text-template{:type => 'text/x-jquery-tmpl'} + [URL=${permalink}]#{t('app_name')}[/URL] %script#outfit-template{:type => 'text/x-jquery-tmpl'}
  • %header diff --git a/public/javascripts/outfits/edit.js b/public/javascripts/outfits/edit.js index 8370daa0..7e9ac917 100644 --- a/public/javascripts/outfits/edit.js +++ b/public/javascripts/outfits/edit.js @@ -715,26 +715,53 @@ View.Outfits = function (wardrobe) { }; var format_selector_els = $('#preview-sharing-url-formats li'); var thumbnail_el = $('#preview-sharing-thumbnail'); + var templates = { + html: { + image: $('#sharing-html-image-template'), + text: $('#sharing-html-text-template') + }, + bbcode: { + image: $('#sharing-bbcode-image-template'), + text: $('#sharing-bbcode-text-template') + } + } + function templateHTML(template, options) { + var contents = template.tmpl(options); + var contentsHTML = contents.clone().wrap('
    ').parent().html(); + return contentsHTML; + } + + // The HTML and BBCode formats could probably be handled more dynamic-like. var formats = { plain: { - image: function (url) { return url }, - text: function (url) { return url } + image: function (image_url) { return image_url }, + text: function (permalink) { return permalink } }, html: { - image: function (url, permalink) { - return ''; + image: function (image_url, permalink) { + return templateHTML(templates.html.image, { + image_url: image_url, + permalink: permalink + }); }, - text: function (url) { - return 'Dress to Impress'; + text: function (permalink) { + return templateHTML(templates.html.text, { + permalink: permalink + }); } }, bbcode: { - image: function (url, permalink) { - return '[URL=' + permalink + '][IMG]' + url + '[/IMG][/URL]'; + image: function (image_url, permalink) { + return templateHTML(templates.bbcode.image, { + image_url: image_url, + permalink: permalink + }); }, - text: function (url) { - return '[URL=' + url + ']Dress to Impress[/URL]'; + text: function (permalink) { + return templateHTML(templates.bbcode.text, { + permalink: permalink + }); } } }; From 629e5c68a97634cc23c9e2bd1504b3111b08a58f Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 4 Jan 2013 21:08:41 -0500 Subject: [PATCH 27/66] i18n for outfits/edit.js userbar message and outfit save errors --- app/controllers/outfits_controller.rb | 4 +++- app/stylesheets/outfits/_edit.sass | 2 +- app/views/outfits/edit.html.haml | 7 ++++++ config/locales/en-meep.yml | 6 +++++ config/locales/en.yml | 6 +++++ public/javascripts/outfits/edit.js | 32 ++++---------------------- public/stylesheets/compiled/screen.css | 2 +- 7 files changed, 29 insertions(+), 30 deletions(-) diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 6c16f28f..e20b8a70 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -90,7 +90,9 @@ class OutfitsController < ApplicationController end def render_outfit_errors - render :json => {:errors => @outfit.errors}, :status => :bad_request + render :json => {:errors => @outfit.errors, + :full_error_messages => @outfit.errors.full_messages}, + :status => :bad_request end end diff --git a/app/stylesheets/outfits/_edit.sass b/app/stylesheets/outfits/_edit.sass index d201e7bd..152e9b7e 100644 --- a/app/stylesheets/outfits/_edit.sass +++ b/app/stylesheets/outfits/_edit.sass @@ -737,7 +737,7 @@ body.outfits-edit #save-error, #outfit-not-found +error - #userbar-message + #userbar-session-message +opacity(.5) display: none diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index a6506dd8..7a832842 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -151,6 +151,13 @@ %a.outfit-delete-confirmation-no{:href => '#'} = t '.sidebar.outfits.outfit.delete_confirmation.cancel'
  • + +%span#userbar-session-message + - if user_signed_in? + = t '.userbar.session_message.signed_in' + - else + = t '.userbar.session_message.not_signed_in' + - content_for :javascripts do = include_javascript_libraries :jquery, :swfobject, :jquery_tmpl = include_javascripts :edit_outfit_package diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index ea5c6b75..b1203972 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -558,6 +558,12 @@ en-meep: query_html: "%{filter_key}:%{filter_value}" description_html: meeps any item that occupies a %{default_value} zone + userbar: + session_message: + signed_in: + You will be meeped out, then brought back to this exact outfit. + not_signed_in: + You will be meeped in, then brought back to this exact outfit. new: tagline: Meeps made meepy! diff --git a/config/locales/en.yml b/config/locales/en.yml index 3c836420..b3e69ca8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -559,6 +559,12 @@ en: query_html: "%{filter_key}:%{filter_value}" description_html: returns any item that occupies a %{default_value} zone + userbar: + session_message: + signed_in: + You will be logged out, then brought back to this exact outfit. + not_signed_in: + You will be logged in, then brought back to this exact outfit. index: title: Your Outfits diff --git a/public/javascripts/outfits/edit.js b/public/javascripts/outfits/edit.js index 7e9ac917..50d73c4f 100644 --- a/public/javascripts/outfits/edit.js +++ b/public/javascripts/outfits/edit.js @@ -902,13 +902,6 @@ View.Outfits = function (wardrobe) { new_outfit_form_el.toggleClass('starred'); }); - var SAVE_ERRORS = { - 'item_outfit_relationships': "Item not found. How odd. Pull some items out of your closet and try again.", - 'pet_state': "Pet state not found. How odd. Try picking a new Gender/Emotion.", - 'name': true, - 'user': "You must be logged in to save outfits" - }; - function saveErrorMessage(text) { save_error_el.text(text).notify(); } @@ -940,21 +933,10 @@ View.Outfits = function (wardrobe) { wardrobe.outfits.bind('updatePetState', clearSharedOutfit); function saveFailure(outfit, response) { - var errors = response.errors; - if(typeof errors == 'undefined') { - saveErrorMessage("Whoops! The save failed, but the server didn't say why. Please try again."); + if(typeof response.full_error_messages !== 'undefined') { + saveErrorMessage(response.full_error_messages.join(', ')); } else { - for(var key in SAVE_ERRORS) { - if(SAVE_ERRORS.hasOwnProperty(key) && typeof errors[key] != 'undefined') { - var message = SAVE_ERRORS[key]; - if(message === true) { - message = key.charAt(0).toUpperCase() + key.substr(1) + ' ' + - errors[key]; - } - saveErrorMessage(message); - break; - } - } + saveErrorMessage("Could not save outfit. Please try again."); } new_outfit_form_el.stopLoading(); liForOutfit(outfit).stopLoading(); @@ -1336,12 +1318,8 @@ View.Search = function (wardrobe) { //wardrobe.pet_attributes.bind('update', prepBuildHelper('only', getSpecies)); } -var userbar_sessions_link = $('#userbar a:last'), - userbar_message_verb = userbar_sessions_link.text() == 'Log out' ? 'logged out' : 'sent to the login page', - userbar_message_el = $('', { - id: 'userbar-message', - text: "You will be " + userbar_message_verb + ", then brought back to this exact outfit you've made." - }).prependTo('#userbar'); +var userbar_sessions_link = $('#userbar a:last'); +var userbar_message_el = $('#userbar-session-message').prependTo('#userbar'); userbar_sessions_link.hover(function () { userbar_message_el.stop().fadeTo('normal', .5); diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index b5ca060a..5e0906ae 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -3293,7 +3293,7 @@ body.outfits-edit #save-error, body.outfits-edit #outfit-not-found { color: #8a1f11; } /* line 740, ../../../app/stylesheets/outfits/_edit.sass */ -body.outfits-edit #userbar-message { +body.outfits-edit #userbar-session-message { -moz-opacity: 0.5; -webkit-opacity: 0.5; -o-opacity: 0.5; From 3d8266951f48cb32cc1d11bce3fee5d0d0f12a66 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 7 Jan 2013 18:55:36 -0600 Subject: [PATCH 28/66] i18n for outfits/edit.js item partials: no-data-yet and icons --- app/views/outfits/edit.html.haml | 20 +++++++++++++ config/locales/en-meep.yml | 1 + config/locales/en.yml | 1 + public/javascripts/outfits/edit.js | 45 ++++++++---------------------- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml index 7a832842..acbfaad1 100644 --- a/app/views/outfits/edit.html.haml +++ b/app/views/outfits/edit.html.haml @@ -151,6 +151,26 @@ %a.outfit-delete-confirmation-no{:href => '#'} = t '.sidebar.outfits.outfit.delete_confirmation.cancel' + %script#item-template{:type => 'text/x-jquery-tmpl'} + %li{:class => 'object object-${id}'} + %img{:src => '${thumbnail_url}', :title => '${description}', :alt => ''} + ${name} + %ul + = link_to '${url}', :target => '_blank', :class => 'object-info' do + %span i + {{if nc}} + = nc_icon + {{/if}} + {{if owned || wanted}} + .closeted-icons + {{if owned}} + = owned_icon + {{/if}} + {{if wanted}} + = wanted_icon + {{/if}} + {{/if}} + %span.no-assets-message= t '.sidebar.closet.no_data.summary' %span#userbar-session-message - if user_signed_in? diff --git a/config/locales/en-meep.yml b/config/locales/en-meep.yml index b1203972..a98d516a 100644 --- a/config/locales/en-meep.yml +++ b/config/locales/en-meep.yml @@ -486,6 +486,7 @@ en-meep: success: Outfeet successfully meeped closet: no_data: + summary: No meepits yet description: We haven't meeped this item on this body type before. Have you? Meep it for us on the home page if you have! diff --git a/config/locales/en.yml b/config/locales/en.yml index b3e69ca8..3204d6fe 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -487,6 +487,7 @@ en: success: Outfit successfully saved closet: no_data: + summary: No data yet description: We haven't seen this item on this body type before. Have you? Model it for us on the home page if you have! diff --git a/public/javascripts/outfits/edit.js b/public/javascripts/outfits/edit.js index 50d73c4f..58bde75d 100644 --- a/public/javascripts/outfits/edit.js +++ b/public/javascripts/outfits/edit.js @@ -26,7 +26,7 @@ var Partial = {}, main_wardrobe, Partial.ItemSet = function ItemSet(wardrobe, selector) { var item_set = this, ul = $(selector), items = [], setClosetItems, setOutfitItems, setOutfitItemsControls, no_assets_full_message = $('#no-assets-full-message'), - container = $('#container'); + container = $('#container'), item_template = $('#item-template'); Partial.ItemSet.setWardrobe(wardrobe); @@ -59,13 +59,6 @@ Partial.ItemSet = function ItemSet(wardrobe, selector) { item = specific_items[i]; no_assets = item.couldNotLoadAssetsFitting(wardrobe.outfits.getPetType()); li = $('li.object-' + item.id).toggleClass('no-assets', no_assets); - (function (li) { - no_assets_message = li.find('span.no-assets-message'); - no_assets_message.remove(); - if(no_assets) { - $('', {'class': 'no-assets-message', text: 'No data yet'}).appendTo(li); - } - })(li); } } @@ -75,33 +68,17 @@ Partial.ItemSet = function ItemSet(wardrobe, selector) { ul.children().remove(); for(var i = 0; i < items.length; i++) { item = items[i]; - li = $('
  • ', {'class': 'object object-' + item.id}); - img = $('', { - 'src': item.thumbnail_url, - 'alt': item.description, - 'title': item.description + li = item_template.tmpl({ + id: item.id, + name: item.name, + thumbnail_url: item.thumbnail_url, + url: item.getURL(), + nc: typeof item.rarity_index != 'undefined' && + (item.rarity_index == 500 || item.rarity_index == 0), + owned: item.owned, + wanted: item.wanted }); - controls = $('