src/pyams_content/shared/site/zmi/container.py
changeset 1182 601ab27cdd59
parent 1159 fc062f9e32c0
child 1198 d8fbefa460d6
equal deleted inserted replaced
1181:c44281c56dc7 1182:601ab27cdd59
    90         pub_info = IWorkflowPublicationInfo(self.context)
    90         pub_info = IWorkflowPublicationInfo(self.context)
    91         if pub_info.publication_effective_date:
    91         if pub_info.publication_effective_date:
    92             if pub_info.publication_effective_date <= now:
    92             if pub_info.publication_effective_date <= now:
    93                 if pub_info.publication_expiration_date:
    93                 if pub_info.publication_expiration_date:
    94                     if pub_info.publication_effective_date > now:
    94                     if pub_info.publication_effective_date > now:
    95                         self.state = '<span class="text-danger">{}</span>'.format(
    95                         state = _("Retired")
    96                             translate(_("Retired since {}")).format(
    96                         state_label = _("{state} since {from_date}")
    97                                 format_datetime(pub_info.publication_expiration_date)))
       
    98                     else:
    97                     else:
    99                         self.state = translate(_("Published since {} until {}")).format(
    98                         state = _("Published")
   100                             format_datetime(pub_info.publication_effective_date),
    99                         state_label = _("{state} since {from_date} until {to_date}")
   101                             format_datetime(pub_info.publication_expiration_date))
       
   102                 else:
   100                 else:
   103                     self.state = translate(_("Published since {}")).format(
   101                     state = _("Published")
   104                         format_datetime(pub_info.publication_effective_date))
   102                     state_label = _("{state} since {from_date}")
   105             else:
   103             else:
   106                 if pub_info.publication_expiration_date:
   104                 if pub_info.publication_expiration_date:
   107                     self.state = '<span class="text-danger">{}</span>'.format(
   105                     state = _("To be published")
   108                         translate(_("To be published from {} to {}")).format(
   106                     state_label = _("{state} from {from_date} to {to_date}")
   109                             format_datetime(pub_info.publication_effective_date),
       
   110                             format_datetime(pub_info.publication_expiration_date)))
       
   111                 else:
   107                 else:
   112                     self.state = '<span class="text-danger">{}</span>'.format(
   108                     state = _("Published")
   113                         translate(_("Published after {}")).format(
   109                     state_label = _("{state} after {to_date}")
   114                             format_datetime(pub_info.publication_effective_date)))
   110             self.state = translate(state_label).format(
       
   111                 state='<span class="text-danger">{}</span>'.format(translate(state)),
       
   112                 from_date=format_datetime(pub_info.publication_effective_date),
       
   113                 to_date=format_datetime(pub_info.publication_expiration_date))
   115         else:
   114         else:
   116             self.state = '<span class="text-danger">{}</span>'.format(
   115             self.state = '<span class="text-danger">{}</span>'.format(
   117                 translate(_("Not published")))
   116                 translate(_("Not published")))
   118 
   117 
   119 
   118