1
0
Fork 0
forked from OpenNeo/impress

i18n for closet_hangers#index, closet_lists#edit, closet_lists#new, and maybe some more closet-related things - this was a biggie

This commit is contained in:
Emi Matchu 2013-01-01 21:42:58 -05:00
parent 50c9ad26e2
commit 0731c7093c
13 changed files with 337 additions and 134 deletions

View file

@ -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)
@ -72,6 +64,12 @@ module ClosetHangersHelper
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'}"
end
@ -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

View file

@ -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)

View file

@ -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
)
]

View file

@ -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')

View file

@ -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
<span class="edit-contact-link">meep your Neopets username</span> 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})}

View file

@ -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
<span class="edit-contact-link">add your Neopets username</span> 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})}

View file

@ -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
= f.submit t('.neopets_username.submit')
%span#cancel-contact-link= t('.neopets_username.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.
= render :partial => 'help', :locals => {:user => @user}
**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
<span class="edit-contact-link">add your Neopets username</span> 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})}
- unless public_perspective?
#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'

View file

@ -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')

View file

@ -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&hellip;'.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')

View file

@ -1,3 +1,3 @@
- title "Editing list \"#{@closet_list.name}\""
- title t('.title', :list_name => @closet_list.name)
= render 'form'

View file

@ -1,3 +1,3 @@
- title 'Create an items list'
- title t('.title')
= render 'form'

View file

@ -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 _<em>support</em>_ **<strong>Meepdown</strong>** and some HTML.
submit: Meep list
groups:
owned_by:
you: Meeps you own
@ -58,6 +148,11 @@ en-meep:
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:
item_suffix: for the first meep

View file

@ -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 _<em>support</em>_ **<strong>Markdown</strong>** and some HTML.
submit: Save list
groups:
owned_by:
you: Items you own
@ -59,6 +149,10 @@ en:
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: