Skip to content

Commit

Permalink
SVG, switch all to rails_icons gem
Browse files Browse the repository at this point in the history
This patch removes the `inline_svg` gem and moves all custom SVG icons to the
`rails_icons` gem, with the `icon` helper.
  • Loading branch information
thibaudgg committed Dec 15, 2024
1 parent 2934f40 commit f81613f
Show file tree
Hide file tree
Showing 69 changed files with 94 additions and 166 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ gem "cancancan"
gem "acts_as_list"

gem "simple_form"
gem "inline_svg"
gem "slim"

gem "importmap-rails"
Expand Down
10 changes: 3 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ GEM
crass (1.0.6)
css_parser (1.21.0)
addressable
csv (3.3.0)
csv (3.3.1)
date (3.4.1)
date_validator (0.12.0)
activemodel (>= 3)
Expand Down Expand Up @@ -264,9 +264,6 @@ GEM
has_scope (>= 0.6)
railties (>= 7.0)
responders (>= 2)
inline_svg (1.10.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.8.0)
io-endpoint (0.14.0)
io-event (1.7.4)
Expand Down Expand Up @@ -512,7 +509,7 @@ GEM
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.3.9)
rexml (3.4.0)
rqrcode (2.2.0)
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
Expand Down Expand Up @@ -595,7 +592,7 @@ GEM
fugit (~> 1.11.0)
railties (>= 7.1)
thor (~> 1.3.1)
sorbet-runtime (0.5.11691)
sorbet-runtime (0.5.11694)
sqlite3 (2.4.1)
mini_portile2 (~> 2.8.0)
sqlite3 (2.4.1-arm64-darwin)
Expand Down Expand Up @@ -686,7 +683,6 @@ DEPENDENCIES
icalendar
image_processing
importmap-rails
inline_svg
kramdown
launchy
letter_opener
Expand Down
24 changes: 6 additions & 18 deletions app/admin/delivery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,9 @@
column :shop, ->(delivery) { status_tag(delivery.shop_configured_open?) }, class: "text-right"
end
actions do |delivery|
div do
link_to baskets_path(q: { delivery_id_eq: delivery.id }, format: :csv), title: "CSV" do
inline_svg_tag "admin/csv_file.svg", class: "w-5 h-5"
end
end
div do
link_to delivery_path(delivery, format: :xlsx), title: "XLSX" do
inline_svg_tag "admin/xlsx_file.svg", class: "w-5 h-5"
end
end
div do
link_to delivery_path(delivery, format: :pdf), target: "_blank", title: "PDF" do
inline_svg_tag "admin/pdf_file.svg", class: "w-5 h-5"
end
end
icon_file_link(:csv, baskets_path(q: { delivery_id_eq: delivery.id }, format: :csv), title: Delivery.human_attribute_name(:summary), size: 5) +
icon_file_link(:xlsx, delivery_path(delivery, format: :xlsx), title: Delivery.human_attribute_name(:summary), size: 5) +
icon_file_link(:pdf, delivery_path(delivery, format: :pdf), target: "_blank", title: Delivery.human_attribute_name(:sheets), size: 5)
end
end

Expand Down Expand Up @@ -84,9 +72,9 @@
columns do
column do
panel Basket.model_name.human(count: 2), action: (
icon_link(:csv_file, Delivery.human_attribute_name(:summary), baskets_path(q: { delivery_id_eq: delivery.id }, format: :csv)) +
icon_link(:xlsx_file, Delivery.human_attribute_name(:summary), delivery_path(delivery, format: :xlsx)) +
icon_link(:pdf_file, Delivery.human_attribute_name(:sheets), delivery_path(delivery, format: :pdf), target: "_blank")
icon_file_link(:csv, baskets_path(q: { delivery_id_eq: delivery.id }, format: :csv), title: Delivery.human_attribute_name(:summary)) +
icon_file_link(:xlsx, delivery_path(delivery, format: :xlsx), title: Delivery.human_attribute_name(:summary)) +
icon_file_link(:pdf, delivery_path(delivery, format: :pdf), target: "_blank", title: Delivery.human_attribute_name(:sheets))
) do
counts = delivery.basket_counts
if counts.present?
Expand Down
4 changes: 2 additions & 2 deletions app/admin/depot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
column do
if next_delivery = depot.next_delivery
panel t("active_admin.page.index.next_delivery", delivery: link_to(next_delivery.display_name(format: :long), next_delivery)).html_safe, action: (
icon_link(:xlsx_file, Delivery.human_attribute_name(:summary), delivery_path(next_delivery, format: :xlsx, depot_id: depot.id)) +
icon_link(:pdf_file, Delivery.human_attribute_name(:sheets), delivery_path(next_delivery, format: :pdf, depot_id: depot.id), target: "_blank")
icon_file_link(:xlsx, delivery_path(next_delivery, format: :xlsx, depot_id: depot.id), title: Delivery.human_attribute_name(:summary)) +
icon_file_link(:pdf, delivery_path(next_delivery, format: :pdf, depot_id: depot.id), target: "_blank", title: Delivery.human_attribute_name(:sheets))
) do
attrs = {}
if authorized?(:update, depot) && depot.delivery_sheets_mode == "home_delivery"
Expand Down
4 changes: 2 additions & 2 deletions app/admin/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
end
end
unless invoice.processing?
panel "PDF", action: icon_link(:pdf_file, "PDF", pdf_invoice_path(invoice), target: "_blank") do
panel "PDF", action: icon_file_link(:pdf, pdf_invoice_path(invoice), target: "_blank") do
div class: "p-2" do
link_to_invoice_pdf(invoice) do
image_tag invoice.pdf_file.preview(resize_to_limit: [ 2000, 2000 ]), class: "w-full"
Expand Down Expand Up @@ -259,7 +259,7 @@

