How to use the spam.lib.notifications function in spam

To help you get started, we’ve selected a few spam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lento / spam / spam / lib / widgets.py View on Github external
help_text='edit'),
            ]),
            twl.Button(id='delete',
                action='%(id)s/delete',
                dialog=True,
                children=[
                    twl.Icon(id='delete',
                        icon_class='icon_delete',
                        help_text='delete'),
            ]),
    ])


class TableProjectsArchived(twl.LiveTable):
    """Archived projects livetable."""
    update_topic = notifications.TOPIC_PROJECTS_ARCHIVED
    update_condition = 'msg.ob.archived || msg.update_type=="activated"'
    update_functions = ('{"added": lw.livetable.addrow,'
                        ' "deleted": lw.livetable.deleterow,'
                        ' "updated": lw.livetable.updaterow,'
                        ' "archived": lw.livetable.addrow,'
                        ' "activated": lw.livetable.deleterow}')
    show_headers = False

    project_id = twl.Text(id='id')
    name = twl.Text()
    description = twl.Text()
    actions = twl.Box(
        children=[
            twl.Button(id='activate',
                action='%(id)s/activate',
                dialog=True,
github lento / spam / spam / lib / widgets.py View on Github external
'/user/%(proj)s/%(user_name)s/remove_admin')


class TableProjectSupervisors(TableProjectUsers):
    """Project users livetable."""
    update_topic = notifications.TOPIC_PROJECT_SUPERVISORS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(cat)s/%(user_name)s/remove_supervisor')


class TableProjectArtists(TableProjectUsers):
    """Project artists livetable."""
    update_topic = notifications.TOPIC_PROJECT_ARTISTS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(cat)s/%(user_name)s/remove_artist')


class TableCategories(twl.LiveTable):
    """Category livetable."""
    update_topic = notifications.TOPIC_CATEGORIES
    ordering = twl.Text(sort_default=True)
    category_id = twl.Text(id='id')
    naming_convention = twl.Text()
    actions = twl.Box(
        children=[
            twl.Button(id='edit',
github lento / spam / spam / lib / widgets.py View on Github external
twl.Link(id='download_link',
                condition='data.ver && data.ver>0',
                dest=url('/asset/%(proj_id)s/%(id)s/download'),
            children=[
                twl.Icon(id='download',
                    icon_class='icon_download',
                    help_text='download',
                )
            ]),
    ])


class TableJournal(twl.LiveTable):
    """Journal entries livetable."""
    curpage = twc.Param('Current displayed page', default='')
    update_topic = notifications.TOPIC_JOURNAL
    show_headers = False
    strftime = twl.Text(
        sort_default=True,
        sort_direction = 'desc',
        help_text='date')
    user_id = twl.Text(help_text='user')
    text = twl.Text()
    
    def prepare(self):
        super(TableJournal, self).prepare()
        self.update_condition = '%s==1' % self.curpage


class TableNotes(twl.LiveTable):
    """Note livetable."""
    update_topic = notifications.TOPIC_NOTES
github lento / spam / spam / lib / widgets.py View on Github external
help_text='edit'),
            ]),
            twl.Button(id='delete',
                action=url('/category/%(id)s/delete'),
                dialog=True,
                children=[
                    twl.Icon(id='delete',
                        icon_class='icon_delete',
                        help_text='delete'),
            ]),
    ])


