view_blog.naml

<subroutine name="view_blog" requires="basic,nabble,servlet">
	<n.apply_app_namespace.view_blog_page />
</subroutine>

<macro name="view_blog_page">
	<n.set_app_rows_per_page rows_per_page="[n.blog_topics_per_page/]"/>
	<n.app_html>
		<head>
			<n.app_title/>
			<n.blog_table_stylesheet/>
		</head>
		<body>
			<n.blog_page_layout/>
		</body>
	</n.app_html>
</macro>

<macro name="blog_topics_per_page">
	10
</macro>

<macro name="blog_table_stylesheet">
	<style type="text/css">
		div.pinned {
			position:relative;
			z-index:999;
			background-image:url('/images/pin.png');
			width:20px;
			height:21px;
			float:right;
		}
		div.blog-header {
			padding:.3em;
			-moz-border-radius: 6px;
			-webkit-border-radius: 6px;
		}
		div.blog-date {
			text-transform:uppercase;
			letter-spacing:.2em;
			font-size:70%;
			margin-bottom:.2em;
			padding: .2em;
		}
		div.blog-title {
			font-size:150%;
			font-weight:bold;
		}
		table.blog-details {
			border-collapse:collapse;
			margin-top:.2em;
			font-variant: small-caps;
		}
		div.blog-text {
			margin-top:.7em;
			padding:.3em;
		}
		div.blog-footer {
			padding:.3em;
			clear:both;
		}
	</style>
</macro>

<macro name="blog_page_layout" requires="app_namespace">
	<n.column_layout.>
		<n.column. width="70%">
			<n.widget.>
				<n.blog_table/>
				<n.app_topic_pagination margin=".5em .3em"/>
			</n.widget.>
		</n.column.>
		<n.column. width="30%">
			<n.sidebar_widget/>
	   </n.column.>
	</n.column_layout.>
</macro>

<macro name="blog_page_layout" requires="narrow_app_namespace">
	<n.new_topic_action_link text="[t]New Post[/t]"/>
	<n.subapps_action_link text="[t]Subcategories[/t]"/>
	<n.people_action_link/>
	<n.options_action_menu/>

	<div style="clear:both"/>
	<n.widget.>
		<n.blog_table/>
		<n.app_topic_pagination margin=".5em .3em"/>
	</n.widget.>
	<n.forum_footer/>
</macro>

<macro name="blog_table">
	<n.page_node.topics_list. sort="pinned-and-root-node-date" start="[n.app_index_record/]" length="[n.app_rows_per_page/]" filter="[n.app_topic_filter/]" >
		<n.handle_empty_blog/>
		<n.loop.current_node.>
			<div style="margin-bottom:2.5em;clear:both">
				<n.blog_post_header/>
				<div class="blog-text adbayes-content">
					<n.node_message_as_html/>
				</div>
				<n.blog_post_footer/>
			</div>
		</n.loop.current_node.>
	</n.page_node.topics_list.>
</macro>

<macro name="blog_post_header" requires="node">
	<div class="blog-header shaded-bg-color">
		<n.if.is_pinned_in_loop>
			<then>
				<div class="pinned"></div>
			</then>
		</n.if.is_pinned_in_loop>
		<div class="blog-date weak-color">
			<n.when_created.date_only/>
		</div>
		<div class="blog-title second-font adbayes-content">
			<n.node_link/>
		</div>
		<table class="blog-details weak-color">
			<tr>
				<td class="nowrap">
					<n.owner.avatar size="small" border_class="medium-border-color"/>
				</td>
				<td class="nowrap">
					<t>by <t.author.owner.name truncate="20"/></t>
					@
					<n.when_created.time_only/>
					<n.if.is_in_subapp>
						<then><t>in <t.location.italic.subapp_link_on_hover/></t></then>
					</n.if.is_in_subapp>
				</td>
			</tr>
		</table>
	</div>
</macro>

<macro name="blog_post_footer" requires="node">
	<div class="blog-footer">
		<n.if.not.is_locked_topic>
			<then>
				<n.permalink/>
				&nbsp;
				<img src="/images/icon_message.png" align="absmiddle" height="14" width="15"/>
				<n.if.has_replies>
					<then.comments_link/>
					<else>
						<a href="[n.new_post_path/]" rel="nofollow"><t>Leave a comment</t></a>
					</else>
				</n.if.has_replies>
			</then>
		</n.if.not.is_locked_topic>
	</div>
</macro>

<macro name="handle_empty_blog" requires="node_list,node_page">
	<n.if.not.has_more_elements>
		<then>
			<div class="rounded light-border-color" style="border-width:2px;border-style:solid;padding:1.5em .5em">
				<n.page_node.>
					<n.new_topic_link>
						<text>
							<div class="blog-title second-font weak-color" style="margin-bottom:.5em"><t>Write Your First Post</t></div>
							<t>Click here to make your first post</t>
						</text>
					</n.new_topic_link>
				</n.page_node.>
			</div>
		</then>
	</n.if.not.has_more_elements>
</macro>