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