~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/translations/browser/translationgroup.py

Merge from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
__all__ = [
8
8
    'TranslationGroupAddTranslatorView',
9
9
    'TranslationGroupAddView',
 
10
    'TranslationGroupBreadcrumb',
10
11
    'TranslationGroupEditView',
11
12
    'TranslationGroupNavigation',
12
13
    'TranslationGroupReassignmentView',
49
50
    text = u"Translation groups"
50
51
 
51
52
 
 
53
class TranslationGroupBreadcrumb(Breadcrumb):
 
54
    """Builds a breadcrumb for an `ITranslationGroup`."""
 
55
 
 
56
    @property
 
57
    def text(self):
 
58
        return self.context.title
 
59
 
52
60
class TranslationGroupView:
53
61
 
54
62
    def __init__(self, context, request):
63
71
            result.append({'lang': item.language.englishname,
64
72
                           'person': item.translator,
65
73
                           'code': item.language.code,
 
74
                           'language' : item.language,
66
75
                           'datecreated': item.datecreated,
67
76
                           'style_guide_url': item.style_guide_url,
 
77
                           'context' : item,
68
78
                           })
69
79
        result.sort(key=operator.itemgetter('lang'))
70
80
        return result
76
86
    schema = ITranslator
77
87
    field_names = ['language', 'translator', 'style_guide_url']
78
88
 
79
 
    @action("Add", name="add")
80
 
    def add_action(self, action, data):
 
89
    @action("Appoint", name="appoint")
 
90
    def appoint_action(self, action, data):
81
91
        """Appoint a translator to do translations for given language.
82
92
 
83
93
        Create a translator who, within this group, will be responsible for
99
109
                "There is already a translator for this language")
100
110
 
101
111
    @property
 
112
    def cancel_url(self):
 
113
        return canonical_url(self.context)
 
114
 
 
115
    @property
102
116
    def next_url(self):
103
 
        return canonical_url(self.context)
 
117
        return self.cancel_url
 
118
 
 
119
    label = "Appoint a translation team"
 
120
 
 
121
    @property
 
122
    def page_title(self):
 
123
        return 'Apoint a translation team in "%s"' % (self.context.title)
104
124
 
105
125
 
106
126
class TranslationGroupEditView(LaunchpadEditFormView):
130
150
                "There is already a translation group with this name")
131
151
 
132
152
    @property
 
153
    def cancel_url(self):
 
154
        return canonical_url(self.context)
 
155
 
 
156
    @property
133
157
    def next_url(self):
134
 
        return canonical_url(self.context)
 
158
        return self.cancel_url
 
159
 
 
160
    @property
 
161
    def label(self):
 
162
        return "Change %s details" % (self.context.title)
 
163
 
 
164
    @property
 
165
    def page_title(self):
 
166
        return 'Change "%s" translation group details' % (self.context.title)
135
167
 
136
168
 
137
169
class TranslationGroupAddView(LaunchpadFormView):