예제 #1
0
def ajax_html_select(name_title_html, **kwargs):
    '''If no htmlid is provided, a new widget containing the target html
    is created and data is an iterable over three elements tuples.'''
    htmlid = gen_unique_id()[:8]
    target = Widget('div', id=htmlid)
    select = Widget('select', cn = 'text-select')\
                    .addData('target','#{0}'.format(htmlid))

    for name, title, body in name_title_html:
        select.add((name, title))
        target.add(Widget('div', body, cn='{0} target'.format(name)))

    return Widget(None, (select, target))
예제 #2
0
파일: tabs.py 프로젝트: pombredanne/djpcms
def ajax_html_select(name_title_html, **kwargs):
    '''If no htmlid is provided, a new widget containing the target html
    is created and data is an iterable over three elements tuples.'''
    htmlid = gen_unique_id()[:8]
    target = Widget('div',id=htmlid)
    select = Widget('select', cn = 'text-select')\
                    .addData('target','#{0}'.format(htmlid))

    for name,title,body in name_title_html:
        select.add((name,title))
        target.add(Widget('div', body, cn = '{0} target'.format(name)))

    return Widget(None,(select,target))
예제 #3
0
 def _unwind(self):
     if self._data_stream:
         ul = Widget('ul').addClass(self.internal.get('type'))
         divs = []
         for key, val in self._data_stream:
             if not isinstance(key, Widget) or key.tag != 'a':
                 id = gen_unique_id()[:8]
                 key = Widget('a', key, href='#' + id)
                 divs.append(Widget('div', val, id=id))
             ul.add(Widget('li', key, cn=classes.clickable))
         yield ul
         for div in divs:
             yield div
예제 #4
0
파일: tabs.py 프로젝트: pombredanne/djpcms
 def _unwind(self):
     if self._data_stream:
         ul = Widget('ul').addClass(self.internal.get('type'))
         divs = []
         for key, val in self._data_stream:
             if not isinstance(key,Widget) or key.tag!='a':
                 id = gen_unique_id()[:8]
                 key = Widget('a', key, href='#'+id)
                 divs.append(Widget('div', val, id=id))
             ul.add(Widget('li', key, cn=classes.clickable))
         yield ul
         for div in divs:
             yield div