phlex-rails 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/Gemfile +2 -1
  4. data/config.ru +9 -0
  5. data/lib/generators/phlex/controller/templates/view.rb.erb +0 -2
  6. data/lib/generators/phlex/layout/templates/layout.rb.erb +0 -1
  7. data/lib/generators/phlex/page/templates/page.rb.erb +0 -2
  8. data/lib/install/phlex.rb +0 -12
  9. data/lib/phlex/rails/helpers.rb +27 -18
  10. data/lib/phlex/rails/layout.rb +1 -0
  11. data/lib/phlex/rails/renderable.rb +34 -2
  12. data/lib/phlex/rails/version.rb +1 -1
  13. data/lib/phlex/rails.rb +11 -0
  14. metadata +6 -39
  15. data/config/sus.rb +0 -5
  16. data/fixtures/dummy/app/assets/config/manifest.js +0 -0
  17. data/fixtures/dummy/app/components/comment_component.html.erb +0 -14
  18. data/fixtures/dummy/app/components/comment_component.rb +0 -8
  19. data/fixtures/dummy/app/components/reaction_component.html.erb +0 -3
  20. data/fixtures/dummy/app/components/reaction_component.rb +0 -7
  21. data/fixtures/dummy/app/controllers/articles_controller.rb +0 -4
  22. data/fixtures/dummy/app/controllers/comments_controller.rb +0 -4
  23. data/fixtures/dummy/app/views/application_view.rb +0 -7
  24. data/fixtures/dummy/app/views/articles/blog.html.erb +0 -14
  25. data/fixtures/dummy/app/views/articles/form.rb +0 -15
  26. data/fixtures/dummy/app/views/articles/index.html.erb +0 -14
  27. data/fixtures/dummy/app/views/articles/new.html.erb +0 -1
  28. data/fixtures/dummy/app/views/blog.rb +0 -27
  29. data/fixtures/dummy/app/views/card.rb +0 -15
  30. data/fixtures/dummy/app/views/comments/comment.rb +0 -25
  31. data/fixtures/dummy/app/views/comments/index.html.erb +0 -3
  32. data/fixtures/dummy/app/views/comments/reaction.rb +0 -17
  33. data/fixtures/dummy/app/views/comments/show.html.erb +0 -3
  34. data/fixtures/dummy/app/views/heading.rb +0 -9
  35. data/fixtures/dummy/config/database.yml +0 -3
  36. data/fixtures/dummy/config/routes.rb +0 -5
  37. data/fixtures/dummy/config/storage.yml +0 -3
  38. data/fixtures/dummy/db/schema.rb +0 -6
  39. data/fixtures/dummy/log/.gitignore +0 -1
  40. data/fixtures/dummy/public/favicon.ico +0 -0
  41. data/fixtures/rails_helper.rb +0 -9
  42. data/fixtures/view_helper.rb +0 -16
  43. data/lib/generators/phlex/collection/USAGE +0 -8
  44. data/lib/generators/phlex/collection/collection_generator.rb +0 -13
  45. data/lib/generators/phlex/collection/templates/collection.rb.erb +0 -16
  46. data/lib/generators/phlex/table/USAGE +0 -8
  47. data/lib/generators/phlex/table/table_generator.rb +0 -14
  48. data/lib/generators/phlex/table/templates/table.rb.erb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a623bc2f1743cc9fb1c081bb545570ea4f74c68fd3239a91e2ea578f84351d49
4
- data.tar.gz: 49ef5747faf129b2c03a74f12f2aa20d1c42618309d3cb3f96eba7f27d0867b2
3
+ metadata.gz: 7235a9f512ec98cba7ac0c7b433c6b8862a79393d7759283f9374c2de12cbc30
4
+ data.tar.gz: 63090c17e5a2996f2dce0da406fb97a3e58a43bfdc7799120cef331f3eea5133
5
5
  SHA512:
