Ignore:
Timestamp:
19/05/09 11:23:47 (10 years ago)
Author:
cbyrom
Message:

Improve structure of DiscoveryState? module by adding a new object,
PagerState? to hold the data connected to the results table paging.
Also tidy up code layout and simplify logic. Create new template
method, pagerControl, to represent the results table paging control

  • to allow reuse across the results and short_results templates.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • MILK/trunk/milk_server/milk_server/templates/ndgPage.kid

    r5116 r5305  
    1919        <div id="logo"><img src="$g.LeftLogo" alt="$g.LeftAlt" /></div> 
    2020    </div> 
     21 
     22    <div py:def="pageControl(state, discoveryURL)" class="resultsBar"> 
     23    <!-- NB, can only have one main page control on the page since it has a form and 
     24    help div associated with it - for the main control, set the discoveryURL to a valid 
     25    value, otherwise set to None 
     26    --> 
     27            <div> 
     28                <?python 
     29                formID = "xyz" 
     30                if discoveryURL: 
     31                        formID = "orderByForm" 
     32                ?> 
     33                <form action="$discoveryURL" name="$formID"> 
     34                <input type="hidden" name="constraints" value="${state.urlformattedconstraints}"/> 
     35                <a href="${state.constrainedurl}"> Refine search</a><span py:replace="helpIcon('refser_help')"/> 
     36                <span py:if="state.hits != 0" py:strip="">  
     37                        <span py:if="discoveryURL" py:strip=""> 
     38                            | Order By ${XML(h.select('orderBy',option_tags = c.orderByList, onchange="orderByForm.submit()"))} 
     39                        ${XML(h.select('orderDirection',option_tags = c.orderDirection, onchange="orderByForm.submit()"))} 
     40                    </span> 
     41                        | Found ${state.hits}  
     42                    <span py:if="state.pager.previousPageURL"> | <a href="$state.pager.startPageURL"> &lt;&lt; </a> 
     43                    | <a href="$state.pager.previousPageURL"> Previous ${state.pager.previousNumber}</a> </span> 
     44                                | Showing ${state.pager.lowerRange}-${state.pager.upperRange}  
     45                    <span py:if="state.pager.nextPageURL"> | <a href="$state.pager.nextPageURL"> Next ${state.pager.nextNumber}</a> 
     46                    | <a href="$state.pager.lastPageURL"> &gt;&gt; </a></span> 
     47                 </span> 
     48                </form> 
     49            </div> 
     50            <div py:if="discoveryURL" id="refser_help" class="hidden"> 
     51                <div class="helptxt"><p> 
     52                The refined search option allows you to constrain your search by returning you to the advanced search page, but retaining your current search parameters 
     53                </p></div> 
     54            </div> 
     55        </div> 
    2156     
    2257    <!-- One line search box for top of many pages follows --> 
    23      
    2458    <div py:def="searchOneLine(targets=0)" class="searchBar"> 
    2559        <table width="100%"><tr><td align="left"> 
Note: See TracChangeset for help on using the changeset viewer.