-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Automatically hide parent 'yii\bootstrap\Nav' section if all subitems are hidden #117
Labels
Comments
Yep, that makes sense. |
samdark
added
status:ready for adoption
Feel free to implement this issue.
type:enhancement
Enhancement
labels
Feb 2, 2016
OK, I will try to send a PR in this case. |
arogachev
changed the title
Automatically hide parent Nav section if all subitems are hidden
Automatically hide parent 'yii\bootstrap\Nav' section if all subitems are hidden
Feb 2, 2016
arogachev
changed the title
Automatically hide parent 'yii\bootstrap\Nav' section if all subitems are hidden
Automatically hide parent Nav section if all subitems are hidden
Feb 2, 2016
arogachev
changed the title
Automatically hide parent Nav section if all subitems are hidden
Automatically hide parent 'yii\bootstrap\Nav' section if all subitems are hidden
Feb 2, 2016
arogachev
added a commit
to arogachev/yii2-bootstrap
that referenced
this issue
Feb 2, 2016
…tion if all subitems are hidden
Done. |
You all forget that /**
* @var array list of menu items in the dropdown. Each array element can be either an HTML string,
* or an array representing a single menu with the following structure:
* ...
* To insert divider use `<li role="presentation" class="divider"></li>`.
*/
public $items = []; Currently such items are considered always visible. So if the OP were to put a divider in his example, the Nav won't be hidden which is not what a user would expect from this additional functionality. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Consider this example.
If the user doesn't have permissions to manage users, slides and news,
Miscellaneous
section will be still shown, but it doesn't make sense because it doesn't have a link (click triggers visibility of subitems).To conditionally hide it we have to add something like this to parent section:
This is clean violation of DRY principle. Obviously we can have a helper method for checking that, but still we need to list permissions in both places, It's better to be done inside Nav widget itself.
So, if parent section have all subitems with
visible
property set andvisible
equalsfalse
in all subitems, we can just skip rendering of this whole section.The text was updated successfully, but these errors were encountered: