diff --git a/app/views/kaminari/alchemy/_first_page.html.erb b/app/views/kaminari/alchemy/_first_page.html.erb
index 9658b3a2c2..f0e885657e 100644
--- a/app/views/kaminari/alchemy/_first_page.html.erb
+++ b/app/views/kaminari/alchemy/_first_page.html.erb
@@ -8,10 +8,10 @@
-%>
<% if current_page.first? %>
-
+ <%= render_icon("skip-left") %>
<% else %>
<%= link_to url, remote: remote, title: Alchemy.t(:first, scope: 'pagination'), class: 'first-page' do %>
-
+ <%= render_icon("skip-left") %>
<% end %>
<% end %>
diff --git a/app/views/kaminari/alchemy/_gap.html.erb b/app/views/kaminari/alchemy/_gap.html.erb
index 21acd0eb05..20eb962db8 100644
--- a/app/views/kaminari/alchemy/_gap.html.erb
+++ b/app/views/kaminari/alchemy/_gap.html.erb
@@ -5,4 +5,4 @@
per_page: number of items to fetch per page
remote: data-remote
-%>
-
+<%= render_icon(:more) %>
diff --git a/app/views/kaminari/alchemy/_last_page.html.erb b/app/views/kaminari/alchemy/_last_page.html.erb
index a934604e66..77df7f3032 100644
--- a/app/views/kaminari/alchemy/_last_page.html.erb
+++ b/app/views/kaminari/alchemy/_last_page.html.erb
@@ -8,10 +8,10 @@
-%>
<% if current_page.last? %>
-
+ <%= render_icon("skip-right") %>
<% else %>
<%= link_to url, remote: remote, title: Alchemy.t(:last, scope: 'pagination'), class: 'last-page' do %>
-
+ <%= render_icon("skip-right") %>
<% end %>
<% end %>
diff --git a/app/views/kaminari/alchemy/_next_page.html.erb b/app/views/kaminari/alchemy/_next_page.html.erb
index b0df91ac99..9ae574c5e6 100644
--- a/app/views/kaminari/alchemy/_next_page.html.erb
+++ b/app/views/kaminari/alchemy/_next_page.html.erb
@@ -8,10 +8,10 @@
-%>
<% if current_page.last? -%>
-
+ <%= render_icon("arrow-right-s") %>
<% else -%>
<%= link_to url, rel: 'next', remote: remote, title: Alchemy.t(:next_page, scope: 'pagination'), class: 'next_page' do %>
-
+ <%= render_icon("arrow-right-s") %>
<% end %>
<% end -%>
diff --git a/app/views/kaminari/alchemy/_prev_page.html.erb b/app/views/kaminari/alchemy/_prev_page.html.erb
index ac0896b0c0..27ac428d58 100644
--- a/app/views/kaminari/alchemy/_prev_page.html.erb
+++ b/app/views/kaminari/alchemy/_prev_page.html.erb
@@ -8,10 +8,10 @@
-%>
<% if current_page.first? -%>
-
+ <%= render_icon("arrow-left-s") %>
<% else -%>
<%= link_to url, rel: 'prev', remote: remote, class: 'previous_page', title: Alchemy.t(:previous_page, scope: 'pagination') do %>
-
+ <%= render_icon("arrow-left-s") %>
<% end %>
<% end -%>
diff --git a/app/views/layouts/alchemy/admin.html.erb b/app/views/layouts/alchemy/admin.html.erb
index 29fc1bdaad..5c724600b4 100644
--- a/app/views/layouts/alchemy/admin.html.erb
+++ b/app/views/layouts/alchemy/admin.html.erb
@@ -7,6 +7,7 @@
<%= csrf_meta_tag %>
+ ">
<%= stylesheet_link_tag('alchemy/admin/all', media: 'screen', 'data-turbo-track' => true) %>
<%= stylesheet_link_tag('alchemy/print', media: 'print', 'data-turbo-track' => true) %>
<%= yield :stylesheets %>
@@ -55,7 +56,7 @@
}, {'data-alchemy-hotkey' => 'alt+q'}) %>
<% else %>
<%= link_to(alchemy.root_path) do %>
-
+ <%= render_icon "logout-box-r", size: "lg" %>
<% end %>
<% end %>
diff --git a/lib/alchemy/engine.rb b/lib/alchemy/engine.rb
index 4eee85296a..6a131e06a1 100644
--- a/lib/alchemy/engine.rb
+++ b/lib/alchemy/engine.rb
@@ -47,8 +47,8 @@ class Engine < Rails::Engine
initializer "alchemy.ransack" do
Ransack.configure do |config|
config.custom_arrows = {
- up_arrow: '',
- down_arrow: ''
+ up_arrow: '',
+ down_arrow: ''
}
end
end
diff --git a/lib/alchemy/test_support/capybara_helpers.rb b/lib/alchemy/test_support/capybara_helpers.rb
index 4ccdd4c5d1..7e56167d39 100644
--- a/lib/alchemy/test_support/capybara_helpers.rb
+++ b/lib/alchemy/test_support/capybara_helpers.rb
@@ -54,6 +54,10 @@ def click_link_with_tooltip(content)
find(%([content="#{content}"] > a)).click
end
+ def click_icon(name)
+ find(%(alchemy-icon[name="#{name}"])).click
+ end
+
private
def within_entire_page(&block)
diff --git a/spec/components/alchemy/admin/icon_spec.rb b/spec/components/alchemy/admin/icon_spec.rb
new file mode 100644
index 0000000000..ad228e2cbd
--- /dev/null
+++ b/spec/components/alchemy/admin/icon_spec.rb
@@ -0,0 +1,159 @@
+require "rails_helper"
+
+RSpec.describe Alchemy::Admin::Icon, type: :component do
+ before do
+ render
+ end
+
+ subject(:render) do
+ render_inline described_class.new(name)
+ end
+
+ let(:name) { "info" }
+
+ it "renders an alchemy-icon with given icon name" do
+ expect(page).to have_css 'alchemy-icon[name="information"]'
+ end
+
+ context "with style" do
+ subject(:render) do
+ render_inline described_class.new(name, style: style)
+ end
+
+ context "set to fill" do
+ let(:style) { "fill" }
+
+ it "renders an alchemy-icon with style set to fill" do
+ expect(page).to have_css 'alchemy-icon[name="information"][icon-style="fill"]'
+ end
+ end
+
+ context "set to solid" do
+ let(:style) { "solid" }
+
+ it "renders an alchemy-icon with style set to fill" do
+ expect(page).to have_css 'alchemy-icon[name="information"][icon-style="fill"]'
+ end
+ end
+
+ context "set to regular" do
+ let(:style) { "regular" }
+
+ it "renders an alchemy-icon with style set to line" do
+ expect(page).to have_css 'alchemy-icon[name="information"][icon-style="line"]'
+ end
+ end
+
+ context "set to m" do
+ let(:style) { "m" }
+
+ it "renders an alchemy-icon with style set to m" do
+ expect(page).to have_css 'alchemy-icon[name="information"][icon-style="m"]'
+ end
+ end
+
+ context "set to false" do
+ let(:style) { false }
+
+ it "renders an alchemy-icon with style set to none" do
+ expect(page).to have_css 'alchemy-icon[name="information"][icon-style="none"]'
+ end
+ end
+ end
+
+ context "with size set" do
+ subject(:render) do
+ render_inline described_class.new(name, size: "1x")
+ end
+
+ it "renders an alchemy-icon with size set" do
+ expect(page).to have_css 'alchemy-icon[name="information"][size="1x"]'
+ end
+ end
+
+ context "with class option given" do
+ subject(:render) do
+ render_inline described_class.new(name, class: "disabled")
+ end
+
+ it "renders a remix icon with additional css class" do
+ expect(page).to have_css "alchemy-icon.disabled"
+ end
+ end
+
+ describe "#ri_icon" do
+ subject { described_class.new(icon_name).send(:ri_icon) }
+
+ context "when `minus`, `remove` or `delete` icon name is given" do
+ %w[minus remove delete].each do |type|
+ let(:icon_name) { type }
+
+ it { is_expected.to eq "delete-bin-2" }
+ end
+ end
+
+ context "when `plus` icon name is given" do
+ let(:icon_name) { "plus" }
+
+ it { is_expected.to eq "add" }
+ end
+
+ context "when `copy` icon name is given" do
+ let(:icon_name) { "copy" }
+
+ it { is_expected.to eq "file-copy" }
+ end
+
+ context "when `download` icon name is given" do
+ let(:icon_name) { "download" }
+
+ it { is_expected.to eq "download-2" }
+ end
+
+ context "when `upload` icon name is given" do
+ let(:icon_name) { "upload" }
+
+ it { is_expected.to eq "upload-2" }
+ end
+
+ context "when `exclamation` icon name is given" do
+ let(:icon_name) { "exclamation" }
+
+ it { is_expected.to eq "alert" }
+ end
+
+ context "when `info` or `info-circle` icon name is given" do
+ %w[info info-circle].each do |type|
+ let(:icon_name) { type }
+
+ it { is_expected.to eq "information" }
+ end
+ end
+
+ context "when `times` icon name is given" do
+ let(:icon_name) { "times" }
+
+ it { is_expected.to eq "close" }
+ end
+
+ context "when `tag` icon name is given" do
+ let(:icon_name) { "tag" }
+
+ it { is_expected.to eq "price-tag-3" }
+ end
+
+ context "when `cog` icon name is given" do
+ let(:icon_name) { "cog" }
+
+ it { is_expected.to eq "settings-3" }
+ end
+
+ context "when unknown icon name is given" do
+ let(:icon_name) { "foo" }
+
+ it "returns the given icon name" do
+ is_expected.to eq "foo"
+ end
+ end
+ end
+end
diff --git a/spec/dummy/config/alchemy/elements.yml b/spec/dummy/config/alchemy/elements.yml
index 727e44c509..1418d88132 100644
--- a/spec/dummy/config/alchemy/elements.yml
+++ b/spec/dummy/config/alchemy/elements.yml
@@ -3,6 +3,8 @@
ingredients:
- role: image
type: Picture
+ settings:
+ linkable: false
- name: headline
ingredients:
diff --git a/spec/features/admin/edit_elements_feature_spec.rb b/spec/features/admin/edit_elements_feature_spec.rb
index 6006048871..cfe54a5825 100644
--- a/spec/features/admin/edit_elements_feature_spec.rb
+++ b/spec/features/admin/edit_elements_feature_spec.rb
@@ -135,7 +135,7 @@
scenario "is possible to copy element into clipboard" do
visit alchemy.admin_elements_path(page_version_id: element.page_version_id)
expect(page).to have_selector(".element-toolbar")
- find(".ri-file-copy-line").click
+ click_icon("file-copy")
within "#flash_notices" do
expect(page).to have_content(/Copied Article/)
end
diff --git a/spec/features/admin/page_editing_feature_spec.rb b/spec/features/admin/page_editing_feature_spec.rb
index 0d72de45e7..0c0285bebb 100644
--- a/spec/features/admin/page_editing_feature_spec.rb
+++ b/spec/features/admin/page_editing_feature_spec.rb
@@ -218,7 +218,9 @@
before do
visit alchemy.admin_pages_path
- find(".sitemap_page[name='#{a_page.name}'] .icon.ri-settings-3-line").click
+ within ".sitemap_page[name='#{a_page.name}']" do
+ click_icon("settings-3")
+ end
expect(page).to have_selector(".alchemy-dialog-overlay.open")
end
diff --git a/spec/features/admin/resources_integration_spec.rb b/spec/features/admin/resources_integration_spec.rb
index 77df05c42e..4ec5dd8785 100644
--- a/spec/features/admin/resources_integration_spec.rb
+++ b/spec/features/admin/resources_integration_spec.rb
@@ -11,7 +11,7 @@
describe "index view" do
it "should have a button for creating a new resource items" do
visit "/admin/events"
- expect(page).to have_selector("#toolbar sl-tooltip a.icon_button .icon.ri-add-line")
+ expect(page).to have_selector('#toolbar sl-tooltip a.icon_button alchemy-icon[name="add"]')
end
it "should list existing items" do
diff --git a/spec/helpers/alchemy/admin/base_helper_spec.rb b/spec/helpers/alchemy/admin/base_helper_spec.rb
index 51fecba78c..9b743091d4 100644
--- a/spec/helpers/alchemy/admin/base_helper_spec.rb
+++ b/spec/helpers/alchemy/admin/base_helper_spec.rb
@@ -259,14 +259,14 @@ module Alchemy
subject { helper.hint_with_tooltip("My hint") }
it "renders a warning icon with hint text wrapped in tooltip" do
- is_expected.to have_css "sl-tooltip.like-hint-tooltip[content='My hint'] i.ri-alert-line"
+ is_expected.to have_css 'sl-tooltip.like-hint-tooltip[content="My hint"] alchemy-icon[name="alert"]'
end
context "with icon set to info" do
subject { helper.hint_with_tooltip("My hint", icon: "info") }
it "renders an info icon instead" do
- is_expected.to have_css "i.ri-information-line"
+ is_expected.to have_css 'alchemy-icon[name="information"]'
end
end
end
diff --git a/spec/helpers/alchemy/admin/navigation_helper_spec.rb b/spec/helpers/alchemy/admin/navigation_helper_spec.rb
index e4733b15fe..a42fd15eb5 100644
--- a/spec/helpers/alchemy/admin/navigation_helper_spec.rb
+++ b/spec/helpers/alchemy/admin/navigation_helper_spec.rb
@@ -75,6 +75,7 @@
describe "#alchemy_main_navigation_entry" do
before do
allow(helper).to receive(:url_for_module).and_return("")
+ allow(helper).to receive(:render_icon).and_return("")
allow(Alchemy).to receive(:t).and_return(alchemy_module["name"])
end
diff --git a/spec/helpers/alchemy/base_helper_spec.rb b/spec/helpers/alchemy/base_helper_spec.rb
index 3f185909f9..db9db94884 100644
--- a/spec/helpers/alchemy/base_helper_spec.rb
+++ b/spec/helpers/alchemy/base_helper_spec.rb
@@ -9,71 +9,15 @@ module Alchemy
let(:options) { {} }
- it "renders a remix icon with fixed width and line style" do
- is_expected.to have_css "i.icon.ri-information-line.ri-fw"
+ it "renders an alchemy-icon with line style" do
+ is_expected.to have_css 'alchemy-icon[name="information"][icon-style="line"]'
end
- context "with style set to fill" do
- let(:options) { {style: "fill"} }
+ context "with options" do
+ let(:options) { {style: "fill", size: "xl"} }
- it "renders a filled remix icon" do
- is_expected.to have_css 'i[class*="-fill"]'
- end
- end
-
- context "with style set to solid" do
- let(:options) { {style: "solid"} }
-
- it "renders a filled remix icon" do
- is_expected.to have_css 'i[class*="-fill"]'
- end
- end
-
- context "with style set to regular" do
- let(:options) { {style: "regular"} }
-
- it "renders a line remix icon" do
- is_expected.to have_css 'i[class*="-line"]'
- end
- end
-
- context "with style set to m" do
- let(:options) { {style: "m"} }
-
- it "renders a line remix icon" do
- is_expected.to have_css 'i[class*="-m"]'
- end
- end
-
- context "with fixed_width set to false" do
- let(:options) { {fixed_width: false} }
-
- it "renders a default width remix icon" do
- is_expected.to have_css "i.icon.ri-information-line"
- end
- end
-
- context "with style set to nil" do
- let(:options) { {style: nil} }
-
- it "renders a remix icon without style" do
- is_expected.to have_css "i.icon.ri-information.ri-fw"
- end
- end
-
- context "with size set to xs" do
- let(:options) { {size: "xs"} }
-
- it "renders a extra small remix icon" do
- is_expected.to have_css "i.ri-xs"
- end
- end
-
- context "with class option given" do
- let(:options) { {class: "disabled"} }
-
- it "renders a remix icon with additional css class" do
- is_expected.to have_css "i.disabled"
+ it "renders an alchemy-icon with given options" do
+ is_expected.to have_css 'alchemy-icon[name="information"][icon-style="fill"][size="xl"]'
end
end
end
@@ -82,7 +26,7 @@ module Alchemy
context "if no argument is passed" do
it "should render a div with an info icon and the given content" do
expect(helper.render_message { content_tag(:p, "my notice") }).to match(
- /
<\/i>
my notice/
+ /
<\/alchemy-icon>
my notice/
)
end
end
@@ -90,7 +34,7 @@ module Alchemy
context "if an argument is passed" do
it "should render the passed argument as the css classname for the icon container" do
expect(helper.render_message(:error) { content_tag(:p, "my notice") }).to match(
- /
/
+ /
/
)
end
end
@@ -157,81 +101,5 @@ module Alchemy
end
end
end
-
- describe "#ri_icon" do
- subject { helper.send(:ri_icon, icon_name) }
-
- context "when `minus`, `remove` or `delete` icon name is given" do
- %w[minus remove delete].each do |type|
- let(:icon_name) { type }
-
- it { is_expected.to eq "delete-bin-2" }
- end
- end
-
- context "when `plus` icon name is given" do
- let(:icon_name) { "plus" }
-
- it { is_expected.to eq "add" }
- end
-
- context "when `copy` icon name is given" do
- let(:icon_name) { "copy" }
-
- it { is_expected.to eq "file-copy" }
- end
-
- context "when `download` icon name is given" do
- let(:icon_name) { "download" }
-
- it { is_expected.to eq "download-2" }
- end
-
- context "when `upload` icon name is given" do
- let(:icon_name) { "upload" }
-
- it { is_expected.to eq "upload-2" }
- end
-
- context "when `exclamation` icon name is given" do
- let(:icon_name) { "exclamation" }
-
- it { is_expected.to eq "alert" }
- end
-
- context "when `info` or `info-circle` icon name is given" do
- %w[info info-circle].each do |type|
- let(:icon_name) { type }
-
- it { is_expected.to eq "information" }
- end
- end
-
- context "when `times` icon name is given" do
- let(:icon_name) { "times" }
-
- it { is_expected.to eq "close" }
- end
-
- context "when `tag` icon name is given" do
- let(:icon_name) { "tag" }
-
- it { is_expected.to eq "price-tag-3" }
- end
-
- context "when `cog` icon name is given" do
- let(:icon_name) { "cog" }
-
- it { is_expected.to eq "settings-3" }
- end
-
- context "when unknown icon name is given" do
- let(:icon_name) { "foo" }
-
- it "returns the given icon name" do
- is_expected.to eq "foo"
- end
- end
- end
end
end
diff --git a/spec/javascript/alchemy_admin/components/element_editor.spec.js b/spec/javascript/alchemy_admin/components/element_editor.spec.js
index 8335bed7a4..d3b5171d4e 100644
--- a/spec/javascript/alchemy_admin/components/element_editor.spec.js
+++ b/spec/javascript/alchemy_admin/components/element_editor.spec.js
@@ -89,7 +89,7 @@ describe("alchemy-element-editor", () => {