def test_faicons(self): icon = FAIcon('check') self.assertEquals( icon.__html__(), u'<i class="fa fa-check"></i>')
# those buttons are made to have valid edit actions, but will not be shown in # edit forms: they must be availabe only during POST ADD_USER_BUTTON = ButtonAction( 'form', 'add_user', condition=lambda v: request.method == 'POST', title=_l('Add'), btn_class='primary', ) REMOVE_USER_BUTTON = ButtonAction( 'form', 'remove_user', condition=lambda v: request.method == 'POST', btn_class='danger', icon=FAIcon('times'), title="", ) class GroupView(GroupBase, views.ObjectView): template = 'admin/group_view.html' def breadcrumb(self): label = render_template_string('<em>{{ g }}</em>', g=self.obj.name) return BreadcrumbItem(label=label, url='', description=self.obj.name) @property def template_kwargs(self): security = get_service('security') kw = super(GroupView, self).template_kwargs
url=lambda ctx: url_for(".folder_view", folder_id=ctx["object"].id), ), # view FolderAction( "documents:content", "view", _l("List content"), icon="list", url=lambda ctx: url_for(".folder_view", folder_id=ctx["object"].id), ), # Descendants FolderAction( "documents:content", "descendants", _l("View descendants"), icon=FAIcon("code-fork fa-rotate-90"), url=lambda ctx: url_for(".descendants_view", folder_id=ctx["object"].id), ), # upload FolderModalAction( "documents:content", "upload_files", _l("Upload file(s)"), icon="upload", url="#modal-upload-files", permission=WRITE, ), # edit FolderModalAction( "documents:content", "edit",
url=lambda ctx: url_for(".folder_view", folder_id=ctx['object'].id), ), # view FolderAction( 'documents:content', 'view', _l(u'List content'), icon='list', url=lambda ctx: url_for(".folder_view", folder_id=ctx['object'].id), ), # Descendants FolderAction( 'documents:content', 'descendants', _l(u'View descendants'), icon=FAIcon('code-fork fa-rotate-90'), url=lambda ctx: url_for(".descendants_view", folder_id=ctx['object'].id), ), # upload FolderModalAction('documents:content', 'upload_files', _l('Upload file(s)'), icon='upload', url='#modal-upload-files', permission=WRITE), # edit FolderModalAction('documents:content', 'edit', _l('Edit properties'), icon='pencil',
def is_admin(context): security = get_service("security") return security.has_role(current_user, Admin, object=context.get("object")) _actions = [ CalendarAction("calendar:global", "new_event", _l("Create a new event"), icon="plus"), CalendarAction("calendar:global", "index", _l("Upcoming events"), icon="list"), EventAction("calendar:event", "event", _l("View event"), icon=FAIcon("eye")), EventAction("calendar:event", "event_edit", _l("Edit event"), icon=FAIcon("pencil")), ] def register_actions(state): if not actions.installed(state.app): return with state.app.app_context(): actions.register(*_actions)
"forum:thread", "delete", _l("Delete"), condition=lambda ctx: is_admin(ctx) and not_closed(ctx), url="#modal-delete", icon="trash", ), # ThreadAction( "forum:thread", "close", _l("Close thread"), url="close", template_string=_close_template_action, condition=lambda ctx: is_admin(ctx) and not_closed(ctx), icon=FAIcon("lock"), ), ThreadAction( "forum:thread", "reopen", _l("Re-open thread"), url="close", template_string=_close_template_action, condition=lambda ctx: is_admin(ctx) and is_closed(ctx), icon=FAIcon("unlock"), ), ThreadAction("forum:thread", "attachments", _l("Attachments"), url="attachments", icon="file"),
def test_faicons() -> None: icon = FAIcon("check") assert icon.__html__() == '<i class="fa fa-check"></i>'
def is_admin(context): svc = current_app.services['security'] return svc.has_role(current_user, Admin, object=context.get('object')) _actions = [ CalendarAction('calendar:global', 'new_event', _l('Create a new event'), icon='plus'), CalendarAction('calendar:global', 'index', _l('Upcoming events'), icon='list'), EventAction('calendar:event', 'event', _l('View event'), icon=FAIcon('eye')), EventAction('calendar:event', 'event_edit', _l('Edit event'), icon=FAIcon('pencil')), ] def register_actions(state): if not actions.installed(state.app): return with state.app.app_context(): actions.register(*_actions)
def test_faicons(self): icon = FAIcon('check') self.assertEqual(icon.__html__(), u'<i class="fa fa-check"></i>')
# those buttons are made to have valid edit actions, but will not be shown in # edit forms: they must be availabe only during POST ADD_USER_BUTTON = ButtonAction( "form", "add_user", condition=lambda v: request.method == "POST", title=_l("Add"), btn_class="primary", ) REMOVE_USER_BUTTON = ButtonAction( "form", "remove_user", condition=lambda v: request.method == "POST", btn_class="danger", icon=FAIcon("times"), title="", ) class GroupView(GroupBase, views.ObjectView): template = "admin/group_view.html" def breadcrumb(self): label = render_template_string("<em>{{ g }}</em>", g=self.obj.name) return BreadcrumbItem(label=label, url="", description=self.obj.name) @property def template_kwargs(self): security = get_service("security") kw = super().template_kwargs
_l("Edit"), endpoint=".page_edit", icon="pencil"), WikiPageModalAction( "wiki:page", "upload_attachment", _l("Upload an attachment"), url="#upload-files", icon="plus", ), WikiPageAction( "wiki:page", "source", _l("Source"), endpoint=".page_source", icon=FAIcon("code"), ), WikiPageAction("wiki:page", "changes", _l("Changes"), endpoint=".page_changes", icon="time"), WikiPageModalAction("wiki:page", "delete", _l("Delete"), url="#modal-delete", icon="trash"), WikiAction("wiki:global", "new", _l("New page"), endpoint=".page_new",
def test_faicons(): icon = FAIcon("check") assert icon.__html__() == '<i class="fa fa-check"></i>'
icon='eye-open'), WikiPageAction('wiki:page', 'edit', _l(u'Edit'), endpoint='.page_edit', icon='pencil'), WikiPageModalAction('wiki:page', 'upload_attachment', _l(u'Upload an attachment'), url='#upload-files', icon='plus'), WikiPageAction('wiki:page', 'source', _l(u'Source'), endpoint='.page_source', icon=FAIcon('code')), WikiPageAction('wiki:page', 'changes', _l(u'Changes'), endpoint='.page_changes', icon='time'), WikiPageModalAction('wiki:page', 'delete', _l(u'Delete'), url='#modal-delete', icon='trash'), WikiAction('wiki:global', 'new', _l(u'New page'), endpoint='.page_new', icon='plus'),
ForumModalAction( 'forum:thread', 'delete', _l(u'Delete'), condition=lambda ctx: is_admin(ctx) and not_closed(ctx), url='#modal-delete', icon='trash'), # ThreadAction( 'forum:thread', 'close', _l('Close thread'), url='close', template_string=_close_template_action, condition=lambda ctx: is_admin(ctx) and not_closed(ctx), icon=FAIcon('lock')), ThreadAction( 'forum:thread', 'reopen', _l('Re-open thread'), url='close', template_string=_close_template_action, condition=lambda ctx: is_admin(ctx) and is_closed(ctx), icon=FAIcon('unlock')), ThreadAction( 'forum:thread', 'attachments', _l(u'Attachments'), url='attachments', icon='file'),)