Exemple #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)
        )
Exemple #2
0
def format_status(self, request, obj, fieldname, *args, **kwargs):
    status = getattr(obj, fieldname)
    column_formatters_args = getattr(self, 'column_formatters_args', {})
    _args = column_formatters_args.get('status', {}).get(fieldname, {})
    labels = _args.get('labels', {})
    return html.span(class_="label label-{0}".format(
        labels.get(status, 'default')),
                     style=_args.get('style', 'min-height:18px;'))(status)
Exemple #3
0
def format_status(self, request, obj, fieldname, *args, **kwargs):
    status = getattr(obj, fieldname)
    column_formatters_args = getattr(self, 'column_formatters_args', {})
    _args = column_formatters_args.get('status', {}).get(fieldname, {})
    labels = _args.get('labels', {})
    return html.span(
        class_="label label-{0}".format(labels.get(status, 'default')),
        style=_args.get('style', 'min-height:18px;')
    )(status)
Exemple #4
0
def format_status(self, request, obj, fieldname, *args, **kwargs):
    """Format the status published or not published and other booleans"""
    model = make_model(obj)
    status = getattr(model, fieldname)
    column_formatters_args = getattr(self, 'column_formatters_args', {})
    _args = column_formatters_args.get('status', {}).get(fieldname, {})
    labels = _args.get('labels', {})
    return html.span(class_="label label-{0}".format(
        labels.get(status, 'default')),
                     style=_args.get('style', 'min-height:18px;'))(status)
Exemple #5
0
def format_status(self, request, obj, fieldname, *args, **kwargs):
    """Format the status published or not published and other booleans"""
    model = make_model(obj)
    status = getattr(model, fieldname)
    column_formatters_args = getattr(self, 'column_formatters_args', {})
    _args = column_formatters_args.get('status', {}).get(fieldname, {})
    labels = _args.get('labels', {})
    return html.span(
        class_="label label-{0}".format(labels.get(status, 'default')),
        style=_args.get('style', 'min-height:18px;')
    )(status)
Exemple #6
0
def format_post_image(self, request, obj, fieldname, *args, **kwargs):
    field = getattr(obj, fieldname)
    name = field.image.filename
    size = field.image.gridout.size
    return html.span(style='border:1px solid black;')("{} - {}".format(
        name, do_filesizeformat(size)))