Esempio n. 1
0
    def __init__(self,
                 id_,
                 board,
                 card_extensions,
                 action_log,
                 card_filter,
                 search_engine_service,
                 services_service,
                 data=None):
        """Initialization

        In:
            - ``id_`` -- the id of the column
        """
        self.db_id = id_
        self._data = data
        self.id = 'list_' + str(self.db_id)
        self.board = board
        self._services = services_service
        self.action_log = action_log
        self.card_filter = card_filter
        self.search_engine = search_engine_service
        self.card_extensions = card_extensions
        self.body = component.Component(self, 'body')
        self.title = component.Component(title.EditableTitle(
            self.get_title)).on_answer(self.set_title)
        self.card_counter = component.Component(CardsCounter(self))
        self._cards = None
        self.new_card = component.Component(NewCard(self))
Esempio n. 2
0
    def __init__(self, id_, board, card_extensions, action_log, search_engine_service, services_service, data=None):
        """Initialization

        In:
            - ``id_`` -- the id of the column
        """
        self.db_id = id_
        self._data = data
        self.id = 'list_' + str(self.db_id)
        self.board = board
        self.nb_card = var.Var(self.data.nb_max_cards)
        self._services = services_service
        self.action_log = action_log
        self.search_engine = search_engine_service
        self.card_extensions = card_extensions
        self.body = component.Component(self, 'body')
        self.title = component.Component(
            title.EditableTitle(self.get_title)).on_answer(self.set_title)
        self.card_counter = component.Component(CardsCounter(self))
        self.cards = [
            component.Component(
                self._services(
                    comp.Card, c.id,
                    self.card_extensions,
                    self.action_log, data=c))
                      for c in self.data.cards]
        self.new_card = component.Component(
            comp.NewCard(self))

        self.actions_comp = component.Component(self, 'overlay')
        self.actions_overlay = component.Component(overlay.Overlay(
            lambda r: r.i(class_='icon-target2'),
            self.actions_comp.render,
            title=_('List actions'), dynamic=False))
Esempio n. 3
0
 def __init__(self, id_, action_log, data=None):
     self.id = id_
     self.action_log = action_log
     data = data if data is not None else self.data
     self.title = component.Component(
         title.EditableTitle(self.get_title,
                             placeholder=i18n._(u'Enter task'))).on_answer(
                                 self.set_title)
     self.done = data.done
Esempio n. 4
0
 def refresh(self):
     """Refresh the sub components
     """
     self.title = component.Component(title.EditableTitle(
         self.get_title)).on_answer(self.set_title)
     self.extensions = [
         (name, component.Component(extension))
         for name, extension in self.card_extensions.instantiate_items(
             self, self.action_log, self._services)
     ]
Esempio n. 5
0
    def __init__(self, board):
        """Initialization

        In:
            - ``board`` -- the board object we are working on
        """
        self.board = board
        self.labels = []
        for label in board.labels:
            t = component.Component(title.EditableTitle(label.get_title))
            t.on_answer(label.set_title)
            l = component.Component(label, model='edit-color')
            self.labels.append((t, l))
Esempio n. 6
0
    def __init__(self, id_, action_log, data=None):
        self.id = id_
        self.action_log = action_log
        data = data if data is not None else self.data
        self.items = [
            component.Component(ChecklistItem(item.id, action_log, item))
            for item in data.items
        ]

        self.title = component.Component(
            title.EditableTitle(self.get_title,
                                placeholder=i18n._(u'Add title'))).on_answer(
                                    self.set_title)
        self.new_item = component.Component(NewChecklistItem(len(
            self.items))).on_answer(self.add_item_from_str)
Esempio n. 7
0
    def __init__(self,
                 id_,
                 app_title,
                 app_banner,
                 theme,
                 card_extensions,
                 search_engine,
                 assets_manager_service,
                 mail_sender_service,
                 services_service,
                 load_children=True):
        """Initialization

        In:
          -- ``id_`` -- the id of the board in the database
          -- ``mail_sender_service`` -- Mail service, used to send mail
          -- ``on_board_delete`` -- function to call when the board is deleted
        """
        self.model = 'columns'
        self.app_title = app_title
        self.app_banner = app_banner
        self.theme = theme
        self.mail_sender = mail_sender_service
        self.id = id_
        self.assets_manager = assets_manager_service
        self.search_engine = search_engine
        self._services = services_service
        # Board extensions are not extracted yet, so
        # board itself implement their API.
        self.board_extensions = {
            'weight': self,
            'labels': self,
            'members': self
        }
        self.card_extensions = card_extensions.set_configurators(
            self.board_extensions)

        self.action_log = ActionLog(self)

        self.version = self.data.version
        self.modal = component.Component(popin.Empty())
        self.card_matches = set()  # search results
        self.last_search = u''

        self.columns = []
        self.archive_column = None
        if load_children:
            self.load_children()

        # Member part
        self.overlay_add_members = component.Component(
            overlay.Overlay(lambda r: (r.i(class_='ico-btn icon-user'),
                                       r.span(_(u'+'), class_='count')),
                            lambda r: component.Component(self).render(
                                r, model='add_member_overlay'),
                            dynamic=True,
                            cls='board-labels-overlay'))
        self.new_member = component.Component(
            usermanager.NewMember(self.autocomplete_method))

        self.update_members()

        def many_user_render(h, number):
            return h.span(h.i(class_='ico-btn icon-user'),
                          h.span(number, class_='count'),
                          title=_("%s more...") % number)

        self.see_all_members = component.Component(
            overlay.Overlay(lambda r: many_user_render(
                r,
                len(self.all_members) - self.MAX_SHOWN_MEMBERS),
                            lambda r: component.Component(self).render(
                                r, model='members_list_overlay'),
                            dynamic=False,
                            cls='board-labels-overlay'))
        self.see_all_members_compact = component.Component(
            overlay.Overlay(
                lambda r: many_user_render(r, len(self.all_members)),
                lambda r: component.Component(self).render(
                    r, model='members_list_overlay'),
                dynamic=False,
                cls='board-labels-overlay'))

        self.comp_members = component.Component(self)

        # Icons for the toolbar
        self.icons = {
            'add_list':
            component.Component(Icon('icon-plus', _('Add list'))),
            'edit_desc':
            component.Component(
                Icon('icon-pencil', _('Edit board description'))),
            'preferences':
            component.Component(Icon('icon-cog', _('Preferences'))),
            'export':
            component.Component(Icon('icon-download3', _('Export board'))),
            'save_template':
            component.Component(Icon('icon-floppy', _('Save as template'))),
            'archive':
            component.Component(Icon('icon-trashcan', _('Archive board'))),
            'leave':
            component.Component(Icon('icon-exit', _('Leave this board'))),
            'history':
            component.Component(Icon('icon-history', _("Action log"))),
        }

        # Title component
        self.title = component.Component(title.EditableTitle(
            self.get_title)).on_answer(self.set_title)

        self.must_reload_search = False