Skip to content

Commit ad270a3

Browse files
authored
Remove Phlex version conditionals (#187)
1 parent 6fb08c9 commit ad270a3

10 files changed

Lines changed: 9 additions & 30 deletions

File tree

lib/ruby_ui/alert_dialog/alert_dialog_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module RubyUI
44
class AlertDialogContent < Base
55
def view_template(&block)
6-
all_template_tag(**attrs) do
6+
template(**attrs) do
77
div(data: {controller: "rbui--alert-dialog"}) do
88
background
99
container(&block)

lib/ruby_ui/base.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@ def before_template
2222

2323
private
2424

25-
def all_template_tag(**attrs, &)
26-
current_version = Gem.loaded_specs["phlex"].version
27-
if current_version.segments[0] >= 2
28-
template(**attrs, &)
29-
else
30-
template_tag(**attrs, &)
31-
end
32-
end
33-
3425
def default_attrs
3526
{}
3627
end

lib/ruby_ui/calendar/calendar_days.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def render_other_month_date_template
8787
end
8888

8989
def date_template(target, &block)
90-
all_template_tag(data: {ruby_ui__calendar_target: target}) do
90+
template(data: {ruby_ui__calendar_target: target}) do
9191
td(
9292
class:
9393
"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected])]:rounded-md",

lib/ruby_ui/calendar/calendar_weekdays.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class CalendarWeekdays < Base
55
DAYS = %w[Monday Tuesday Wednesday Thursday Friday Saturday Sunday].freeze
66

77
def view_template
8-
all_template_tag(data: {ruby_ui__calendar_target: "weekdaysTemplate"}) do
8+
template(data: {ruby_ui__calendar_target: "weekdaysTemplate"}) do
99
thead(**attrs) do
1010
tr(class: "flex") do
1111
DAYS.each do |day|

lib/ruby_ui/codeblock/codeblock.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,7 @@ def with_clipboard
5454
def codeblock
5555
div(**attrs) do
5656
div(class: "after:content-none") do
57-
pre do
58-
current_version = Gem.loaded_specs["phlex"].version
59-
60-
if current_version.segments[0] >= 2
61-
# Any 2.x version (including betas)
62-
raw(safe(FORMATTER.format(lexer.lex(@code))))
63-
else
64-
# Any 1.x version
65-
unsafe_raw FORMATTER.format(
66-
lexer.lex(@code)
67-
)
68-
end
69-
end
57+
pre { raw(safe(FORMATTER.format(lexer.lex(@code)))) }
7058
end
7159
end
7260
end

lib/ruby_ui/command/command_dialog_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(size: :md, **attrs)
1717
end
1818

1919
def view_template(&block)
20-
all_template_tag(data: {ruby_ui__command_target: "content"}) do
20+
template(data: {ruby_ui__command_target: "content"}) do
2121
div(data: {controller: "ruby-ui--command"}) do
2222
backdrop
2323
div(**attrs, &block)

lib/ruby_ui/context_menu/context_menu_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module RubyUI
44
class ContextMenuContent < Base
55
def view_template(&block)
6-
all_template_tag(data: {ruby_ui__context_menu_target: "content"}) do
6+
template(data: {ruby_ui__context_menu_target: "content"}) do
77
div(**attrs, &block)
88
end
99
end

lib/ruby_ui/dialog/dialog_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(size: :md, **attrs)
1717
end
1818

1919
def view_template
20-
all_template_tag(data: {ruby_ui__dialog_target: "content"}) do
20+
template(data: {ruby_ui__dialog_target: "content"}) do
2121
div(data_controller: "ruby-ui--dialog") do
2222
backdrop
2323
div(**attrs) do

lib/ruby_ui/hover_card/hover_card_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module RubyUI
44
class HoverCardContent < Base
55
def view_template(&block)
6-
all_template_tag(data: {ruby_ui__hover_card_target: "content"}) do
6+
template(data: {ruby_ui__hover_card_target: "content"}) do
77
div(**attrs, &block)
88
end
99
end

lib/ruby_ui/sheet/sheet_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(side: :right, **attrs)
1616
end
1717

1818
def view_template(&block)
19-
all_template_tag(data: {ruby_ui__sheet_target: "content"}) do
19+
template(data: {ruby_ui__sheet_target: "content"}) do
2020
div(data: {controller: "ruby-ui--sheet-content"}) do
2121
backdrop
2222
div(**attrs) do

0 commit comments

Comments
 (0)