Anonymous avatar Anonymous committed 535ad78

access name

Comments (0)

Files changed (3)

newsmeme/models.py

                     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

newsmeme/static/css/base.css

 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; }
+

newsmeme/templates/macros/_post.html

     <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>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.