Conjunto de mudanças 6585 no repositório publico


Ignorar:
Timestamp:
29/06/2012 20:25:53 (9 anos atrás)
Autor:
mazza
Mensagem:

refatoracao: renomeado Carousel.numbers -> Carousel.panels

Localização:
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis
Arquivos:
3 editados

Legenda:

Não Modificado
Adicionado
Removido
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/boxes/carousel.py

    r6584 r6585  
    2222        else:
    2323            template = get_template("carousel.html")
    24         boxes = [(number, Box(ICarouselItem, number)) for number in self.numbers]
     24        boxes = [(panel, Box(ICarouselItem, panel)) for panel in self.panels]
    2525        return template.render(
    2626            carousel_edit_href=carousel_edit_href(self.number),
    27             items=[(number,
     27            items=[(panel,
    2828                    box.get_data(self.context),
    29                     box.edit_href) for number, box in boxes])
     29                    box.edit_href) for panel, box in boxes])
    3030
    31     # TODO: renomear isso para panels
    3231    @property
    33     def numbers(self):
    34         return self.get_box_data(self.context,
    35                                  "carousel_numbers_%s" % self.number,
    36                                  PersistentList)
     32    def panels(self):
     33        return self.get_box_data(self.context, self._panels_key(), PersistentList)
     34
     35    def _panels_key(self):
     36        return "carousel_panels_%s" % self.number
    3737
    3838    def add_item(self):
    39         numbers = self.numbers
     39        panels = self.panels
    4040        for i in range(NUMBER_OF_PRE_CREATED_BOXES):
    41             if i not in numbers and Box(ICarouselItem, number).is_empty(self.context):
    42                 numbers.insert(0, i)
     41            if i not in panels and Box(ICarouselItem, number).is_empty(self.context):
     42                panels.insert(0, i)
    4343                break
    4444
    4545    def remove_item(self, id):
    4646        index = self._index_from_id(id)
    47         self.numbers.remove(index)
     47        self.panels.remove(index)
    4848        Box(ICarouselItem, index).erase_data(self.context)
    4949
    5050    def reorder(self, ids):
    51         self.numbers[:] = [self._index_from_id(id) for id in ids.split(',')]
     51        self.panels[:] = [self._index_from_id(id) for id in ids.split(',')]
    5252
    5353    def _index_from_id(self, id):
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/boxes/templates/carousel-edit.html

    r6584 r6585  
    11<div id="carousel-edit-panels">
    2   {%- for number, data, edit_href in items %}
    3   <div class="portlet" id="carousel_item_{{ number }}">
     2  {%- for panel, data, edit_href in items %}
     3  <div class="portlet" id="carousel_item_{{ panel }}">
    44    <div class="portlet-header">Arraste e solte para reordenar os painéis</div>
    55    <div class="portlet-content editable-box">
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/tests/testunitcarousel.py

    r6584 r6585  
    1717        assert a redered output
    1818        """
    19 
     19        context = object()
    2020        with patch('il.portalinterlegis.browser.boxes.manager.IAnnotations') as IAnnotations:
    2121            IAnnotations.return_value = {BoxAware.ALL_BOXES_KEY: {
    22                 "carousel_numbers_0": [1, 2],
     22                Carousel(0, context)._panels_key(): [1, 2],
    2323                Box(ICarouselItem, 1).id: dict(
    2424                    target = "TARGET_1",
     
    3434                ),
    3535            }}
    36             context = object()
    3736            self.assertMultiLineEqual('''
    3837<div class="carousel-container">
Note: Veja TracChangeset para ajuda no uso do visualizador de conjunto de mudanças.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.