Exemplo n.º 1
0
    def test_ActionCut(self):
        model = CopySupportNode('copysupport')
        request = self.layer.new_request()

        ActionContext(model, request, 'listing')
        self.assertTrue(ICopySupport.providedBy(model))
        self.assertTrue(model.supports_cut)

        action = ActionCut()
        self.assertEqual(action(model, request), u'')

        with self.layer.authenticated('editor'):
            self.assertEqual(action(model, request), u'')

        with self.layer.authenticated('manager'):
            rendered = action(model, request)
            self.checkOutput(
                """
            ...<a
            id="toolbaraction-cut"
            href="#"
            ajax:target="http://example.com/copysupport"
            ><span class="ion-scissors"></span
            >&nbsp;Cut</a>...
            """, rendered)

            model.supports_cut = False
            self.assertEqual(action(model, request), u'')
Exemplo n.º 2
0
 def sorted_rows(self, start, end, sort, order):
     children = self.sorted_children(sort, order)
     rows = list()
     cut_urls = extract_copysupport_cookie(self.request, 'cut')
     for child in children[start:end]:
         row_data = self.row_data(child)
         target = make_url(self.request, node=child)
         if ICopySupport.providedBy(child):
             row_data.selectable = True
             row_data.target = target
             row_data.css = 'copysupportitem'
             if target in cut_urls:
                 row_data.css += ' copysupport_cut'
         if IWorkflowState.providedBy(child):
             row_data.css += ' state-%s' % child.state
         if hasattr(child, 'node_info_name') and child.node_info_name:
             row_data.css += ' node-type-%s' % child.node_info_name
         rows.append(row_data)
     return rows
Exemplo n.º 3
0
 def sorted_rows(self, start, end, sort, order):
     children = self.sorted_children(sort, order)
     rows = list()
     cut_urls = extract_copysupport_cookie(self.request, 'cut')
     for child in children[start:end]:
         row_data = self.row_data(child)
         target = make_url(self.request, node=child)
         if ICopySupport.providedBy(child):
             row_data.selectable = True
             row_data.target = target
             row_data.css = 'copysupportitem'
             if target in cut_urls:
                 row_data.css += ' copysupport_cut'
         if IWorkflowState.providedBy(child):
             row_data.css += ' state-%s' % child.state
         if hasattr(child, 'node_info_name') and child.node_info_name:
             row_data.css += ' node-type-%s' % child.node_info_name
         rows.append(row_data)
     return rows
Exemplo n.º 4
0
 def display(self):
     return ICopySupport.providedBy(self.model) \
         and self.model.supports_paste \
         and self.permitted('paste') \
         and self.action_scope == 'listing'
Exemplo n.º 5
0
 def display(self):
     return ICopySupport.providedBy(self.model) \
         and self.model.supports_paste \
         and self.permitted('paste') \
         and self.action_scope == 'listing'