/hudson-core/src/main/resources/lib/hudson/editableDescription.jelly
http://github.com/hudson/hudson · Unknown · 56 lines · 48 code · 8 blank · 0 comment · 0 complexity · 1b0f65153d9a498234a8236f8aac94a4 MD5 · raw file
- <!--
- The MIT License
- Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts, Yahoo! Inc.
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- -->
- <?jelly escape-by-default='true'?>
- <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
- <st:documentation>
- Renders ${it.description} and then allow it to be editable in place,
- if the current user has the specified permission.
- <st:attribute name="permission" use="required">
- If the current user doesn't have this permission, the description
- is not editable.
- </st:attribute>
- </st:documentation>
- <div id="description">
- <div>
- <j:out value="${it.description!=null ? app.markupFormatter.translate(it.description) : ''}" />
- </div>
- <l:hasPermission permission="${permission}">
- <div align="right"><a href="editDescription" onclick="${h.isAutoRefresh(request) ? null : 'return replaceDescription();'}">
- <img src="${imagesURL}/16x16/notepad.gif" alt="" />
- <j:choose>
- <j:when test="${empty(it.description)}">
- ${%add description}
- </j:when>
- <j:otherwise>
- ${%edit description}
- </j:otherwise>
- </j:choose>
- </a></div>
- </l:hasPermission>
- </div>
- </j:jelly>