Skip to content

Commit

Permalink
Merge pull request #5542 from mrpau/feature/configurable-welcome-message
Browse files Browse the repository at this point in the history
Display custom welcome message for admins
  • Loading branch information
benjaoming committed Nov 15, 2017
2 parents 713f908 + 41421dd commit e6c5272
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/installguide/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Bug fixes
* Video download retry upon connection timeouts/errors :url-issue:`5528`
* Simplified login is now working when there are 1,000 or more users registered in a facility. :url-issue:`5523`

New Features
^^^^^^^^^^^^

* Customizable welcome message for first time KA Lite admins! :url-issue:`5522`

Developers
^^^^^^^^^^

Expand Down
3 changes: 3 additions & 0 deletions kalite/control_panel/templates/control_panel/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
{% endblock headcss %}

{% block content %}
{% if request.session.logged_in_first_time and request.is_admin %}
{% include "control_panel/partials/_welcome_message.html" %}
{% endif %}

{% block subnavbar %}{{block.super}}{% endblock subnavbar %}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="alert alert-info alert-dismissable" role="alert">
<button type="button" class="close" data-dismiss="alert" data-target="#welcome-message"><span aria-hidden="true">&times;</span></button>
{{ welcome_message|safe }}
</div>
3 changes: 2 additions & 1 deletion kalite/distributed/custom_context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ def custom(request):
"False": False,
"is_config_package_nalanda": getattr(settings, 'NALANDA', False),
"HIDE_CONTENT_RATING": settings.HIDE_CONTENT_RATING,
"universal_js_user_error": settings.AJAX_ERROR
"universal_js_user_error": settings.AJAX_ERROR,
"welcome_message": settings.KALITE_WELCOME_MESSAGE,
}
4 changes: 4 additions & 0 deletions kalite/facility/api_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def flag_facility_cache(**kwargs):
global FACILITY_LIST
FACILITY_LIST = None

def logged_in_first_time(user):
return user.last_login == user.date_joined

post_save.connect(flag_facility_cache, sender=Facility)

class FacilityUserResource(ModelResource):
Expand Down Expand Up @@ -103,6 +106,7 @@ def login(self, request, **kwargs):
if not settings.CENTRAL_SERVER:
user = authenticate(username=username, password=password)
if user:
request.session["logged_in_first_time"] = logged_in_first_time(user)
login(request, user)
return self.create_response(request, {
'success': True,
Expand Down
23 changes: 23 additions & 0 deletions kalite/project/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,26 @@
SOUTH_MIGRATION_MODULES = {
'tastypie': 'tastypie.south_migrations',
}

# Default welcome message
KALITE_WELCOME_MESSAGE = """
<h2>Need help?</h2>
<p>KA Lite is community-driven and relies on help and experience which you can both share and receive in our community.</p>
<br>
<h4>Offline help: </h4>
<ul>
<li>Use the "Docs" button in the top menu to get help.</li>
</ul>
<h4>Online help: </h4>
<ul>
<li>Share your implementation of KA Lite on the map and find other KA Lite users in your country
<a href='https://learningequality.org/ka-lite/map/' target='_blank'>https://learningequality.org/ka-lite/map/</a>
(Click on "Add your story!")</li>
<li>Give and receive KA Lite support in the Learning Equality community
<a href='http://community.learningequality.org/' target='_blank'>http://community.learningequality.org/</a></li>
<li>Help program KA Lite at GitHub
<a href='http://github.com/learningequality/ka-lite/' target='_blank'>http://github.com/learningequality/ka-lite/</a></li>
<li>Sign up for emails about new releases <a href='https://groups.google.com/a/learningequality.org/forum/#!forum/dev' target='_blank'>
https://groups.google.com/a/learningequality.org/forum/#!forum/dev</a></li>
</ul>
"""

0 comments on commit e6c5272

Please sign in to comment.