6
- metadata.gz: 1bd8a771b4f85a3a3a6cd60e9b9e5c813f19a3ad5399fe5a2b668ac9a120435e5239c6a540b8565b3ac8a34848bb31fd0588c3bc9df0398148abb621eeb460d6
7
- data.tar.gz: 2822f8e1c9cff19bf6ac7aaa7e8f76241bdec94f425bebb195c60d750bd5262996a4db0acbdb55e28e49cf3280def61274588dfdc9d964efe3b0ef7db16b3823
6
+ metadata.gz: 3f6488be48a2585d14065193a5c15b8c96218926f1617ece544062fc2d6957a4ab0a43f4d9a46ce610ff5c2cc883c40547af9764699444976755df67784dc55f
7
+ data.tar.gz: 1154d9f20816c76a233b4d83e919189a7c020fa0b7e364c113ab496867b40d33e19d6516571c7237baa11ce96de78bbcbcc2522f4acc614e8d6122f1227dfc9b
data/.rubocop.yml CHANGED
@@ -29,3 +29,6 @@ Style/MixinUsage:
29
29
 
30
30
  Style/ConditionalAssignment:
31
31
  Enabled: false
32
+
33
+ Lint/UnderscorePrefixedVariableName:
34
+ Enabled: false
data/Gemfile CHANGED
@@ -6,8 +6,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
6
  gemspec
7
7
 
8
8
  gem "phlex", github: "joeldrapper/phlex", branch: "main"
9
- gem "sus"
9
+ gem "rspec-rails"
10
10
  gem "combustion"
11
11
  gem "rubocop"
12
12
  gem "solargraph"
13
+ gem "view_component"
13
14
  gem "appraisal", github: "excid3/appraisal", branch: "fix-bundle-env"
data/config.ru ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems"
4
+ require "bundler"
5
+
6
+ Bundler.require :default, :development
7
+
8
+ Combustion.initialize! :all
9
+ run Combustion::Application
@@ -1,8 +1,6 @@
1
1
  <% module_namespacing do -%>
2
2
  module Views
3
3
  class <%= class_name %>::<%= @action.camelize %> < Phlex::HTML
4
- include ApplicationView
5
-
6
4
  def template
7
5
  <%= "# " unless @has_layout %>render Layout.new(title: "<%= class_name.gsub("::", " ").titlecase %> - <%= @action.titlecase %>") do
8
6
  h1 { "<%= class_name %>#<%= @action %>" }
@@ -1,7 +1,6 @@
1
1
  <% module_namespacing do -%>
2
2
  module Views
3
3
  class <%= class_name %> < Phlex::HTML
4
- include ApplicationView
5
4
  include Phlex::Rails::Layout
6
5
 
7
6
  def initialize(title:)
@@ -1,8 +1,6 @@
1
1
  <% module_namespacing do -%>
2
2
  module Views
3
3
  class <%= class_name %> < Phlex::HTML
4
- include ApplicationView
5
-
6
4
  def template
7
5
  render Layout.new(title: "<%= class_name.gsub("::", " ") %>") do
8
6
  h1 { "👋 Hello World!" }
data/lib/install/phlex.rb CHANGED
@@ -15,18 +15,6 @@ unless application_configuration_content.match?(pattern)
15
15
  )
16
16
  end
17
17
 
18
- unless Rails.root.join("app/views/application_view.rb").exist?
19
- create_file(Rails.root.join("app/views/application_view.rb"), <<~RUBY)
20
- # frozen_string_literal: true
21
-
22
- module Views
23
- module ApplicationView
24
- include Rails.application.routes.url_helpers
25
- end
26
- end
27
- RUBY
28
- end
29
-
30
18
  tailwind_config_path = Rails.root.join("config/tailwind.config.js")
31
19
 
32
20
  if tailwind_config_path.exist?
@@ -4,8 +4,8 @@ module Phlex
4
4
  module Rails
5
5
  module Helpers
6
6
  module CSPMetaTag
7
- def csp_meta_tag(**options)
8
- if (output = @_view_context.csp_meta_tag(**options))
7
+ def csp_meta_tag(...)
8
+ if (output = @_view_context.csp_meta_tag(...))
9
9
  @_target << output
10
10
  end
11
11
  end
@@ -63,6 +63,7 @@ module Phlex
63
63
  alias_method :week_field, :__output_method__
64
64
  alias_method :weekday_select, :__output_method__
65
65
  alias_method :button, :__output_method__
66
+ alias_method :rich_text_area, :__output_method__
66
67
  end
67
68
 
68
69
  def form_with(*args, **kwargs, &block)
