From 61ec2fdcc2f377db18473f779e84ce3c8831821d Mon Sep 17 00:00:00 2001 From: Sommerregen Date: Sat, 21 Feb 2015 20:01:30 +0100 Subject: [PATCH 1/2] Refactored code and implemented new param_sep variable from Grav 0.9.18 --- README.md | 6 ++-- archive_plus.php | 42 +++++------------------ {css => assets/css}/archive_plus.css | 0 CONTRIBUTING.md => docs/CONTRIBUTING.md | 0 INSTALL.md => docs/INSTALL.md | 8 ++--- templates/partials/archive_plus.html.twig | 4 +-- 6 files changed, 18 insertions(+), 42 deletions(-) rename {css => assets/css}/archive_plus.css (100%) rename CONTRIBUTING.md => docs/CONTRIBUTING.md (100%) rename INSTALL.md => docs/INSTALL.md (95%) diff --git a/README.md b/README.md index 68e3fce..50208ec 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Installing or updating the `Archive Plus` plugin can be done in one of two ways. /your/site/grav/user/plugins/archive_plus -For more informations, please check the [Installation and update guide](INSTALL.md). +For more informations, please check the [Installation and update guide](docs/INSTALL.md). ## Usage @@ -75,13 +75,13 @@ You can now edit the override and tweak it however you prefer. ## Contributing -You can contribute at any time! Before opening any issue, please search for existing issues and review the [guidelines for contributing](CONTRIBUTING.md). +You can contribute at any time! Before opening any issue, please search for existing issues and review the [guidelines for contributing](docs/CONTRIBUTING.md). After that please note: * If you find a bug or would like to make a feature request or suggest an improvement, [please open a new issue][issues]. If you have any interesting ideas for additions to the syntax please do suggest them as well! * Feature requests are more likely to get attention if you include a clearly described use case. -* If you wish to submit a pull request, please make again sure that your request match the [guidelines for contributing](CONTRIBUTING.md) and that you keep track of adding unit tests for any new or changed functionality. +* If you wish to submit a pull request, please make again sure that your request match the [guidelines for contributing](docs/CONTRIBUTING.md) and that you keep track of adding unit tests for any new or changed functionality. ### Support and donations diff --git a/archive_plus.php b/archive_plus.php index b0fb599..d833acc 100644 --- a/archive_plus.php +++ b/archive_plus.php @@ -11,22 +11,20 @@ * @package Archive Plus * @version 1.0.2 * @link - * @author Benjamin Regler + * @author Benjamin Regler * @copyright 2015, Benjamin Regler * @license MIT */ namespace Grav\Plugin; -use Grav\Common\Plugin; use Grav\Common\Grav; -use Grav\Common\Page\Collection; -use Grav\Common\Page\Page; -use Grav\Common\Debugger; +use Grav\Common\Plugin; use Grav\Common\Taxonomy; +use Grav\Common\Page\Page; +use Grav\Common\Page\Collection; use RocketTheme\Toolbox\Event\Event; - /** * Archive Plus Plugin * @@ -98,7 +96,6 @@ public function onTwigTemplatePaths() { public function onPageProcessed(Event $event) { // Get the page header $page = $event['page']; - $header = $page->header(); $taxonomy = $page->taxonomy(); if (!isset($taxonomy['archive'])) { @@ -130,7 +127,6 @@ public function onTwigSiteVariables() { // Initialize variables $id = $this->grav['page']->id(); - $this->mergeConfig($this->grav['page']); $archives = array(); $current = NULL; @@ -207,39 +203,19 @@ public function onTwigSiteVariables() { } } - // Get configurations of archive_plus plugin + // Get configurations of Archive Plus plugin $config = (array) $this->config->get('plugins.archive_plus'); $config['data'] = $archives; $config['current'] = $current; $config['show_more'] = $show_more; - // Add the archives configurations to the twig variables + // Add Archive Plus configurations to the twig variables $this->grav['twig']->twig_vars['archive_plus'] = $config; - // Inject built in CSS if desired - if ( $this->config->get('plugins.breadcrumbs.built_in_css') ) { - $this->grav['assets']->add('plugin://archive_plus/css/archive_plus.css'); - } - } - - /** ------------------------------- - * Private/protected helper methods - * -------------------------------- - */ - - /** - * Merge global and page configurations. - * - * @param Page $page The page to merge the configurations with the - * plugin settings. - */ - protected function mergeConfig(Page $page) { - $defaults = (array) $this->config->get('plugins.archive_plus'); - if ( isset($page->header()->archive_plus) ) { - $this->config->set('plugins.archive_plus', - array_merge($defaults, $page->header()->archive_plus) - ); + // Inject built-in CSS if desired + if ( $this->config->get('plugins.archive_plus.built_in_css') ) { + $this->grav['assets']->add('plugin://archive_plus/assets/css/archive_plus.css'); } } } diff --git a/css/archive_plus.css b/assets/css/archive_plus.css similarity index 100% rename from css/archive_plus.css rename to assets/css/archive_plus.css diff --git a/CONTRIBUTING.md b/docs/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to docs/CONTRIBUTING.md diff --git a/INSTALL.md b/docs/INSTALL.md similarity index 95% rename from INSTALL.md rename to docs/INSTALL.md index 9499459..856f485 100644 --- a/INSTALL.md +++ b/docs/INSTALL.md @@ -9,7 +9,7 @@ Installing the `Archive Plus` plugin can be done in one of two ways. The GPM (Gr The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type: - bin/gpm install mathjax + bin/gpm install archive_plus This will install the `Archive Plus` plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/archive_plus`. @@ -19,7 +19,7 @@ To install this plugin, just download the zip version of this repository and unz You should now have all the plugin files under - /your/site/grav/user/plugins/archive_plus + /your/site/grav/user/plugins/archive_plus >> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav), the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) plugins, and a theme to be installed in order to operate. @@ -31,7 +31,7 @@ As development for `Archive Plus` continues, new versions may become available t The simplest way to update this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm). You can do this with this by navigating to the root directory of your Grav install using your system's Terminal (also called command line) and typing the following: - bin/gpm update mathjax + bin/gpm update archive_plus This command will check your Grav install to see if your `Archive Plus` plugin is due for an update. If a newer release is found, you will be asked whether or not you wish to update. To continue, type `y` and hit enter. The plugin will automatically update and clear Grav's cache. @@ -41,7 +41,7 @@ Manually updating `Archive Plus` is pretty simple. Here is what you will need to * Delete the `your/site/user/plugins/archive_plus` directory. * Downalod the new version of the Archive Plus plugin from either [GitHub](https://github.com/sommerregen/grav-plugin-archive-plus) or [GetGrav.org](http://getgrav.org/downloads/plugins#dropcaps). -* Unzip the zip file in `your/site/user/plugins` and rename the resulting folder to `Archive Plus`. +* Unzip the zip file in `your/site/user/plugins` and rename the resulting folder to `archive_plus`. * Clear the Grav cache. The simplest way to do this is by going to the root Grav directory in terminal and typing `bin/grav clear-cache`. >> Note: Any changes you have made to any of the files listed under this directory will also be removed and replaced by the new set. Any files located elsewhere (for example a YAML settings file placed in `user/config/plugins`) will remain intact. diff --git a/templates/partials/archive_plus.html.twig b/templates/partials/archive_plus.html.twig index bd71a8f..271f5fc 100644 --- a/templates/partials/archive_plus.html.twig +++ b/templates/partials/archive_plus.html.twig @@ -31,7 +31,7 @@ {% endif %} - + {{ year }} @@ -62,7 +62,7 @@ {% endif %} - + {{ month }} From 2f722413bfeb6751ff2e8c96596c19e7ad9659ae Mon Sep 17 00:00:00 2001 From: Sommerregen Date: Sat, 21 Feb 2015 20:05:25 +0100 Subject: [PATCH 2/2] :maple_leaf: Version update - Release v1.1.0 --- CHANGELOG.md | 8 ++++++++ archive_plus.php | 4 ++-- blueprints.yaml | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7508c15..4a10757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v1.1.0 +## 02/21/2015 + +1. [](#new) + * Implemented new `param_sep` variable from Grav 0.9.18 +2. [](#improved) + * Refactored code, fixed INSTALL.md + # v1.0.2 ## 02/05/2015 diff --git a/archive_plus.php b/archive_plus.php index d833acc..ccd7d5c 100644 --- a/archive_plus.php +++ b/archive_plus.php @@ -1,6 +1,6 @@ * @author Benjamin Regler * @copyright 2015, Benjamin Regler diff --git a/blueprints.yaml b/blueprints.yaml index e8d79ab..878ba2c 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Archive Plus -version: 1.0.2 +version: 1.1.0 description: "The **Archive Plus** plugin is an enhanced version of the [Grav Archives plugin](https://github.com/getgrav/grav-plugin-archives) with more configuration options and the ability to show a blogger like hierarchical archive menu for links grouped by month and/or year." icon: university author: @@ -7,7 +7,7 @@ author: email: sommerregen@benjamin-regler.de homepage: https://github.com/sommerregen/grav-plugin-archive-plus docs: https://github.com/sommerregen/grav-plugin-archive-plus/blob/master/README.md -keywords: archive, plugin, blog, month, year, date, navigation, history +keywords: [archive, plugin, blog, month, year, date, navigation, history] bugs: https://github.com/sommerregen/grav-plugin-archive-plus/issues license: MIT