views

NAML documentation   Watch a video
   Usages of this macro
... in views.naml
1
2
<override_macro name="views" requires="node" parameters="show_text">
</override_macro>
Overrides default macro
... in utilities.naml
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
<macro name="views" requires="node" parameters="show_text">
    <n.if.equal value1="[n.show_text/]" value2="true">
        <then>
            <span id="v[n.id/]" style="display:none">1 <t>view</t>|%1 <t>views</t></span>
        </then>
        <else>
            <span id="v[n.id/]" style="display:none"></span>
        </else>
    </n.if.equal>
    <n.put_in_head.>
        <script type="text/javascript">
            Nabble.nViews = function(id, views) {
                var $v = $('#v'+id);
                var pos = views=='1'?0:1;
                var t = $v.html()? $v.html().split('|')[pos]:'';
                $v.html(t == ''? views : t.replace(/%1/g,views)).show();
            };
        </script>
    </n.put_in_head.>
    <n.call_later value="[n.id/]" param="views"/>
</macro>