From 1a5a58c7570bba47683646fe6fbed48d090bef7c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 27 Jun 2019 11:33:38 +0200 Subject: [PATCH] Template synchronization was off --- .../templates/__devtoolsLanguageChooser.tpl | 16 ++++++++++++++++ com.woltlab.wcf/templates/__iconFormField.tpl | 4 +++- com.woltlab.wcf/templates/articleAdd.tpl | 4 ++-- com.woltlab.wcf/templates/formError.tpl | 2 +- com.woltlab.wcf/templates/optionFieldList.tpl | 14 ++------------ syncTemplates.json | 4 +--- .../install/files/acp/templates/formError.tpl | 2 +- 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/com.woltlab.wcf/templates/__devtoolsLanguageChooser.tpl b/com.woltlab.wcf/templates/__devtoolsLanguageChooser.tpl index fe8e59f50b..91864470cc 100644 --- a/com.woltlab.wcf/templates/__devtoolsLanguageChooser.tpl +++ b/com.woltlab.wcf/templates/__devtoolsLanguageChooser.tpl @@ -17,6 +17,22 @@ }; var callback = function(listItem) { + var languageCode = elData(listItem, 'language-code'); + if (languageCode === '{$__wcf->getLanguage()->getFixedLanguageCode()}') { + window.location.reload(); + return; + } + + var alternateLink = elBySel('link[rel="alternate"][hreflang="' + languageCode + '"]'); + if (alternateLink) { + // Check if the page does not have unique links per language, such as for the landing page. + var currentLink = elBySel('link[rel="alternate"][hreflang="{$__wcf->getLanguage()->getFixedLanguageCode()}"]'); + if (!currentLink || currentLink.href !== alternateLink.href) { + window.location = alternateLink.href; + return; + } + } + Ajax.apiOnce({ data: { actionName: 'devtoolsSetLanguage', diff --git a/com.woltlab.wcf/templates/__iconFormField.tpl b/com.woltlab.wcf/templates/__iconFormField.tpl index fe3cecf0a4..b8c8d2535d 100644 --- a/com.woltlab.wcf/templates/__iconFormField.tpl +++ b/com.woltlab.wcf/templates/__iconFormField.tpl @@ -22,7 +22,9 @@ input.value = iconName; }; - button.addEventListener('click', function() { + button.addEventListener('click', function(event) { + event.preventDefault(); + UiStyleFontAwesome.open(callback); }); }); diff --git a/com.woltlab.wcf/templates/articleAdd.tpl b/com.woltlab.wcf/templates/articleAdd.tpl index f149a9eeeb..355012dcdc 100644 --- a/com.woltlab.wcf/templates/articleAdd.tpl +++ b/com.woltlab.wcf/templates/articleAdd.tpl @@ -86,13 +86,13 @@ {include file='formError'} {if $success|isset} -

{lang}wcf.global.success.{$action}{/lang}

+

{lang}wcf.global.success.{$action}{/lang}

{/if} {if $action == 'edit'}

isDeleted} style="display: none;"{/if}>{lang}wcf.acp.article.trash.notice{/lang}

- {if $lastVersion}

{lang}wcf.acp.article.lastVersion{/lang}

{/if} + {if $lastVersion}

{lang}wcf.acp.article.lastVersion{/lang}

{/if} {/if}
diff --git a/com.woltlab.wcf/templates/formError.tpl b/com.woltlab.wcf/templates/formError.tpl index 3e8987cc86..3afcdc6925 100644 --- a/com.woltlab.wcf/templates/formError.tpl +++ b/com.woltlab.wcf/templates/formError.tpl @@ -4,4 +4,4 @@ {else} {/if} -{/if} \ No newline at end of file +{/if} diff --git a/com.woltlab.wcf/templates/optionFieldList.tpl b/com.woltlab.wcf/templates/optionFieldList.tpl index 4ed68fe6ba..740eed8e1f 100644 --- a/com.woltlab.wcf/templates/optionFieldList.tpl +++ b/com.woltlab.wcf/templates/optionFieldList.tpl @@ -1,5 +1,4 @@ {if !$isGuestGroup|isset}{assign var=isGuestGroup value=false}{/if} -{if !$groupIsOwner|isset}{assign var=groupIsOwner value=false}{/if} {foreach from=$options item=optionData} {assign var=option value=$optionData[object]} {if $errorType|is_array && $errorType[$option->optionName]|isset} @@ -8,16 +7,7 @@ {assign var=error value=''} {/if}
- - {if $isSearchMode|empty || !$optionData[hideLabelInSearch]} - - {/if} - + {if $isSearchMode|empty || !$optionData[hideLabelInSearch]}{/if}
{@$optionData[html]} {if $error} @@ -31,4 +21,4 @@ {lang __optional=true}{@$langPrefix}{$option->optionName}.description{/lang}
-{/foreach} +{/foreach} \ No newline at end of file diff --git a/syncTemplates.json b/syncTemplates.json index a4f0245991..75370394fb 100644 --- a/syncTemplates.json +++ b/syncTemplates.json @@ -8,7 +8,6 @@ "__booleanFormField", "__contentLanguageFormField", "__dateFormField", - "__devtoolsLanguageChooser", "__form", "__formButton", "__formContainer", @@ -66,7 +65,6 @@ "mediaBBCodeTag", "mediaManager", "multipleLanguageInputJavascript", - "optionFieldList", "radioButtonSearchableOptionType", "recaptcha", "scrollablePageCheckboxList", @@ -80,4 +78,4 @@ "wysiwyg", "wysiwygToolbar" ] -} \ No newline at end of file +} diff --git a/wcfsetup/install/files/acp/templates/formError.tpl b/wcfsetup/install/files/acp/templates/formError.tpl index 3e8987cc86..3afcdc6925 100644 --- a/wcfsetup/install/files/acp/templates/formError.tpl +++ b/wcfsetup/install/files/acp/templates/formError.tpl @@ -4,4 +4,4 @@ {else} {/if} -{/if} \ No newline at end of file +{/if} -- 2.20.1