<xf:macro name="resource_update" arg-update="!" arg-resource="!">
	<xf:css src="message.less" />
	<div class="message message--simple js-resourceUpdate" id="js-resourceUpdate-{$update.resource_update_id}">
		<span class="u-anchorTarget" id="resource-update-{$update.resource_update_id}"></span>
		<div class="message-inner">
			<div class="message-cell message-cell--main">
				<div class="js-quickEditTarget">
					<div class="message-content js-messageContent">
						<div class="message-attribution message-attribution--split">
							<h2 class="message-attribution-main block-textHeader" style="margin: 0">
								<a href="{{ link('resources/update', $update) }}" rel="nofollow">{$update.title}</a>
							</h2>
							<ul class="message-attribution-opposite message-attribution-opposite--list">
								<xf:if contentcheck="true">
									<li>
										<xf:contentcheck>
											<xf:macro template="bookmark_macros" name="link"
												arg-content="{$update}"
												arg-confirmUrl="{{ link('resources/update/bookmark', $update) }}"
												arg-class="bookmarkLink--highlightable"
												arg-showText="{{ false }}"/>
										</xf:contentcheck>
									</li>
								</xf:if>
								<li>
									<a href="{{ link('resources/update', $update) }}" rel="nofollow">
										<xf:date time="{$update.post_date}"/>
									</a>
								</li>
							</ul>
						</div>

						<xf:if is="$update.message_state == 'deleted'">
							<div class="messageNotice messageNotice--deleted">
								<xf:macro template="deletion_macros" name="notice" arg-log="{$update.DeletionLog}" />
							</div>
						<xf:elseif is="$update.message_state == 'moderated'" />
							<div class="messageNotice messageNotice--moderated">
								{{ phrase('this_message_is_awaiting_moderator_approval_and_is_invisible_to_normal') }}
							</div>
						</xf:if>
						<xf:if is="$update.warning_message">
							<div class="messageNotice messageNotice--warning">
								{$update.warning_message}
							</div>
						</xf:if>

						<div class="message-userContent lbContainer js-lbContainer"
							data-lb-id="resource_update-{$update.resource_update_id}"
							data-lb-caption-desc="{{ $resource.User ? $resource.User.username : $resource.username }} &middot; {{ date_time($update.post_date) }}">

							<blockquote class="message-body">
								{{ bb_code($update.message, 'resource_update', $update) }}
							</blockquote>

							<xf:if is="$update.attach_count">
								<xf:macro template="message_macros" name="attachments"
									arg-attachments="{$update.Attachments}"
									arg-message="{$update}"
									arg-canView="{{ $resource.canViewUpdateImages() }}" />
							</xf:if>
						</div>
						
						<div class="reactionsBar js-reactionsList {{ $update.reactions ? 'is-active' : '' }}">
							<xf:reactions content="{$update}" link="resources/update/reactions" />
						</div>

						<xf:if is="$resource.canViewTeamMembers() AND $update.team_user_id AND $update.team_user_id != $resource.user_id">
							<div class="message-lastEdit">
								{{ phrase('posted_by:') }} <xf:username user="{$update.TeamUser}" defaultname="{$update.team_username}" />
							</div>
						</xf:if>

						<xf:if contentcheck="true">
							<div class="message-actionBar actionBar">
								<xf:contentcheck>
									<xf:if contentcheck="true">
										<div class="actionBar-set actionBar-set--external">
										<xf:contentcheck>
											<xf:react content="{$update}" link="resources/update/react" list="< .js-resourceUpdate | .js-reactionsList" />
										</xf:contentcheck>
										</div>
									</xf:if>

									<xf:if contentcheck="true">
										<div class="actionBar-set actionBar-set--internal">
										<xf:contentcheck>
											<xf:if is="$update.canReport()">
												<a href="{{ link('resources/update/report', $update) }}"
													class="actionBar-action actionBar-action--report"
													data-xf-click="overlay">{{ phrase('report_verb') }}</a>
											</xf:if>

											<xf:set var="$hasActionBarMenu" value="{{ false }}" />
											<xf:if is="$update.canEdit()">
												<xf:js src="xf/message.js" min="1" />
												<a href="{{ link('resources/update/edit', $update) }}"
													class="actionBar-action actionBar-action--edit actionBar-action--menuItem"
													data-xf-click="quick-edit"
													data-editor-target="#js-resourceUpdate-{$update.resource_update_id} .js-quickEditTarget"
													data-menu-closer="true">{{ phrase('edit') }}</a>
												<xf:set var="$hasActionBarMenu" value="{{ true }}" />
											</xf:if>
											<xf:if is="$update.edit_count && $update.canViewHistory()">
												<a href="{{ link('resources/update/history', $update) }}"
													class="actionBar-action actionBar-action--history actionBar-action--menuItem"
													data-xf-click="toggle"
													data-target="#js-resourceUpdate-{$update.resource_update_id} .js-historyTarget"
													data-menu-closer="true">{{ phrase('history') }}</a>

												<xf:set var="$hasActionBarMenu" value="{{ true }}" />
											</xf:if>
											<xf:if is="$update.canDelete('soft')">
												<a href="{{ link('resources/update/delete', $update) }}"
													class="actionBar-action actionBar-action--delete actionBar-action--menuItem"
													data-xf-click="overlay">{{ phrase('delete') }}</a>
												<xf:set var="$hasActionBarMenu" value="{{ true }}" />
											</xf:if>
											<xf:if is="$update.message_state == 'deleted' AND $update.canUndelete()">
												<a href="{{ link('resources/update/undelete', $update) }}" data-xf-click="overlay"
													class="actionBar-action actionBar-action--undelete actionBar-action--menuItem">{{ phrase('undelete') }}</a>
												<xf:set var="$hasActionBarMenu" value="{{ true }}" />
											</xf:if>
											<xf:if is="$xf.visitor.canViewIps() && $update.ip_id">
												<a href="{{ link('resources/update/ip', $update) }}"
													class="actionBar-action actionBar-action--ip actionBar-action--menuItem"
													data-xf-click="overlay">{{ phrase('ip') }}</a>
												<xf:set var="$hasActionBarMenu" value="{{ true }}" />
											</xf:if>
											<xf:if is="$update.canWarn()">
												<a href="{{ link('resources/update/warn', $update) }}"
													class="actionBar-action actionBar-action--warn actionBar-action--menuItem">{{ phrase('warn') }}</a>
												<xf:set var="$hasActionBarMenu" value="{{ true }}" />
											<xf:elseif is="$update.warning_id && $xf.visitor.canViewWarnings()" />
												<a href="{{ link('warnings', {'warning_id': $update.warning_id}) }}"
													class="actionBar-action actionBar-action--warn actionBar-action--menuItem"
													data-xf-click="overlay">{{ phrase('view_warning') }}</a>
												<xf:set var="$hasActionBarMenu" value="{{ true }}" />
											</xf:if>
											<xf:if is="$update.canApproveUnapprove()">
												<xf:if is="$update.message_state == 'moderated'">
													<a href="{{ link('resources/update/approve', $update, {'t': csrf_token()}) }}"
														class="actionBar-action actionBar-action--approve actionBar-action--menuItem">{{ phrase('approve') }}</a>
													<xf:set var="$hasActionBarMenu" value="{{ true }}" />
												<xf:elseif is="$update.message_state == 'visible'" />
													<a href="{{ link('resources/update/unapprove', $update, {'t': csrf_token()}) }}"
														class="actionBar-action actionBar-action--unapprove actionBar-action--menuItem">{{ phrase('unapprove') }}</a>
													<xf:set var="$hasActionBarMenu" value="{{ true }}" />
												</xf:if>
											</xf:if>

											<xf:if is="$hasActionBarMenu">
												<a class="actionBar-action actionBar-action--menuTrigger"
													data-xf-click="menu"
													title="{{ phrase('more_options')|for_attr }}"
													role="button"
													tabindex="0"
													aria-expanded="false"
													aria-haspopup="true">&#8226;&#8226;&#8226;</a>

												<div class="menu" data-menu="menu" aria-hidden="true" data-menu-builder="actionBar">
													<div class="menu-content">
														<h4 class="menu-header">{{ phrase('more_options') }}</h4>
														<div class="js-menuBuilderTarget"></div>
													</div>
												</div>
											</xf:if>
										</xf:contentcheck>
										</div>
									</xf:if>
								</xf:contentcheck>
							</div>
						</xf:if>

						<xf:if is="$update.edit_count && $update.canViewHistory()">
							<div class="js-historyTarget toggleTarget" data-href="trigger-href"></div>
						</xf:if>
					</div>
				</div>
			</div>
		</div>
	</div>
</xf:macro>