From 75418339dada40fdfd783ef55ce26a86f815790e Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Wed, 13 Mar 2024 17:46:45 -0700 Subject: [PATCH] Add DTI 2020 link to item pages Someone requested this in Discord, and I figured why not! I'm still planning to move stuff away from Impress 2020 over time, I just figure may as well have them more linked while this is still The Reality --- app/helpers/items_helper.rb | 9 +++++++++ app/views/items/_item_header.html.haml | 1 + config/locales/en.yml | 1 + 3 files changed, 11 insertions(+) diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index ce6fc719..9449fad6 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -1,3 +1,5 @@ +require "addressable/template" + module ItemsHelper JNItemsURLFormat = 'https://items.jellyneo.net/search/?name=%s&name_type=3' @@ -75,6 +77,13 @@ module ItemsHelper def jn_items_url_for(item) sprintf(JNItemsURLFormat, CGI::escape(item.name)) end + + IMPRESS_2020_ITEM_URL_TEMPLATE = Addressable::Template.new( + "#{Rails.configuration.impress_2020_origin}/items/{id}" + ) + def impress_2020_url_for(item) + IMPRESS_2020_ITEM_URL_TEMPLATE.expand(id: item.id).to_s + end def shop_wizard_url_for(item) "https://www.neopets.com/market.phtml?type=wizard&string=#{CGI::escape item.name}" diff --git a/app/views/items/_item_header.html.haml b/app/views/items/_item_header.html.haml index eddc2e0c..7d1fe303 100644 --- a/app/views/items/_item_header.html.haml +++ b/app/views/items/_item_header.html.haml @@ -26,6 +26,7 @@ }= time_with_only_month_if_old item.created_at = link_to t('items.show.resources.jn_items'), jn_items_url_for(item) + = link_to t('items.show.resources.impress_2020'), impress_2020_url_for(item) - if item.nc_trade_value = link_to t('items.show.resources.owls', value: item.nc_trade_value.value_text), "https://www.neopets.com/~owls", diff --git a/config/locales/en.yml b/config/locales/en.yml index acc364ac..4680c527 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -309,6 +309,7 @@ en: description: Only obtainable via paintbrush resources: jn_items: JN Items + impress_2020: DTI 2020 owls: "Owls: %{value}" shop_wizard: Shop Wizard super_shop_wizard: Super Wizard