class TableProjectsActive(twl.LiveTable):
    """Active projects livetable."""
    update_topic = notifications.TOPIC_PROJECTS_ACTIVE
    update_condition = '!msg.ob.archived || msg.update_type=="archived"'
    update_functions = ('{"added": lw.livetable.addrow,'
                        ' "deleted": lw.livetable.deleterow,'
                        ' "updated": lw.livetable.updaterow,'
                        ' "archived": lw.livetable.deleterow,'
                        ' "activated": lw.livetable.addrow}')
    show_headers = False

    project_id = twl.Text(id='id')
    name = twl.Text()
    description = twl.Text()
    actions = twl.Box(
        children=[
            twl.Button(id='archive',
                action='%(id)s/archive',
                dialog=True,
github lento / spam / spam / lib / widgets.py View on Github external
user_name = twl.Text(sort_default=True)
    display_name = twl.Text()
    actions = twl.Box(
        children=[
            twl.Button(id='remove',
                children=[
                    twl.Icon(id='remove',
                        icon_class='icon_delete',
                        help_text='remove'),
            ]),
    ])


class TableProjectAdmins(TableProjectUsers):
    """Project administrators livetable."""
    update_topic = notifications.TOPIC_PROJECT_ADMINS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(user_name)s/remove_admin')


class TableProjectSupervisors(TableProjectUsers):
    """Project users livetable."""
    update_topic = notifications.TOPIC_PROJECT_SUPERVISORS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(cat)s/%(user_name)s/remove_supervisor')
github lento / spam / spam / lib / widgets.py View on Github external
])


class TableProjectAdmins(TableProjectUsers):
    """Project administrators livetable."""
    update_topic = notifications.TOPIC_PROJECT_ADMINS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(user_name)s/remove_admin')


class TableProjectSupervisors(TableProjectUsers):
    """Project users livetable."""
    update_topic = notifications.TOPIC_PROJECT_SUPERVISORS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(cat)s/%(user_name)s/remove_supervisor')


class TableProjectArtists(TableProjectUsers):
    """Project artists livetable."""
    update_topic = notifications.TOPIC_PROJECT_ARTISTS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(cat)s/%(user_name)s/remove_artist')
github lento / spam / spam / lib / widgets.py View on Github external
actions = twl.Box(
        children=[
            twl.Button(id='activate',
                action='%(id)s/activate',
                dialog=True,
                children=[
                    twl.Icon(id='activate',
                        icon_class='icon_activate',
                        help_text='activate'),
        ]),
    ])


class TableScenes(twl.LiveTable):
    """Scene livetable."""
    update_topic = notifications.TOPIC_SCENES
    show_headers = False
    thumbnail = twl.Box(
        css_class='thumbnail',
        children=[
            twl.Image(id='thumbnail',
                help_text='thumbnail',
                css_class='thumbnail',
                condition='data.has_preview',
                src=url('/repo/%(thumbnail)s')
            )
    ])
    namelink = twl.Link(
        dest=url('/scene/%(proj_id)s/%(name)s/'),
        sort_default=True,
        children=[
            twl.Text(id='name', help_text='name')
github lento / spam / spam / lib / widgets.py View on Github external
'/user/%(proj)s/%(cat)s/%(user_name)s/remove_supervisor')


class TableProjectArtists(TableProjectUsers):
    """Project artists livetable."""
    update_topic = notifications.TOPIC_PROJECT_ARTISTS

    @classmethod
    def post_define(cls):
        cls.child.children[2].children[0].action = url(
                    '/user/%(proj)s/%(cat)s/%(user_name)s/remove_artist')


class TableCategories(twl.LiveTable):
    """Category livetable."""
    update_topic = notifications.TOPIC_CATEGORIES
    ordering = twl.Text(sort_default=True)
    category_id = twl.Text(id='id')
    naming_convention = twl.Text()
    actions = twl.Box(
        children=[
            twl.Button(id='edit',
                action=url('/category/%(id)s/edit'),
                dialog=True,
                children=[
                    twl.Icon(id='edit',
                        icon_class='icon_edit',
                        help_text='edit'),
            ]),
            twl.Button(id='delete',
                action=url('/category/%(id)s/delete'),
                dialog=True,
github lento / spam / spam / lib / widgets.py View on Github external
help_text='edit'),
            ]),
            twl.Button(id='delete',
                action=url('/scene/%(proj_id)s/%(name)s/delete'),
                dialog=True,
                children=[
                    twl.Icon(id='delete',
                        icon_class='icon_delete',
                        help_text='delete'),
            ]),
    ])


class TableShots(twl.LiveTable):
    """Shot livetable."""
    update_topic = notifications.TOPIC_SHOTS
    show_headers = False
    thumbnail = twl.Box(
        css_class='thumbnail',
        children=[
            twl.Image(id='thumbnail',
                help_text='thumbnail',
                css_class='thumbnail',
                condition='data.has_preview',
                src=url('/repo/%(thumbnail)s')
            ),
    ])
    namelink = twl.Link(
        dest=url('/shot/%(proj_id)s/%(parent_name)s/%(name)s/'),
        sort_default=True,
        children=[
            twl.Text(id='name', help_text='name')
github lento / spam / spam / lib / widgets.py View on Github external
show_headers = False
    strftime = twl.Text(
        sort_default=True,
        sort_direction = 'desc',
        help_text='date')
    user_id = twl.Text(help_text='user')
    text = twl.Text()
    
    def prepare(self):
        super(TableJournal, self).prepare()
        self.update_condition = '%s==1' % self.curpage


class TableNotes(twl.LiveTable):
    """Note livetable."""
    update_topic = notifications.TOPIC_NOTES
    show_headers = False
    user_name = twl.Text(
        css_class='note_header',
        help_text='user name')
    strftime = twl.Text(
        sort_default=True,
        sort_direction='desc',
        css_class='note_header',
        help_text='date')
    lines = twl.Box(
        children=[
            twl.Text(id='text', help_text='')
    ])
    actions = twl.Box(
        condition='$.inArray(data.user_id, data.project.admin_ids)>=0',
        children=[