diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index 9f78e085..26f6a7d4 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -47,7 +47,7 @@ class OutfitsController < ApplicationController end unless localized_fragment_exist?('outfits#new newest_items') - newest_items = Item.newest.select([:id, :thumbnail_url, :rarity_index]). + newest_items = Item.newest.select([:id, :updated_at, :thumbnail_url, :rarity_index]). includes(:translations).limit(18) @newest_modeled_items, @newest_unmodeled_items = newest_items.partition(&:predicted_fully_modeled?) diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index 13a3bb6b..77834ce2 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -55,12 +55,14 @@ module OutfitsHelper end def render_predicted_missing_species_by_color(species_by_color) + # Transform the Color => Array map into an Array>>. # TODO: i18n standard = species_by_color.delete(:standard) sorted_pairs = species_by_color.to_a.map { |k, v| [k.human_name, v] }. sort_by { |k, v| k } sorted_pairs.unshift(['', standard]) if standard - species_by_color[:standard] = standard # undo mutation + species_by_color[:standard] = standard # undo parameter mutation first = true contents = sorted_pairs.map { |color_human_name, species| diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 6ae99fed..498385a5 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -74,28 +74,28 @@ #whats-new -# TODO: remove newest_items.header i18n key? - - localized_cache 'outfits#new newest_items' do - - if @newest_unmodeled_items.present? - %h3 We need your help! Can you model these items? - %ul#newest-unmodeled-items - - @newest_unmodeled_items.each do |item| + -# TODO: i18n all the things + -# TODO: cache this entire block? or just request newest items every time? + - if @newest_unmodeled_items.present? + %h3 We need your help! Can you model these items? + %ul#newest-unmodeled-items + - @newest_unmodeled_items.each do |item| + - localized_cache "items/#{item.id} modeling_progress updated_at=#{item.updated_at.to_i}" do %li = link_to image_tag(item.thumbnail_url), item, :class => 'image-link' = link_to item, :class => 'header' do - -# TODO: i18n %h2= item.name - -#: we need #{lolremove} more models %span.meter{style: "width: #{@newest_unmodeled_items_predicted_modeled_ratio[item]*100}%"} .missing-bodies = render_predicted_missing_species_by_color(@newest_unmodeled_items_predicted_missing_species_by_color[item]) - - if @newest_modeled_items.present? - %h3 These items have already been modeled—thanks for your help! - %ul#newest-modeled-items - - @newest_modeled_items.each do |item| - %li.object - = link_to item, title: item.name, alt: item.name do - = image_tag item.thumbnail_url - = nc_icon_for(item) + - if @newest_modeled_items.present? + %h3 These items have already been modeled—thanks for your help! + %ul#newest-modeled-items + - @newest_modeled_items.each do |item| + %li.object + = link_to item, title: item.name, alt: item.name do + = image_tag item.thumbnail_url + = nc_icon_for(item) - localized_cache :action_suffix => 'templates' do