Beispiel #1
0
 def get_batch_actions(cls, category, user):
     actions = super(GtgMetadata, cls).get_batch_actions(category, user)
     actions['start_review'] = MenuItem(
         'start-review',
         _('Start review'),
         reverse('batch_start_reviews',
                 args=[category.organisation.slug, category.slug]),
         ajax=True,
         modal='batch-review-modal',
         progression_modal=True,
         icon='eye-open',
     )
     actions['cancel_review'] = MenuItem(
         'cancel-review',
         'Cancel review',
         reverse('batch_cancel_reviews',
                 args=[category.organisation.slug, category.slug]),
         ajax=True,
         modal='cancel-review-modal',
         progression_modal=True,
         icon='eye-close',
     )
     if user.has_perm('transmittals.add_outgoingtransmittal'):
         actions['create_transmittal'] = MenuItem(
             'create-transmittal',
             'Create transmittal',
             reverse('transmittal_create',
                     args=[category.organisation.slug, category.slug]),
             ajax=True,
             modal='create-transmittal-modal',
             progression_modal=True,
             icon='transfer',
         )
     return actions
Beispiel #2
0
    def get_actions(self, metadata, user):
        """Define actions that apply to a single document.

        This list is used to build the "Actions" menu in the
        document form.

        """
        actions = []
        category = self.document.category
        if user.has_perm('documents.change_document'):
            actions.append(MenuItem(
                'create-revision',
                _('Create revision'),
                reverse('document_revise', args=[
                    category.organisation.slug,
                    category.slug,
                    self.document.document_key]),
                disabled=self.is_under_review(),
                method='GET',
            ))

        if user.has_perm('documents.can_control_document'):
            actions.append(DividerMenuItem())

            actions.append(MenuItem(
                'delete-revision',
                _('Delete last revision'),
                reverse('document_revision_delete', args=[
                    category.organisation.slug,
                    category.slug,
                    self.document.document_key]),
                modal='delete-revision-modal',
                disabled=self.revision <= 1
            ))

            actions.append(MenuItem(
                'delete-document',
                _('Delete document'),
                reverse('document_delete', args=[
                    category.organisation.slug,
                    category.slug,
                    self.document.document_key]),
                modal='delete-document-modal'
            ))

            actions.append(DividerMenuItem())

            actions.append(MenuItem(
                'audit-trail',
                _('Audit Trail'),
                reverse('document_audit_trail', args=[
                    category.organisation.slug,
                    category.slug,
                    self.document.document_key]),
                modal='audit-trail-modal',
                disabled=False,
                method='GET',
            ))
        return actions
Beispiel #3
0
    def get_actions(self, metadata, user):
        actions = super(ReviewMixin, self).get_actions(metadata, user)
        category = self.document.category

        can_start_stop_review = user.has_perm(
            'documents.can_start_stop_review')

        if self.is_under_review():

            if can_start_stop_review:
                actions.insert(
                    -3,
                    MenuItem('cancel-review',
                             _('Cancel review'),
                             reverse('document_cancel_review',
                                     args=[self.document.document_key]),
                             modal='cancel-review-modal'))

            user_review = self.get_review(user)
            review_closed_on = user_review.closed_on if user_review else None
            if review_closed_on:
                actions.insert(
                    -3,
                    MenuItem(
                        'update-comment',
                        _('Modify your comment'),
                        reverse('review_document',
                                args=[self.document.document_key]),
                        method='GET',
                    ))

        else:  # revision is not under review

            if self.can_be_reviewed and can_start_stop_review:
                actions.insert(
                    -3,
                    MenuItem(
                        'start-review',
                        _('Start review'),
                        reverse('document_start_review',
                                args=[
                                    category.organisation.slug, category.slug,
                                    self.document.document_key
                                ]),
                    ))

                actions.insert(
                    -3,
                    MenuItem('start-review-remark',
                             _('Start review w/ remark'),
                             reverse('document_start_review',
                                     args=[
                                         category.organisation.slug,
                                         category.slug,
                                         self.document.document_key
                                     ]),
                             modal='start-comment-review'))

        return actions
Beispiel #4
0
    def get_batch_actions(cls, category, user):
        actions = super(ContractorDeliverable,
                        cls).get_batch_actions(category, user)

        if user.has_perm('documents.can_control_document') and user.has_perm(
                'reviews.can_add_review'):
            actions['start_review'] = MenuItem(
                'start-review',
                _('Start review'),
                reverse('batch_start_reviews',
                        args=[category.organisation.slug, category.slug]),
                ajax=True,
                modal='batch-review-modal',
                progression_modal=True,
                icon='eye-open',
            )
            actions['cancel_review'] = MenuItem(
                'cancel-review',
                _('Cancel review'),
                reverse('batch_cancel_reviews',
                        args=[category.organisation.slug, category.slug]),
                ajax=True,
                modal='cancel-review-modal',
                progression_modal=True,
                icon='eye-close',
            )

        if user.has_perm('transmittals.add_outgoingtransmittal'):
            actions['prepare_transmittal'] = MenuItem(
                'prepare-transmittal',
                _('Prepare outgoing transmittal'),
                reverse('transmittal_prepare',
                        args=[category.organisation.slug, category.slug]),
                ajax=False,
                progression_modal=False,
                icon='hand-up')
            actions['create_transmittal'] = MenuItem(
                'create-transmittal',
                'Create transmittal',
                reverse('transmittal_create',
                        args=[category.organisation.slug, category.slug]),
                ajax=True,
                modal='create-transmittal-modal',
                progression_modal=True,
                icon='transfer',
            )
        return actions
Beispiel #5
0
    def get_batch_actions(cls, category, user):
        actions = super(OutgoingTransmittal,
                        cls).get_batch_actions(category, user)

        if user.is_external:
            actions['ack_transmittals'] = MenuItem(
                'ack-transmittals',
                _('Ack receipt'),
                reverse('transmittal_batch_ack_of_receipt',
                        args=[category.organisation.slug, category.slug]),
                ajax=False,
                icon='eye-open',
            )

        return actions
Beispiel #6
0
    def get_batch_actions(cls, category, user):
        """Define actions that apply on lists of documents.

        This list is used to build the menu in the document list navbar.

        """
        actions = OrderedDict()
        actions['download'] = MenuItem(
            'download',
            _('Download'),
            reverse('document_download',
                    args=[category.organisation.slug, category.slug]),
            ajax=False,
            modal='documents-download-modal',
            icon='download')
        return actions
Beispiel #7
0
    def get_actions(self, metadata, user):
        actions = super(OutgoingTransmittalRevision, self).get_actions(
            metadata, user)
        category = self.document.category

        if user.is_external and metadata.ack_of_receipt_date is None:
            actions.insert(-3, MenuItem(
                'ack-transmittal',
                _('Acknowledge receipt'),
                reverse('transmittal_ack_of_receipt', args=[
                    category.organisation.slug,
                    category.slug,
                    self.document.document_key])
            ))

        return actions