summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--forums/settings.py5
-rw-r--r--static/website/css/nice-bar.css4
-rw-r--r--static/website/templates/base.html13
-rw-r--r--website/templatetags/nice_bar.py25
4 files changed, 44 insertions, 3 deletions
diff --git a/forums/settings.py b/forums/settings.py
index be17520..406ac21 100644
--- a/forums/settings.py
+++ b/forums/settings.py
@@ -185,7 +185,10 @@ LOGGING = {
AUTH_USER_MODEL = 'drupal_auth.Users'
AUTHENTICATION_BACKENDS = ( 'drupal_auth.backends.DrupalAuthBackend', )
DATABASE_ROUTERS = ['drupal_auth.routers.DrupalAuthRouter']
-TEMPLATE_CONTEXT_PROCESSORS += ('website.context_processors.admin_processor', )
+TEMPLATE_CONTEXT_PROCESSORS += (
+ 'django.core.context_processors.request',
+ 'website.context_processors.admin_processor',
+)
COMPRESS_ROOT = PROJECT_DIR + "/static/"
COMPRESS_ENABLED = True
diff --git a/static/website/css/nice-bar.css b/static/website/css/nice-bar.css
index 6159b09..9294c7e 100644
--- a/static/website/css/nice-bar.css
+++ b/static/website/css/nice-bar.css
@@ -1,8 +1,8 @@
.nice-bar {
display: none;
width: 100%;
- background: #70a865;
- border-bottom: 3px solid #27ae60;
+ background: #0074D9;
+ border-bottom: 3px solid #ffffff;
font-size: 0.85em;
}
.nice-bar .nice-text {
diff --git a/static/website/templates/base.html b/static/website/templates/base.html
index 172c901..d0697dd 100644
--- a/static/website/templates/base.html
+++ b/static/website/templates/base.html
@@ -7,9 +7,21 @@
<link rel="stylesheet" href="{% static 'website/css/bootstrap.min.css' %}" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="{% static 'website/slick/slick.css' %}" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="{% static 'website/css/main.css' %}" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="{% static 'website/css/nice-bar.css' %}" type="text/css" media="screen" charset="utf-8" />
{% endcompress %}
</head>
<body>
+ {% load nice_bar %}
+ {% if request|is_nice_bar_visible %}
+ <div class="nice-bar">
+ <p class="nice-text">
+ One day Oscad workshop on 10<sup>th</sup> May 2014.
+ <a class="nice-button" href="http://oscad.in/one-day-workshop">View more</a> details about the workshop.
+ <a class="nice-button" href="http://pesit-oscad-workshop.doattend.com">Click here</a> for registration.
+ <span class="nice-close">x</span>
+ </p>
+ </div>
+ {% endif %}
<div id="page-wrapper">
<div id="header-wrapper">
<div id="header-inner">
@@ -111,6 +123,7 @@
<script src="{% static 'website/js/jquery.min.js' %}"></script>
<script src="{% static 'website/js/bootstrap.min.js' %}"></script>
<script src="{% static 'website/slick/slick.min.js' %}"></script>
+ <script src="{% static 'website/js/nice-bar.js' %}"></script>
{% block javascript %}
<!-- overide with custom javascript -->
{% endblock %}
diff --git a/website/templatetags/nice_bar.py b/website/templatetags/nice_bar.py
new file mode 100644
index 0000000..f7fd78c
--- /dev/null
+++ b/website/templatetags/nice_bar.py
@@ -0,0 +1,25 @@
+import re
+
+from django import template
+
+from website.models import Question, Answer
+
+register = template.Library()
+
+# Showing/Hiding nice-bar on pages
+def is_nice_bar_visible(request):
+ if request.path == '/':
+ return True
+ elif "Oscad" in request.path:
+ return True
+ elif "/question/" in request.path:
+ try:
+ question_id = request.path[1:-1].split('/')
+ question_id = int(question_id[1])
+ question = Question.objects.get(pk=question_id)
+ if question.category == "Oscad":
+ return True
+ except:
+ return False
+ return False
+register.filter('is_nice_bar_visible', is_nice_bar_visible)