coprl 3.0.0.beta.9 → 3.0.0.beta.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 236ae7548578c302ec736e18f4bc4542d37548f4a6f6cea794b80eadb263c61d
4
- data.tar.gz: 44da31446c80059812b1839d53ddc36d91d95d8db1ac5f8c09738aae34f9da69
3
+ metadata.gz: 2e31bf11c84ed9cd6321131d9053436c610e5e193124c12503d8fead966b7347
4
+ data.tar.gz: 9e3f161bf2de8462f6a7234923f9ddb17e38ab31098ead2ea6bdbb59b3102796
5
5
  SHA512:
6
- metadata.gz: c417061bb470e7a028d82b9e699e60c96b24fee025f8fcd16c2301841ac913b6da140dad47a23c8ed7d814cf25044b2a517aff76e9e2720cc0c1bbdb5821d0a7
7
- data.tar.gz: cde447a1e215f53bf2aec0854cac8611b05db11d49b2596a52ec1f13bd27249a84e73147a7f375a190e0bc445f17fb1508b033b3b0ad3812fa7e638772dfc3ee
6
+ metadata.gz: 0deb84df0f2d9e38dd7e16ae62203c887154c2b6d86c0ee862de96b29aa8ab9018b8893e2e121152395d8bfeb1ae3239bc2b49832fde8008e72eef88e066763e
7
+ data.tar.gz: ff24bd5e388206523e917bb678276a780f0d17cbba4afb229fe7db6a345f31efb3bffb3d0593770d1f8187202737c789e7ac44d0306f42de8c926e691b15d8c6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [3.0.0-beta.10](https://github.com/rx/presenters/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-09-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added POM scaffolding generators ([1323b32](https://github.com/rx/presenters/commit/1323b322f83fd9e9519740d9aa7ace4ef8d63b61))
7
+
1
8
  # [3.0.0-beta.9](https://github.com/rx/presenters/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-09-21)
2
9
 
3
10
 
data/Gemfile.lock CHANGED
@@ -80,7 +80,7 @@ GIT
80
80
  PATH
81
81
  remote: .
82
82
  specs:
83
- coprl (3.0.0.beta.8)
83
+ coprl (3.0.0.beta.10)
84
84
  dry-configurable (> 0.1, <= 7.0)
85
85
  dry-container (~> 0.6)
86
86
  dry-inflector (~> 0.1)
@@ -1,7 +1,7 @@
1
1
  module Coprl
2
2
  module Presenters
3
3
  module Version
4
- VERSION = '3.0.0.beta.9'
4
+ VERSION = '3.0.0.beta.10'
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,15 @@
1
+ require 'rails/generators/erb/controller/controller_generator'
2
+
3
+ module Pom
4
+ module Generators
5
+ class ControllerGenerator < Erb::Generators::ControllerGenerator
6
+ source_root File.expand_path(File.join('..', 'templates'), __FILE__)
7
+
8
+ protected
9
+ def handler
10
+ :pom
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ h1 <%= class_name %>#<%= @action %>
2
+ p Find me in <%= @path %>
@@ -0,0 +1,27 @@
1
+ require 'rails/generators/erb/scaffold/scaffold_generator'
2
+
3
+ module Pom
4
+ module Generators
5
+ class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
6
+ source_root File.expand_path(File.join('..', 'templates'), __FILE__)
7
+
8
+ def copy_view_files
9
+ available_views.each do |view|
10
+ filename = filename_with_extensions view
11
+ template "#{view}.html.pom", File.join('app', 'views', controller_file_path, filename)
12
+ end
13
+ end
14
+
15
+ hook_for :form_builder, as: :scaffold
16
+
17
+ protected
18
+ def available_views
19
+ ['index', 'edit', 'show', 'new', '_form']
20
+ end
21
+
22
+ def handler
23
+ :pom
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,10 @@
1
+ Coprl::Presenters.define("_form", namespace: :<%= plural_table_name %>) do
2
+ helpers <%= controller_class_name %>Helper
3
+
4
+ <% attributes.each do |attribute| -%>
5
+ text_field name: :<%= attribute.name %> do
6
+ label :<%= attribute.name %>
7
+ value <%= singular_table_name %>.<%= attribute.name %> if params[:<%= singular_table_name %>_id]
8
+ end
9
+ <% end -%>
10
+ end
@@ -0,0 +1,19 @@
1
+ Coprl::Presenters.define(:edit, namespace: :<%= plural_table_name %>) do
2
+ helpers <%= controller_class_name %>Helper
3
+ grid do
4
+ column 1
5
+ column 5 do
6
+ heading 'Editing <%= human_name %>'
7
+ content do
8
+ attach '_form'
9
+ button 'Update' do
10
+ event :click do
11
+ updates <%= url_helper_prefix %>_path(<%= singular_table_name %>)
12
+ end
13
+ end
14
+ end
15
+ link 'Show', presenter_path(:show, <%= singular_table_name %>_id: <%= singular_table_name %>.id)
16
+ link 'Back', presenter_path(:index)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,33 @@
1
+ Coprl::Presenters.define(:index, namespace: :<%= plural_table_name %>) do
2
+ helpers <%= controller_class_name %>Helper
3
+ snackbar params[:notice] if params[:notice]
4
+ grid do
5
+ column 1
6
+ column 5 do
7
+ heading '<%= human_name %>'
8
+ list do
9
+ <%= plural_table_name %>.each do |<%= singular_table_name %>|
10
+ line <%= attributes.first ? "#{singular_table_name}.#{attributes.first.name}" : "\"#{human_name}\"" %> do
11
+ actions do
12
+ icon :edit do
13
+ event :click do
14
+ loads :edit, <%= singular_table_name %>_id: <%= singular_table_name %>.id
15
+ end
16
+ end
17
+ icon :delete do
18
+ event :click do
19
+ dialog "are_you_sure#{<%= singular_table_name %>.id}"
20
+ end
21
+ end
22
+ end
23
+ event :click do
24
+ loads :show, <%= singular_table_name %>_id: <%= singular_table_name %>.id
25
+ end
26
+ end
27
+ end
28
+ end
29
+ link 'New <%= human_name %>', presenter_path(:new)
30
+ end
31
+ end
32
+ confirm_delete_dialog
33
+ end
@@ -0,0 +1,17 @@
1
+ Coprl::Presenters.define(:new, namespace: :<%= plural_table_name %>) do
2
+ grid do
3
+ column 1
4
+ column 5 do
5
+ heading 'New <%= human_name %>'
6
+ content do
7
+ attach '_form'
8
+ button 'Create' do
9
+ event :click do
10
+ creates <%= index_helper %>_path
11
+ end
12
+ end
13
+ end
14
+ link 'Back', presenter_path(:index)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ Coprl::Presenters.define(:show, namespace: :<%= plural_table_name %>) do
2
+ helpers <%= controller_class_name %>Helper
3
+
4
+ snackbar params[:notice] if params[:notice]
5
+ grid do
6
+ column 1
7
+ column 5 do
8
+ card do
9
+ <% attributes.each_with_index do |attribute,index| -%>
10
+ <% if index == 0 -%>
11
+ heading <%= singular_table_name %>.<%= attribute.name %>
12
+ <% else -%>
13
+ body <%= singular_table_name %>.<%= attribute.name %>
14
+ <% end -%>
15
+ <% end -%>
16
+ end
17
+ link 'Edit', presenter_path(:edit,<%= singular_table_name %>_id: params[:<%= singular_table_name %>_id])
18
+ link 'Back', presenter_path(:index)
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coprl
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta.9
4
+ version: 3.0.0.beta.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Edens
@@ -642,6 +642,14 @@ files:
642
642
  - lib/coprl/serializer.rb
643
643
  - lib/coprl/symbol/to_str.rb
644
644
  - lib/coprl/trace.rb
645
+ - lib/generators/pom/controller/controller_generator.rb
646
+ - lib/generators/pom/controller/templates/view.html.pom
647
+ - lib/generators/pom/scaffold/scaffold_generator.rb
648
+ - lib/generators/pom/scaffold/templates/_form.html.pom
649
+ - lib/generators/pom/scaffold/templates/edit.html.pom
650
+ - lib/generators/pom/scaffold/templates/index.html.pom
651
+ - lib/generators/pom/scaffold/templates/new.html.pom
652
+ - lib/generators/pom/scaffold/templates/show.html.pom
645
653
  - lib/hash_ext/traverse.rb
646
654
  - public/bundle.css
647
655
  - public/bundle.js