From 8440a28898b02fbf5e94c79cf9e12572ed631f56 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 21 May 2024 18:12:40 -0700 Subject: [PATCH] Add cart icon to Item Getting Guide's "Buy" buttons for NC Mall --- app/assets/stylesheets/_layout.sass | 2 +- app/helpers/application_helper.rb | 8 ++++++++ app/views/items/sources.html.haml | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/_layout.sass b/app/assets/stylesheets/_layout.sass index 173d1916..2cb57740 100644 --- a/app/assets/stylesheets/_layout.sass +++ b/app/assets/stylesheets/_layout.sass @@ -101,7 +101,7 @@ a.button, input[type=submit], button &.loud +loud-awesome-button .icon - margin-right: .375em + margin-right: .25em vertical-align: middle ul.buttons diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4fa2b261..01cd3d9c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -25,6 +25,7 @@ module ApplicationHelper klass = options.fetch(:class, "") + " button" link_to url, class: klass, **options do concat icon + concat " " concat content end end @@ -77,6 +78,13 @@ module ApplicationHelper end end + # SVG icon source from Font Awesome 6! (https://creativecommons.org/licenses/by/4.0/) + CART_ICON_SVG_SOURCE = ''.html_safe + def cart_icon(alt: "Cart") + content_tag :svg, CART_ICON_SVG_SOURCE, alt:, class: "icon", + viewBox: "0 0 576 512", style: "height: 1em" + end + def contact_email "matchu@openneo.net" end diff --git a/app/views/items/sources.html.haml b/app/views/items/sources.html.haml index c82826b1..73bf2ed7 100644 --- a/app/views/items/sources.html.haml +++ b/app/views/items/sources.html.haml @@ -20,6 +20,7 @@ %td.actions-cell %button{onclick: "alert('Todo!')"} + = cart_icon alt: "" Buy all in NC Mall %tbody - @nc_mall_items.each do |item| @@ -28,6 +29,7 @@ %td= item.name %td.actions-cell %button{onclick: "alert('Todo!')"} + = cart_icon alt: "" Buy (#{item.current_nc_price} NC) - if @np_items.present?