1
0
Fork 0
forked from OpenNeo/impress

Link to the NC Mall homepage from the Shopping List

We were previously planning a more interesting "Add to Cart"
integration with TNT, but it hasn't panned out! For now, we'll just
link to the NC Mall homepage.
This commit is contained in:
Emi Matchu 2024-07-09 13:30:28 -07:00
parent 81c6a4a023
commit a007479f99
2 changed files with 24 additions and 12 deletions

View file

@ -21,12 +21,24 @@ module ApplicationHelper
end end
end end
def button_link_to(content, url, icon: nil, **options) def button_link_to(content_or_url, url = nil, icon: nil, **options)
if url.present?
content = content_or_url
url = url
else
content = nil
url = content_or_url
end
klass = options.fetch(:class, "") + " button" klass = options.fetch(:class, "") + " button"
link_to url, class: klass, **options do link_to url, class: klass, **options do
concat icon concat icon
concat " " concat " "
concat content if block_given?
yield
else
concat content
end
end end
end end

View file

@ -27,16 +27,16 @@
%td.actions-cell %td.actions-cell
- if @items_needed[:nc_mall].present? - if @items_needed[:nc_mall].present?
%button{ = button_link_to "https://ncmall.neopets.com/",
onclick: "alert('Todo!')", target: "_blank",
data: {"action-kind": "bulk-nc-mall"}, data: {"action-kind": "bulk-nc-mall"} do
}
= cart_icon alt: "" = cart_icon alt: ""
Buy all in NC Mall Buy all in NC Mall
%tbody %tbody
- @items[:nc_mall].each do |item| - @items[:nc_mall].each do |item|
= render "item_list_row", item: do = render "item_list_row", item: do
%button{onclick: "alert('Todo!')"} = button_link_to "https://ncmall.neopets.com/",
target: "_blank" do
= cart_icon alt: "" = cart_icon alt: ""
Buy (#{item.current_nc_price} NC) Buy (#{item.current_nc_price} NC)
@ -74,10 +74,9 @@
(~#{dyeworks_estimated_potions_cost_for @items_needed[:dyeworks]} NC) (~#{dyeworks_estimated_potions_cost_for @items_needed[:dyeworks]} NC)
%td.actions-cell %td.actions-cell
- if @items_needed[:dyeworks].present? - if @items_needed[:dyeworks].present?
%button{ = button_link_to "https://ncmall.neopets.com/",
onclick: "alert('Todo!')", target: "_blank",
data: {"action-kind": "bulk-nc-mall"}, data: {"action-kind": "bulk-nc-mall"} do
}
= cart_icon alt: "" = cart_icon alt: ""
Buy all in NC Mall Buy all in NC Mall
%tbody %tbody
@ -112,7 +111,8 @@
} }
(Limited-time) (Limited-time)
%button{onclick: "alert('Todo!')"} = button_link_to "https://ncmall.neopets.com/",
target: "_blank" do
= cart_icon alt: "" = cart_icon alt: ""
Buy base (#{item.dyeworks_base_item.current_nc_price} NC) Buy base (#{item.dyeworks_base_item.current_nc_price} NC)