frontyard 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72576ecd3dce51ced4bb38029d7f98fb5a62cd9ec7739fb68b6b348a09fde469
|
|
4
|
+
data.tar.gz: c55e4d16f9216196db52fdee4123d256cdfe0bb3df24cc544161910eb261e476
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cff6d014483d8dfd857e160ce0dc13107d07e6d55aba706ef558d62ea39d47e9b9756f2e6ba8981fb376c1b13a2e6fd73a4c0fbdc634b3abeba8c51d576e912b
|
|
7
|
+
data.tar.gz: f59cc1d59f38471dbf8d1ea0f01de6fde5c76541b4a5fdb554392ad90c014b4b1e9902e7ccd556b8869cafa0a174b4dcafc1ec840765276f9034ca447618c65d
|
data/Rakefile
CHANGED
|
@@ -73,8 +73,7 @@ module Frontyard
|
|
|
73
73
|
]
|
|
74
74
|
end.to_h
|
|
75
75
|
kwargs.each do |key, value|
|
|
76
|
-
value
|
|
77
|
-
tokens["#{key}: #{value}"] = "@#{key} = #{key}"
|
|
76
|
+
tokens["#{key}: #{value.inspect}"] = "@#{key} = #{key}"
|
|
78
77
|
end
|
|
79
78
|
accessors = keys + kwargs.keys
|
|
80
79
|
keyword_args = tokens.keys
|
|
@@ -90,7 +89,7 @@ module Frontyard
|
|
|
90
89
|
end
|
|
91
90
|
|
|
92
91
|
mod.class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
|
93
|
-
def initialize(#{keyword_args.join(", ")}, **options)
|
|
92
|
+
def initialize(#{keyword_args.join(", ")}, **options, &block)
|
|
94
93
|
#{ivars.join("\n")}
|
|
95
94
|
@flash = options.delete(:flash) || {}
|
|
96
95
|
if options.key?(:html_options)
|
|
@@ -181,7 +180,7 @@ module Frontyard
|
|
|
181
180
|
render klass.new(**filtered_kwargs, &block)
|
|
182
181
|
end
|
|
183
182
|
|
|
184
|
-
def params =
|
|
183
|
+
def params = view_context.params
|
|
185
184
|
|
|
186
185
|
def view_template(&) = div(**html_options, &)
|
|
187
186
|
end
|
|
@@ -15,7 +15,7 @@ module Frontyard
|
|
|
15
15
|
def view_template(&block)
|
|
16
16
|
div(**self.class.config) do
|
|
17
17
|
# Use basic HTML label to avoid Rails helper conflicts
|
|
18
|
-
tag(:label) { attribute.to_s.humanize }
|
|
18
|
+
tag(:label) { options[:label] || attribute.to_s.humanize }
|
|
19
19
|
|
|
20
20
|
case field_type
|
|
21
21
|
when :text
|
|
@@ -59,8 +59,7 @@ module Frontyard
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def field_options
|
|
62
|
-
|
|
63
|
-
{}
|
|
62
|
+
options[:field_options] || {}
|
|
64
63
|
end
|
|
65
64
|
end
|
|
66
65
|
end
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
module Frontyard
|
|
2
2
|
module Controller
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
layout -> { _resolve_frontyard_layout }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class_methods do
|
|
10
|
+
# Set an explicit Phlex layout class for this controller.
|
|
11
|
+
#
|
|
12
|
+
# frontyard_layout Views::Layouts::AdminLayout
|
|
13
|
+
# frontyard_layout false # disable Phlex layout
|
|
14
|
+
def frontyard_layout(klass = :__unset__)
|
|
15
|
+
if klass == :__unset__
|
|
16
|
+
if defined?(@_frontyard_layout)
|
|
17
|
+
@_frontyard_layout
|
|
18
|
+
elsif superclass.respond_to?(:frontyard_layout)
|
|
19
|
+
superclass.frontyard_layout
|
|
20
|
+
end
|
|
21
|
+
else
|
|
22
|
+
@_frontyard_layout = klass
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
3
27
|
# Get the form class for the current controller
|
|
4
28
|
def form
|
|
5
29
|
namespace = controller_name.camelize
|
|
@@ -35,5 +59,24 @@ module Frontyard
|
|
|
35
59
|
render_data = symbolized_kwargs.except(*view_data.keys)
|
|
36
60
|
render klass.new(**view_data), **render_data
|
|
37
61
|
end
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
def _resolve_frontyard_layout
|
|
66
|
+
# Check for explicit layout set on the controller class
|
|
67
|
+
explicit = self.class.frontyard_layout
|
|
68
|
+
if explicit
|
|
69
|
+
return explicit
|
|
70
|
+
elsif explicit == false
|
|
71
|
+
return nil
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Convention: look for Views::Layouts::ApplicationLayout
|
|
75
|
+
begin
|
|
76
|
+
Views::Layouts::ApplicationLayout
|
|
77
|
+
rescue NameError
|
|
78
|
+
nil
|
|
79
|
+
end
|
|
80
|
+
end
|
|
38
81
|
end
|
|
39
82
|
end
|
data/lib/frontyard/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: frontyard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jim Gay
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -90,14 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
90
90
|
requirements:
|
|
91
91
|
- - ">="
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
|
-
version:
|
|
93
|
+
version: 3.4.0
|
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements:
|
|
96
96
|
- - ">="
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
98
|
version: '0'
|
|
99
99
|
requirements: []
|
|
100
|
-
rubygems_version:
|
|
100
|
+
rubygems_version: 4.0.3
|
|
101
101
|
specification_version: 4
|
|
102
102
|
summary: Frontyard is a Rails engine for creating and managing views with Phlex.
|
|
103
103
|
test_files: []
|