Zine

open source content publishing system


Changeset 1382:0c233d0a90dc for zine


Ignore:
Timestamp:
09/04/10 18:52:31 (21 months ago)
Author:
Christopher Grebs <cg@…>
Branch:
default
Tags:
tip
Message:

show theme contributors in theme list just as seen in the plugin list

Location:
zine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • zine/application.py

    r1339 r1382  
    470470        """Return the URL of the author of the theme.""" 
    471471        return self.author_info[2] 
     472 
     473    @property 
     474    def contributors(self): 
     475        """The Contributors of the plugin.""" 
     476        from zine.utils.mail import split_email 
     477        data = self.metadata.get('contributors', '') 
     478        if not data: 
     479            return [] 
     480        return [split_email(c.strip()) for c in 
     481        self.metadata.get('contributors', '').split(',')] 
     482 
     483    @property 
     484    def html_contributors_info(self): 
     485        from zine.utils.mail import check, is_valid_email 
     486        result = [] 
     487        for contributor in self.contributors: 
     488            name, contact = contributor 
     489            if not contact: 
     490                result.append(escape(name)) 
     491            else: 
     492                result.append('<a href="%s">%s</a>' % ( 
     493                    escape(check(is_valid_email, contact) and 
     494                           'mailto:' + contact or contact), 
     495                    escape(name) 
     496                )) 
     497        return u', '.join(result) 
    472498 
    473499    @cached_property 
  • zine/templates/admin/theme.html

    r1022 r1382  
    1818          <blockquote><p>{{ theme.description|e }}</p></blockquote> 
    1919          {%- if theme.has_author %} 
    20             <p class="author">{% trans author=theme.html_author_info %}by {{ author }}{% endtrans %}</p> 
     20            <p class="author"> 
     21              {% trans author=theme.html_author_info %}by {{ author }}{% endtrans %} 
     22              {% if theme.contributors %} 
     23              {% trans contributors=theme.html_contributors_info %} 
     24                and {{ contributors }} 
     25              {% endtrans %} 
     26              {% endif %} 
     27            </p> 
    2128          {%- endif %} 
    2229        </div> 
Note: See TracChangeset for help on using the changeset viewer.