Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from config import Config as C, Names as N 

2from control.html import HtmlElements as H 

3from control.utils import pick as G, E, DOT 

4from control.record import Record 

5 

6CW = C.web 

7 

8MESSAGES = CW.messages 

9Qu = H.icon(CW.unknown[N.user], asChar=True) 

10 

11 

12class ReviewEntryR(Record): 

13 """Logic for reviewEntry records. 

14 

15 Review entry records have a customised title, 

16 showing when the entry was made and by whom. 

17 

18 There is also a `compact` method to present these records, just the title and 

19 the comments entered by the reviewer. 

20 

21 !!! hint 

22 If the `reviewEntry` record is not part of the workflow, the behaviour 

23 of this class falls back to the base class `control.record.Record`. 

24 """ 

25 

26 def __init__(self, *args, **kwargs): 

27 super().__init__(*args, **kwargs) 

28 

29 def title(self, *args, **kwargs): 

30 uid = self.uid 

31 record = self.record 

32 

33 markup = kwargs.get("markup", True) 

34 creatorId = G(record, N.creator) 

35 creator = self.field(N.creator).wrapBare(markup=markup) 

36 youRep = f""" ({N.you})""" if creatorId == uid else E 

37 

38 lastModified = G(record, N.modified) 

39 lastModifiedRep = ( 

40 self.field(N.modified).value[-1].rsplit(DOT, maxsplit=1)[0] 

41 if lastModified 

42 else ("not modified" if markup is None else Qu) 

43 ) 

44 return ( 

45 H.span(f"""{lastModifiedRep}{creator}{youRep}""", cls="rentrytitle") 

46 if markup 

47 else f"""{lastModifiedRep}{creator}{youRep}""" 

48 ) 

49 

50 def bodyCompact(self, **kwargs): 

51 perm = self.perm 

52 

53 theTitle = self.title() 

54 comments = ( 

55 """<!-- begin review comment -->""" 

56 + H.div( 

57 self.field(N.comments).wrap(withLabel=False, asEdit=G(perm, N.isEdit)), 

58 ) 

59 + """<!-- end review comment -->""" 

60 ) 

61 

62 return H.div([theTitle, comments], cls="reviewentry")