<%!
    title = 'Controller Paths'
%>
<%inherit file="//layout/base.html" />

<%def name="css()">
    <style type="text/css">
    body { font-family: helvetica, arial, san-serif; }
    .pathnames { font-size: 12px; list-style-type: none; padding: 0 0 10px 0; border-bottom: 1px dotted #ccc; }
    .pathnames li   { padding: 1px; margin-left: 0; padding-bottom: 5px; }
    .mapping      { font-size: 12px; margin-bottom: 40px; }
    .mapping h1     { border-bottom: 1px solid #ccc; padding-bottom: 2px;}
    .pathextra { color: red; }
    .mapping pre { font-weight: bold; }
    .mapping p { color: #555; }
    </style>
</%def>

<h2>Controller paths</h2>


<ul class="pathnames">
  % for i, path in pathnames:
      <li><a href="#${i}">${path|h}</a></li>
  % endfor
</ul>

% for i, pathdata in enumerate(mappings):
    <div class="mapping">
        <h1><a name="${i}"></a>${pathdata['basepath']|h}<span class="pathextra">${pathdata['pathextra'].lstrip('/') | h}</span></h1>
        % if pathdata['doc']:
            <pre>${pathdata['doc']|h}</pre>
        % endif
        <p class="signature">Defined as ${pathdata['ctrl'] | h}.${pathdata['method'] | h}(${pathdata['sig'] | h})</p>

        % if pathdata['is_route']:
            % if pathdata['route_defaults']:
                <h3>Route Default Arguments</h3>
                <ul>
                % if pathdata['route_defaults']:
                    % for k,v in pathdata['route_defaults'].items():
                        <li>${k|h} = ${v|h}</li>
                    % endfor
                % else:
                    <li>(none)</li>
                % endif
                </ul>
            % endif
        % endif

        % if pathdata['args'] or pathdata['defaults']:
            <h3>Form/URL Arguments</h3>
            <ul>
                % if pathdata['args']:
                    % for arg in pathdata['args']:
                        <li>${arg|h}</li>
                    % endfor
                % endif
                % if pathdata['defaults']:
                    % for argname, argval in pathdata['defaults'].items():
                        <li>${argname|h} = ${argval|h}</li>
                    % endfor
                % endif
            </ul>
        % endif
    </div>
% endfor
