Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions collab_coursebook/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down
1 change: 1 addition & 0 deletions collab_coursebook/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
path('accounts/logout/', django_cas_ng.views.LogoutView.as_view(), name='cas_ng_logout'),
path('accounts/callback/', django_cas_ng.views.CallbackView.as_view(), name='cas_ng_proxy_callback'),
path('', include('frontend.urls', namespace='frontend')),
path('i18n/', include('django.conf.urls.i18n')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
55 changes: 37 additions & 18 deletions frontend/templates/frontend/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,49 @@

<link rel="stylesheet" href="{% static 'css/main.css' %}">

<script type='text/javascript'>
var changed_form = false;

$(document).ready(function() {
// Ask before changing language if user changed main form on page
$("#language-switcher").submit(function(e){
if(changed_form) {
if(!confirm("{% trans 'Are you sure you want to change the language now? This will clear the form!' %}"))
e.preventDefault(e);
}
});

// Remember any main form edits/changes
$("form.post-form :input").change(function(){
if($(this).val() != '')
changed_form = true;
});
});
</script>

{% block imports %}{% endblock %}
</head>
<body>

{% block general_content %}
{% block general_content %}
{% endblock %}

{% endblock %}
<div class="container" style="padding-top:1em;padding-bottom: 1em;">
{% block footer_custom %}
{% endblock %}
{% footer_info as FI %}
{% if FI.impress_text %}
{{ FI.impress_text }} &middot;
{% endif %}
{% if FI.impress_url %}
<a href="{{ FI.impress_url }}">{% trans "Impress" %}</a> &middot;
{% endif %}
{% if FI.repo_url %}
<a href="{{ FI.repo_url }}">{% trans "This software is open source" %}</a>
{% endif %}
</div>

<div class="container" style="padding-top:1em;padding-bottom: 1em;">
{% block footer_custom %}
{% endblock %}
{% footer_info as FI %}
{% if FI.impress_text %}
{{ FI.impress_text }} &middot;
{% endif %}
{% if FI.impress_url %}
<a href="{{ FI.impress_url }}">{% trans "Impress" %}</a> &middot;
{% endif %}
{% if FI.repo_url %}
<a href="{{ FI.repo_url }}">{% trans "This software is open source" %}</a>
{% endif %}
</div>

{% block bottom_script %}{% endblock %}
{% block bottom_script %}{% endblock %}

</body>
</html>
2 changes: 1 addition & 1 deletion frontend/templates/frontend/comment/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{% block content %}
<h1>Edit comment</h1>
<form action="" method="post">
<form action="" class="post-form" method="post">
{% csrf_token %}

{% bootstrap_form form %}
Expand Down
2 changes: 1 addition & 1 deletion frontend/templates/frontend/content/addcontent.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% endblock %}

{% block content %}
<form method="post" enctype=multipart/form-data>
<form method="post" class="post-form" enctype=multipart/form-data>
{% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_form content_type_form %}
Expand Down
2 changes: 1 addition & 1 deletion frontend/templates/frontend/content/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h5><a name="rating">{% trans "Rating" %}</a></h5>

<h5 style="margin-top: 30px;"><a name="comments">{% trans "Comments" %}</a></h5>
{% if user.is_authenticated %}
<form action="{% url 'frontend:content' course.id topic.id content.id %}" method="post">
<form action="{% url 'frontend:content' course.id topic.id content.id %}" class="post-form" method="post">
{% csrf_token %}

{% bootstrap_form comment_form %}
Expand Down
2 changes: 1 addition & 1 deletion frontend/templates/frontend/course/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{% block content %}
<h1>Create a new Course</h1>

<form method="post" enctype=multipart/form-data>
<form method="post" class="post-form" enctype=multipart/form-data>
{% csrf_token %}

{% bootstrap_form form %}
Expand Down
2 changes: 1 addition & 1 deletion frontend/templates/frontend/course/duplicate.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{% block content %}
<h1>{% trans "Duplicate Course" %}</h1>

<form method="post" enctype=multipart/form-data>
<form method="post" class="post-form" enctype=multipart/form-data>
{% csrf_token %}

{% bootstrap_form form %}
Expand Down
2 changes: 1 addition & 1 deletion frontend/templates/frontend/course/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{% block content %}
<h1>Edit Course</h1>

<form method="post" enctype=multipart/form-data>
<form method="post" class="post-form" enctype=multipart/form-data>
{% csrf_token %}

{% bootstrap_form form %}
Expand Down
32 changes: 29 additions & 3 deletions frontend/templates/frontend/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,35 @@
&nbsp;
{% endif %}
<a href="{% url 'frontend:profile' pk=user.profile.pk %}" class="text-decoration-none text-white">{{ user.get_username }}</a>
&nbsp;
<a href="{% url "cas_ng_logout" %}" class="btn btn-primary" style="">{% trans "Logout" %}</a>

<div class="btn-group" role="group">
<div class="btn-group" role="group">
<button id="btnGroupNavbar" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="btnGroupNavbar" style="">
<div class="dropdown-header">
{% trans "Language" %}:
</div>
<!-- language switcher -->
<form action="{% url 'set_language' %}" method="post" class="form-inline" name="language-form" id="language-switcher" style="flex-direction: column;">
{% csrf_token %}
<input name="next" type="hidden" value="{{ request.path }}" />

{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}

{% for language in languages %}
<button type="submit" class="dropdown-item" name="language" value="{{ language.code }}" style="align-self: end;">
{{ language.code | upper }}
</button>
{% endfor %}
</form>
<div class="dropdown-divider"></div>
<a href="{% url "cas_ng_logout" %}" class="dropdown-item" style="">{% trans "Logout" %}</a>
</div>
</div>
</div>
</div>
{% endif %}

<a href="{% url "frontend:dashboard" %}" style="color: #ffffff;text-decoration: none;"><h4 style="font-weight: bold;display: inline;">Collab Coursebook</h4></a>
<a href="{% url "frontend:dashboard" %}" style="color: #ffffff;text-decoration: none;"><h4 style="font-weight: bold;display: inline;">Collab Coursebook</h4></a>
2 changes: 1 addition & 1 deletion frontend/templates/frontend/profile/profile_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% block content %}
<h1>{% trans "Edit your profile" %}</h1>

<form method="POST" class="post-form">{% csrf_token %}
<form method="POST" class="post-form" class="post-form">{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="reset" class="btn btn-danger">
Expand Down