@@ -77,64 +78,72 @@ module Phlex
77
78
  end
78
79
 
79
80
  module StylesheetLinkTag
80
- def stylesheet_link_tag(*sources)
81
- if (output = @_view_context.stylesheet_link_tag(*sources))
81
+ def stylesheet_link_tag(...)
82
+ if (output = @_view_context.stylesheet_link_tag(...))
82
83
  @_target << output
83
84
  end
84
85
  end
85
86
  end
86
87
 
87
88
  module FaviconLinkTag
88
- def favicon_link_tag(*args)
89
- if (output = @_view_context.favicon_link_tag(*args))
89
+ def favicon_link_tag(...)
90
+ if (output = @_view_context.favicon_link_tag(...))
90
91
  @_target << output
91
92
  end
92
93
  end
93
94
  end
94
95
 
95
96
  module ImageTag
96
- def image_tag(*args)
97
- if (output = @_view_context.image_tag(*args))
97
+ def image_tag(...)
98
+ if (output = @_view_context.image_tag(...))
98
99
  @_target << output
99
100
  end
100
101
  end
101
102
  end
102
103
 
103
104
  module AudioTag
104
- def audio_tag(*args)
105
- if (output = @_view_context.audio_tag(*args))
105
+ def audio_tag(...)
106
+ if (output = @_view_context.audio_tag(...))
106
107
  @_target << output
107
108
  end
108
109
  end
109
110
  end
110
111
 
111
112
  module VideoTag
112
- def video_tag(*args)
113
- if (output = @_view_context.video_tag(*args))
113
+ def video_tag(...)
114
+ if (output = @_view_context.video_tag(...))
114
115
  @_target << output
115
116
  end
116
117
  end
117
118
  end
118
119
 
119
120
  module PreloadLinkTag
120
- def preload_link_tag(*args)
121
- if (output = @_view_context.preload_link_tag(*args))
121
+ def preload_link_tag(...)
122
+ if (output = @_view_context.preload_link_tag(...))
122
123
  @_target << output
123
124
  end
124
125
  end
125
126
  end
126
127
 
127
128
  module JavaScriptIncludeTag
128
- def javascript_include_tag(*sources)
129
- if (output = @_view_context.javascript_include_tag(*sources))
129
+ def javascript_include_tag(...)
130
+ if (output = @_view_context.javascript_include_tag(...))
130
131
  @_target << output
131
132
  end
132
133
  end
133
134
  end
134
135
 
135
136
  module JavaScriptImportmapTags
136
- def javascript_importmap_tags
137
- if (output = @_view_context.javascript_importmap_tags)
137
+ def javascript_importmap_tags(...)
138
+ if (output = @_view_context.javascript_importmap_tags(...))
139
+ @_target << output
140
+ end
141
+ end
142
+ end
143
+
144
+ module JavaScriptImportModuleTag
145
+ def javascript_import_module_tag(...)
146
+ if (output = @_view_context.javascript_import_module_tag(...))
138
147
  @_target << output
139
148
  end
140
149
  end
@@ -11,6 +11,7 @@ module Phlex
11
11
  include Helpers::ActionCableMetaTag
12
12
  include Helpers::JavaScriptIncludeTag
13
13
  include Helpers::JavaScriptImportmapTags
14
+ include Helpers::JavaScriptImportModuleTag
14
15
  end
15
16
  end
16
17
  end
@@ -21,7 +21,15 @@ module Phlex
21
21
  call(view_context: view_context) do |*args|
22
22
  view_context.with_output_buffer(self) do
23
23
  original_length = @_target.length
24
- output = yield(*args)
24
+
25
+ if args.length == 1 && Phlex::HTML === args[0]
26
+ output = yield(
27
+ args[0].unbuffered
28
+ )
29
+ else
30
+ output = yield(*args)
31
+ end
32
+
25
33
  unchanged = (original_length == @_target.length)
26
34
 
27
35
  if unchanged
@@ -32,6 +40,8 @@ module Phlex
32
40
  end
33
41
  end
34
42
  end
43
+
44
+ nil
35
45
  end.html_safe
36
46
  else
37
47
  call(view_context: view_context).html_safe
@@ -63,12 +73,34 @@ module Phlex
63
73
  end
