-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from zope.component import adapts | ||
from zope.interface import implements | ||
|
||
from bika.aquaculture.config import is_installed | ||
from bika.aquaculture.config import _ | ||
from senaite.app.listing.interfaces import IListingView | ||
from senaite.app.listing.interfaces import IListingViewAdapter | ||
|
||
|
||
class SamplesListingViewAdapter(object): | ||
adapts(IListingView) | ||
implements(IListingViewAdapter) | ||
|
||
def __init__(self, listing, context): | ||
self.listing = listing | ||
self.context = context | ||
|
||
def before_render(self): | ||
if not is_installed(): | ||
return | ||
spt = "getSamplePointTitle" | ||
if spt in self.listing.columns: | ||
self.listing.columns[spt]["title"] = _("Pond") | ||
|
||
spl = "SamplePointLocation" | ||
if spl in self.listing.columns: | ||
self.listing.columns[spl]["title"] = _("Pond Location") | ||
|
||
stt = "getSampleTypeTitle" | ||
if stt in self.listing.columns: | ||
self.listing.columns[stt]["title"] = _("Specimen Type") | ||
|
||
loc = "location" | ||
if loc in self.listing.columns: | ||
self.listing.columns[loc]["title"] = _("Pond Location") | ||
|
||
def folder_item(self, obj, item, index): | ||
if not is_installed(): | ||
return item | ||
return item |