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/browse/results.kid

    r5303 r5305  
    1818                </div></div> 
    1919            </div> 
    20             <?python 
    21             n,p=c.state.getNext() 
    22             if p: 
    23                 purl=c.state.geturl(offset=p[0],stride=p[1]) 
    24             if n: 
    25                 nurl=c.state.geturl(offset=n[0],stride=n[1]) 
    26             upper=c.state.offset+c.state.stride-1 
    27             ?> 
    28             <div class="resultsBar">  
    29                 <div> 
    30                     <form action="$c.discoveryUrl" name="orderByForm"> 
    31                                 <input type="hidden" name="constraints" value="${c.state.urlformattedconstraints}"/> 
    32                     <a href="${c.state.constrainedurl}"> Refine search</a><span py:replace="helpIcon('refser_help')"/> 
    33                     <span py:if="c.state.hits != 0" py:strip="">  
    34                                 | Order By ${XML(h.select('orderBy',option_tags = c.orderByList, onchange="orderByForm.submit()"))} 
    35                                 ${XML(h.select('orderDirection',option_tags = c.orderDirection, onchange="orderByForm.submit()"))} 
    36                         | Found ${c.state.hits}  
    37                             <span py:if="p!=[]"> | <a href="$purl"> Previous ${p[1]}</a> </span> 
    38                                                 | Showing ${c.state.offset}-$upper  
    39                         <span py:if="n!=[]"> | <a href="$nurl"> Next ${n[1]}</a></span> 
    40                      </span> 
    41                             </form> 
    42                 </div><div id="refser_help" class="hidden"> 
    43                     <div class="helptxt"><p> 
    44                     The refined search option allows you to constrain your search by returning you to the advanced search page, but retaining your current search parameters 
    45                     </p></div> 
    46                 </div> 
    47             </div> 
     20                <div py:replace="pageControl(c.state, c.discoveryUrl)"/> 
    4821            <div py:if="c.state.hits != 0" id="resultsTab"> 
    4922                <table> 
     
    6033                    </tbody>  
    6134                </table> 
    62             </div> 
    63             <div py:if="c.state.hits != 0" class="resultsBar"> 
    64                 <a href="${c.state.constrainedurl}"> Refine search</a>  
    65                 | Order By | 
    66                 | Found ${c.state.hits} | Showing ${c.state.offset}-$upper  
    67                   <span py:if="p!=[]"> | <a href="$purl"> Previous ${p[1]}</a> </span> 
    68                   <span py:if="n!=[]"> | <a href="$nurl"> Next ${n[1]}</a></span> | 
     35                        <div py:replace="pageControl(c.state, None)"/> 
    6936            </div> 
    7037        </div> 
Note: See TracChangeset for help on using the changeset viewer.