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) )
def format_link(self, request, obj, fieldname, *args, **kwars): """Format a link from the model""" model = make_model(obj) value = getattr(model, fieldname) return html.a(href=value, title=value, target='_blank')(html.i(class_="icon icon-resize-small", style="margin-right: 5px;")())
def format_link(self, request, obj, fieldname, *args, **kwars): """Format a link from the model""" model = make_model(obj) value = getattr(model, fieldname) return html.a(href=value, title=value, target='_blank')( html.i(class_="icon icon-resize-small", style="margin-right: 5px;")() )
def format_view_on_site(self, request, obj, fieldname, *args, **kwargs): """Returns button to view or preview depending on content status""" model = make_model(obj) return html.a( href=model.external_url, target='_blank', )(html.i(class_="icon fa fa-globe glyphicon glyphicon-globe", style="margin-right: 5px;")(), 'View' if model.published else 'Preview')
def view_on_site(self, request, obj, fieldname, *args, **kwargs): available = obj.is_available endpoint = kwargs.pop( 'endpoint', 'flaskpress.core.detail' if available else 'flaskpress.core.preview') return html.a( href=obj.get_absolute_url(endpoint), target='_blank', )(html.i(class_="icon icon-eye-open", style="margin-right: 5px;")(), _l('View on site') if available else _l('Preview on site'))
def view_on_site(self, request, obj, fieldname, *args, **kwargs): available = obj.is_available endpoint = kwargs.pop( 'endpoint', 'quokka.core.detail' if available else 'quokka.core.preview' ) return html.a( href=obj.get_absolute_url(endpoint), target='_blank', )(html.i(class_="icon icon-eye-open", style="margin-right: 5px;")(), _l('View on site') if available else _l('Preview on site'))
def format_link(self, request, obj, fieldname, *args, **kwars): value = getattr(obj, fieldname) return html.a(href=value, title=value, target='_blank')( html.i(class_="icon icon-resize-small", style="margin-right: 5px;")() )
def format_link(self, request, obj, fieldname, *args, **kwars): value = getattr(obj, fieldname) return html.a(href=value, title=value, target='_blank')(html.i(class_="icon icon-resize-small", style="margin-right: 5px;")())