diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ad8c8ae..facde8ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v0.2.10 +## 06/14/2021 + +1. [](#new) + * add config Option to add jquery asset in case the used Theme does not. + * add Frontmatter Variable lang to allow override of language for page + # v0.2.9 ## 05/20/2021 diff --git a/README.md b/README.md index 0ce958d0..a63d12b4 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,11 @@ Here is the default configuration and an explanation of available options: ```yaml enabled: true -colors: #3a87ad # see additional Note on custom colors in the Changelog +colors: "#3a87ad" # see additional Note on custom colors in the Changelog, be sure to use single or double quotes around list ! showlegend: false # set to true to show calendar File Name(s) as Legend below grid weekNumbers: false # set to true to show Week Numbers cors_api_url: # the default value is now empty as the formerly used external proxy, https://cors-anywhere.herokuapp.com/ , will no longer work +addJquery: false # Add Jquery asset in case your Theme does not do this ``` diff --git a/assets/calendar.js b/assets/calendar.js index 37fd59cc..86f6994c 100644 --- a/assets/calendar.js +++ b/assets/calendar.js @@ -2,7 +2,7 @@ // gets Parameters via DOM, see below jQuery(document).ready(function () { - var verbose = false; + var verbose = true; var defaultLocale = 'en'; var cfgWeekNums = jQuery('#weeknums').text(); // get Paramter from DOM weekNums = false; diff --git a/blueprints.yaml b/blueprints.yaml index e5bac406..a95b5809 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: FullCalendar -version: 0.2.9 +version: 0.2.10 description: show Calendar Widget from ICS File(s), based on fullcalendar.io icon: calendar author: @@ -46,11 +46,20 @@ form: type: text size: large label: Calendar(s) Colors - help: Comma separated List of valid html Colors, e.g. Red,LightBlue or '#DEFFAB,#GADEEF + help: Comma separated List of valid html Colors, e.g. Red,LightBlue or '#DEFFAB,#GADEEF' cors_api_url: type: text size: large label: local Cors API URL default: help: leave this empty if you are not sure - it will be evaluated automatically and mostly work ! - see README + addJquery: + type: toggle + label: Add Jquery + help: Add Jquery asset in case your Theme does not do this + highlight: 1 + default: 0 + options: + 1: Enabled + 0: Disabled \ No newline at end of file diff --git a/fullcalendar.php b/fullcalendar.php index 78bdeb5d..c519de7a 100644 --- a/fullcalendar.php +++ b/fullcalendar.php @@ -43,6 +43,9 @@ private function addAssets() { /** @var Assets */ $assets = $this->grav['assets']; + $config = $this->config->get('plugins.fullcalendar'); + if ($config['addJquery']) + $assets->add('jquery', 100); // add jquery on demand (in case Theme does not do this) $assets->addJs('plugins://' . $this->name . '/assets/jquery.ajax-cross-origin.min.js', ['group' => 'bottom']); // 12.05.21 - so gehts !!! $assets->addJs('plugins://' . $this->name . '/assets/ical.js/build/ical.min.js', ['group' => 'bottom']); // see also reamde.txt file there // for Tooltip: @@ -60,7 +63,21 @@ private function addAssets() $assets->addJs('plugins://' . $this->name . '/assets/calendar.js', ['group' => 'bottom']); $assets->addCss('plugins://' . $this->name . '/assets/daygrid.css'); // default CSS for #calendar $language = $this->grav['language']->getLanguage(); + // dump($language); $assets->addJs('plugins://' . $this->name . '/fc4/packages/core/locales/'.$language.'.js', ['group' => 'bottom']); + $languages = $this->config->get('system.languages.supported'); + // $languages = ['en','it']; + // dump($languages); + foreach ($languages as $lang) { + // dump($lang); + if ($lang != $language) { + $asset = 'plugins://' . $this->name . '/fc4/packages/core/locales/'.$lang.'.js'; + // dump($asset); + $assets->addJs('plugins://' . $this->name . '/fc4/packages/core/locales/'.$lang.'.js', ['group' => 'bottom']); + } + } + /* + */ } public function onTwigTemplatePaths() diff --git a/templates/calendar.html.twig b/templates/calendar.html.twig index bd19e63a..bc93bddc 100644 --- a/templates/calendar.html.twig +++ b/templates/calendar.html.twig @@ -29,6 +29,17 @@ {% if (num_mpics|int) >= 12 %} {# 12 pics sollten für 1 Jahr reichen :-) #}
{% endif %} + + {% set lang = grav.language.getLanguage %} + {# + {{ lang }} + {{ page.header.lang }} + #} + {% if page.header.lang|length > 0 %} + {% set lang = page.header.lang %} + {% endif %} + + {% if (numcalendars|int) > 0 %} {# write local page calendars to DOM, json encoded #} {% endif %} diff --git a/templates/partials/fullcalendar.html.twig b/templates/partials/fullcalendar.html.twig index a6e411a8..f79c5941 100644 --- a/templates/partials/fullcalendar.html.twig +++ b/templates/partials/fullcalendar.html.twig @@ -7,6 +7,7 @@ - +{# hat keinen Zugriff auf page header !!! +#}