Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for ingrate vue router #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class MenuItem implements ArrayableContract
'active',
'order',
'hideWhen',
'vue'
);

/**
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Presenters/Admin/AdminltePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public function getCloseTagWrapper()
*/
public function getMenuWithoutDropdownWrapper($item)
{
return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' <span>' . $item->title . '</span></a></li>' . PHP_EOL;
//return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' <span>' . $item->title . '</span></a></li>' . PHP_EOL;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code please.

return '<li ' . $this->getActiveState($item) . '>'.$this->getOpenTagA($item).$item->getUrl() . '"' . $item->getAttributes() . '>' . $item->getIcon() . ' <span>' . $item->title . '</span>'.$this->getCloseTagA($item).'</li>' . PHP_EOL;
}

/**
Expand Down
28 changes: 28 additions & 0 deletions src/Presenters/Presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '<router-link to="' . PHP_EOL;
}
return PHP_EOL . '<a href=">' . PHP_EOL;
}

/**
* Get close tag A.
*
* @return string
*/
public function getCloseTagA($item)
{
if($item->attributes['vue']){
return PHP_EOL . '</router-link>' . PHP_EOL;
}
return PHP_EOL . '</a>' . PHP_EOL;
}


/**
* Get menu tag without dropdown wrapper.
*
Expand Down
14 changes: 14 additions & 0 deletions src/Presenters/PresenterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down