Code Duplication    Length = 52-53 lines in 2 locations

bika/lims/controlpanel/bika_referencedefinitions.py 1 location

@@ 30-82 (lines=53) @@
27
    """Listing view for all Methods
28
    """
29
30
    def __init__(self, context, request):
31
        super(ReferenceDefinitionsView, self).__init__(context, request)
32
33
        self.catalog = "bika_setup_catalog"
34
35
        self.contentFilter = {
36
            "portal_type": "ReferenceDefinition",
37
            "sort_on": "sortable_title",
38
            "sort_order": "ascending"
39
40
        }
41
42
        self.context_actions = {
43
            _("Add"): {
44
                "url": "createObject?type_name=ReferenceDefinition",
45
                "permission": AddReferenceDefinition,
46
                "icon": "++resource++bika.lims.images/add.png"}}
47
48
        self.title = self.context.translate(_("Reference Definitions"))
49
        self.description = ""
50
        self.icon = "{}/{}".format(
51
            self.portal_url,
52
            "++resource++bika.lims.images/referencedefinition_big.png")
53
54
        self.show_select_column = True
55
        self.pagesize = 25
56
57
        self.columns = collections.OrderedDict((
58
            ("Title", {
59
                "title": _("Title"),
60
                "index": "sortable_title"}),
61
            ("Description", {
62
                "title": _("Description"),
63
                "index": "description",
64
                "toggle": True}),
65
        ))
66
67
        self.review_states = [
68
            {
69
                "id": "default",
70
                "title": _("Active"),
71
                "contentFilter": {"is_active": True},
72
                "columns": self.columns.keys(),
73
            }, {
74
                "id": "inactive",
75
                "title": _("Inactive"),
76
                "contentFilter": {"is_active": False},
77
                "columns": self.columns.keys(),
78
            }, {
79
                "id": "all",
80
                "title": _("All"),
81
                "contentFilter": {},
82
                "columns": self.columns.keys(),
83
            },
84
        ]
85

bika/lims/controlpanel/bika_identifiertypes.py 1 location

@@ 27-78 (lines=52) @@
24
    """Listing for identifier types
25
    """
26
27
    def __init__(self, context, request):
28
        super(IdentifierTypesView, self).__init__(context, request)
29
30
        self.catalog = "bika_setup_catalog"
31
32
        self.contentFilter = {
33
            "portal_type": "IdentifierType",
34
            "sort_on": "sortable_title",
35
            "sort_order": "ascending"
36
        }
37
38
        self.context_actions = {
39
            _("Add"): {
40
                "url": "createObject?type_name=IdentifierType",
41
                "permission": AddIdentifierType,
42
                "icon": "++resource++bika.lims.images/add.png"}}
43
44
        self.title = self.context.translate(_("Identifier Types"))
45
        self.description = ""
46
        self.icon = "{}/{}".format(
47
            self.portal_url,
48
            "++resource++bika.lims.images/identifiertype_big.png")
49
50
        self.show_select_column = True
51
        self.pagesize = 25
52
53
        self.columns = collections.OrderedDict((
54
            ("Title", {
55
                "title": _("Title"),
56
                "index": "sortable_title"}),
57
            ("Description", {
58
                "title": _("Description"),
59
                "index": "description",
60
                "toggle": True}),
61
        ))
62
63
        self.review_states = [
64
            {
65
                "id": "default",
66
                "title": _("Active"),
67
                "contentFilter": {"is_active": True},
68
                "columns": self.columns.keys(),
69
            }, {
70
                "id": "inactive",
71
                "title": _("Inactive"),
72
                "contentFilter": {"is_active": False},
73
                "columns": self.columns.keys(),
74
            }, {
75
                "id": "all",
76
                "title": _("All"),
77
                "contentFilter": {},
78
                "columns": self.columns.keys(),
79
            },
80
        ]
81