Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #320 from edx/dsjen/soapbox
Browse files Browse the repository at this point in the history
Added soapbox announcements to display per-page messages.
  • Loading branch information
dsjen committed Jun 19, 2015
2 parents 30420d1 + 41ee781 commit b761e74
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 26 deletions.
1 change: 1 addition & 0 deletions analytics_dashboard/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
'courses',
'django_rjs',
'help',
'soapbox',
)

# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
Expand Down
34 changes: 34 additions & 0 deletions analytics_dashboard/templates/_announcement.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{% load i18n %}

<div class="announcement-container"
data-dismiss-url="{{ dismiss_url }}"
data-view="announcement">
<div class="container">
<div class="row">
<div class="hidden-xs col-sm-1">
<div class="icon"><i class="fa fa-bullhorn"></i></div>
</div>

<div class="col-xs-10">
{% if message %}
{{ message|safe }}
{% else %}
<div class="message">
<h1>{{ title }}</h1>
<p>{{ body|safe }}</p>
</div>
{% endif %}
</div>

{% if dismiss_url %}
<div class="col-xs-2 col-sm-1">
{% csrf_token %}
<a class="dismiss">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
<span class="sr-only">{% trans "Close" %}</span>
</a>
</div>
{% endif %}
</div>
</div>
</div>
34 changes: 8 additions & 26 deletions analytics_dashboard/templates/announcements.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
{% load announcements_tags i18n %}
{% load soapbox %}
{% load announcements_tags %}

{% announcements as announcements_list %}
{% get_messages_for_page view.page_name as soapbox_messages %}
{% for message in soapbox_messages %}
{% include "_announcement.html" with message=message %}
{% endfor %}

{% announcements as announcements_list %}
{% with announcements_list|first as announcement %}
{% if announcement %}
<div class="announcement-container" data-dismiss-url="{{ announcement.dismiss_url }}"
data-view="announcement">
<div class="container">
{% csrf_token %}
<a class="dismiss">
<span aria-hidden="true"><i class="fa fa-times"></i></span><span class="sr-only">{% trans "Close" %}</span>
</a>

<div class="container">
<div class="row">
<div class="col-xs-1 col-md-1">
<div class="icon"><i class="fa fa-bullhorn"></i></div>
</div>

<div class="col-xs-9 col-md-9">
<div class="message">
<div class="title">{{ announcement.title }}</div>
<div class="body">{{ announcement.content|safe }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% include "_announcement.html" with body=announcement.content title=announcement.title dismiss_url=announcement.dismiss_url %}
{% endif %}
{% endwith %}
1 change: 1 addition & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ django_compressor==1.4 # MIT
django-countries==3.1.1 # MIT
django-libsass==0.2 # BSD
django-model-utils==1.5.0 # BSD
django-soapbox==1.1 # BSD
django-waffle==0.10 # BSD

# other versions cause a segment fault when running compression
Expand Down

0 comments on commit b761e74

Please sign in to comment.