Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

create a macro that produces an editable table/content

Jochem Berends June 12, 2013

I would like a macro that will create in the editor a table that is edited directly without (re)setting the macro parameters. I would like to have behave it more like a template functionality that a 'macro'.

For example: As a user I want to insert a properties table with a page status that is rendered in the editor in the 'body' of the macro and edited directly without setting the parameters. Like the color of the status block.

The following code is what I have so far using parameters. It renders a properties table in a viewable page, but renders just a 'macro' block in the editor and if I need to update the 'status' I need to change the macro parameters.

I would like to know if it is possible to 'set' the $body of the macro to the 'html' included in the macro below the parameters definitions.

## Macro title: Owner and Approved properties table
## Macro has a body: N
## Body processing: -
## Output: -
##
## Developed by: @jochem.berends
## Date created: 10-06-2013
## Installed by: @jochem.berends

## @param Owner:title=Owner|type=username|required=true|desc=The Owner of this Page
## @param Status:title=Status|type=enum|enumValues=For Reference,In Work,Prepared,Approved,Released|desc=Choose the status of the page|default=In Work
## @param Approval:title=Approval|type=username|desc=Enter the name who need to approve this page
## @param ReleasedBy:title=Released By|type=username|desc=Enter the name who need to release this page
## @param ReleaseDate:title=Release Date|type=date|desc=Enter release date in format dd-mm-YYYY

<ac:macro ac:name="details"><ac:parameter ac:name="label">Status</ac:parameter>
	<ac:rich-text-body>
		<table>
			<tbody>
				<tr>
					<th>Page Status</th>
					<td colspan="1"><ac:macro ac:name="status"><ac:parameter ac:name="colour">Green</ac:parameter><ac:parameter ac:name="title">$paramStatus</ac:parameter></ac:macro></td></tr>
				<tr>
					<th>Owner</th>
					<td colspan="1">
						<p><ac:link><ri:user ri:username="$!paramOwner" /></ac:link></p></td></tr>
				<tr>
					<th colspan="1">Approval By</th>
					<td colspan="1">
						<ac:task-list>
							<ac:task>
								<ac:task-id>1</ac:task-id>
								<ac:task-status>incomplete</ac:task-status>
								<ac:task-body><ac:link><ri:user ri:username="$!paramApproval" /></ac:link></ac:task-body>
							</ac:task>
						</ac:task-list>
					</td></tr>
				<tr>
					<th colspan="1">Release By</th>
					<td colspan="1">
						<ac:task-list>
							<ac:task>
								<ac:task-id>1</ac:task-id>
								<ac:task-status>incomplete</ac:task-status>
								<ac:task-body><ac:link><ri:user ri:username="$!paramReleasedBy" /></ac:link></ac:task-body>
							</ac:task>
						</ac:task-list>
					</td></tr>
				<tr>
					<th>Issue Number</th>
					<td colspan="1">
						<p>1</p></td></tr>
				<tr>
					<th colspan="1">Date of Release</th>
					<td colspan="1">$!paramReleaseDate</td>
				</tr>
			</tbody>
		</table>
	</ac:rich-text-body>
</ac:macro>

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer