From 333d21a977ae7ed5ed03e6aea664a636171cc0df Mon Sep 17 00:00:00 2001 From: Angel Kurten Date: Thu, 24 Jan 2019 12:37:42 -0500 Subject: [PATCH] =changes for ingrate vue router --- src/MenuItem.php | 6 ++++- src/Presenters/Admin/AdminltePresenter.php | 3 ++- src/Presenters/Presenter.php | 28 ++++++++++++++++++++++ src/Presenters/PresenterInterface.php | 14 +++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/MenuItem.php b/src/MenuItem.php index 2c7ed53..6243606 100644 --- a/src/MenuItem.php +++ b/src/MenuItem.php @@ -50,6 +50,7 @@ class MenuItem implements ArrayableContract 'active', 'order', 'hideWhen', + 'vue' ); /** @@ -125,6 +126,7 @@ public static function make(array $properties) public function fill($attributes) { foreach ($attributes as $key => $value) { + if (in_array($key, $this->fillable)) { $this->{$key} = $value; } @@ -324,6 +326,8 @@ public function getUrl() { if ($this->route !== null) { return route($this->route[0], $this->route[1]); + } elseif ($this->attributes['vue']) { + return $this->url; } return url($this->url); @@ -377,7 +381,7 @@ public function getAttributes() { $attributes = $this->attributes ? $this->attributes : []; - array_forget($attributes, ['active', 'icon']); + array_forget($attributes, ['active', 'icon', 'vue']); return HTML::attributes($attributes); } diff --git a/src/Presenters/Admin/AdminltePresenter.php b/src/Presenters/Admin/AdminltePresenter.php index d20076a..9609173 100644 --- a/src/Presenters/Admin/AdminltePresenter.php +++ b/src/Presenters/Admin/AdminltePresenter.php @@ -27,7 +27,8 @@ public function getCloseTagWrapper() */ public function getMenuWithoutDropdownWrapper($item) { - return 'getActiveState($item) . '>getAttributes() . '>' . $item->getIcon() . ' ' . $item->title . '' . PHP_EOL; + //return 'getActiveState($item) . '>getAttributes() . '>' . $item->getIcon() . ' ' . $item->title . '' . PHP_EOL; + return '
  • getActiveState($item) . '>'.$this->getOpenTagA($item).$item->getUrl() . '"' . $item->getAttributes() . '>' . $item->getIcon() . ' ' . $item->title . ''.$this->getCloseTagA($item).'
  • ' . PHP_EOL; } /** diff --git a/src/Presenters/Presenter.php b/src/Presenters/Presenter.php index c458929..48463e3 100644 --- a/src/Presenters/Presenter.php +++ b/src/Presenters/Presenter.php @@ -22,8 +22,36 @@ public function getOpenTagWrapper() */ public function getCloseTagWrapper() { + + } + + /** + * Get open tag A. + * + * @return string + */ + public function getOpenTagA($item) + { + if($item->attributes['vue']){ + return PHP_EOL . '' . PHP_EOL; } + /** + * Get close tag A. + * + * @return string + */ + public function getCloseTagA($item) + { + if($item->attributes['vue']){ + return PHP_EOL . '' . PHP_EOL; + } + return PHP_EOL . '' . PHP_EOL; + } + + /** * Get menu tag without dropdown wrapper. * diff --git a/src/Presenters/PresenterInterface.php b/src/Presenters/PresenterInterface.php index 7b4c006..5dded5b 100644 --- a/src/Presenters/PresenterInterface.php +++ b/src/Presenters/PresenterInterface.php @@ -20,6 +20,20 @@ public function getOpenTagWrapper(); */ public function getCloseTagWrapper(); + /** + * Get open tag A. + * + * @return string + */ + public function getOpenTagA($item); + + /** + * Get close tag A. + * + * @return string + */ + public function getCloseTagA($item); + /** * Get menu tag without dropdown wrapper. *