Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ All notable changes to this project will be documented in this file.
- Cells -> ViewComponents refactoring:
- Folio::Console::Form::HeaderCell -> Folio::Console::Form::HeaderComponent
- Folio::PublishableHintCell -> Folio::Publishable::HintComponent
- Folio::Console::Ui::WarningRibbonCell -> Folio::Console::Ui::WarningRibbonComponent
- generalized tiptap_config.use_as_single_image_in_toolbar -> tiptap_config.toolbar with icon and slot names

### Fixed
Expand Down
5 changes: 2 additions & 3 deletions app/cells/folio/console/publishable_inputs/item/show.slim
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@ div class=class_name data=data
atom_setting: model[:atom_setting] == false ? nil : "#{field}_until"

- if field == :published
== cell('folio/console/ui/warning_ribbon',
t('.unpublished'),
class: "f-c-publishable-inputs-item__warning-ribbon")
== render_view_component(Folio::Console::Ui::WarningRibbonComponent.new(message: t('.unpublished'),
class_name: "f-c-publishable-inputs-item__warning-ribbon"))
4 changes: 0 additions & 4 deletions app/cells/folio/console/ui/warning_ribbon_cell.rb

This file was deleted.

8 changes: 8 additions & 0 deletions app/components/folio/console/ui/warning_ribbon_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class Folio::Console::Ui::WarningRibbonComponent < Folio::Console::ApplicationComponent
def initialize(message:, class_name: nil)
@message = message
@class_name = class_name
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.f-c-ui-warning-ribbon class=options[:class]
.f-c-ui-warning-ribbon class=@class_name
== cell('folio/console/ui/with_icon',
model,
@message,
icon: :alert,
icon_options: { width: 16 })
2 changes: 1 addition & 1 deletion app/views/folio/console/ui/warning_ribbons.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ h2 Warning ribbon

h3 Standalone

== cell('folio/console/ui/warning_ribbon', 'Warning text')
= render(Folio::Console::Ui::WarningRibbonComponent.new(message: 'Warning text'))

h3 Publishable inputs

Expand Down
10 changes: 0 additions & 10 deletions test/cells/folio/console/ui/warning_ribbon_cell_test.rb

This file was deleted.

10 changes: 10 additions & 0 deletions test/components/folio/console/ui/warning_ribbon_component_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require "test_helper"

class Folio::Console::Ui::WarningRibbonComponentTest < Folio::Console::ComponentTest
test "show" do
render_inline(Folio::Console::Ui::WarningRibbonComponent.new(message: "foo"))
assert_selector(".f-c-ui-warning-ribbon")
end
end