* Make preview_iframe.tpl template files load the proper frontend

CSS file, including cache-busting version string when changing
     themes

References #302
This commit is contained in:
Garvin Hicking 2015-03-18 13:31:46 +01:00
parent 8b863d5370
commit 93e781048c
6 changed files with 28 additions and 1 deletions

View File

@ -58,6 +58,10 @@ Version 2.1 ()
Version 2.0.2 ()
------------------------------------------------------------------------
* Make preview_iframe.tpl template files load the proper frontend
CSS file, including cache-busting version string when changing
themes
* Implement patch to properly initiate templates_c on installation
for shared installs (thanks to fugue88)

View File

@ -999,6 +999,8 @@ function serendipity_smarty_init($vars = array()) {
}
if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
$serendipity['smarty_vars']['head_link_stylesheet_frontend'] = serendipity_rewriteURL('serendipity.css');
if (IN_serendipity_admin === true) {
$serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity_admin.css');
} else {
@ -1008,8 +1010,10 @@ function serendipity_smarty_init($vars = array()) {
// When templates are switched, append a specific version string to make sure the browser does not cache the CSS
if (strstr($serendipity['smarty_vars']['head_link_stylesheet'], '?')) {
$serendipity['smarty_vars']['head_link_stylesheet'] .= '&v=' . $serendipity['last_template_change'];
$serendipity['smarty_vars']['head_link_stylesheet_frontend'] .= '&v=' . $serendipity['last_template_change'];
} else {
$serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . $serendipity['last_template_change'];
$serendipity['smarty_vars']['head_link_stylesheet_frontend'] .= '?v=' . $serendipity['last_template_change'];
}
}
@ -1062,6 +1066,7 @@ function serendipity_smarty_init($vars = array()) {
'head_subtitle' => $serendipity['head_subtitle'],
'head_link_stylesheet' => $serendipity['smarty_vars']['head_link_stylesheet'],
'head_link_script' => $serendipity['smarty_vars']['head_link_script'],
'head_link_stylesheet_frontend' => $serendipity['smarty_vars']['head_link_stylesheet_frontend'],
'is_xhtml' => true,
'use_popups' => $serendipity['enablePopup'],

View File

@ -21,7 +21,11 @@
{elseif $template_option.webfonts == 'dserif'}
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700,700italic">
{/if}
{if $head_link_stylesheet_frontend}
<link rel="stylesheet" href="{$head_link_stylesheet_frontend}">
{else}
<link rel="stylesheet" href="{$serendipityHTTPPath}{$serendipityRewritePrefix}serendipity.css">
{/if}
<script src="{serendipity_getFile file="admin/js/modernizr-2.8.3.min.js"}"></script>
{serendipity_hookPlugin hook="backend_header" hookAll="true"}
<script src="{serendipity_getFile file='admin/js/plugins.js'}"></script>

View File

@ -10,6 +10,12 @@
<meta name="generator" content="Serendipity v.{$serendipityVersion}" />
<link rel="stylesheet" type="text/css" href="{serendipity_getFile file="base.css"}" />
<link rel="stylesheet" type="text/css" href="{$head_link_stylesheet}" />
{if $head_link_stylesheet_frontend}
<link rel="stylesheet" href="{$head_link_stylesheet_frontend}">
{else}
<link rel="stylesheet" href="{$serendipityHTTPPath}{$serendipityRewritePrefix}serendipity.css">
{/if}
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="{serendipity_getFile file="ie6.css"}" />
<![endif]-->

View File

@ -11,7 +11,11 @@
<title>{$CONST.SERENDIPITY_ADMIN_SUITE}</title>
<meta http-equiv="Content-Type" content="text/html; charset={$head_charset}" />
<meta name="generator" content="Serendipity v.{$serendipityVersion}" />
<link rel="stylesheet" href="{$serendipityHTTPPath}{$serendipityRewritePrefix}serendipity.css" />
{if $head_link_stylesheet_frontend}
<link rel="stylesheet" href="{$head_link_stylesheet_frontend}">
{else}
<link rel="stylesheet" href="{$serendipityHTTPPath}{$serendipityRewritePrefix}serendipity.css">
{/if}
<script type="text/javascript">
window.onload = function() {ldelim}
parent.document.getElementById('serendipity_iframe').style.height = document.getElementById('mainpane').offsetHeight

View File

@ -19,7 +19,11 @@
{elseif $template_option.webfonts == 'dserif'}
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700,700italic">
{/if}
{if $head_link_stylesheet_frontend}
<link rel="stylesheet" href="{$head_link_stylesheet_frontend}">
{else}
<link rel="stylesheet" href="{$serendipityHTTPPath}{$serendipityRewritePrefix}serendipity.css">
{/if}
<!--[if lte IE 8]>
<link rel="stylesheet" href="{serendipity_getFile file="oldie.css"}">
<![endif]-->