-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
AutoField.soy
178 lines (160 loc) · 5.33 KB
/
AutoField.soy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{namespace com.liferay.asset.list.web.AutoField}
/**
* Renders the main element
*/
{template .render}
{@param categorySelectorURL: string}
{@param groupIds: string}
{@param id: string}
{@param? namespace: string}
{@param pathThemeImages: string}
{@param rules: list<[type: string, queryAndOperator: bool, queryContains: bool]>}
{@param tagSelectorURL: string}
{@param vocabularyIds: string}
{@param? queryLogicIndexes: string}
<div id="{$id}">
<input
name="{$namespace}queryLogicIndexes"
type="hidden"
value="{$queryLogicIndexes}"
>
<ul class="timeline">
<li class="timeline-item">
<div class="flex-container panel-body">
<div class="timeline-increment">
<span class="timeline-icon"></span>
</div>
</div>
</li>
{if $rules and length($rules) > 0}
{foreach $rule in $rules}
{let $ruleIndex: index($rule) /}
{call .rule}
{param categorySelectorURL: $categorySelectorURL /}
{param groupIds: $groupIds /}
{param index: $ruleIndex /}
{param namespace: $namespace /}
{param pathThemeImages: $pathThemeImages /}
{param rule: $rule /}
{param tagSelectorURL: $tagSelectorURL /}
{param vocabularyIds: $vocabularyIds /}
{/call}
{/foreach}
{/if}
</ul>
{call .addRuleButton}
{param pathThemeImages: $pathThemeImages /}
{/call}
</div>
{/template}
/**
* Renders the Add Button at the bottom of the timeline
*/
{template .addRuleButton}
{@param pathThemeImages: string}
<div class="addbutton-timeline-item">
<div class="add-condition timeline-increment-icon">
<button
class="btn btn-monospaced btn-primary btn-xs form-builder-timeline-add-item form-builder-rule-add-condition"
data-onclick="addRule_"
type="button"
>
<svg class="icon-monospaced lexicon-icon">
<use xlink:href="{$pathThemeImages}/lexicon/icons.svg#plus"></use>
</svg>
</button>
</div>
</div>
{/template}
/**
* Renders a Rule item
*/
{template .rule}
{@param categorySelectorURL: string}
{@param groupIds: string}
{@param index: int}
{@param? namespace: string}
{@param pathThemeImages: string}
{@param rule: [type: string, queryAndOperator: bool, queryContains: bool]}
{@param tagSelectorURL: string}
{@param vocabularyIds: string}
<li class="timeline-item">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group">
<select class="form-control" id="{$namespace}queryContains{$index}" name="{$namespace}queryContains{$index}" title="Query Contains">
<option class="" {if $rule.queryContains}selected="selected"{/if} value="true">{msg desc=""}contains{/msg}</option>
<option class="" {if not $rule.queryContains}selected="selected"{/if} value="false">{msg desc=""}does-not-contain{/msg}</option>
</select>
</div>
<div class="form-group">
<select class="form-control" id="{$namespace}queryAndOperator{$index}" name="{$namespace}queryAndOperator{$index}" title="And Operator">
<option class="" {if $rule.queryAndOperator}selected="selected"{/if} value="true">{msg desc=""}all{/msg}</option>
<option class="" {if not $rule.queryAndOperator}selected="selected"{/if}>{msg desc=""}any{/msg}</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="{$namespace + 'queryName' + $index}">{msg desc=""}of-the-following{/msg}</label>
</div>
<div class="form-group">
<select
class="form-control asset-query-name"
data-item-index="{$index}"
data-onchange="changeSelector_"
id="{$namespace + 'queryName' + $index}"
name="{$namespace + 'queryName' + $index}"
>
<option class="" {if $rule.type == 'assetCategories'}selected="selected"{/if} value="assetCategories">{msg desc=""}categories{/msg}</option>
<option class="" {if $rule.type == 'assetTags'}selected="selected"{/if} value="assetTags">{msg desc=""}tags{/msg}</option>
</select>
</div>
{if $rule.type == 'assetCategories'}
{call com.liferay.asset.list.web.CategorySelector.render}
{param eventName: $namespace + 'selectCategory' /}
{param groupIds: $groupIds /}
{param index: $index /}
{param namespace: $namespace /}
{param categorySelectorURL: $categorySelectorURL /}
{param rule: $rule /}
{param vocabularyIds: $vocabularyIds /}
{/call}
{else}
{call com.liferay.asset.list.web.TagSelector.render}
{param eventName: $namespace + 'selectTag' /}
{param groupIds: $groupIds /}
{param index: $index /}
{param namespace: $namespace /}
{param tagSelectorURL: $tagSelectorURL /}
{param rule: $rule /}
{/call}
{/if}
<div class="timeline-increment">
<span class="timeline-icon"></span>
</div>
</div>
</div>
{call .trashButton}
{param pathThemeImages: $pathThemeImages /}
{param ruleId: $index /}
{/call}
</li>
{/template}
/**
* Renders a trash button that allows deleting the current rule row
*/
{template .trashButton}
{@param pathThemeImages: string}
{@param ruleId: int}
<div class="container-trash">
<button
class="btn btn-link btn-monospaced btn-xs condition-card-delete"
data-onclick="deleteRule_"
data-rule-id="{$ruleId}"
type="button"
>
<svg class="icon-monospaced lexicon-icon">
<use xlink:href="{$pathThemeImages}/lexicon/icons.svg#trash"></use>
</svg>
</button>
</div>
{/template}