Changeset 635:0f39a1e81b90


Ignore:
Timestamp:
25/06/12 10:07:30 (11 months ago)
Author:
nicoechaniz <nicoechaniz@…>
Branch:
default
Message:

frontend edit: added translation strings, initial migration and minor fixes

Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • cyclope/admin.py

    r634 r635  
    107107            category_slug = request.REQUEST['_from_category'] 
    108108            category = Category.objects.get(slug=category_slug) 
    109             #            extra_context['initial_category'] = category.id 
    110             #            extra_context['initial_collection'] = category.collection.id 
     109            extra_context['initial_category'] = category.id 
     110            extra_context['initial_collection'] = category.collection.id 
    111111        return super(BaseContentAdmin, self).add_view(request, form_url, extra_context) 
    112112     
  • cyclope/core/collections/templates/collections/category_contents_base.html

    r634 r635  
    22 
    33{% load i18n cyclope_utils fb_versions obj_perms %} 
     4 
     5{% block extra_head %} 
     6{{ block.super }} 
     7<script type="text/javascript"> 
     8var hide_children = function (el){ 
     9    $(el).children('ul').css('display', 'none'); 
     10} 
     11 
     12var show_children = function (el){ 
     13    $(el).children('ul').css('display', 'block'); 
     14} 
     15 
     16jQuery(document).ready(function(){ 
     17    $('.category_add_content').each(function(){ 
     18        hide_children($(this)); 
     19    }); 
     20    $('.category_add_content').each(function(){ 
     21        $(this).mouseenter(function(){ 
     22            show_children($(this)); 
     23            return false; 
     24        }) 
     25        $(this).mouseleave(function(){ 
     26            hide_children($(this)); 
     27            return false; 
     28        }); 
     29    }); 
     30}); 
     31</script> 
     32{% endblock %} 
    433 
    534{% block content %} 
     
    736  {% per_category_perms category as cat_perms %} 
    837  {% if cat_perms.add_content %} 
    9  
    1038  <div class="category_add_content"> 
    11     <a href="{% url category-default category.slug %}">Add content</a> 
     39    <a href="{% url category-default category.slug %}">{% trans "Add content" %}</a> 
    1240    <ul class="content_types"> 
    1341      {% for c_type in category.collection.content_types.all %} 
  • cyclope/core/perms/models.py

    r634 r635  
    2727from django.db import models 
    2828from django.contrib.auth.models import User 
     29from django.utils.translation import ugettext_lazy as _ 
     30 
    2931from cyclope.core.collections.models import Category 
    3032 
    3133 
    3234class CategoryPermission(models.Model): 
    33     user = models.ForeignKey(User) 
    34     can_edit_content = models.BooleanField() 
    35     can_add_content = models.BooleanField()     
    36     category = models.ForeignKey(Category) 
    37  
    38     def _available_perms(self): 
    39         return [ f.name for f in self.fields if f.name.startswith('can_') ] 
    40  
    41     available_perms = property(_available_perms) 
     35    user = models.ForeignKey(User, verbose_name=_('user')) 
     36    can_edit_content = models.BooleanField(_('can edit content')) 
     37    can_add_content = models.BooleanField(_('can add content')) 
     38    category = models.ForeignKey(Category, verbose_name=_('category')) 
    4239 
    4340    class Meta: 
    4441        unique_together = ('category', 'user') 
    45  
     42        verbose_name = _('category permission') 
     43        verbose_name_plural = _('category permissions') 
  • cyclope/tests.py

    r634 r635  
    636636        response = self.client.post(url, data={}) 
    637637        self.assertEqual(response.status_code, 200) 
    638         print response 
    639638        self.assertTrue("This field is required" in response.content) 
    640639 
Note: See TracChangeset for help on using the changeset viewer.