| 18 | === Component `HtmlContent` === |
| 19 | Enables HTML content in description, adding Javascript editor and |
| 20 | adding additional CSS file for manipulation CSS declarations. |
| 21 | |
| 22 | Options: |
| 23 | || '''option name''' || '''values''' || '''description''' || |
| 24 | || description_format || `wiki` | `html` || format for ticket description (default: '''wiki''') || |
| 25 | || editor_source || valid path || Usually it should stored in project or common js folder. For ckeditor for example it could be site/js/ckeditor/ckeditor.js. || |
| 26 | || editor_replace || valid path || Javascript, which should replace textareas. || |
| 27 | || additional_css || valid path || Path to additional css file, which overrides css-declarations. || |
| 28 | |
| 29 | Sample configuration: |
| 30 | {{{ |
| 31 | [ticket] |
| 32 | description_format = html |
| 33 | editor_source = site/js/ckeditor/ckeditor.js |
| 34 | editor_replace = <script type="text/javascript">CKEDITOR.replace('@FIELD_NAME@', {toolbar: 'custom'});</script> |
| 35 | additional_css = site/css/add_ticket.css |
| 36 | }}} |
| 37 | |
| 38 | In above sample configuration [http://ckeditor.com/ CKEditor] is used as online editor and |
| 39 | the editor source is located in projects-folder `htdocs/js/ckeditor`, |
| 40 | after each `textarea` with HTML-Option content of `editor_replace` will be added. |
| 41 | The file in option `additional_css` will be added and therefore will override these declarations. |
| 42 | |
| 43 | '''Attention:''' To have a correct preview, file `ticket_box.html` has to be edited: |
| 44 | {{{ |
| 45 | 1 <py:if test="field"> |
| 46 | 2 <py:choose test=""> |
| 47 | 3 <py:when test="ticket[field.name] and field.format == 'html'">${wiki_to_html(context, '{{{ \n#!html \n' + ticket[field.name] + '\n}}}', escape_newlines=preserve_newlines)}</py:when> |
| 48 | 4 <py:when test="'rendered' in field">${field.rendered}</py:when> |
| 49 | 5 <py:otherwise>${ticket[field.name]}</py:otherwise> |
| 50 | 6 </py:choose> |
| 51 | 7 </py:if> |
| 52 | }}} |
| 53 | |
| 54 | Line 3 has to be inserted into `py:choose` block in above template-snippet. |
| 55 | |
| 56 | {{{ |
| 57 | <div py:if="ticket.description" class="searchable" xml:space="preserve"> |
| 58 | <py:choose> |
| 59 | <py:when test="description_format == 'html'">${wiki_to_html(context, '{{{ \n#!html \n' + ticket.description + '\n}}}', escape_newlines=preserve_newlines)}</py:when> |
| 60 | <py:otherwise>${wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)}</py:otherwise> |
| 61 | </py:choose> |
| 62 | </div> |
| 63 | }}} |
| 64 | |
| 65 | Also `py:choose` block has to be added into div-block near the end of file (see above template-snippet). |
| 66 | |
| 67 | === Screenshots === |
| 68 | |