64
74
 
65
75
  def capture
66
- super.html_safe
76
+ super&.html_safe
67
77
  end
68
78
 
69
79
  # Trick ViewComponent into thinking we're a ViewComponent to fix rendering output
70
80
  def set_original_view_context(view_context)
71
81
  end
82
+
83
+ private def yield_content(&block)
84
+ return unless block
85
+
86
+ case block.binding.receiver
87
+ when Phlex::HTML
88
+ super
89
+ else
90
+ @_view_context.with_output_buffer(self) { super }
91
+ end
92
+ end
93
+
94
+ private def yield_content_with_args(*args, &block)
95
+ return unless block
96
+
97
+ case block.binding.receiver
98
+ when Phlex::HTML
99
+ super
100
+ else
101
+ @_view_context.with_output_buffer(self) { super }
102
+ end
103
+ end
72
104
  end
73
105
  end
74
106
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlex
4
4
  module Rails
5
- VERSION = "0.4.2"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
data/lib/phlex/rails.rb CHANGED
@@ -10,5 +10,16 @@ module Phlex::Rails
10
10
  loader.setup
11
11
  end
12
12
 
13
+ module AppendMethodAddedWarning
14
+ def method_added(name)
15
+ if name == :append || name == :safe_append
16
+ raise Phlex::NameError, "You shouldn't redefine the #{name} method as it's required for safe HTML output."
17
+ end
18
+
19
+ super
20
+ end
21
+ end
22
+
13
23
  Phlex::HTML.prepend(Phlex::Rails::Renderable)
24
+ Phlex::HTML.extend(Phlex::Rails::AppendMethodAddedWarning)
14
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-14 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
19
+ version: 1.3.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '1'
29
+ version: 1.3.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2'
@@ -80,37 +80,7 @@ files:
80
80
  - LICENSE.txt
81
81
  - README.md
82
82
  - SECURITY.md
83
- - config/sus.rb
84
- - fixtures/dummy/app/assets/config/manifest.js
85
- - fixtures/dummy/app/components/comment_component.html.erb
86
- - fixtures/dummy/app/components/comment_component.rb
87
- - fixtures/dummy/app/components/reaction_component.html.erb
88
- - fixtures/dummy/app/components/reaction_component.rb
89
- - fixtures/dummy/app/controllers/articles_controller.rb
90
- - fixtures/dummy/app/controllers/comments_controller.rb
91
- - fixtures/dummy/app/views/application_view.rb
92
- - fixtures/dummy/app/views/articles/blog.html.erb
93
- - fixtures/dummy/app/views/articles/form.rb
94
- - fixtures/dummy/app/views/articles/index.html.erb
95
- - fixtures/dummy/app/views/articles/new.html.erb
96
- - fixtures/dummy/app/views/blog.rb
97
- - fixtures/dummy/app/views/card.rb
98
- - fixtures/dummy/app/views/comments/comment.rb
99
- - fixtures/dummy/app/views/comments/index.html.erb
100
- - fixtures/dummy/app/views/comments/reaction.rb
101
- - fixtures/dummy/app/views/comments/show.html.erb
102
- - fixtures/dummy/app/views/heading.rb
103
- - fixtures/dummy/config/database.yml
104
- - fixtures/dummy/config/routes.rb
105
- - fixtures/dummy/config/storage.yml
106
- - fixtures/dummy/db/schema.rb
107
- - fixtures/dummy/log/.gitignore
108
- - fixtures/dummy/public/favicon.ico
109
- - fixtures/rails_helper.rb
110
- - fixtures/view_helper.rb
111
- - lib/generators/phlex/collection/USAGE
112
- - lib/generators/phlex/collection/collection_generator.rb
113
- - lib/generators/phlex/collection/templates/collection.rb.erb
83
+ - config.ru
114
84
  - lib/generators/phlex/controller/USAGE
115
85
  - lib/generators/phlex/controller/controller_generator.rb
116
86
  - lib/generators/phlex/controller/templates/controller.rb.erb
@@ -121,9 +91,6 @@ files:
121
91
  - lib/generators/phlex/page/USAGE
122
92
  - lib/generators/phlex/page/page_generator.rb
123
93
  - lib/generators/phlex/page/templates/page.rb.erb
