Skip to content

Commit

Permalink
Clean up the repo
Browse files Browse the repository at this point in the history
- Remove outdated CONTRIBUTING document
- Stop using `template`
- Update outdated helper references
  • Loading branch information
joeldrapper committed Mar 17, 2024
1 parent f8ed079 commit 16e7ce5
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 52 deletions.
23 changes: 0 additions & 23 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion lib/generators/phlex/component/templates/component.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<% module_namespacing do -%>
class <%= class_name %>Component < ApplicationComponent
def template
def view_template
h1 { "<%= class_name %>" }
p { "Find me in <%= @path %>" }
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class ApplicationLayout < ApplicationView
include Phlex::Rails::Layout

def template(&block)
def view_template(&block)
doctype

html do
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/phlex/view/templates/view.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<% module_namespacing do -%>
class <%= class_name %>View < ApplicationView
def template
def view_template
h1 { "<%= class_name %>" }
p { "Find me in <%= @path %>" }
end
Expand Down
6 changes: 3 additions & 3 deletions lib/phlex/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ module Rails
autoload :BufferedFormBuilder, "phlex/rails/buffered_form_builder"
autoload :BufferedLabelBuilder, "phlex/rails/buffered_label_builder"
autoload :BufferedRadioButtonBuilder, "phlex/rails/buffered_radio_button_builder"
autoload :HelperMacros, "phlex/rails/helper_macros"
autoload :CSV, "phlex/rails/csv"
autoload :SGML, "phlex/rails/sgml"
autoload :HTML, "phlex/rails/html"
autoload :UnbufferedOverrides, "phlex/rails/unbuffered_overrides"
autoload :HelperMacros, "phlex/rails/helper_macros"
autoload :Helpers, "phlex/rails/helpers"
autoload :Layout, "phlex/rails/layout"
autoload :SGML, "phlex/rails/sgml"
autoload :UnbufferedOverrides, "phlex/rails/unbuffered_overrides"
end

CSV.prepend Phlex::Rails::CSV::Overrides
Expand Down
8 changes: 4 additions & 4 deletions lib/phlex/rails/layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module Layout
include Helpers::CSRFMetaTags
include Helpers::FaviconLinkTag
include Helpers::PreloadLinkTag
include Helpers::StyleSheetLinkTag
include Helpers::StylesheetLinkTag
include Helpers::ActionCableMetaTag
include Helpers::AutoDiscoveryLinkTag
include Helpers::JavaScriptIncludeTag
include Helpers::JavaScriptImportMapTags
include Helpers::JavaScriptImportModuleTag
include Helpers::JavascriptIncludeTag
include Helpers::JavascriptImportmapTags
include Helpers::JavascriptImportModuleTag

# @api private
module Interface
Expand Down
4 changes: 2 additions & 2 deletions spec/c_level_proc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# require "spec_helper"

# class A < Phlex::HTML
# def template
# def view_template
# yield
# end

Expand All @@ -13,7 +13,7 @@
# end

# class B < Phlex::HTML
# def template
# def view_template
# render A.new(&:foo)
# end
# end
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/builder_yielding_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Class.new(Phlex::HTML) do
include Phlex::Rails::Helpers::FormWith

def template
def view_template
form_with url: "/foo" do |f|
f.text_field :name

Expand Down
6 changes: 3 additions & 3 deletions spec/helpers/output_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

require "spec_helper"

RSpec.describe Phlex::Rails::Helpers::DateTimeFieldTag do
RSpec.describe Phlex::Rails::Helpers::DatetimeFieldTag do
include ViewHelper

let(:output) { render example.new }

let(:example) do
Class.new(Phlex::HTML) do
include Phlex::Rails::Helpers::DateTimeFieldTag
include Phlex::Rails::Helpers::DatetimeFieldTag

def template
def view_template
datetime_field_tag :created_at
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/output_helper_with_capture_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Class.new(Phlex::HTML) do
include Phlex::Rails::Helpers::LinkTo

def template
def view_template
link_to "Foo", "/foo"

link_to("/bar") do
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers/tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Class.new(Phlex::HTML) do
include Phlex::Rails::Helpers::Tag

def template
def view_template
tag.div "Hello"
end
end
Expand All @@ -28,7 +28,7 @@ def template
Class.new(Phlex::HTML) do
include Phlex::Rails::Helpers::Tag

def template
def view_template
tag.h1 do
tag.h2 do
h3 { "Hello" }
Expand All @@ -48,7 +48,7 @@ def template
Class.new(Phlex::HTML) do
include Phlex::Rails::Helpers::Tag

def template
def view_template
tag(:img, src: "image.jpg")
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/value_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Class.new(Phlex::HTML) do
include Phlex::Rails::Helpers::NumberToHuman

def template
def view_template
div do
number_to_human 10_000
end
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/controllers/examples_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def form_with
end

def view_component; end
def templateless_view_component; end
def view_templateless_view_component; end
def tabs; end
def card; end
end
2 changes: 1 addition & 1 deletion spec/internal/app/views/articles/index_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Articles::IndexView < Phlex::HTML
include Phlex::Rails::Helpers::ContentFor

def template
def view_template
content_for(:title) { "Articles" }
h1 { "Articles" }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/views/components/card_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class CardComponent < Phlex::HTML
def template(&block)
def view_template(&block)
article(&block)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/views/components/tabs_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize
@tabs = []
end

def template
def view_template
div(class: "tabs") do
ul(class: "names") do
@tabs.each { |t| li { t.name } }
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/views/helpers/form_with_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Helpers
class FormWithView < Phlex::HTML
include Phlex::Rails::Helpers::FormWith

def template
def view_template
form_with do |f|
f.text_field :name
end
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/views/layouts/application_layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class ApplicationLayout < Phlex::HTML
include Phlex::Rails::Layout

def template(&block)
def view_template(&block)
doctype

html do
Expand Down
4 changes: 2 additions & 2 deletions spec/phlex/sgml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
context "when given a block" do
it "renders content in the proper order" do
component = Class.new(Phlex::HTML) do
def template(&block)
def view_template(&block)
plain "Component A\n"
render("examples/sgml/wrap", &block)
plain "Component B\n"
Expand Down Expand Up @@ -38,7 +38,7 @@ def template(&block)

it "renders a template without a block" do
component = Class.new(Phlex::HTML) do
def template
def view_template
render(template: "examples/sgml/template")
end
end
Expand Down

0 comments on commit 16e7ce5

Please sign in to comment.