action_item :pdf, only: :show, if: -> { !resource.processing? } do
link_to_invoice_pdf(resource, class: "action-item-button") do
"PDF"
icon "file-pdf", class: "h-5 w-5", library: "own"
end
end

Expand Down
8 changes: 2 additions & 6 deletions app/admin/shop/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,13 @@
action_item :delivery_pdf, only: :index, if: -> { params.dig(:q, :_delivery_gid_eq).present? } do
delivery_gid = params.dig(:q, :_delivery_gid_eq)
depot_id = params.dig(:q, :depot_id_eq)
link_to delivery_shop_orders_path(delivery_gid: delivery_gid, depot_id: depot_id, format: :pdf), class: "action-item-button", target: "_blank", title: t(".delivery_orders_pdf") do
inline_svg_tag "admin/pdf_file.svg", class: "w-5 h-5"
end
icon_file_link :pdf, delivery_shop_orders_path(delivery_gid: delivery_gid, depot_id: depot_id, format: :pdf), size: 5, class: "action-item-button", target: "_blank", title: t(".delivery_orders_pdf")
end

action_item :delivery_xlsx, only: :index, if: -> { params.dig(:q, :_delivery_gid_eq).present? } do
delivery_gid = params.dig(:q, :_delivery_gid_eq)
depot_id = params.dig(:q, :depot_id_eq)
link_to delivery_shop_orders_path(delivery_gid: delivery_gid, depot_id: depot_id, format: :xlsx), class: "action-item-button", target: "_blank", title: "XLSX" do
inline_svg_tag "admin/xlsx_file.svg", class: "w-5 h-5"
end
icon_file_link :xlsx, delivery_shop_orders_path(delivery_gid: delivery_gid, depot_id: depot_id, format: :xlsx), size: 5, class: "action-item-button", target: "_blank"
end

batch_action :invoice, if: ->(attr) { params[:scope].in?([ nil, "pending" ]) }, confirm: true do |selection|
Expand Down
14 changes: 3 additions & 11 deletions app/admin/shop/special_delivery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,8 @@
q: { _delivery_gid_eq: d.gid }, scope: :all_without_cart))
}, sortable: false, class: "text-right"
actions do |delivery|
div do
link_to shop_special_delivery_path(delivery, format: :xlsx), title: "XLSX" do
inline_svg_tag "admin/xlsx_file.svg", class: "h-5 w-5"
end
end
div do
link_to delivery_shop_orders_path(delivery_gid: delivery.gid, format: :pdf), title: "PDF", target: "_blank" do
inline_svg_tag "admin/pdf_file.svg", class: "h-5 w-5"
end
end
icon_file_link(:xlsx, shop_special_delivery_path(delivery, format: :xlsx), size: 5) +
icon_file_link(:pdf, delivery_shop_orders_path(delivery_gid: delivery.gid, format: :pdf), target: "_blank", size: 5)
end
end

Expand All @@ -83,7 +75,7 @@
end
else
all.each do |producer, items|
panel producer.name, action: icon_link(:xlsx_file, "XLSX", shop_special_delivery_path(delivery, format: :xlsx, producer_id: producer.id)) do
panel producer.name, action: icon_file_link(:xlsx, shop_special_delivery_path(delivery, format: :xlsx, producer_id: producer.id)) do
table_for items, i18n: Shop::OrderItem, class: "table-auto data-table-total" do
column(:product) { |i| auto_link i.product }
column(:product_variant) { |i| i.product_variant }
Expand Down
3 changes: 0 additions & 3 deletions app/assets/images/admin/clipboard-check.svg

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/images/admin/clipboard.svg

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/images/admin/external-link.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/logo.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/basket.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/calendar.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/cash.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/chevron_right.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/close.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/document_download.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/globe.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/hand.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/identification.svg

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/images/members/information.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/link.svg

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/images/members/mail.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/map.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/menu.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/minus.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/notice.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/participant.svg

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/images/members/pencil_square.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/phone.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/plus.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/scale.svg

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/images/members/shopping_cart.svg
Diff not rendered.
1 change: 0 additions & 1 deletion app/assets/images/members/sign_out.svg
Diff not rendered.
1 change: 0 additions & 1 deletion app/assets/images/members/trash.svg
Diff not rendered.
1 change: 0 additions & 1 deletion app/assets/images/members/truck.svg
Diff not rendered.
1 change: 0 additions & 1 deletion app/assets/images/members/user_circle.svg
Diff not rendered.
Loading

0 comments on commit f81613f

Please sign in to comment.