Skip to content

Commit c4d4d25

Browse files
authored
Merge pull request #6597 from WoltLab/63-label-group-add-form-builder
Reactor `LabelGroupAddForm` to a FormBuilder form
2 parents 42ef713 + 943cd88 commit c4d4d25

4 files changed

Lines changed: 218 additions & 402 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<script data-relocate="true">
2+
require(["WoltLabSuite/Core/Acp/Component/Label/Availability"], ({ setup }) => {
3+
setup();
4+
});
5+
</script>
6+
7+
<div id="connect">
8+
{foreach from=$labelObjectTypeContainers item=container}
9+
<dl>
10+
<dt>{$container->getTitle()}</dt>
11+
<dd>
12+
<ul class="structuredList">
13+
{foreach from=$container item=objectType}
14+
<li class="{if $objectType->isCategory()} category{/if}"{if $objectType->getDepth()} style="padding-left: {$objectType->getDepth() * 20}px"{/if} data-depth="{$objectType->getDepth()}">
15+
<span>{$objectType->getLabel()}</span>
16+
<label><input id="checkbox_{$container->objectTypeID}_{$objectType->getObjectID()}" type="checkbox" name="objectTypes[{$container->objectTypeID}][]" value="{$objectType->getObjectID()}"{if $objectType->getOptionValue()} checked{/if}></label>
17+
</li>
18+
{/foreach}
19+
</ul>
20+
</dd>
21+
</dl>
22+
{/foreach}
23+
</div>

wcfsetup/install/files/acp/templates/labelGroupAdd.tpl

Lines changed: 6 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,36 @@
11
{include file='header' pageTitle='wcf.acp.label.group.'|concat:$action}
22

3-
{include file='aclPermissions'}
4-
<script data-relocate="true">
5-
require(["WoltLabSuite/Core/Acp/Component/Label/Availability"], ({ setup }) => {
6-
setup();
7-
});
8-
</script>
9-
10-
{if !$groupID|isset}
11-
{include file='shared_aclPermissionJavaScript' containerID='groupPermissions'}
12-
{else}
13-
{include file='shared_aclPermissionJavaScript' containerID='groupPermissions' objectID=$groupID}
14-
{/if}
15-
16-
{assign var=labelForceSelection value=$forceSelection}
17-
183
<header class="contentHeader">
194
<div class="contentHeaderTitle">
205
<h1 class="contentTitle">{lang}wcf.acp.label.group.{$action}{/lang}</h1>
216
</div>
22-
7+
238
<nav class="contentHeaderNavigation">
249
<ul>
2510
{if $action == 'edit'}
26-
{if !$labelGroup->sortAlphabetically}
11+
{if !$formObject->sortAlphabetically}
2712
<li><button type="button" class="button jsChangeShowOrder">{icon name='up-down'} <span>{lang}wcf.global.changeShowOrder{/lang}</span></button></li>
2813
{/if}
2914
<li>
3015
{unsafe:$interactionContextMenu->render()}
3116
</li>
3217
{/if}
33-
18+
3419
{event name='contentHeaderNavigation'}
3520
</ul>
3621
</nav>
3722
</header>
3823

