post_count_js

NAML documentation   Watch a video
   Usages of this macro
... in post_count_js.naml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<override_macro name="post_count_js">
    <n.param_loop
Macro
Parameters: param, do
. param="postCount">
        <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.not
Binary
Namespace: BasicNamespace
Parameters: condition
.page_user
Macro
Requires: parameter_value_list
Parameters: do
.is_deactivated
Binary
Namespace: UserNamespace
>
            <then>
                var $div = $('div.post-count<n.page_user
Macro
Requires: parameter_value_list
Parameters: do
.user_tag_id
Macro
Requires: user
/>');
                $div.html('<n.one_or_many
Macro
Parameters: many_text, one_text, n
 n="[n.page_user
Macro
Requires: parameter_value_list
Parameters: do
.post_count_value
Macro
Requires: user
/]" one_text="[t]post[/t]" many_text="[t]posts[/t]"/>');
            
                $div.append("<br/>");
                var postCount = <n.page_user
Macro
Requires: parameter_value_list
Parameters: do
.post_count_value
Macro
Requires: user
/>;
                if (postCount > 1000)
                    $div.append("Super Farmer");
                else if (postCount > 500)
                    $div.append("Crop Master");
                else if (postCount > 300)
                    $div.append("Agriculturalist");
                else if (postCount > 200)
                    $div.append("Farmer");
                else if (postCount > 100)
                    $div.append("Rancher");
                else if (postCount > 50)
                    $div.append("Farm Hand");
                else if (postCount > 20)
                    $div.append("Cowpoke");
                else
                    $div.append("Sprout");
            </then>
        </n.if.not.page_user.is_deactivated>
    </n.param_loop.>
</override_macro>
Overrides default macro
... in topic.naml
602
603
604
605
606
607
608
609
610
611
<macro name="post_count_js">
    <n.param_loop. param="postCount">
        <n.if.not.page_user.is_deactivated>
            <then>
                $('div.post-count<n.page_user.user_tag_id/>')
                    .html('<n.one_or_many n="[n.page_user.post_count_value/]" one_text="[t]post[/t]" many_text="[t]posts[/t]"/>');
            </then>
        </n.if.not.page_user.is_deactivated>
    </n.param_loop.>
</macro>