示例#1
0
def format_profile(self, request, obj, fieldname, *args, **kwargs):
    """IF user has a profile page return a link to it"""
    existing_profile = current_app.db.index.find_one(
        {'content_type': 'block', 'slug': slugify(obj.get('fullname'))}
    )
    if existing_profile:
        edit_url = url_for(
            'quokka.core.content.admin.blockview.edit_view',
            id=existing_profile['_id']
        )
        view_url = url_for(
            'quokka.core.content.author',
            author=existing_profile['slug']
        )
        edit_link = html.a(href=edit_url, target='_blank')(
            html.i(class_="icon fa fa-pencil glyphicon glyphicon-pencil",
                   style="margin-right: 5px;")(),
            'Edit Profile'
        )
        view_link = html.a(href=view_url, target='_blank')(
            html.i(class_="icon fa fa-globe glyphicon glyphicon-globe",
                   style="margin-right: 5px;")(),
            'View Profile'
        )
        return html.div()(
            html.span()(edit_link),
            Markup(' '),
            html.span()(view_link)
        )
示例#2
0
def format_datetime(self, request, obj, fieldname, *args, **kwargs):
    """Returns the formated datetime in string from object"""
    model = make_model(obj)
    return html.div(style='min-width:130px;')(
        getattr(model, fieldname).strftime(
            app.config.get('ADMIN_DATE_FORMAT', '%Y-%m-%d')
        )
    )
示例#3
0
 def site_body():
     return html.has_block('container')(
         html.div(class_='container')(
             html.block('container'),
             html.block('undefined'),
             html.has_block('noblock')(
                 html.p()
             )
         )
     )
示例#4
0
def format_datetime(self, request, obj, fieldname, *args, **kwargs):
    return html.div(style='min-width:130px;')(
        getattr(obj, fieldname).strftime(self.get_datetime_format())
    )
示例#5
0
def format_datetime(self, request, obj, fieldname, *args, **kwargs):
    return html.div(style='min-width:130px;')(getattr(obj, fieldname).strftime(
        self.get_datetime_format()))
示例#6
0
 def view_a():
     html.block('container')(
         html.div('Container content.')
     )
     return render_template()
示例#7
0
 def view_a_container():
     return html.div('Container content.')
示例#8
0
 def view_a_body():
     return html.div(class_='container')(g.blocks['container'])
示例#9
0
 def container_body():
     return html.div('Container content.')
示例#10
0
 def site_body():
     return html.div(class_='container')(g.blocks['container'])
示例#11
0
def test_newline():
    assert render([html.p('First'), html.newline(), html.p('Second')]) == '<p>First</p>\n\n<p>Second</p>\n'
    assert render(html.div(html.p('First'), html.newline(), html.p('Second'))) == \
           '<div>\n  <p>First</p>\n  \n  <p>Second</p>\n</div>\n'
    assert rn([html.p('First'), html.newline(), html.p('Second')]) == '<p>First</p><p>Second</p>'