Move calendar/event stylesheets/scripts registration to modules
- Add media parameter to Page->registerStylesheet - Fixes CSS precedence with custom theme stylesheet
This commit is contained in:
parent
4b15b9fe56
commit
2e286d6a57
|
@ -105,6 +105,11 @@ function cal_content(App $a)
|
|||
// get the translation strings for the callendar
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.min.css');
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.print.min.css', 'print');
|
||||
DI::page()->registerFooterScript('view/asset/moment/min/moment-with-locales.min.js');
|
||||
DI::page()->registerFooterScript('view/asset/fullcalendar/dist/fullcalendar.min.js');
|
||||
|
||||
$htpl = Renderer::getMarkupTemplate('event_head.tpl');
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
|
||||
'$module_url' => '/cal/' . $a->data['user']['nickname'],
|
||||
|
|
|
@ -256,6 +256,11 @@ function events_content(App $a)
|
|||
// get the translation strings for the callendar
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.min.css');
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.print.min.css', 'print');
|
||||
DI::page()->registerFooterScript('view/asset/moment/min/moment-with-locales.min.js');
|
||||
DI::page()->registerFooterScript('view/asset/fullcalendar/dist/fullcalendar.min.js');
|
||||
|
||||
$htpl = Renderer::getMarkupTemplate('event_head.tpl');
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
|
||||
'$module_url' => '/events',
|
||||
|
|
|
@ -165,11 +165,10 @@ class Page implements ArrayAccess
|
|||
* The path can be absolute or relative to the Friendica installation base folder.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @param string $media
|
||||
* @see Page::initHead()
|
||||
*
|
||||
*/
|
||||
public function registerStylesheet($path)
|
||||
public function registerStylesheet($path, string $media = 'screen')
|
||||
{
|
||||
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
|
||||
|
||||
|
@ -177,7 +176,7 @@ class Page implements ArrayAccess
|
|||
$path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR));
|
||||
}
|
||||
|
||||
$this->stylesheets[] = trim($path, '/');
|
||||
$this->stylesheets[trim($path, '/')] = $media;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,7 +251,7 @@ class Page implements ArrayAccess
|
|||
'$shortcut_icon' => $shortcut_icon,
|
||||
'$touch_icon' => $touch_icon,
|
||||
'$block_public' => intval($config->get('system', 'block_public')),
|
||||
'$stylesheets' => array_unique($this->stylesheets),
|
||||
'$stylesheets' => $this->stylesheets,
|
||||
]) . $this->page['htmlhead'];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
|
||||
<link rel="stylesheet" type="text/css" href="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" />
|
||||
<link rel="stylesheet" type="text/css" href="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.print.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" media="print" />
|
||||
<script type="text/javascript" src="{{$baseurl}}/view/asset/moment/min/moment-with-locales.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
<script type="text/javascript" src="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
|
||||
<script>
|
||||
function showEvent(eventid) {
|
||||
$.get(
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<link rel="stylesheet" href="view/asset/jquery-datetimepicker/build/jquery.datetimepicker.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" type="text/css" media="screen" />
|
||||
<link rel="stylesheet" href="view/asset/perfect-scrollbar/dist/css/perfect-scrollbar.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" type="text/css" media="screen" />
|
||||
|
||||
{{foreach $stylesheets as $stylesheetUrl}}
|
||||
<link rel="stylesheet" href="{{$stylesheetUrl}}" type="text/css" media="screen" />
|
||||
{{foreach $stylesheets as $stylesheetUrl => $media}}
|
||||
<link rel="stylesheet" href="{{$stylesheetUrl}}" type="text/css" media="{{$media}}" />
|
||||
{{/foreach}}
|
||||
|
||||
<link rel="shortcut icon" href="{{$shortcut_icon}}" />
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
<link rel="stylesheet" type="text/css" href="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" />
|
||||
<link rel="stylesheet" type="text/css" href="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.print.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" media="print" />
|
||||
<link rel="stylesheet" type="text/css" href="view/theme/frio/css/mod_events.css?v={{$smarty.const.FRIENDICA_VERSION}}" />
|
||||
<script type="text/javascript" src="{{$baseurl}}/view/asset/moment/min/moment-with-locales.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
<script type="text/javascript" src="{{$baseurl}}/view/asset/fullcalendar/dist/fullcalendar.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
<script type="text/javascript" src="view/theme/frio/js/mod_events.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
<link rel="stylesheet" href="view/theme/frio/frameworks/bootstrap-toggle/css/bootstrap-toggle.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" type="text/css" media="screen"/>
|
||||
<link rel="stylesheet" href="view/theme/frio/font/open_sans/open-sans.css?v={{$smarty.const.FRIENDICA_VERSION}}" type="text/css" media="screen"/>
|
||||
|
||||
{{foreach $stylesheets as $stylesheetUrl}}
|
||||
<link rel="stylesheet" href="{{$stylesheetUrl}}" type="text/css" media="screen" />
|
||||
{{/foreach}}
|
||||
|
||||
{{* own css files *}}
|
||||
<link rel="stylesheet" href="view/theme/frio/css/hovercard.css?v={{$smarty.const.FRIENDICA_VERSION}}" type="text/css" media="screen"/>
|
||||
<link rel="stylesheet" href="view/theme/frio/css/font-awesome.custom.css?v={{$smarty.const.FRIENDICA_VERSION}}" type="text/css" media="screen"/>
|
||||
|
||||
{{foreach $stylesheets as $stylesheetUrl => $media}}
|
||||
<link rel="stylesheet" href="{{$stylesheetUrl}}" type="text/css" media="{{$media}}" />
|
||||
{{/foreach}}
|
||||
|
||||
<link rel="shortcut icon" href="{{$shortcut_icon}}" />
|
||||
<link rel="apple-touch-icon" href="{{$touch_icon}}"/>
|
||||
|
||||
|
|
Loading…
Reference in a new issue