Merge pull request #807 from MITx/feature/victor/status-banner
Feature/victor/status banner
This commit is contained in:
1
common/djangoapps/status/__init__.py
Normal file
1
common/djangoapps/status/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
29
common/djangoapps/status/status.py
Normal file
29
common/djangoapps/status/status.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
A tiny app that checks for a status message.
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def get_site_status_msg():
|
||||
"""
|
||||
Look for a file settings.STATUS_MESSAGE_PATH. If found, return the
|
||||
contents. Otherwise, return None.
|
||||
|
||||
If something goes wrong, returns None. ("is there a status msg?" logic is
|
||||
not allowed to break the entire site).
|
||||
"""
|
||||
try:
|
||||
content = None
|
||||
if os.path.isfile(settings.STATUS_MESSAGE_PATH):
|
||||
with open(settings.STATUS_MESSAGE_PATH) as f:
|
||||
content = f.read()
|
||||
|
||||
return content
|
||||
except:
|
||||
log.exception("Error while getting a status message.")
|
||||
return None
|
||||
@@ -25,6 +25,7 @@ import glob2
|
||||
import errno
|
||||
import hashlib
|
||||
from collections import defaultdict
|
||||
import socket
|
||||
|
||||
import djcelery
|
||||
from path import path
|
||||
@@ -95,6 +96,7 @@ GENERATE_PROFILE_SCORES = False
|
||||
# Used with XQueue
|
||||
XQUEUE_WAITTIME_BETWEEN_REQUESTS = 5 # seconds
|
||||
|
||||
|
||||
############################# SET PATH INFORMATION #############################
|
||||
PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /mitx/lms
|
||||
REPO_ROOT = PROJECT_ROOT.dirname()
|
||||
@@ -103,7 +105,6 @@ ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /mitx is in
|
||||
ASKBOT_ROOT = REPO_ROOT / "askbot"
|
||||
COURSES_ROOT = ENV_ROOT / "data"
|
||||
|
||||
# FIXME: To support multiple courses, we should walk the courses dir at startup
|
||||
DATA_DIR = COURSES_ROOT
|
||||
|
||||
sys.path.append(REPO_ROOT)
|
||||
@@ -127,8 +128,11 @@ node_paths = [COMMON_ROOT / "static/js/vendor",
|
||||
NODE_PATH = ':'.join(node_paths)
|
||||
|
||||
|
||||
# Where to look for a status message
|
||||
STATUS_MESSAGE_PATH = ENV_ROOT / "status_message.html"
|
||||
|
||||
############################ OpenID Provider ##################################
|
||||
OPENID_PROVIDER_TRUSTED_ROOTS = ['cs50.net', '*.cs50.net']
|
||||
OPENID_PROVIDER_TRUSTED_ROOTS = ['cs50.net', '*.cs50.net']
|
||||
|
||||
################################## MITXWEB #####################################
|
||||
# This is where we stick our compiled template files. Most of the app uses Mako
|
||||
@@ -158,7 +162,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'askbot.user_messages.context_processors.user_messages',#must be before auth
|
||||
'django.contrib.auth.context_processors.auth', #this is required for admin
|
||||
'django.core.context_processors.csrf', #necessary for csrf protection
|
||||
|
||||
|
||||
# Added for django-wiki
|
||||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.tz',
|
||||
@@ -355,7 +359,7 @@ WIKI_CAN_ASSIGN = lambda article, user: user.is_staff or user.is_superuser
|
||||
|
||||
WIKI_USE_BOOTSTRAP_SELECT_WIDGET = False
|
||||
WIKI_LINK_LIVE_LOOKUPS = False
|
||||
WIKI_LINK_DEFAULT_LEVEL = 2
|
||||
WIKI_LINK_DEFAULT_LEVEL = 2
|
||||
|
||||
################################# Jasmine ###################################
|
||||
JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee'
|
||||
@@ -372,10 +376,10 @@ STATICFILES_FINDERS = (
|
||||
TEMPLATE_LOADERS = (
|
||||
'mitxmako.makoloader.MakoFilesystemLoader',
|
||||
'mitxmako.makoloader.MakoAppDirectoriesLoader',
|
||||
|
||||
|
||||
# 'django.template.loaders.filesystem.Loader',
|
||||
# 'django.template.loaders.app_directories.Loader',
|
||||
|
||||
|
||||
#'askbot.skins.loaders.filesystem_load_template_source',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
@@ -393,7 +397,7 @@ MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'track.middleware.TrackMiddleware',
|
||||
'mitxmako.middleware.MakoMiddleware',
|
||||
|
||||
|
||||
'course_wiki.course_nav.Middleware',
|
||||
|
||||
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
|
||||
@@ -622,7 +626,7 @@ INSTALLED_APPS = (
|
||||
'certificates',
|
||||
'instructor',
|
||||
'psychometrics',
|
||||
|
||||
|
||||
#For the wiki
|
||||
'wiki', # The new django-wiki from benjaoming
|
||||
'django_notify',
|
||||
|
||||
BIN
lms/static/images/large-white-error-icon.png
Normal file
BIN
lms/static/images/large-white-error-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -154,6 +154,35 @@ mark {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.site-status {
|
||||
display: none;
|
||||
padding: 10px;
|
||||
background: -webkit-linear-gradient(top, rgba(0, 0, 0, .1), rgba(0, 0, 0, .0)) $pink;
|
||||
box-shadow: 0 -1px 0 rgba(0, 0, 0, .3) inset;
|
||||
font-size: 14px;
|
||||
|
||||
.white-error-icon {
|
||||
position: relative;
|
||||
top: -4px;
|
||||
float: left;
|
||||
display: block;
|
||||
width: 27px;
|
||||
height: 24px;
|
||||
margin-right: 15px;
|
||||
background: url(../images/large-white-error-icon.png) no-repeat;
|
||||
}
|
||||
|
||||
.inner-wrapper {
|
||||
margin: auto;
|
||||
max-width: 1180px;
|
||||
min-width: 760px;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 1.3;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -131,6 +131,9 @@ img {
|
||||
border: 1px solid #f00;
|
||||
}
|
||||
|
||||
.site-status {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.toast-notification {
|
||||
position: fixed;
|
||||
|
||||
@@ -8,19 +8,36 @@ from django.core.urlresolvers import reverse
|
||||
|
||||
# App that handles subdomain specific branding
|
||||
import branding
|
||||
# app that handles site status messages
|
||||
from status.status import get_site_status_msg
|
||||
%>
|
||||
|
||||
%if course:
|
||||
<%block cached="False">
|
||||
<%
|
||||
site_status_msg = get_site_status_msg()
|
||||
%>
|
||||
% if site_status_msg:
|
||||
<div class="site-status">
|
||||
<div class="inner-wrapper">
|
||||
<span class="white-error-icon"></span>
|
||||
<p>${site_status_msg}</p>
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
||||
</%block>
|
||||
|
||||
|
||||
% if course:
|
||||
<header class="global slim" aria-label="Global Navigation">
|
||||
%else:
|
||||
% else:
|
||||
<header class="global" aria-label="Global Navigation">
|
||||
%endif
|
||||
% endif
|
||||
<nav>
|
||||
<h1 class="logo"><a href="${reverse('root')}"><img src="${static.url(branding.get_logo_url(request.META.get('HTTP_HOST')))}"/></a></h1>
|
||||
|
||||
%if course:
|
||||
% if course:
|
||||
<h2><span class="provider">${course.org}:</span> ${course.number} ${course.title}</h2>
|
||||
%endif
|
||||
% endif
|
||||
|
||||
<ol class="left find-courses-button">
|
||||
<li class="primary">
|
||||
@@ -28,7 +45,7 @@ import branding
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
%if user.is_authenticated():
|
||||
% if user.is_authenticated():
|
||||
<ol class="user">
|
||||
<li class="primary">
|
||||
<a href="${reverse('dashboard')}" class="user-link">
|
||||
@@ -46,7 +63,7 @@ import branding
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
%else:
|
||||
% else:
|
||||
<ol class="guest">
|
||||
<li class="secondary">
|
||||
<a href="${reverse('about_edx')}">About</a>
|
||||
|
||||
Reference in New Issue
Block a user