Add preview to articleAdd
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 3 Mar 2021 14:25:14 +0000 (15:25 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 3 Mar 2021 14:25:43 +0000 (15:25 +0100)
Resolves #3965

com.woltlab.wcf/templates/articleAdd.tpl
wcfsetup/install/files/acp/templates/articleAdd.tpl

index 6a1597d35ee03f80ef88969734c02e481cb35b6b..aeccb5ccf6f5e1d23bbf114aac21e0172eec7d4c 100644 (file)
        
        <div class="formSubmit">
                <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
+               <button id="buttonMessagePreview" class="jsOnly">{lang}wcf.global.button.preview{/lang}</button>
                <input type="hidden" name="isMultilingual" value="{@$isMultilingual}">
                <input type="hidden" name="timeNowReference" value="{@TIME_NOW}">
                {csrfToken}
        $(function() {
                WCF.Language.addObject({
                        'wcf.label.none': '{jslang}wcf.label.none{/jslang}',
+                       'wcf.global.preview': '{jslang}wcf.global.preview{/jslang}',
                });
                
                {if !$labelGroups|empty}
                        new WCF.Label.ArticleLabelChooser({ {implode from=$labelGroupsToCategories key=__labelCategoryID item=labelGroupIDs}{@$__labelCategoryID}: [ {implode from=$labelGroupIDs item=labelGroupID}{@$labelGroupID}{/implode} ] {/implode} }, { {implode from=$labelIDs key=groupID item=labelID}{@$groupID}: {@$labelID}{/implode} }, '.articleAddForm');
                {/if}
+               
+               new WCF.Message.I18nPreview({
+                       messageFields: [
+                               {if !$isMultilingual}
+                                       'content0',
+                               {else}
+                                       {implode from=$availableLanguages item=availableLanguage}'content{$availableLanguage->languageID}'{/implode}
+                               {/if}
+                       ],
+                       messageObjectType: 'com.woltlab.wcf.article.content',
+                       messageObjectID: {if $action === 'edit'}{$article->articleID}{else}0{/if}
+               });
        });
 </script>
 
index 6a1597d35ee03f80ef88969734c02e481cb35b6b..aeccb5ccf6f5e1d23bbf114aac21e0172eec7d4c 100644 (file)
        
        <div class="formSubmit">
                <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
+               <button id="buttonMessagePreview" class="jsOnly">{lang}wcf.global.button.preview{/lang}</button>
                <input type="hidden" name="isMultilingual" value="{@$isMultilingual}">
                <input type="hidden" name="timeNowReference" value="{@TIME_NOW}">
                {csrfToken}
        $(function() {
                WCF.Language.addObject({
                        'wcf.label.none': '{jslang}wcf.label.none{/jslang}',
+                       'wcf.global.preview': '{jslang}wcf.global.preview{/jslang}',
                });
                
                {if !$labelGroups|empty}
                        new WCF.Label.ArticleLabelChooser({ {implode from=$labelGroupsToCategories key=__labelCategoryID item=labelGroupIDs}{@$__labelCategoryID}: [ {implode from=$labelGroupIDs item=labelGroupID}{@$labelGroupID}{/implode} ] {/implode} }, { {implode from=$labelIDs key=groupID item=labelID}{@$groupID}: {@$labelID}{/implode} }, '.articleAddForm');
                {/if}
+               
+               new WCF.Message.I18nPreview({
+                       messageFields: [
+                               {if !$isMultilingual}
+                                       'content0',
+                               {else}
+                                       {implode from=$availableLanguages item=availableLanguage}'content{$availableLanguage->languageID}'{/implode}
+                               {/if}
+                       ],
+                       messageObjectType: 'com.woltlab.wcf.article.content',
+                       messageObjectID: {if $action === 'edit'}{$article->articleID}{else}0{/if}
+               });
        });
 </script>