Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormBuilder for tags #6072

Open
wants to merge 1 commit into
base: 6.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions wcfsetup/install/files/acp/templates/__tagFormSynonym.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<dl>
<dt><label for="synonyms">{lang}wcf.acp.tag.synonymFor{/lang}</label></dt>
<dd>
<a href="{link controller='TagEdit' id=$synonym->tagID}{/link}" class="badge tag">{$synonym->name}</a>
</dd>
</dl>
83 changes: 1 addition & 82 deletions wcfsetup/install/files/acp/templates/tagAdd.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,87 +14,6 @@
</nav>
</header>

{include file='shared_formNotice'}

<form method="post" action="{if $action == 'add'}{link controller='TagAdd'}{/link}{else}{link controller='TagEdit' object=$tagObj}{/link}{/if}">
<div class="section">
<dl{if $errorField == 'name'} class="formError"{/if}>
<dt><label for="name">{lang}wcf.global.name{/lang}</label></dt>
<dd>
<input type="text" id="name" name="name" value="{$name}" required autofocus class="long">
{if $errorField == 'name'}
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{elseif $errorType == 'duplicate'}
{lang}wcf.acp.tag.error.name.duplicate{/lang}
{/if}
</small>
{/if}
</dd>
</dl>

{hascontent}
<dl{if $errorField == 'languageID' || $action == 'edit'} class="{if $action == 'edit'}disabled{else}formError{/if}"{/if}>
<dt><label for="languageID">{lang}wcf.acp.tag.languageID{/lang}</label></dt>
<dd>
<select id="languageID" name="languageID"{if $action == 'edit'} disabled{/if}>
{content}
{foreach from=$availableLanguages item=language}
<option value="{$language->languageID}"{if $languageID == $language->languageID} selected{/if}>{$language->languageName} ({$language->languageCode})</option>
{/foreach}
{/content}
</select>
{if $errorField == 'languageID'}
<small class="innerError">
{lang}wcf.acp.tag.error.languageID.{$errorType}{/lang}
</small>
{/if}
</dd>
</dl>
{/hascontent}

{if !$tagObj|isset || $tagObj->synonymFor === null}
<dl>
<dt><label for="synonyms">{lang}wcf.acp.tag.synonyms{/lang}</label></dt>
<dd>
<input id="synonyms" type="text" value="" class="long">
</dd>
</dl>

<script data-relocate="true">
require(['WoltLabSuite/Core/Ui/ItemList'], function(UiItemList) {
UiItemList.init(
'synonyms',
[{if !$synonyms|empty}{implode from=$synonyms item=synonym}'{$synonym|encodeJS}'{/implode}{/if}],
{
ajax: {
className: 'wcf\\data\\tag\\TagAction'
},
maxLength: {@TAGGING_MAX_TAG_LENGTH},
submitFieldName: 'tags[]'
}
);
});
</script>
{elseif $tagObj|isset}
<dl>
<dt><label for="synonyms">{lang}wcf.acp.tag.synonymFor{/lang}</label></dt>
<dd>
<a href="{link controller='TagEdit' id=$tagObj->synonymFor}{/link}" class="badge tag">{$synonym->name}</a>
</dd>
</dl>
{/if}

{event name='dataFields'}
</div>

{event name='sections'}

<div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
{csrfToken}
</div>
</form>
{unsafe:$form->getHtml()}

{include file='footer'}
Loading
Loading