~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugtask.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-31 14:42:32 UTC
  • mfrom: (14128.3.63 navigate-batches)
  • Revision ID: launchpad@pqm.canonical.com-20111031144232-hnxlaf3l7cf857ah
[r=deryck][bug=882264] AJAX batch navigation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2212
2212
 
2213
2213
    @property
2214
2214
    def mustache(self):
2215
 
        return pystache.render(self.mustache_template, self.model)
 
2215
        """The rendered mustache template."""
 
2216
        cache = IJSONRequestCache(self.request)
 
2217
        return pystache.render(self.mustache_template,
 
2218
                               cache.objects['mustache_model'])
2216
2219
 
2217
2220
    @property
2218
2221
    def model(self):
2479
2482
            self.context, self.request, self.user)
2480
2483
        if getFeatureFlag('bugs.dynamic_bug_listings.enabled'):
2481
2484
            cache = IJSONRequestCache(self.request)
2482
 
            cache.objects['mustache_model'] = self.search().model
 
2485
            batch_navigator = self.search()
 
2486
            cache.objects['mustache_model'] = batch_navigator.model
 
2487
 
 
2488
            def _getBatchInfo(batch):
 
2489
                if batch is None:
 
2490
                    return None
 
2491
                return {'memo': batch.range_memo,
 
2492
                        'start': batch.startNumber() - 1}
 
2493
 
 
2494
            next_batch = batch_navigator.batch.nextBatch()
 
2495
            cache.objects['next'] = _getBatchInfo(next_batch)
 
2496
            prev_batch = batch_navigator.batch.prevBatch()
 
2497
            cache.objects['prev'] = _getBatchInfo(prev_batch)
 
2498
            cache.objects['order_by'] = ','.join(
 
2499
                get_sortorder_from_request(self.request))
 
2500
            cache.objects['forwards'] = batch_navigator.batch.range_forwards
 
2501
            last_batch = batch_navigator.batch.lastBatch()
 
2502
            cache.objects['last_start'] = last_batch.startNumber() - 1
 
2503
            cache.objects.update(_getBatchInfo(batch_navigator.batch))
2483
2504
 
2484
2505
    @property
2485
2506
    def columns_to_show(self):