예제 #1
0
파일: actions.py 프로젝트: rkintzi/Kotti
def contents_buttons(context, request):
    """
    Build the action buttons for the contents view based on the current
    state and the persmissions of the user.

    :result: List of ActionButtons.
    :rtype: list
    """
    buttons = []
    if get_paste_items(context, request):
        buttons.append(
            ActionButton('paste', title=_(u'Paste'), no_children=True))
    if context.children:
        buttons.append(ActionButton('copy', title=_(u'Copy')))
        buttons.append(ActionButton('cut', title=_(u'Cut')))
        buttons.append(
            ActionButton('rename_nodes',
                         title=_(u'Rename'),
                         css_class=u'btn btn-warning'))
        buttons.append(
            ActionButton('delete_nodes',
                         title=_(u'Delete'),
                         css_class=u'btn btn-danger'))
        if get_workflow(context) is not None:
            buttons.append(
                ActionButton('change_state', title=_(u'Change State')))
        buttons.append(ActionButton('up', title=_(u'Move up')))
        buttons.append(ActionButton('down', title=_(u'Move down')))
        buttons.append(ActionButton('show', title=_(u'Show')))
        buttons.append(ActionButton('hide', title=_(u'Hide')))
    return [button for button in buttons if button.permitted(context, request)]
예제 #2
0
파일: actions.py 프로젝트: geojeff/Kotti
def contents_buttons(context, request):
    """
    Build the action buttons for the contents view based on the current
    state and the persmissions of the user.

    :result: List of ActionButtons.
    :rtype: list
    """
    buttons = []
    if get_paste_items(context, request):
        buttons.append(ActionButton('paste', title=_(u'Paste'),
                                    no_children=True))
    if context.children:
        buttons.append(ActionButton('copy', title=_(u'Copy')))
        buttons.append(ActionButton('cut', title=_(u'Cut')))
        buttons.append(ActionButton('rename_nodes', title=_(u'Rename'),
                                    css_class=u'btn btn-warning'))
        buttons.append(ActionButton('delete_nodes', title=_(u'Delete'),
                                    css_class=u'btn btn-danger'))
        if get_workflow(context) is not None:
            buttons.append(ActionButton('change_state',
                                        title=_(u'Change State')))
        buttons.append(ActionButton('up', title=_(u'Move up')))
        buttons.append(ActionButton('down', title=_(u'Move down')))
        buttons.append(ActionButton('show', title=_(u'Show')))
        buttons.append(ActionButton('hide', title=_(u'Hide')))
    return [button for button in buttons if button.permitted(context, request)]
    def test_get_non_existing_paste_item(self, root):
        from kotti.views.edit import get_paste_items

        request = DummyRequest()
        request.session['kotti.paste'] = ([1701], 'copy')
        item = get_paste_items(root, request)
        assert item == []
예제 #4
0
    def test_get_non_existing_paste_item(self, root):
        from kotti.views.edit import get_paste_items

        request = DummyRequest()
        request.session['kotti.paste'] = ([1701], 'copy')
        item = get_paste_items(root, request)
        assert item == []
예제 #5
0
    def test_get_non_existing_paste_item(self):
        from kotti import DBSession
        from kotti.resources import Node
        from kotti.views.edit import get_paste_items

        root = DBSession.query(Node).get(1)
        request = DummyRequest()
        request.session['kotti.paste'] = ([1701], 'copy')
        item = get_paste_items(root, request)
        assert item == []
예제 #6
0
    def test_get_non_existing_paste_item(self):
        from kotti import DBSession
        from kotti.resources import Node
        from kotti.views.edit import get_paste_items

        root = DBSession.query(Node).get(1)
        request = DummyRequest()
        request.session['kotti.paste'] = ([1701], 'copy')
        item = get_paste_items(root, request)
        assert item == []
예제 #7
0
파일: actions.py 프로젝트: rkintzi/Kotti
def actions(context, request):
    """
    Renders the drop down menu for Actions button in editor bar.

    :result: Dictionary passed to the template for rendering.
    :rtype: dict
    """
    root = get_root()
    actions = [ViewLink("copy", title=_(u"Copy"))]
    is_root = context is root
    if not is_root:
        actions.append(ViewLink("cut", title=_(u"Cut")))
    if get_paste_items(context, request):
        actions.append(ViewLink("paste", title=_(u"Paste")))
    if not is_root:
        actions.append(ViewLink("rename", title=_(u"Rename")))
        actions.append(ViewLink("delete", title=_(u"Delete")))
    return {"actions": [action for action in actions if action.permitted(context, request)]}
예제 #8
0
파일: actions.py 프로젝트: geojeff/Kotti
def actions(context, request):
    """
    Renders the drop down menu for Actions button in editor bar.

    :result: Dictionary passed to the template for rendering.
    :rtype: dict
    """
    root = get_root()
    actions = [ViewLink('copy', title=_(u'Copy'))]
    is_root = context is root
    if not is_root:
        actions.append(ViewLink('cut', title=_(u'Cut')))
    if get_paste_items(context, request):
        actions.append(ViewLink('paste', title=_(u'Paste')))
    if not is_root:
        actions.append(ViewLink('rename', title=_(u'Rename')))
        actions.append(ViewLink('delete', title=_(u'Delete')))
    return {'actions': [action for action in actions
                        if action.permitted(context, request)]}
예제 #9
0
파일: actions.py 프로젝트: rkintzi/Kotti
def actions(context, request):
    """
    Renders the drop down menu for Actions button in editor bar.

    :result: Dictionary passed to the template for rendering.
    :rtype: dict
    """
    root = get_root()
    actions = [ViewLink('copy', title=_(u'Copy'))]
    is_root = context is root
    if not is_root:
        actions.append(ViewLink('cut', title=_(u'Cut')))
    if get_paste_items(context, request):
        actions.append(ViewLink('paste', title=_(u'Paste')))
    if not is_root:
        actions.append(ViewLink('rename', title=_(u'Rename')))
        actions.append(ViewLink('delete', title=_(u'Delete')))
    return {
        'actions':
        [action for action in actions if action.permitted(context, request)]
    }
예제 #10
0
파일: actions.py 프로젝트: rkintzi/Kotti
def contents_buttons(context, request):
    """
    Build the action buttons for the contents view based on the current
    state and the persmissions of the user.

    :result: List of ActionButtons.
    :rtype: list
    """
    buttons = []
    if get_paste_items(context, request):
        buttons.append(ActionButton("paste", title=_(u"Paste"), no_children=True))
    if context.children:
        buttons.append(ActionButton("copy", title=_(u"Copy")))
        buttons.append(ActionButton("cut", title=_(u"Cut")))
        buttons.append(ActionButton("rename_nodes", title=_(u"Rename"), css_class=u"btn btn-warning"))
        buttons.append(ActionButton("delete_nodes", title=_(u"Delete"), css_class=u"btn btn-danger"))
        if get_workflow(context) is not None:
            buttons.append(ActionButton("change_state", title=_(u"Change State")))
        buttons.append(ActionButton("up", title=_(u"Move up")))
        buttons.append(ActionButton("down", title=_(u"Move down")))
        buttons.append(ActionButton("show", title=_(u"Show")))
        buttons.append(ActionButton("hide", title=_(u"Hide")))
    return [button for button in buttons if button.permitted(context, request)]