Пример #1
0
 def new_title(self, title):
     cl = self.data
     data = {'list': title, 'card': cl.card.title}
     notifications.add_history(cl.card.column.board,
                               cl.card,
                               security.get_user().data,
                               u'card_add_list',
                               data)
Пример #2
0
 def delete_checklist(self, index):
     cl = self.checklists.pop(index)()
     for i in range(index, len(self.checklists)):
         self.checklists[i]().set_index(i)
     data = {'list': cl.get_title(), 'card': self.parent.get_title()}
     cl.data.delete()
     if data['list']:
         notifications.add_history(self.parent.column.board.data,
                                   self.parent.data,
                                   security.get_user().data,
                                   u'card_delete_list', data)
Пример #3
0
 def set_done(self):
     '''toggle done status'''
     self.data.done = self.done = not self.done
     item = self.data
     data = {'item': self.get_title(),
             'list': item.checklist.title,
             'card': item.checklist.card.title}
     notifications.add_history(item.checklist.card.column.board,
                               item.checklist.card,
                               security.get_user().data,
                               u'card_listitem_done' if self.done else u'card_listitem_undone',
                               data)
Пример #4
0
 def delete_checklist(self, index):
     cl = self.checklists.pop(index)()
     for i in range(index, len(self.checklists)):
         self.checklists[i]().set_index(i)
     data = {'list': cl.get_title(), 'card': self.parent.get_title()}
     cl.data.delete()
     if data['list']:
         notifications.add_history(self.parent.column.board.data,
                                   self.parent.data,
                                   security.get_user().data,
                                   u'card_delete_list',
                                   data)
Пример #5
0
 def set_done(self):
     '''toggle done status'''
     self.data.done = self.done = not self.done
     item = self.data
     data = {
         'item': self.get_title(),
         'list': item.checklist.title,
         'card': item.checklist.card.title
     }
     notifications.add_history(
         item.checklist.card.column.board, item.checklist.card,
         security.get_user().data,
         u'card_listitem_done' if self.done else u'card_listitem_undone',
         data)
Пример #6
0
    def test_get_boards(self):
        '''Test get boards methods'''
        helpers.set_dummy_context()
        board = helpers.create_board()
        user = helpers.create_user()
        helpers.set_context(user)
        user2 = helpers.create_user('test')
        board.add_member(user2)
        self.assertTrue(board.has_manager(user))
        self.assertIn(
            board.data,
            board_module.Board.get_user_boards_for(user.data.username,
                                                   user.data.source).all())
        self.assertNotIn(
            board.data,
            board_module.Board.get_guest_boards_for(user.data.username,
                                                    user.data.source).all())

        self.assertFalse(board.has_manager(user2))
        self.assertNotIn(
            board.data,
            board_module.Board.get_user_boards_for(user2.data.username,
                                                   user2.data.source).all())
        self.assertIn(
            board.data,
            board_module.Board.get_guest_boards_for(user2.data.username,
                                                    user2.data.source).all())

        notifications.add_history(board.data, board.data.columns[0].cards[0],
                                  user.get_user_data(), u'test', {})
        self.assertIn(
            board.data,
            board_module.Board.get_last_modified_boards_for(
                user.data.username, user.data.source).all())

        board.archive_board()
        self.assertIn(
            board.data,
            board_module.Board.get_archived_boards_for(user.data.username,
                                                       user.data.source).all())
        self.assertNotIn(
            board.data,
            board_module.Board.get_user_boards_for(user.data.username,
                                                   user.data.source).all())
Пример #7
0
 def new_title(self, title):
     cl = self.data
     data = {'list': title, 'card': cl.card.title}
     notifications.add_history(cl.card.column.board, cl.card,
                               security.get_user().data, u'card_add_list',
                               data)