~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/browser/mergequeuelisting.py

  • Committer: Ian Booth
  • Date: 2010-10-25 13:12:44 UTC
  • mto: This revision was merged to the branch mainline in revision 11934.
  • Revision ID: ian.booth@canonical.com-20101025131244-9wqphh6r7oi5291r
Initial prototype

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Base class view for merge queue listings."""
 
5
 
 
6
__metaclass__ = type
 
7
 
 
8
__all__ = [
 
9
    'MergeQueueListingView',
 
10
    'HasMergeQueuesMenuMixin',
 
11
    'PersonMergeQueueListingView',
 
12
    'ProductMergeQueueListingView',
 
13
    ]
 
14
 
 
15
 
 
16
from canonical.launchpad.browser.feeds import FeedsMixin
 
17
from canonical.launchpad.webapp import (
 
18
    LaunchpadView,
 
19
    Link,
 
20
    )
 
21
 
 
22
 
 
23
class HasMergeQueuesMenuMixin:
 
24
    """A context menus mixin for objects that implement IHasMergeQueues."""
 
25
 
 
26
    def view_merge_queues(self):
 
27
        text = 'View merge queues'
 
28
        enabled = self.context.getMergeQueues().count() > 0
 
29
#        enabled = True
 
30
        return Link(
 
31
            '+merge-queues', text, icon='info', enabled=enabled, site='code')
 
32
 
 
33
 
 
34
class MergeQueueListingView(LaunchpadView, FeedsMixin):
 
35
 
 
36
    feed_types = ()
 
37
 
 
38
    branch_enabled = True
 
39
    owner_enabled = True
 
40
 
 
41
    @property
 
42
    def page_title(self):
 
43
        return 'Merge Queues for %(displayname)s' % {
 
44
            'displayname': self.context.displayname}
 
45
 
 
46
 
 
47
class PersonMergeQueueListingView(MergeQueueListingView):
 
48
 
 
49
    owner_enabled = False
 
50