From 73e0b3bb3cca3cb1fc3d39dd21b1fe8bb4c0260a Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Fri, 20 Sep 2024 18:08:11 -0700 Subject: [PATCH] Remove some silly view template caching calls When I was trying to debug slow view code one time long long ago, I was like "let's cache any part of the template that's static!" And like. no that's silly, I don't trust that this speeds anything up, but it _definitely_ adds complexity. Let's just not. --- app/views/items/index.html.haml | 35 ++++--- .../neopets_page_import_tasks/new.html.haml | 95 +++++++++---------- app/views/outfits/new.html.haml | 33 +++---- app/views/pets/bulk.html.haml | 94 +++++++++--------- 4 files changed, 125 insertions(+), 132 deletions(-) diff --git a/app/views/items/index.html.haml b/app/views/items/index.html.haml index 6021169c1..517049d7c 100644 --- a/app/views/items/index.html.haml +++ b/app/views/items/index.html.haml @@ -9,24 +9,23 @@ = will_paginate @items - else #search-info - - localized_cache :action_suffix => 'search_help' do - #search-help - %h2= t '.search_help_header' - %dl - %dt= t '.examples.basic.query' - %dd= t '.examples.basic.description' - %dt= t '.examples.user_items.query' - %dd - = twl '.examples.user_items.description', - :user_items_link_url => your_items_path - %dt= t '.examples.nc.query' - %dd= t '.examples.nc.description' - %dt= t '.examples.pb.query' - %dd= t '.examples.pb.description' - %dt= t '.examples.species.query' - %dd= t '.examples.species.description' - %dt= t '.examples.type.query' - %dd= t '.examples.type.description' + #search-help + %h2= t '.search_help_header' + %dl + %dt= t '.examples.basic.query' + %dd= t '.examples.basic.description' + %dt= t '.examples.user_items.query' + %dd + = twl '.examples.user_items.description', + :user_items_link_url => your_items_path + %dt= t '.examples.nc.query' + %dd= t '.examples.nc.description' + %dt= t '.examples.pb.query' + %dd= t '.examples.pb.description' + %dt= t '.examples.species.query' + %dd= t '.examples.species.description' + %dt= t '.examples.type.query' + %dd= t '.examples.type.description' #search-new-items %h2= t '.newest_items.header' diff --git a/app/views/neopets_page_import_tasks/new.html.haml b/app/views/neopets_page_import_tasks/new.html.haml index 4695b57db..446391719 100644 --- a/app/views/neopets_page_import_tasks/new.html.haml +++ b/app/views/neopets_page_import_tasks/new.html.haml @@ -16,52 +16,51 @@ = f.select :list_id, neopets_page_list_options(current_user) = f.submit t('.submit') -- localized_cache :action_suffix => 'explanation' do - %p - = t '.help.welcome', :name => @import_task.page.name - = t '.help.intro', :name => @import_task.page.name - - %ol - %li - = twl '.help.check_frame.header', :page_link_url => @import_task.page.url, - :name => @import_task.page.name, :index => @import_task.page.expected_index - %ul - %li - %strong= t '.help.check_frame.check_login.summary' - = t '.help.check_frame.check_login.details' - %li - %strong - = twl '.help.check_frame.login.summary', - :login_link_url => neopets_login_url - = twl '.help.check_frame.login.details', +%p + = t '.help.welcome', :name => @import_task.page.name + = t '.help.intro', :name => @import_task.page.name + +%ol + %li + = twl '.help.check_frame.header', :page_link_url => @import_task.page.url, + :name => @import_task.page.name, :index => @import_task.page.expected_index + %ul + %li + %strong= t '.help.check_frame.check_login.summary' + = t '.help.check_frame.check_login.details' + %li + %strong + = twl '.help.check_frame.login.summary', :login_link_url => neopets_login_url - %li - %strong - = t '.help.check_frame.check_content.summary', - :name => @import_task.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' - %li - = twl '.help.view_source.troubleshooting', - :page_link_url => @import_task.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 => @import_task.page.name + = twl '.help.check_frame.login.details', + :login_link_url => neopets_login_url + %li + %strong + = t '.help.check_frame.check_content.summary', + :name => @import_task.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' + %li + = twl '.help.view_source.troubleshooting', + :page_link_url => @import_task.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 => @import_task.page.name diff --git a/app/views/outfits/new.html.haml b/app/views/outfits/new.html.haml index 697737800..22b9250e4 100644 --- a/app/views/outfits/new.html.haml +++ b/app/views/outfits/new.html.haml @@ -22,12 +22,11 @@ DTI here for a long time to come! #outfit-forms - - localized_cache :action_suffix => 'outfit_forms_intro' do - #pet-preview - = image_tag 'default_preview.png', :alt => '' - %span - %h1= t 'app_name' - %h2= t '.tagline' + #pet-preview + = image_tag 'default_preview.png', :alt => '' + %span + %h1= t 'app_name' + %h2= t '.tagline' = form_tag load_pet_path, method: 'POST', class: 'primary load-pet-to-wardrobe' do = hidden_field_tag 'destination', 'wardrobe' @@ -109,19 +108,17 @@ = image_tag item.thumbnail_url = nc_icon_for(item) +%script#pet-query-notice-template{:type => 'text/x-jquery-tmpl'} + .notice + %img.inline-image{:src => '${pet_image_url}'} + = t '.pet_query.notice_html', :pet_name => '${pet_name}' -- localized_cache :action_suffix => 'templates' do - %script#pet-query-notice-template{:type => 'text/x-jquery-tmpl'} - .notice - %img.inline-image{:src => '${pet_image_url}'} - = t '.pet_query.notice_html', :pet_name => '${pet_name}' - - %script#preview-pet-type-not-found-template{:type => 'text/x-jquery-tmpl'} - = t '.preview.pet_type_not_found', :color_name => '${color_name}', - :species_name => '${species_name}' - - %script#preview-pet-not-found-template{:type => 'text/x-jquery-tmpl'} - = t '.preview.pet_not_found' +%script#preview-pet-type-not-found-template{:type => 'text/x-jquery-tmpl'} + = t '.preview.pet_type_not_found', :color_name => '${color_name}', + :species_name => '${species_name}' + +%script#preview-pet-not-found-template{:type => 'text/x-jquery-tmpl'} + = t '.preview.pet_not_found' - content_for :javascripts do = include_javascript_libraries :jquery, :jquery_tmpl diff --git a/app/views/pets/bulk.html.haml b/app/views/pets/bulk.html.haml index a51322ca8..1d27e3022 100644 --- a/app/views/pets/bulk.html.haml +++ b/app/views/pets/bulk.html.haml @@ -1,57 +1,55 @@ - title t('modeling_hub') = form_tag load_pet_path, :id => 'bulk-pets-form' do - - localized_cache :action_suffix => 'bulk_pets_content' do - %p= t '.explanation' - - = origin_tag bulk_pets_path - - %div.noscript - %input{:name => "name", :type => "text"}/ - %input{:type => "submit", :value => t('.submit')}/ - %div.script-only - %textarea - %button#bulk-pets-form-add{:type => "button"}= t '.add' - %button#bulk-pets-form-clear{:type => "button"}= t '.clear' - %ul + %p= t '.explanation' -- 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 - %img{:src => '${thumbnail_url}', :alt => '${description}', :title => '${description}'} - %span.name ${name} - - {{if nc}} - = nc_icon - {{/if}} - - .closeted-icons - {{if owned}} - = owned_icon - {{/if}} - - {{if wanted}} - = wanted_icon - {{/if}} - + = origin_tag bulk_pets_path + + %div.noscript + %input{:name => "name", :type => "text"}/ + %input{:type => "submit", :value => t('.submit')}/ + %div.script-only + %textarea + %button#bulk-pets-form-add{:type => "button"}= t '.add' + %button#bulk-pets-form-clear{:type => "button"}= t '.clear' + %ul + +%script#item-template{:type => 'text/x-jquery-tmpl'} + %li{:class => 'object{{if owned}} owned{{/if}}'} + = link_to item_path(':id').sub(':id', '${id}') do + %img{:src => '${thumbnail_url}', :alt => '${description}', :title => '${description}'} + %span.name ${name} + + {{if nc}} + = nc_icon + {{/if}} + + .closeted-icons {{if owned}} - %span.object-owned= t '.needed_items.item_owned' + = owned_icon {{/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 => '${pet_thumbnail}'} - %span.name ${pet_name} - %span.waiting-message= t '.waiting' - %span.loading-message= t '.loading' - %span.response - - %script#bulk-pets-submission-success-template{:type => 'text/x-jquery/tmpl'} - = t '.submission_success', :points => '${points}' + + {{if wanted}} + = wanted_icon + {{/if}} + + {{if owned}} + %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 => '${pet_thumbnail}'} + %span.name ${pet_name} + %span.waiting-message= t '.waiting' + %span.loading-message= t '.loading' + %span.response + +%script#bulk-pets-submission-success-template{:type => 'text/x-jquery/tmpl'} + = t '.submission_success', :points => '${points}' - content_for :javascripts do = include_javascript_libraries :jquery, :jquery_tmpl