<xf:title>{{ phrase('privacy') }}</xf:title>

<xf:wrap template="account_wrapper" />

<xf:form action="{{ link('account/privacy') }}" ajax="true" class="block" data-force-flash-message="true">
	<div class="block-container">
		<div class="block-body">
			<xf:macro template="helper_account" name="activity_privacy_row" />
			<xf:macro template="helper_account" name="dob_privacy_row" />
			<xf:macro template="helper_account" name="email_options_row" arg-showExplain="{{ true }}" />

			<xf:formrow rowtype="inputLabelPair"
				label="{{ phrase('allow_users_to') }}">

				<xf:macro name="privacy_option"
					arg-user="{$xf.visitor}"
					arg-name="allow_view_profile"
					arg-label="{{ phrase('view_your_details_on_your_profile_page:') }}" />

				<xf:if is="$xf.visitor.canViewProfilePosts()">
					<xf:macro name="privacy_option"
						arg-user="{$xf.visitor}"
						arg-name="allow_post_profile"
						arg-label="{{ phrase('post_messages_on_your_profile_page:') }}"
						arg-hideEveryone="{{true}}" />
				</xf:if>

				<xf:if is="$xf.options.enableNewsFeed">
					<xf:macro name="privacy_option"
						arg-user="{$xf.visitor}"
						arg-name="allow_receive_news_feed"
						arg-label="{{ phrase('receive_your_news_feed:') }}" />
				</xf:if>

				<xf:macro name="privacy_option"
					arg-user="{$xf.visitor}"
					arg-name="allow_send_personal_conversation"
					arg-label="{{ phrase('start_conversations_with_you:') }}"
					arg-hideEveryone="{{true}}" />

				<xf:macro name="privacy_option"
					arg-user="{$xf.visitor}"
					arg-name="allow_view_identities"
					arg-label="{{ phrase('view_your_identities:') }}" />
			</xf:formrow>
		</div>
		<xf:submitrow icon="save" sticky="true" />
	</div>
</xf:form>

<xf:macro name="privacy_option" arg-user="!" arg-name="!" arg-label="!" arg-hideEveryone="{{ false }}" arg-hideFollowed="{{ false }}">
	<dl class="inputLabelPair">
		<dt>{$label}</dt>
		<dd>
			<xf:select name="privacy[{$name}]" value="{$user.Privacy.{$name}}">
				<xf:if is="!$hideEveryone">
					<xf:option value="everyone">{{ phrase('all_visitors') }}</xf:option>
				</xf:if>
				<xf:option value="members">{{ phrase('members_only') }}</xf:option>
				<xf:if is="!$hideFollowed">
					<xf:option value="followed">{{ phrase('people_you_follow') }}</xf:option>
				</xf:if>
				<xf:option value="none">{{ phrase('nobody') }}</xf:option>
			</xf:select>
		</dd>
	</dl>
</xf:macro>