grails에는 메뉴가 있습니다. 활성 페이지의 메뉴 항목을 강조 표시하려고합니다.grails 현재 페이지 하이라이트
link1
link2 (show as bold if the controller action partially matches this gsp name)
link3
나는 작동하는 코드가 있지만 더 좋은 방법이있는 것처럼 보입니다.
def active = { attrs, body ->
for (page in attrs.check) {
if (params.action.startsWith(page)) {
out << "current"
break
}
}
}
이 옵션은 잘 작동하지만 말의 것 :
태그 라이브러리는 잘 작동
<li><a href="${createLink(action: 'contactInfo')}" title="Contact Info" class="<xyz:active check='${['contactInfo']}'/>">Contact Info</a></li>
<li><a href="${createLink(action: 'aboutYouFamily')}" title="About You" class="<xyz:active check='${['aboutYouFamily', 'aboutYouBackground', 'aboutYouCharacteristics', 'aboutYouLifestyle', 'aboutYouApplicant2']}'/>">About You</a></li>
이 불면 :
는<g:link action='myProfile' class="${<xyz:active check='${['myControllerAction']}'/>}">My Profile</g:link>
난 당신이 전달할 수 있습니다 생각하지 않는다 g에 대한 매개 변수 인 taglib : link
나는 여러 GSPS가/행동이 링크가 있기 때문에 그들이 이름을 지정하는 방법의 활성화에 원인이 요구 사항이 있습니다
About You
내가 할 수있는 :
aboutYouLocation
aboutYouBackground
aboutYouEducation
모든이 링크 활성 하나를 만들 부분적으로 일치 시키지만, 배열 (taglib)에 전달되는 배열을 사용하게되는 aboutYour (추가 R)로 시작하는 몇 가지 액션/gsp도 있습니다.
[탐색 모음에서 선택한 항목의 클래스 속성을 변경하는 방법] 가능한 복제본 (http://stackoverflow.com/questions/14146950/how-to-change-the-class-attribute-of-a -selected-item-in-the-navigation-bar) – Gregg