Example #1
0
def render_profile_box_profile_view(self, h, comp, *args):
    user = self.user

    # expert's business area
    if user.di_business_area and security.has_permissions('view_di_business_area', self):
        with h.h2:
            h << _(u"Expert's Business Area")
        with h.p:
            h << user.di_business_area or ''

    with h.div(class_='group'):
        h << h.h2(_(u'Who am I?'))
        if user.description:
            with h.p:
                h << '"%s"' % user.description

    with h.div(class_='group'):
        with h.table:
            with h.tbody:
                with h.tr:
                    with h.td:
                        h << h.h2(_(u'Skills'))
                        if user.competencies:
                            h << text_to_html_elements(h, user.competencies)
                    with h.td:
                        h << h.h2(_(u'Expertises'))
                        if user.expertises:
                            h << text_to_html_elements(h, user.expertises)
                    with h.td:
                        h << h.h2(_(u'Hobbies'))
                        if user.hobbies:
                            h << text_to_html_elements(h, user.hobbies)

    return h.root
Example #2
0
def render_profile_box_profile_view(self, h, comp, *args):
    user = self.user

    # expert's business area
    if user.di_business_area and security.has_permissions(
            'view_di_business_area', self):
        with h.h2:
            h << _(u"Expert's Business Area")
        with h.p:
            h << user.di_business_area or ''

    with h.div(class_='group'):
        h << h.h2(_(u'Who am I?'))
        if user.description:
            with h.p:
                h << '"%s"' % user.description

    with h.div(class_='group'):
        with h.table:
            with h.tbody:
                with h.tr:
                    with h.td:
                        h << h.h2(_(u'Skills'))
                        if user.competencies:
                            h << text_to_html_elements(h, user.competencies)
                    with h.td:
                        h << h.h2(_(u'Expertises'))
                        if user.expertises:
                            h << text_to_html_elements(h, user.expertises)
                    with h.td:
                        h << h.h2(_(u'Hobbies'))
                        if user.hobbies:
                            h << text_to_html_elements(h, user.hobbies)

    return h.root
Example #3
0
def render_comment(self, h, comp, *args):
    voters = self.voters
    voters_uids = [voter.uid for voter in voters]

    pager = UserPager(self, lambda uids=voters_uids: UserRepository().get_by_uids(uids))
    relevant_comment_users_dialog = component.Component(ModalBox(AsyncWrapper(component.Component(pager, model='minimal')),
                                                                 title=_(u'Users finding this comment relevant'),
                                                                 visible=False))

    with h.li:
        h << h.a(name='comment%s' % self.id)  # so we can navigate to comments
        sync = h.SyncRenderer()
        h << relevant_comment_users_dialog.render(sync)
        with h.div(class_='user'):
            # creator avatar
            h << component.Component(User(self, self.comment.created_by)).render(sync, model='avatar100')
        if voters:
            with h.div(class_='alert'):
                nb_voters = len(voters_uids)
                if nb_voters > 1:
                    message = _(u"%s people find this comment relevant") % nb_voters
                else:
                    message = _(u"One people find this comment relevant")

                h << h.a(message,
                         title=message,
                         href='javascript:' + relevant_comment_users_dialog().show_js(),
                         class_='votes')
        with h.div(class_='author'):
            # author
            h << _(u"From") << " "
            h << comp.render(sync, model='author') << " "

            # date
            if self.comment.submission_date:  # deal with missing dates in the database
                h << _(u'on') << " "
                with h.span(class_='date'):
                    h << format_datetime(self.comment.submission_date)
                h << " "
        h << h.p(text_to_html_elements(h, self.comment.content))

        # attachment
        if self.comment.attachment:
            with h.p:
                h << component.Component(Attachment(self.comment.attachment)).render(h)

        with h.div(class_='links'):
            h << comp.render(h, model='actions')

        # delete form
        h << comp.render(h, model='delete_form')

    return h.root