Commit | Line | Data |
---|---|---|
a63f9b97 | 1 | <span{if $field->getValue()} class="icon icon64 fa-{$field->getValue()}"{/if} id="{@$field->getPrefixedId()}_icon"></span> |
aa6f8535 MS |
2 | {if !$field->isImmutable()} |
3 | <a href="#" class="button small" id="{@$field->getPrefixedId()}_openIconDialog">{lang}wcf.global.button.edit{/lang}</a> | |
a63f9b97 | 4 | {/if} |
aa6f8535 | 5 | <input type="hidden" id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}" value="{$field->getValue()}"> |
a63f9b97 | 6 | |
aa6f8535 MS |
7 | {if !$field->isImmutable()} |
8 | {if $__iconFormFieldIncludeJavaScript} | |
9 | {include file='fontAwesomeJavaScript'} | |
10 | {/if} | |
11 | ||
12 | <script data-relocate="true"> | |
13 | require(['WoltLabSuite/Core/Ui/Style/FontAwesome'], function(UiStyleFontAwesome) { | |
14 | var button = elById('{@$field->getPrefixedId()}_openIconDialog'); | |
15 | var icon = elById('{@$field->getPrefixedId()}_icon'); | |
16 | var input = elById('{@$field->getPrefixedId()}'); | |
17 | ||
18 | var callback = function(iconName) { | |
19 | icon.className = 'icon icon64 fa-' + iconName; | |
20 | input.value = iconName; | |
21 | }; | |
22 | ||
1a5a58c7 AE |
23 | button.addEventListener('click', function(event) { |
24 | event.preventDefault(); | |
25 | ||
aa6f8535 MS |
26 | UiStyleFontAwesome.open(callback); |
27 | }); | |
a63f9b97 | 28 | }); |
aa6f8535 MS |
29 | </script> |
30 | {/if} |