Esempio n. 1
0
    def test_translate_titles(self, root, dummy_request):
        from pyramid.i18n import TranslationString
        from kotti.views.edit import _state_info

        content = self.make_document(root)
        for state in _state_info(content, dummy_request):
            assert isinstance(state['title'], TranslationString)
Esempio n. 2
0
    def test_translate_titles(self, root, dummy_request):
        from pyramid.i18n import TranslationString
        from kotti.views.edit import _state_info

        content = self.make_document(root)
        for state in _state_info(content, dummy_request):
            assert isinstance(state["title"], TranslationString)
Esempio n. 3
0
def workflow(context, request):
    """
    Renders the drop down menu for workflow actions.

    :result: Dictionary passed to the template for rendering.
    :rtype: dict
    """
    wf = get_workflow(context)
    if wf is not None:
        state_info = _state_info(context, request)
        curr_state = [i for i in state_info if i["current"]][0]
        trans_info = wf.get_transitions(context, request)
        return {"states": _states(context, request), "transitions": trans_info, "current_state": curr_state}

    return {"current_state": None}
Esempio n. 4
0
def workflow(context, request):
    """
    Renders the drop down menu for workflow actions.

    :result: Dictionary passed to the template for rendering.
    :rtype: dict
    """
    wf = get_workflow(context)
    if wf is not None:
        state_info = _state_info(context, request)
        curr_state = [i for i in state_info if i['current']][0]
        trans_info = wf.get_transitions(context, request)
        return {
            'states': _states(context, request),
            'transitions': trans_info,
            'current_state': curr_state,
        }

    return {'current_state': None}
Esempio n. 5
0
def workflow(context, request):
    """ Renders the drop down menu for workflow actions.

    :result: Dictionary passed to the template for rendering.
    :rtype: dict
    """
    wf = get_workflow(context)
    if wf is not None:
        state_info = _state_info(context, request)
        curr_state = [i for i in state_info if i["current"]][0]
        trans_info = [
            trans for trans in wf.get_transitions(context, request)
            if request.has_permission(trans["permission"], context)
        ]

        return {
            "states": _states(context, request),
            "transitions": trans_info,
            "current_state": curr_state,
        }

    return {"current_state": None}
Esempio n. 6
0
def workflow(context, request):
    """ Renders the drop down menu for workflow actions.

    :result: Dictionary passed to the template for rendering.
    :rtype: dict
    """
    wf = get_workflow(context)
    if wf is not None:
        state_info = _state_info(context, request)
        curr_state = [i for i in state_info if i['current']][0]
        trans_info = [trans for trans in wf.get_transitions(context, request)
                      if request.has_permission(trans['permission'], context)]

        return {
            'states': _states(context, request),
            'transitions': trans_info,
            'current_state': curr_state,
        }

    return {
        'current_state': None
    }