File tree Expand file tree Collapse file tree 1 file changed +2
-28
lines changed Expand file tree Collapse file tree 1 file changed +2
-28
lines changed Original file line number Diff line number Diff line change @@ -13,34 +13,8 @@ defmodule Backpex.HTML.Layout do
13
13
14
14
def layout ( assigns ) do
15
15
case assigns . live_resource . config ( :layout ) do
16
- { module , fun } ->
17
- apply ( module , fun , [ assigns ] )
18
-
19
- fun when is_function ( fun , 1 ) ->
20
- fun . ( assigns )
21
-
22
- wrong_config ->
23
- raise ArgumentError , """
24
- Invalid layout configuration for Backpex LiveResource.
25
-
26
- Expected one of:
27
- • A tuple with module and function: {MyAppWeb.Layouts, :admin}
28
- • A function reference: &MyAppWeb.Layouts.admin/1
29
-
30
- Got: #{ inspect ( wrong_config ) }
31
-
32
- Examples of valid configurations:
33
-
34
- # Option 1: Module and function tuple
35
- use Backpex.LiveResource,
36
- layout: {MyAppWeb.Layouts, :admin}
37
-
38
- # Option 2: Function capture
39
- use Backpex.LiveResource,
40
- layout: &MyAppWeb.Layouts.admin/1
41
-
42
- Make sure your layout function accepts assigns and returns rendered HTML.
43
- """
16
+ { module , fun } -> apply ( module , fun , [ assigns ] )
17
+ fun when is_function ( fun , 1 ) -> fun . ( assigns )
44
18
end
45
19
end
46
20
You can’t perform that action at this time.
0 commit comments