39-
{include file='shared_formNotice'}
40-
41-
<form method="post" action="{if $action == 'add'}{link controller='LabelGroupAdd'}{/link}{else}{link controller='LabelGroupEdit' object=$labelGroup}{/link}{/if}">
42-
<div class="section tabMenuContainer">
43-
<nav class="tabMenu">
44-
<ul>
45-
<li><a href="#general">{lang}wcf.global.form.data{/lang}</a></li>
46-
<li><a href="#connect">{lang}wcf.acp.label.group.category.connect{/lang}</a></li>
47-
</ul>
48-
</nav>
49-
50-
<div id="general" class="tabMenuContent">
51-
<div class="section">
52-
<dl{if $errorField == 'groupName'} class="formError"{/if}>
53-
<dt><label for="groupName">{lang}wcf.global.title{/lang}</label></dt>
54-
<dd>
55-
<input type="text" id="groupName" name="groupName" value="{$i18nPlainValues['groupName']}" autofocus class="long" maxlength="80">
56-
{if $errorField == 'groupName'}
57-
<small class="innerError">
58-
{if $errorType == 'empty' || $errorType == 'multilingual'}
59-
{lang}wcf.global.form.error.{$errorType}{/lang}
60-
{else}
61-
{lang}wcf.acp.label.group.groupName.error.{$errorType}{/lang}
62-
{/if}
63-
</small>
64-
{/if}
65-
<small>{lang}wcf.acp.label.group.groupName.description{/lang}</small>
66-
{include file='shared_multipleLanguageInputJavascript' elementIdentifier='groupName' forceSelection=false}
67-
</dd>
68-
</dl>
69-
70-
<dl>
71-
<dt><label for="groupDescription">{lang}wcf.global.description{/lang}</label></dt>
72-
<dd>
73-
<input type="text" id="groupDescription" name="groupDescription" class="long" value="{$groupDescription}" maxlength="255">
74-
<small>{lang}wcf.acp.label.group.groupDescription.description{/lang}</small>
75-
</dd>
76-
</dl>
77-
78-
<dl>
79-
<dt><label for="showOrder">{lang}wcf.global.showOrder{/lang}</label></dt>
80-
<dd>
81-
<input type="number" min="0" id="showOrder" name="showOrder" class="tiny" value="{if $showOrder}{$showOrder}{/if}">
82-
</dd>
83-
</dl>
84-
85-
<dl>
86-
<dt></dt>
87-
<dd><label><input type="checkbox" name="forceSelection" id="forceSelection" value="1"{if $labelForceSelection} checked{/if}> {lang}wcf.acp.label.group.forceSelection{/lang}</label></dd>
88-
</dl>
89-
90-
<dl>
91-
<dt></dt>
92-
<dd><label><input type="checkbox" name="sortAlphabetically" id="sortAlphabetically" value="1"{if $sortAlphabetically} checked{/if}> {lang}wcf.acp.label.group.sortAlphabetically{/lang}</label></dd>
93-
</dl>
94-
95-
<dl id="groupPermissions">
96-
<dt>{lang}wcf.acl.permissions{/lang}</dt>
97-
<dd></dd>
98-
</dl>
99-
100-
{event name='dataFields'}
101-
</div>
102-
103-
{event name='generalSections'}
104-
</div>
105-
106-
<div id="connect" class="tabMenuContent">
107-
<div class="section">
108-
{foreach from=$labelObjectTypeContainers item=container}
109-
<dl>
110-
<dt>{$container->getTitle()}</dt>
111-
<dd>
112-
<ul class="structuredList">
113-
{foreach from=$container item=objectType}
114-
<li class="{if $objectType->isCategory()} category{/if}"{if $objectType->getDepth()} style="padding-left: {$objectType->getDepth() * 20}px"{/if} data-depth="{$objectType->getDepth()}">
115-
<span>{$objectType->getLabel()}</span>
116-
<label><input id="checkbox_{$container->objectTypeID}_{$objectType->getObjectID()}" type="checkbox" name="objectTypes[{$container->objectTypeID}][]" value="{$objectType->getObjectID()}"{if $objectType->getOptionValue()} checked{/if}></label>
117-
</li>
118-
{/foreach}
119-
</ul>
120-
</dd>
121-
</dl>
122-
{/foreach}
123-
</div>
124-
125-
{event name='connectSections'}
126-
</div>
127-
</div>
128-
129-
<div class="formSubmit">
130-
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
131-
{csrfToken}
132-
</div>
133-
</form>
24+
{unsafe:$form->getHtml()}
13425

135-
{if $action == 'edit' && !$labelGroup->sortAlphabetically}
26+
{if $action == 'edit' && !$formObject->sortAlphabetically}
13627
<script data-relocate="true">
13728
require(["WoltLabSuite/Core/Component/ChangeShowOrder"], ({ setup }) => {
13829
{jsphrase name='wcf.global.changeShowOrder'}
13930
14031
setup(
14132
document.querySelector('.jsChangeShowOrder'),
142-
'core/labels/groups/{$labelGroup->groupID}/labels/show-order'
33+
'core/labels/groups/{$formObject->groupID}/labels/show-order'
14334
);
14435
});
14536
</script>

0 commit comments

Comments
 (0)