124
- - lib/generators/phlex/table/USAGE
125
- - lib/generators/phlex/table/table_generator.rb
126
- - lib/generators/phlex/table/templates/table.rb.erb
127
94
  - lib/generators/phlex/view/USAGE
128
95
  - lib/generators/phlex/view/templates/view.rb.erb
129
96
  - lib/generators/phlex/view/view_generator.rb
@@ -167,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
134
  - !ruby/object:Gem::Version
168
135
  version: '0'
169
136
  requirements: []
170
- rubygems_version: 3.3.25
137
+ rubygems_version: 3.4.3
171
138
  signing_key:
172
139
  specification_version: 4
173
140
  summary: A Phlex adapter for Rails
data/config/sus.rb DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "phlex/rails"
4
-
5
- Zeitwerk::Loader.eager_load_all
File without changes
@@ -1,14 +0,0 @@
1
- <div>
2
- <span>
3
- <%= @name %>
4
- </span>
5
- <span>
6
- <%= @body %>
7
- </span>
8
-
9
- <%= content %>
10
-
11
- <%= render Views::Comments::Reaction.new(emoji: 'hamburger') do |reaction| %>
12
- <p>Emoji reaction for a comment from <%= @name %> with body <%= @body %></p>
13
- <% end %>
14
- </div>
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CommentComponent < ViewComponent::Base
4
- def initialize(name:, body:)
5
- @name = name
6
- @body = body
7
- end
8
- end
@@ -1,3 +0,0 @@
1
- <p><%= @emoji %></p>
2
-
3
- <%= content %>
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ReactionComponent < ViewComponent::Base
4
- def initialize(emoji:)
5
- @emoji = emoji
6
- end
7
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ArticlesController < ActionController::Base
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CommentsController < ActionController::Base
4
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Views
4
- class ApplicationView < Phlex::HTML
5
- include Rails.application.routes.url_helpers
6
- end
7
- end
@@ -1,14 +0,0 @@
1
- <%= render Views::Blog.new do |v| %>
2
-
3
- hidden
4
-
5
- <% v.with_post do %><%= link_to "First Post", "/posts/1" %><% end %>
6
-
7
- content
8
-
9
- <% v.with_header do %><%= link_to "My blog", "/" %><% end %>
10
-
11
- here
12
-
13
- <% v.with_post do %><%= link_to "Last Post", "/posts/2" %><% end %>
14
- <% end %>
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Views
4
- module Articles
5
- class Form < ApplicationView
6
- include Phlex::Rails::Helpers::FormWith
7
-
8
- def template
9
- form_with url: "test" do |f|
10
- f.text_field :name
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,14 +0,0 @@
1
- <p>Before</p>
2
-
3
- <%= render(Views::Heading.new) { "Hello World!" } %>
4
-
5
- <%= render Views::Card.new do |a| %>
6
- <p>Start Card A</p>
7
- <%= a.title "Hello from A" %>
8
- <%= render Views::Card.new do |b| %>
9
- <p>Start Card B</p>
10
- <%= b.title "Hello from B" %>
11
- <p>End Card B</p>
12
- <% end %>
13
- <p>End Card A</p>
14
- <% end %>
@@ -1 +0,0 @@
1
- <%= render Views::Articles::Form.new %>
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Views
4
- class Blog < ApplicationView
5
- def initialize
6
- @posts = []
7
- end
8
-
9
- def template(&block)
10
- capture(&block)
11
-
12
- h3(class: "font-bold") { @header }
13
-
14
- @posts.each do |post|
15
- article(class: "drop-shadow p-5 rounded") { post }
16
- end
17
- end
18
-
19
- def with_header(&block)
20
- @header = capture(&block)
21
- end
22
-
23
- def with_post(&block)
24
- @posts << capture(&block)
25
- end
26
- end
27
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Views
4
- class Card < ApplicationView
5
- def template(&block)
6
- article class: "drop-shadow p-5 rounded", &block
7
- end
8
-
9
- def title(text)
10
- h3 class: "font-bold" do
11
- text
12
- end
13
- end
14
- end
15
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Views
4
- module Comments
5
- class Comment < ApplicationView
6
- def initialize(name:, body:)
7
- @name = name
8
- @body = body
9
- end
10
-
11
- def template(&block)
12
- div {
13
- span { @name }
14
- span { @body }
15
-
16
- yield_content(&block)
17
-
18
- render(::ReactionComponent.new(emoji: "hamburger")) do
19
- p { "Emoji reaction for a comment from #{@name} with body #{@body}" }
20
- end
21
- }
22
- end
23
- end
24
- end
25
- end
@@ -1,3 +0,0 @@
1
- <%= render(CommentComponent.new(name: "Matz", body: "hey, folks")) do %>
2
- Hello, World from a ViewComponent!
3
- <% end %>
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Views
4
- module Comments
5
- class Reaction < ApplicationView
6
- def initialize(emoji:)
7
- @emoji = emoji
8
- end
9
-
10
- def template(&block)
11
- p { @emoji }
12
-
13
- yield_content(&block)
14
- end
15
- end
16
- end
17
- end
@@ -1,3 +0,0 @@
1
- <%= render Views::Comments::Comment.new(name: "_why", body: "I'm back") do %>
2
- Hello, World from a Phlex Component!
3
- <% end %>
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Views
4
- class Heading < ApplicationView
5
- def template(&block)
6
- h1(&block)
7
- end
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: db/combustion_test.sqlite
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Rails.application.routes.draw do
4
- # Rails routes here
5
- end
@@ -1,3 +0,0 @@
1
- test:
2
- service: Disk
3
- root: /Users/joeldrapper/src/joeldrapper/phlex/tmp/storage
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ActiveRecord::Schema.define do
4
- # Set up any tables you need to exist for your test suite that don't belong
5
- # in migrations.
6
- end
@@ -1 +0,0 @@
1
- *.log
File without changes
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Bundler.require :default
4
-
5
- Combustion.path = "fixtures/dummy"
6
-
7
- Combustion.initialize! :action_controller do
8
- config.autoload_paths << "#{root}/app"
9
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ViewHelper
4
- def self.extended(parent)
5
- parent.class_exec do
6
- let(:output) { example.call }
7
- let(:example) { view.new }
8
- end
9
- end
10
-
11
- def view(&block)
12
- let :view do
13
- Class.new(Phlex::HTML, &block)
14
- end
15
- end
16
- end
@@ -1,8 +0,0 @@
1
- Description:
2
- Generates a Phlex collection view with the given name
3
-
4
- Example:
5
- rails generate phlex:collection Articles::List
6
-
7
- This will create:
8
- app/views/articles/list.rb
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Phlex
4
- module Generators
5
- class CollectionGenerator < ::Rails::Generators::NamedBase
6
- source_root File.expand_path("templates", __dir__)
7
-
8
- def create_view
9
- template "collection.rb.erb", File.join("app/views", class_path, "#{file_name}.rb")
10
- end
11
- end
12
- end
13
- end
@@ -1,16 +0,0 @@
1
- <% module_namespacing do -%>
2
- module Views
3
- class <%= class_name %> < Phlex::HTML
4
- include ApplicationView
5
- include Phlex::Collection
6
-
7
- def collection_template(&)
8
- ul(&)
9
- end
10
-
11
- def item_template
12
- li { @item }
13
- end
14
- end
15
- end
16
- <% end %>
@@ -1,8 +0,0 @@
1
- Description:
2
- Generates a Phlex table collection view with the given name
3
-
4
- Example:
5
- rails generate phlex:collection Articles::Table --properties title author created_at
6
-
7
- This will create:
8
- app/views/articles/table.rb
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Phlex
4
- module Generators
5
- class TableGenerator < ::Rails::Generators::NamedBase
6
- source_root File.expand_path("templates", __dir__)
7
- class_option :properties, type: :array, default: []
8
-
9
- def create_view
10
- template "table.rb.erb", File.join("app/views", class_path, "#{file_name}.rb")
11
- end
12
- end
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- <% module_namespacing do -%>
2
- module Views
3
- class <%= class_name %> < Phlex::HTML
4
- include ApplicationView
5
- include Phlex::Table
6
-
7
- <% options["properties"].each do |property| %>
8
- property "<%= property.humanize %>", &:<%= property.underscore %><% end %>
9
- end
10
- end
11
- <% end %>