1. Dan Jacob
  2. newsmeme

Commits

danjac  committed 535ad78

access name

  • Participants
  • Parent commits 92b49f8
  • Branches default

Comments (0)

Files changed (3)

File newsmeme/models.py

View file
  • Ignore whitespace
                     num_comments=self.num_comments,
                     author=self.author.username)
 
+    @cached_property
+    def access_name(self):
+        return {
+                 Post.PUBLIC : "public",
+                 Post.FRIENDS : "friends",
+                 Post.PRIVATE : "private"
+               }.setdefault(self.access)
+        
     def can_access(self, user=None):
         if self.access == self.PUBLIC:
             return True

File newsmeme/static/css/base.css

View file
  • Ignore whitespace
 ul.following li, ul.followers li { display:inline; }
 
 li.faded { font-weight: 100; }
+
+a.public { color: #009; }
+a.friends { color: #090; }
+a.private { color: #900; }
+

File newsmeme/templates/macros/_post.html

View file
  • Ignore whitespace
     <a href="#" onclick="newsmeme.vote_post('{{ url_for('post.downvote', post_id=post.id) }}'); return false;"><img src="{{ theme_static("images/down-icon.png") }}"></a>  
 </span>
 {% endif %}
-<a href="{{ post.link if post.link else post.url }}">{{ post.title }}</a>
+<a href="{{ post.link if post.link else post.url }}" class="{{ post.access_name }}">{{ post.title }}</a>
 
 {% if post.link %}
 <span class="domain">&rarr; {{ post.domain }}</span>