Code Duplication    Length = 53-57 lines in 2 locations

bika/lims/controlpanel/dynamic_analysisspecs.py 1 location

@@ 27-83 (lines=57) @@
24
    """Displays all system's dynamic analysis specifications
25
    """
26
27
    def __init__(self, context, request):
28
        super(DynamicAnalysisSpecsView, self).__init__(context, request)
29
30
        self.catalog = SETUP_CATALOG
31
32
        self.contentFilter = {
33
            "portal_type": "DynamicAnalysisSpec",
34
            "sort_on": "created",
35
            "sort_order": "descending",
36
        }
37
38
        self.context_actions = {
39
            _("Add"): {
40
                "url": "++add++DynamicAnalysisSpec",
41
                "permission": "cmf.AddPortalContent",
42
                "icon": "++resource++bika.lims.images/add.png"}
43
            }
44
45
        self.icon = "{}/{}/{}".format(
46
            self.portal_url,
47
            "/++resource++bika.lims.images",
48
            "analysisspec_big.png"
49
        )
50
51
        self.title = self.context.Title()
52
        self.description = self.context.Description()
53
        self.show_select_column = True
54
        self.pagesize = 25
55
56
        self.columns = collections.OrderedDict((
57
            ("Title", {
58
                "title": _("Title"),
59
                "replace_url": "absolute_url",
60
                "index": "sortable_title"}),
61
            ("Description", {
62
                "title": _("Description"),
63
                "index": "Description"}),
64
        ))
65
66
        self.review_states = [
67
            {
68
                "id": "default",
69
                "title": _("Active"),
70
                "contentFilter": {"is_active": True},
71
                "transitions": [],
72
                "columns": self.columns.keys(),
73
            }, {
74
                "id": "inactive",
75
                "title": _("Inactive"),
76
                "contentFilter": {'is_active': False},
77
                "transitions": [],
78
                "columns": self.columns.keys(),
79
            }, {
80
                "id": "all",
81
                "title": _("All"),
82
                "contentFilter": {},
83
                "columns": self.columns.keys(),
84
            },
85
        ]
86

bika/lims/controlpanel/bika_referencedefinitions.py 1 location

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