coprl 3.0.0.beta.8 → 3.0.0.beta.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/Gemfile.lock +1 -1
- data/lib/coprl/presenters/api/app.rb +7 -2
- data/lib/coprl/presenters/helpers/rails/routes.rb +1 -1
- data/lib/coprl/presenters/rails/railtie.rb +5 -0
- data/lib/coprl/presenters/version.rb +1 -1
- data/lib/coprl.rb +2 -0
- data/lib/generators/pom/controller/controller_generator.rb +15 -0
- data/lib/generators/pom/controller/templates/view.html.pom +2 -0
- data/lib/generators/pom/scaffold/scaffold_generator.rb +31 -0
- data/lib/generators/pom/scaffold/templates/_form.html.pom +10 -0
- data/lib/generators/pom/scaffold/templates/edit.html.pom +19 -0
- data/lib/generators/pom/scaffold/templates/index.html.pom +33 -0
- data/lib/generators/pom/scaffold/templates/new.html.pom +17 -0
- data/lib/generators/pom/scaffold/templates/show.html.pom +21 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b184228bec9672d9fd6141f96e837a91bcc2002e3d1657121accc91d8f39a730
|
4
|
+
data.tar.gz: '091bb9a097020c8b822a8bfa5c2318f30d34f96bc5784ff5bc73e645197c9325'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb57a9378ee3fc277c2c0fa70dfe0565a02db1e2710d8868d267fe7289ff21affcf0daf4e9ed8a9b8348491aa1bb087d2b00a0637add275ef7237cdc25db512
|
7
|
+
data.tar.gz: 5de8475d3fd3055152890add20f51197115e46dc911bed3476c64db2abbf92ad981e9f0a0a5c2e1ae52e207614bf201c0ba8a3a68ec997d1ef6d2b40db8d0bc5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
# [3.0.0-beta.12](https://github.com/rx/presenters/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2021-09-22)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* defaulted :pom as the rails scaffolding template when the copral gem is included inside Rails ([7179a6f](https://github.com/rx/presenters/commit/7179a6fddd37c1b1d735469c4a79cf0a960c7d92))
|
7
|
+
* when generating scaffolding creates proper routes that ignore the pom files ([63d6c49](https://github.com/rx/presenters/commit/63d6c49af151fd409293c4eb46ee200c0c58855b))
|
8
|
+
|
9
|
+
# [3.0.0-beta.11](https://github.com/rx/presenters/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-09-21)
|
10
|
+
|
11
|
+
|
12
|
+
### Bug Fixes
|
13
|
+
|
14
|
+
* forced release bump ([6c22e06](https://github.com/rx/presenters/commit/6c22e061acc2e714b5b87be8994b2eb0d488ac2d))
|
15
|
+
|
16
|
+
# [3.0.0-beta.10](https://github.com/rx/presenters/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-09-21)
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* added POM scaffolding generators ([1323b32](https://github.com/rx/presenters/commit/1323b322f83fd9e9519740d9aa7ace4ef8d63b61))
|
21
|
+
|
22
|
+
# [3.0.0-beta.9](https://github.com/rx/presenters/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-09-21)
|
23
|
+
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* added support for api base base_url ([8f69979](https://github.com/rx/presenters/commit/8f699793de899a450df5cfb8b95015a832200178))
|
28
|
+
* fixed bug in context prep for api client ([d0558cf](https://github.com/rx/presenters/commit/d0558cf3966a9bdc91bd9d106dcb0a7ab6f56c34))
|
29
|
+
|
1
30
|
# [3.0.0-beta.8](https://github.com/rx/presenters/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-09-17)
|
2
31
|
|
3
32
|
|
data/Gemfile.lock
CHANGED
@@ -66,9 +66,9 @@ module Coprl
|
|
66
66
|
|
67
67
|
def prepare_context(base_params = params)
|
68
68
|
prepare_context = Presenters::Settings.config.presenters.web_client.prepare_context.dup
|
69
|
-
prepare_context.push(method(:scrub_context))
|
69
|
+
prepare_context.push(method(:scrub_context)).push(method(:base_url_context))
|
70
70
|
context = base_params.dup
|
71
|
-
prepare_context.reduce(context) do |params, context_proc|
|
71
|
+
context = prepare_context.reduce(context) do |params, context_proc|
|
72
72
|
context_proc.call(params, session, env)
|
73
73
|
end
|
74
74
|
context
|
@@ -80,6 +80,11 @@ module Coprl
|
|
80
80
|
end
|
81
81
|
params
|
82
82
|
end
|
83
|
+
|
84
|
+
def base_url_context(params, _session, env)
|
85
|
+
params[:base_url] = "#{request.base_url}#{env['SCRIPT_NAME']}"
|
86
|
+
params
|
87
|
+
end
|
83
88
|
end
|
84
89
|
end
|
85
90
|
end
|
@@ -5,7 +5,7 @@ module Coprl
|
|
5
5
|
module Routes
|
6
6
|
include ::Rails.application.routes.url_helpers
|
7
7
|
def default_url_options
|
8
|
-
::Rails.application.config.action_controller.default_url_options || { :host => context[:request].host_with_port }
|
8
|
+
::Rails.application.config.action_controller.default_url_options || { :host => context[:base_url] ? context[:base_url] : context[:request].host_with_port }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -2,6 +2,11 @@ module Coprl
|
|
2
2
|
module Presenters
|
3
3
|
module Rails
|
4
4
|
class Railtie < ::Rails::Railtie
|
5
|
+
# Use pom as the default scaffolding templating engine
|
6
|
+
config.app_generators.generators do |g|
|
7
|
+
g.template_engine :pom
|
8
|
+
end
|
9
|
+
|
5
10
|
BOOT = -> {
|
6
11
|
Coprl::Presenters::App.reset!
|
7
12
|
Coprl::Presenters::Settings.configure do |config|
|
data/lib/coprl.rb
CHANGED
@@ -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,31 @@
|
|
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
|
+
def resource_route
|
16
|
+
route "resources :#{file_name.pluralize}, only: [:create, :destroy, :update]", namespace: regular_class_path
|
17
|
+
end
|
18
|
+
|
19
|
+
hook_for :form_builder, as: :scaffold
|
20
|
+
|
21
|
+
protected
|
22
|
+
def available_views
|
23
|
+
['index', 'edit', 'show', 'new', '_form']
|
24
|
+
end
|
25
|
+
|
26
|
+
def handler
|
27
|
+
:pom
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coprl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.beta.
|
4
|
+
version: 3.0.0.beta.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Edens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ice_nine
|
@@ -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
|