/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

  1. <!--
  2. The MIT License
  3. Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts, Yahoo! Inc.
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. -->
  20. <?jelly escape-by-default='true'?>
  21. <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">
  22. <st:documentation>
  23. Renders ${it.description} and then allow it to be editable in place,
  24. if the current user has the specified permission.
  25. <st:attribute name="permission" use="required">
  26. If the current user doesn't have this permission, the description
  27. is not editable.
  28. </st:attribute>
  29. </st:documentation>
  30. <div id="description">
  31. <div>
  32. <j:out value="${it.description!=null ? app.markupFormatter.translate(it.description) : ''}" />
  33. </div>
  34. <l:hasPermission permission="${permission}">
  35. <div align="right"><a href="editDescription" onclick="${h.isAutoRefresh(request) ? null : 'return replaceDescription();'}">
  36. <img src="${imagesURL}/16x16/notepad.gif" alt="" />
  37. <j:choose>
  38. <j:when test="${empty(it.description)}">
  39. ${%add description}
  40. </j:when>
  41. <j:otherwise>
  42. ${%edit description}
  43. </j:otherwise>
  44. </j:choose>
  45. </a></div>
  46. </l:hasPermission>
  47. </div>
  48. </j:jelly>