Skip to content

Conversation

thiagotalma
Copy link
Contributor

(@klimov-paul yiisoft/yii2#4346)

Navigation is not always done with Dropdown.

On the website "Themeforest" many themes for the Bootstrap, use a sidebar for navigation without Dropdown.

It's nice to have the option to also generate sub items as a list.

Even if the implementation is not the way I propose, would be very important to have this option.

}

/**
* Renders widget items.
*/
public function renderItems()
public function renderItems($items, $options = [])
Copy link
Member

Choose a reason for hiding this comment

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

It is not good to change public method signature.
It is better to extract some method like renderItemsInternal(), which can be used at renderItem() and at renderItems()

@thiagotalma
Copy link
Contributor Author

@klimov-paul You could have made the comments before, when you told me to redo the PR and I had the job of making the merge 😅

@klimov-paul
Copy link
Member

Sorry

@thiagotalma
Copy link
Contributor Author

@klimov-paul Your comment was very good!
I think the way I did now was much better.

Check it out and tell me what you think.

@@ -164,6 +174,7 @@ public function renderItem($item)
$items = ArrayHelper::getValue($item, 'items');
$url = ArrayHelper::getValue($item, 'url', '#');
$linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
$asDropdown = isset($item['inline']) ? !$item['inline'] : $this->asDropdown;
Copy link
Member

Choose a reason for hiding this comment

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

Diffrent names 'inline' and 'asDropdown' will confuse developer. Single one should be used both for default optnion property and item option key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I let different because they are different things. One is a global property of the widget, another is an option item.

You think it might be the same name?

Copy link
Member

Choose a reason for hiding this comment

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

It must be same or similar. 'dropdown' can be used for item, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See if it was good now, please.

@thiagotalma
Copy link
Contributor Author

@klimov-paul See if it was good now, please.

@@ -66,6 +67,10 @@ class Nav extends Widget
*/
public $items = [];
/**
* @var boolean whether the nav subitems should be a [[Dropdown]] widget.
*/
public $asDropdown = true;
Copy link
Member

Choose a reason for hiding this comment

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

I am unsure about name for this option.
Curently it does not sound very good. Must be something consistent with encodeLabels, but I can't find a good name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hard decision! 😆

How about $itemsAsDropdown?

Copy link
Member

Choose a reason for hiding this comment

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

useDropdown?

@klimov-paul
Copy link
Member

Rendering Nav as list actually produce an ugly result:
nav

Now, I am not sure if such option should be supported at core level.

@thiagotalma
Copy link
Contributor Author

@klimov-paul this option is set according to the application menu.

On a sidebar, the sub-items must be in the list.

@klimov-paul
Copy link
Member

Can you provide an example link?

@thiagotalma
Copy link
Contributor Author

@klimov-paul
Copy link
Member

May be I am missing something, but this link does not look convincing for me.

I am lack of exprtise here. Someone else should look into this.

@thiagotalma
Copy link
Contributor Author

I see no problem here and I do not understand your concern.

By default, the result is the same.

If necessary, a parameter is included and we have the possibility of using the navigation sidebar.

Without this PR, the sidebar is frustrated.

Perhaps @cebe can give us help.

@klimov-paul
Copy link
Member

The problem is that without extra adjustments 'inline' rendering produces HTML code, which have a poor appearance.
The exmples you have provided use extra JavaScript and markup to achieve different effect, which does not belong to Bootstrap itself.
At present state it feels like you need to create an extra special widget for such kind of things and this enhancement does not belong to Bootstrap at all.

@thiagotalma
Copy link
Contributor Author

The problem is that without extra adjustments 'inline' rendering produces HTML code, which have a poor appearance.

But that is precisely the goal of PR: To give the option to those in need. Who does not need, does not touch anything.

All developers who use a sidebar for navigation need.
Take a look here: http://themeforest.net/category/site-templates/admin-templates

@cebe cebe self-assigned this Apr 27, 2015
@cebe cebe added this to the 2.0.x milestone Apr 27, 2015
@samdark samdark removed this from the 2.0.x milestone Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants