diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a878a2..76f3c32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.0.0-rc.3 +## 02/27/2016 +1. [](#bugfix) + * fixed attributes broken on link shortcode + +2.[](#new) + * Added new gravstrap-list shortcode to handle a generic list + * Added new gravstrap-item shortcode to handle a generic html item + # v1.0.0-rc.2 ## 02/24/2016 1. [](#bugfix) diff --git a/blueprints.yaml b/blueprints.yaml index 6dd941f..6cc2dae 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Gravstrap -version: 1.0.0-rc.2 +version: 1.0.0-rc.3 description: "Gravstrap is a Grav plugin that provides Bootstrap components as shortcodes. It has 30+ basic, modules and bootstrap shortcodes" icon: share-alt author: diff --git a/shortcodes/Basic/ItemShortcode.php b/shortcodes/Basic/ItemShortcode.php new file mode 100644 index 0000000..74ab896 --- /dev/null +++ b/shortcodes/Basic/ItemShortcode.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * For extra documentation and help please visit http://diblas.net + * + * @license MIT License + * + */ + +namespace Grav\Plugin\Shortcodes; + +use Thunder\Shortcode\Shortcode\ShortcodeInterface; + +/** + * Class ItemShortcode handles a generic html item + * + * @author Giansimon Diblas + */ +class ItemShortcode extends GravstrapShortcode +{ + /** + * {@inheritdoc} + */ + public function shortcodeName() + { + return 'gravstrap-item'; + } + + /** + * {@inheritdoc} + */ + protected function template() + { + return 'basic/item.html.twig'; + } + + /** + * {@inheritdoc} + */ + protected function renderOutput(ShortcodeInterface $shortcode) + { + return $this->grav['twig']->processTemplate($this->template(), [ + 'name' => $shortcode->getParameter('name'), + 'tag' => $shortcode->getParameter('tag'), + 'item_attributes' => $shortcode->getParameter('attributes'), + 'content' => $shortcode->getContent(), + ]); + } +} diff --git a/shortcodes/Basic/LinkShortcode.php b/shortcodes/Basic/LinkShortcode.php index 7c1737e..888b3f8 100644 --- a/shortcodes/Basic/LinkShortcode.php +++ b/shortcodes/Basic/LinkShortcode.php @@ -55,7 +55,7 @@ protected function renderOutput(ShortcodeInterface $shortcode) 'icon' => $shortcode->getParameter('icon'), 'icon_container' => $shortcode->getParameter('icon_container'), 'stacked' => $this->stringToBoolean($shortcode->getParameter('stacked')), - 'attributes' => $shortcode->getParameter('attributes'), + 'link_attributes' => $shortcode->getParameter('attributes'), ]); } } diff --git a/shortcodes/Basic/ListItemShortcode.php b/shortcodes/Basic/ListItemShortcode.php new file mode 100644 index 0000000..132861f --- /dev/null +++ b/shortcodes/Basic/ListItemShortcode.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * For extra documentation and help please visit http://diblas.net + * + * @license MIT License + * + */ + +namespace Grav\Plugin\Shortcodes; + +use Thunder\Shortcode\Shortcode\ShortcodeInterface; + +/** + * Class ListItemShortcode handles a list item + * + * @author Giansimon Diblas + */ +class ListItemShortcode extends GravstrapShortcode +{ + /** + * {@inheritdoc} + */ + public function shortcodeName() + { + return 'gravstrap-list-item'; + } + + /** + * {@inheritdoc} + */ + protected function template() + { + return 'basic/list-item.html.twig'; + } + + /** + * {@inheritdoc} + */ + protected function renderOutput(ShortcodeInterface $shortcode) + { + $output = $this->grav['twig']->processTemplate($this->template(), [ + 'name' => $shortcode->getParameter('name'), + 'item_attributes' => $shortcode->getParameter('attributes'), + 'content' => $shortcode->getContent(), + ]); + + return $output; + } +} diff --git a/shortcodes/Basic/ListShortcode.php b/shortcodes/Basic/ListShortcode.php new file mode 100644 index 0000000..be0d435 --- /dev/null +++ b/shortcodes/Basic/ListShortcode.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * For extra documentation and help please visit http://diblas.net + * + * @license MIT License + * + */ + +namespace Grav\Plugin\Shortcodes; + +use Gravstrap\Base\RegisteredShortcodes; +use Thunder\Shortcode\Shortcode\ShortcodeInterface; + +/** + * Class ListShortcode handles a generic list + * + * @author Giansimon Diblas + */ +class ListShortcode extends GravstrapShortcode +{ + /** + * {@inheritdoc} + */ + public function shortcodeName() + { + return 'gravstrap-list'; + } + + /** + * {@inheritdoc} + */ + protected function template() + { + return 'basic/list.html.twig'; + } + + /** + * {@inheritdoc} + */ + protected function renderOutput(ShortcodeInterface $shortcode) + { + $tag = null !== $shortcode->getParameter('tag') ? $shortcode->getParameter('tag') : 'ul'; + $items = RegisteredShortcodes::get($this->shortcode->getId($shortcode)); + $output = $this->grav['twig']->processTemplate($this->template(), [ + 'list_attributes' => $shortcode->getParameter('attributes'), + 'items' => $items, + 'tag' => $tag, + ]); + + return $output; + } +} \ No newline at end of file diff --git a/templates/basic/item.html.twig b/templates/basic/item.html.twig new file mode 100644 index 0000000..96efcd4 --- /dev/null +++ b/templates/basic/item.html.twig @@ -0,0 +1,8 @@ +{% set attributes = parse_attributes(item_attributes) %} +{% if tag is not null %} +<{{ tag }} {% include 'partials/_attributes.html.twig' %}> +{% endif %} +{{ content }} +{% if tag is not null %} +{{ tag }}> +{% endif %} \ No newline at end of file diff --git a/templates/basic/list-item.html.twig b/templates/basic/list-item.html.twig new file mode 100644 index 0000000..e6da044 --- /dev/null +++ b/templates/basic/list-item.html.twig @@ -0,0 +1,2 @@ +{% set attributes = parse_attributes(item_attributes) %} +