Mercurial Hosting > nabble
diff src/nabble/view/naml/user_nodes.naml @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children | 72765b66e2c3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/nabble/view/naml/user_nodes.naml Thu Mar 21 19:15:52 2019 -0600 @@ -0,0 +1,299 @@ +<macro name="user_nodes" requires="servlet"> + <n.user_page.> + <n.html> + <head> + <n.user_nodes_meta/> + <n.title.> + <t>Profile of <t.author.page_user.name/></t> + <n.hide_if_equals. value1="[n.user_nodes_page_number/]" value2="1"> + | <t>Page <t.number.user_nodes_page_number/></t> + </n.hide_if_equals.> + </n.title.> + <style type="text/css"> + table.nodes { + width:100%; + border-collapse:collapse; + } + table.nodes td { + padding:.3em; + } + table.nodes td.header { + padding: .2em; + font-weight:bold; + } + div.table-title { + font-weight:bold; + font-size:120%; + margin: 1em .1em 1em; + } + </style> + </head> + <body> + <n.page_user.profile_header/> + + <n.user_nodes_search_box/> + + <div class="second-font table-title"> + <t>Posts in <t.location.root_node.subject/></t> + </div> + + <n.user_nodes_table.> + <n.date_column width="7em"/> + <n.subject_column/> + <n.count_column/> + <n.location_column/> + </n.user_nodes_table.> + </body> + </n.html> + </n.user_page.> +</macro> + +<macro name="user_nodes_search_box" requires="user_page"> + <div class="search-box" style="float:right;white-space:nowrap;margin-top:1em"> + <n.root_node.page_search_box author="[n.page_user.id/]"/> + </div> +</macro> + +<macro name="user_nodes_table" dot_parameter="columns"> + <n.page_user.nodes_list. + start="[n.user_nodes_index_record/]" + length="[n.user_nodes_length/]" + filter="[n.user_nodes_filter_condition/]" + > + <div style="position:relative;margin:-.6em 0 .2em"> + <n.user_nodes_pagination/> + <n.user_nodes_filter_control/> + </div> + <table class="nodes"> + <n.table_header.> + <tr class="header-row shaded-bg-color"> + <n.columns/> + </tr> + </n.table_header.> + <n.loop.> + <tr class="[n.alternate var='row-class' first_value='main-row' second_value='light-bg-color main-row'/]"> + <n.columns/> + </tr> + </n.loop.> + </table> + <n.check_omitted_nodes/> + <n.user_nodes_pagination/> + </n.page_user.nodes_list.> +</macro> + +<macro name="user_nodes_index_record"> + <n.get_parameter name="i"/> +</macro> + +<macro name="user_nodes_filter"> + <n.get_parameter name="filter"/> +</macro> + +<macro name="user_nodes_length"> + 20 +</macro> + +<macro name="user_nodes_filter_control" requires="user_page"> + <n.put_in_head.> + <script type="text/javascript"> + $(document).ready(function() { + function applyFilter() { + window.location = $('#filter').val(); + }; + $('#filter').change(applyFilter); + }); + </script> + </n.put_in_head.> + <div class="float-left nowrap" style="margin:.3em .2em"> + <b><t>Show</t></b> + <n.set_var. name='url'> + <n.page_user.url filter="[n.user_nodes_filter/]"/> + </n.set_var.> + <select id="filter"> + <n.select_option value="[n.page_user.url/]" text="[t]All[/t]"/> + <n.select_option value="[n.page_user.url filter='apps_only'/]" selectedValue="[n.var name='url'/]" text="[t]Apps[/t]"/> + <n.select_option value="[n.page_user.url filter='topics_only'/]" selectedValue="[n.var name='url'/]" text="[t]Topics[/t]"/> + </select> + + <span class="weak-color" style="font-style: italic"> + <t>Total</t>: + <n.one_or_many.user_nodes_count> + <one_text><t>item</t></one_text> + <many_text><t>items</t></many_text> + </n.one_or_many.user_nodes_count> + </span> + </div> +</macro> + +<macro name="user_nodes_filter_condition" requires="user_page"> + <n.if.equal value1="[n.user_nodes_filter/]" value2="apps_only"> + <then.page_user.app_filter/> + <else.if.equal value1="[n.user_nodes_filter/]" value2="topics_only"> + <then.page_user.topic_filter/> + <else.null/> + </else.if.equal> + </n.if.equal> +</macro> + +<macro name="user_nodes_pagination" requires="user_page"> + <n.paging. + total_rows="[n.user_nodes_count/]" + current_row="[n.user_nodes_index_record/]" + rows_per_page="[n.user_nodes_length/]" + > + <n.generic_paging> + <margin>.55em .2em</margin> + <url><n.page_user.path index_record="[n.page_row/]" filter="[n.user_nodes_filter/]"/></url> + </n.generic_paging> + </n.paging.> +</macro> + +<macro name="user_nodes_page_number" requires="servlet"> + <n.paging. + total_rows="0" + current_row="[n.user_nodes_index_record/]" + rows_per_page="[n.user_nodes_length/]" + > + <n.current_page_number/> + </n.paging.> +</macro> + +<macro name="user_nodes_count" requires="user_page"> + <n.cache. var="user_nodes_count" > + <n.page_user.node_count filter="[n.user_nodes_filter_condition/]"/> + </n.cache.> +</macro> + +<macro name="path" parameters="index_record,filter" requires="user"> + <n.encode_url.remove_spaces.> + /template/NamlServlet.jtp?macro=user_nodes&user=<n.id/> + <n.add_to_path name="i" value="[n.index_record/]" default_value="0"/> + <n.add_to_path name="filter" value="[n.filter/]"/> + </n.encode_url.remove_spaces.> +</macro> + +<macro name="url" parameters="index_record,filter" requires="user"> + <n.base_url /><n.path index_record="[n.index_record/]" filter="[n.filter/]" /> +</macro> + +<macro name="date_column" parameters="title,width"> + <n.table_column> + <head> + <td class="header" style="[n.width_style.width/]"> + <n.default. to="[t]Date[/t]"><n.title/></n.default.> + </td> + </head> + <body> + <td class="weak-color"> + <n.current_node.when_created.short_format/> + </td> + </body> + </n.table_column> +</macro> + +<macro name="subject_column" parameters="title,width"> + <n.table_column> + <head> + <td class="header" colspan="2" style="[n.width_style.width/]"> + <n.default. to="[t]Subject[/t]"><n.title/></n.default.> + </td> + </head> + <body> + <td style="width:25px;padding:.2em"> + <n.if.current_node.is_app> + <then><img src="/images/forum_sm.png" class="image16"/></then> + <else><img src="/images/thread_sm.png" class="image16"/></else> + </n.if.current_node.is_app> + </td> + <td> + <n.current_node.node_link/> + <n.if.current_node.is_private> + <then><span class="weak-color"><t>(private)</t></span></then> + </n.if.current_node.is_private> + <n.if.current_node.is_pending> + <then><img src="/images/icon_pending.png" class="image16" title="[t]This post has NOT been accepted by the mailing list yet.[/t]"/></then> + </n.if.current_node.is_pending> + </td> + </body> + </n.table_column> +</macro> + +<macro name="count_column" parameters="title,width"> + <n.table_column> + <head> + <td class="header" style="[n.width_style.width/]"> + <n.default. to="[t]Count[/t]"><n.title/></n.default.> + </td> + </head> + <body> + <td class="weak-color nowrap"> + <n.if.current_node.is_app> + <then> + <n.one_or_many.current_node.topic_count> + <one_text><t>topic</t></one_text> + <many_text><t>topics</t></many_text> + </n.one_or_many.current_node.topic_count> + </then> + <else> + <n.one_or_many.current_node.replies> + <one_text><t>reply</t></one_text> + <many_text><t>replies</t></many_text> + </n.one_or_many.current_node.replies> + </else> + </n.if.current_node.is_app> + </td> + </body> + </n.table_column> +</macro> + +<macro name="location_column" parameters="title,width"> + <n.table_column> + <head> + <td class="header" style="[n.width_style.width/]"> + <n.default. to="[t]Location[/t]"><n.title/></n.default.> + </td> + </head> + <body> + <td class="weak-color"> + <n.if.not.current_node.is_app> + <then><n.current_node.app_or_root.node_link/></then> + </n.if.not.current_node.is_app> + </td> + </body> + </n.table_column> +</macro> + +<macro name="check_omitted_nodes" requires="node_list, user_page"> + <n.comment.> + Here we check if this page contains the correct number of rows. If this is not the case, + it is because the visitor doesn't have permission to view them and we must display a message. + The check is simple: we get the number of rows this page is meant to show (current_page_rows + command in pagination namespace) and subtract the number of rows displayed (current_index + of the node_list loop). If the result if greater than zero, then some rows were not displayed and + we show the message. + </n.comment.> + <n.paging. + total_rows="[n.user_nodes_count/]" + current_row="[n.user_nodes_index_record/]" + rows_per_page="[n.user_nodes_length/]" + > + <n.int. i="[n.current_page_rows/]"> + <n.no_output.minus i="[n.current_index/]"/> + <n.if.is_greater_than i="0"> + <then> + <div class="info-message" style="margin-top:.2em;padding:.7em .5em"> + <t>Some private items have been omitted because you don't have permission to view them.</t> + </div> + </then> + </n.if.is_greater_than> + </n.int.> + </n.paging.> +</macro> + +<macro name="user_nodes_meta" requires="user_page"> + <n.if.not.equal value1="[n.user_nodes_page_number/]" value2="1"> + <then> + <meta name="robots" content="noindex,follow"/> + </then> + </n.if.not.equal> +</macro> \ No newline at end of file