src/pyams_content/component/extfile/__init__.py
changeset 384 d433c8c46ec9
parent 371 ceeb76aee369
child 571 b2e79295caec
equal deleted inserted replaced
383:8409f13da5d0 384:d433c8c46ec9
    85     def pictogram(self):
    85     def pictogram(self):
    86         return self.context.icon_class
    86         return self.context.icon_class
    87 
    87 
    88     @property
    88     @property
    89     def user_title(self):
    89     def user_title(self):
       
    90         title = II18n(self.context).query_attribute('title')
       
    91         if not title:
       
    92             title = self.context.filename
       
    93         return title
       
    94 
       
    95     @property
       
    96     def user_icon(self):
    90         filename = self.context.filename
    97         filename = self.context.filename
    91         if filename:
    98         if filename:
    92             name, ext = os.path.splitext(filename)
    99             name, ext = os.path.splitext(filename)
    93             return '{title} <img class="margin-left-5 align-top" ' \
   100             return '<img class="margin-left-5 align-top" ' \
    94                 'src="/--static--/pyams_skin/img/mimetypes/16x16/{thumb}" />'.format(
   101                 'src="/--static--/pyams_skin/img/mimetypes/16x16/{thumb}" />'.format(
    95                  title=II18n(self.context).query_attribute('title') or filename,
       
    96                  thumb=EXTENSIONS_THUMBNAILS.get(ext, 'unknown.png'))
   102                  thumb=EXTENSIONS_THUMBNAILS.get(ext, 'unknown.png'))
    97         else:
       
    98             return '--'
       
    99 
   103 
   100     @property
   104     @property
   101     def inner_title(self):
   105     def inner_title(self):
   102         return self.context.filename or '--'
   106         return self.context.filename or '--'
   103 
   107