Skip to content

Commit 27adf3d

Browse files
chaimanntvdeyen
authored andcommitted
Update alert attribute "description" to "message"
1 parent 2526156 commit 27adf3d

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div id="flash_alerts" class="flex items-center justify-center">
22
<div class="fixed w-2/3 top-3 flex flex-col gap-3 pointer-events-none" role="alert">
33
<% alerts.each do |key, text| %>
4-
<%= render component("ui/alert").new(title: text[:title], description: text[:description], scheme: key.to_sym) %>
4+
<%= render component("ui/alert").new(title: text[:title], message: text[:message], scheme: key.to_sym) %>
55
<% end %>
66
</div>
77
</div>

admin/app/components/solidus_admin/layout/flashes/alerts/component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ class SolidusAdmin::Layout::Flashes::Alerts::Component < SolidusAdmin::BaseCompo
44
attr_reader :alerts
55

66
# Construct alert flashes like:
7-
# flash[:alert] = { <alert_type>: { title: "", description: "" } }
7+
# flash[:alert] = { <alert_type>: { title: "", message: "" } }
88
# See +SolidusAdmin::UI::Alert::Component::SCHEMES+ for available alert types.
99
#
1010
# If a string is passed to flash[:alert], we treat it is a body of the alert message and fall back to +danger+ type
1111
# and default title (see +SolidusAdmin::UI::Alert::Component+).
1212
def initialize(alerts:)
1313
if alerts.is_a?(String)
14-
alerts = { danger: { description: alerts } }
14+
alerts = { danger: { message: alerts } }
1515
end
1616

1717
@alerts = alerts.slice(*SolidusAdmin::UI::Alert::Component::SCHEMES.keys)

admin/app/components/solidus_admin/ui/alert/component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</div>
1919
<div class="flex flex-col px-2 pt-1 gap-3">
2020
<p class="font-semibold text-base text-black leading-none"><%= @title %></p>
21-
<p class="font-normal text-sm text-black leading-none"><%= @description.html_safe %></p>
21+
<p class="font-normal text-sm text-black leading-none"><%= @message.html_safe %></p>
2222
</div>
2323
</div>
2424
<div>

admin/app/components/solidus_admin/ui/alert/component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class SolidusAdmin::UI::Alert::Component < SolidusAdmin::BaseComponent
3535
},
3636
}
3737

38-
def initialize(title:, description:, scheme: :success)
38+
def initialize(title:, message:, scheme: :success)
3939
@title = title
40-
@description = description
40+
@message = message
4141
@scheme = scheme
4242
end
4343

admin/spec/components/previews/solidus_admin/ui/alert/component_preview/overview.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</h6>
66

77
<div class="w-5/6">
8-
<%= render current_component.new(scheme: :success, title: "Added Solidus T-Shirt", description: "<a href='#' class='underline'>Add another product</a> or <a href='#' class='underline'>view product in a new window</a>".html_safe) %>
8+
<%= render current_component.new(scheme: :success, title: "Added Solidus T-Shirt", message: "<a href='#' class='underline'>Add another product</a> or <a href='#' class='underline'>view product in a new window</a>".html_safe) %>
99
</div>
1010
</div>
1111

@@ -15,7 +15,7 @@
1515
</h6>
1616

1717
<div class="w-5/6">
18-
<%= render current_component.new(scheme: :warning, title: "No active stock locations left", description: "You can assign new active stock location <a href='#' class='underline'>here</a>".html_safe) %>
18+
<%= render current_component.new(scheme: :warning, title: "No active stock locations left", message: "You can assign new active stock location <a href='#' class='underline'>here</a>".html_safe) %>
1919
</div>
2020
</div>
2121

@@ -25,7 +25,7 @@
2525
</h6>
2626

2727
<div class="w-5/6">
28-
<%= render current_component.new(scheme: :danger, title: "Request was not completed", description: "Cannot destroy default store") %>
28+
<%= render current_component.new(scheme: :danger, title: "Request was not completed", message: "Cannot destroy default store") %>
2929
</div>
3030
</div>
3131

@@ -35,7 +35,7 @@
3535
</h6>
3636

3737
<div class="w-5/6">
38-
<%= render current_component.new(scheme: :info, title: "Locales available", description: "Did you know you can update storefront locales <a href='#' class='underline'>here</a>?".html_safe) %>
38+
<%= render current_component.new(scheme: :info, title: "Locales available", message: "Did you know you can update storefront locales <a href='#' class='underline'>here</a>?".html_safe) %>
3939
</div>
4040
</div>
4141
</div>

admin/spec/components/solidus_admin/layout/flashes/alerts/component_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
context "when alerts passed as Hash" do
99
let(:alerts) do
10-
{ warning: { title: "Be careful", description: "Something fishy going on" } }
10+
{ warning: { title: "Be careful", message: "Something fishy going on" } }
1111
end
1212

1313
it "renders correctly" do
@@ -36,8 +36,8 @@
3636
describe "multiple alerts" do
3737
let(:alerts) do
3838
{
39-
warning: { title: "Be careful", description: "Something fishy going on" },
40-
success: { title: "It worked", description: "Nothing to worry about!" }
39+
warning: { title: "Be careful", message: "Something fishy going on" },
40+
success: { title: "It worked", message: "Nothing to worry about!" }
4141
}
4242
end
4343

admin/spec/components/solidus_admin/ui/alert/component_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
end
99

1010
describe "defaults" do
11-
let(:component) { described_class.new(title:, description:, scheme:) }
11+
let(:component) { described_class.new(title:, message:, scheme:) }
1212
let(:title) { "Title" }
13-
let(:description) { "Description" }
13+
let(:message) { "Message" }
1414
let(:scheme) { :success }
1515

1616
context "when title is not present" do

0 commit comments

Comments
 (0)