Skip to content

Commit e6c5272

Browse files
authored
Merge pull request #5542 from mrpau/feature/configurable-welcome-message
Display custom welcome message for admins
2 parents 713f908 + 41421dd commit e6c5272

File tree

6 files changed

+41
-1
lines changed

6 files changed

+41
-1
lines changed

docs/installguide/release_notes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Bug fixes
1818
* Video download retry upon connection timeouts/errors :url-issue:`5528`
1919
* Simplified login is now working when there are 1,000 or more users registered in a facility. :url-issue:`5523`
2020

21+
New Features
22+
^^^^^^^^^^^^
23+
24+
* Customizable welcome message for first time KA Lite admins! :url-issue:`5522`
25+
2126
Developers
2227
^^^^^^^^^^
2328

kalite/control_panel/templates/control_panel/base.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
{% endblock headcss %}
3131

3232
{% block content %}
33+
{% if request.session.logged_in_first_time and request.is_admin %}
34+
{% include "control_panel/partials/_welcome_message.html" %}
35+
{% endif %}
3336

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="alert alert-info alert-dismissable" role="alert">
2+
<button type="button" class="close" data-dismiss="alert" data-target="#welcome-message"><span aria-hidden="true">&times;</span></button>
3+
{{ welcome_message|safe }}
4+
</div>

kalite/distributed/custom_context_processors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ def custom(request):
3636
"False": False,
3737
"is_config_package_nalanda": getattr(settings, 'NALANDA', False),
3838
"HIDE_CONTENT_RATING": settings.HIDE_CONTENT_RATING,
39-
"universal_js_user_error": settings.AJAX_ERROR
39+
"universal_js_user_error": settings.AJAX_ERROR,
40+
"welcome_message": settings.KALITE_WELCOME_MESSAGE,
4041
}

kalite/facility/api_resources.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def flag_facility_cache(**kwargs):
5959
global FACILITY_LIST
6060
FACILITY_LIST = None
6161

62+
def logged_in_first_time(user):
63+
return user.last_login == user.date_joined
64+
6265
post_save.connect(flag_facility_cache, sender=Facility)
6366

6467
class FacilityUserResource(ModelResource):
@@ -103,6 +106,7 @@ def login(self, request, **kwargs):
103106
if not settings.CENTRAL_SERVER:
104107
user = authenticate(username=username, password=password)
105108
if user:
109+
request.session["logged_in_first_time"] = logged_in_first_time(user)
106110
login(request, user)
107111
return self.create_response(request, {
108112
'success': True,

kalite/project/settings/base.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,26 @@
2020
SOUTH_MIGRATION_MODULES = {
2121
'tastypie': 'tastypie.south_migrations',
2222
}
23+
24+
# Default welcome message
25+
KALITE_WELCOME_MESSAGE = """
26+
<h2>Need help?</h2>
27+
<p>KA Lite is community-driven and relies on help and experience which you can both share and receive in our community.</p>
28+
<br>
29+
<h4>Offline help: </h4>
30+
<ul>
31+
<li>Use the "Docs" button in the top menu to get help.</li>
32+
</ul>
33+
<h4>Online help: </h4>
34+
<ul>
35+
<li>Share your implementation of KA Lite on the map and find other KA Lite users in your country
36+
<a href='https://learningequality.org/ka-lite/map/' target='_blank'>https://learningequality.org/ka-lite/map/</a>
37+
(Click on "Add your story!")</li>
38+
<li>Give and receive KA Lite support in the Learning Equality community
39+
<a href='http://community.learningequality.org/' target='_blank'>http://community.learningequality.org/</a></li>
40+
<li>Help program KA Lite at GitHub
41+
<a href='http://github.com/learningequality/ka-lite/' target='_blank'>http://github.com/learningequality/ka-lite/</a></li>
42+
<li>Sign up for emails about new releases <a href='https://groups.google.com/a/learningequality.org/forum/#!forum/dev' target='_blank'>
43+
https://groups.google.com/a/learningequality.org/forum/#!forum/dev</a></li>
44+
</ul>
45+
"""

0 commit comments

Comments
 (0)