view_category.naml

<subroutine name="view_category" requires="basic,nabble,servlet">
	<n.view_category_page/>
</subroutine>

<macro name="view_category_page">
	<n.app_html>
		<head>
			<n.app_title/>
			<n.category_table_stylesheet/>
		</head>
		<body>
			<n.topics_action_link/>
			<n.people_action_link/>
			<n.options_action_menu/>

			<n.category_table.>
				<n.subcategories_column/>
				<n.topic_count_column width="5em"/>
				<n.post_count_column width="5em"/>
				<n.last_post_column/>
			</n.category_table.>

			<n.forum_footer/>
		</body>
	</n.app_html>
</macro>

<macro name="category_table_stylesheet">
	<style type="text/css">
		table.main {
			margin-top:.2em;
			border-collapse:collapse;
			width:100%;
			border-width:1px;
			border-style:solid;
		}
		table.main tr.header-row td {
			padding: .3em .4em;
			font-weight: bold;
			border-bottom-width: 1px;
			border-bottom-style: solid;
		}
		table.main tr.main-row td {
			padding:.3em .5em;
			border-bottom-width: 1px;
			border-bottom-style: dotted;
		}
		table.main tr.main-row,
		table.avatar-table tr {
			vertical-align:top;
		}
		div.sub-forums {
			margin-top:.8em;
			font-size:90%;
			clear:both;
		}
	</style>
</macro>

<macro name="category_table" dot_parameter="columns">
	<div style="clear:both"></div>
	<table class="main medium-border-color">
		<n.table_header.>
			<tr class="header-row shaded-bg-color">
				<n.columns/>
			</tr>
		</n.table_header.>
		<n.if.page_node.has_children>
			<then>
				<n.page_node.children_list. length="80">
						<n.preload_messages/>
						<n.loop.>
							<n.current_node.>
								<tr class="main-row [n.category_row_classes/]" node="[n.id/]">
									<n.columns/>
								</tr>
							</n.current_node.>
						</n.loop.>
					<n.if.there_is_more>
						<then>
							<tr>
								<td></td>
								<td><n.page_node.node_link href="[n.url template='view_standard'/]" text="[t]View more[/t]"/> &raquo;</td>
							</tr>
						</then>
					</n.if.there_is_more>
				</n.page_node.children_list.>
			</then>
			<else>
				<tr>
					<td><t>Empty</t></td>
				</tr>
			</else>
		</n.if.page_node.has_children>
	</table>
	<div style="clear:both"></div>

	<n.if.page_node.has_private_subapps>
		<then.category_privacy_js/>
	</n.if.page_node.has_private_subapps>
</macro>

<macro name="category_row_classes" requires="node">
	<n.if.is_private>
		<then>
			private private<n.id/> invisible
		</then>
	</n.if.is_private>
</macro>

<macro name="category_privacy_js">
	<script type="text/javascript">
		var url = '/template/NamlServlet.jtp?macro=category_ajax&node=<n.root_node.id/>';
		$(document).ready(function() {
			function showPrivateRows() {
				$('tr.private').each(function() {
					var nodeId = $(this).attr('node');
					url += '&node=' + nodeId;
				});
				url = url + Nabble.getClientID();
				$.getScript(url);
			}
			if (Nabble.userId)
				showPrivateRows();
		});
	</script>
</macro>

<macro name="category_ajax" requires="servlet">
	<n.javascript_response/>
	<n.get_parameter_values. name="node">
		<n.loop.>
			<n.get_node_from_id. node_id="[n.current_parameter_value/]">
				<n.set_local_node.this_node />
				<n.if.visitor.can_view.local_node>
					<then>
						$('tr.private<n.local_node.id/>').show();
					</then>
				</n.if.visitor.can_view.local_node>
			</n.get_node_from_id.>
		</n.loop.>
	</n.get_parameter_values.>
</macro>