Skip to content

Commit

Permalink
Merge pull request #10 from pierre-24/add_some_CSS
Browse files Browse the repository at this point in the history
"There is nothing that a bit of CSS cannot fix" !
  • Loading branch information
GCodeur committed Apr 4, 2017
2 parents 6281072 + d5b6509 commit 472ba3d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
7 changes: 6 additions & 1 deletion assets/scss/components/_mobile-menu.scss
Expand Up @@ -298,4 +298,9 @@
}
}
}
}


.mobile-menu-link .validations-count {
display: none;
}
}
18 changes: 17 additions & 1 deletion assets/scss/layout/_header.scss
Expand Up @@ -270,6 +270,7 @@
height: 60px;
width: 60px;
float: right;
position: relative;

.username {
display: none;
Expand Down Expand Up @@ -481,11 +482,26 @@
right: 2.5%;
}
}

.my-account {
.validations-count {
display: block !important;
position: absolute;
z-index: 1;
top: 50%;
right: 50%;
margin: -20px -22px 0 0;
padding: 0 5px;
height: 16px;
line-height: 14px;
background: #c0392b; //@TODO: Color
border-radius: 16px;
}
}
}

@media only screen and #{$media-extra-wide} {
.header-container header .header-menu {
margin-left: 5%;
}
}

7 changes: 7 additions & 0 deletions templates/base.html
Expand Up @@ -483,6 +483,13 @@
data-active="open-my-account"
{% endif %}
>
{% if perms.forum.change_post %}
{% with waiting_all_count=""|waiting_count %}
{% if waiting_all_count > 0 %}
<span class="validations-count">{{ waiting_all_count }}</span>
{% endif %}
{% endwith %}
{% endif %}
<img src="{{ profile.get_avatar_url|remove_url_protocole }}" alt="" class="avatar">
<span class="username label">{{ user.username }}</span>
</a>
Expand Down
16 changes: 11 additions & 5 deletions zds/utils/templatetags/interventions.py
Expand Up @@ -200,9 +200,15 @@ def alerts_list(user):

@register.filter(name='waiting_count')
def waiting_count(content_type):
if content_type not in TYPE_CHOICES_DICT:
raise template.TemplateSyntaxError("'content_type' must be in 'zds.tutorialv2.models.TYPE_CHOICES_DICT'")
return Validation.objects.filter(

queryset = Validation.objects.filter(
validator__isnull=True,
status='PENDING',
content__type=content_type).count()
status='PENDING')

if content_type:
if content_type not in TYPE_CHOICES_DICT:
raise template.TemplateSyntaxError("'content_type' must be in 'zds.tutorialv2.models.TYPE_CHOICES_DICT'")
else:
queryset = queryset.filter(content__type=content_type)

return queryset.count()

0 comments on commit 472ba3d

Please sign in to comment.