Skip to content

Commit

Permalink
SIO-1272 Include "- [website_name]" in titles and make them more unique
Browse files Browse the repository at this point in the history
Change-Id: Ia49263351ab0306ca891a82a9b29aea6849716cf
  • Loading branch information
Tommalla committed Oct 24, 2013
1 parent 87d57ff commit b24651c
Show file tree
Hide file tree
Showing 30 changed files with 57 additions and 22 deletions.
5 changes: 5 additions & 0 deletions oioioi/base/processors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.core.urlresolvers import get_script_prefix
from oioioi.base.menu import side_pane_menus_registry
from django.conf import settings


def base_url(request):
Expand All @@ -9,3 +10,7 @@ def base_url(request):
def side_menus(request):
menus = [m for m in side_pane_menus_registry if m.condition(request)]
return {'side_menus': menus}


def site_name(request):
return {'site_name': settings.SITE_NAME}
4 changes: 2 additions & 2 deletions oioioi/base/templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
{% all_with_prefix extra_head_ %}
{% endblock %}

{% block title %}{{ title }} | {% trans 'OIOIOI Admin' %}{% endblock %}
{% block title %}{{ title }} - {% blocktrans %}{{ site_name }} Admin{% endblocktrans %}{% endblock %}

{% block branding %}
<h1 id="site-name">{% trans 'OIOIOI Admin' %}</h1>
<h1 id="site-name">{% blocktrans %}{{ site_name }} Admin{% endblocktrans %}</h1>
{% endblock %}

{% block footer %}
Expand Down
2 changes: 1 addition & 1 deletion oioioi/base/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<html lang="{{ LANGUAGE_CODE|default:"en" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
{% block head %}
<title>{% block title %}OIOIOI{% endblock %}</title>
<title>{% block title %}{% trans "Main page" %}{% endblock %} - {{ site_name }}</title>
{% block styles %}
{% compress css %}
<link charset="utf-8" rel="stylesheet" type="text/less" href="{{ STATIC_URL }}less/style.less">
Expand Down
2 changes: 1 addition & 1 deletion oioioi/base/templates/ingredients/navbar_branding.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a class="brand" href="{% url 'index' %}">OIOIOI</a>
<a class="brand" href="{% url 'index' %}">{{ site_name }}</a>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "simple-centered.html" %}
{% load i18n %}

{% block title %}{% trans 'Password reset' %}{% endblock %}
{% block title %}{% trans "Enter new password" %} - {% trans "Password reset" %}{% endblock %}

{% block content %}

Expand Down
2 changes: 1 addition & 1 deletion oioioi/complaints/templates/complaints/make.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Complaints" %}{% endblock %}
{% block title %}{% trans "Make complaint" %} - {% trans "Complaints" %}{% endblock %}

{% block content %}
<h1>{% trans "Complaint form" %}</h1>
Expand Down
2 changes: 2 additions & 0 deletions oioioi/contests/templates/contests/html_statement.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{{ problem_name }} - {% trans "Problem statement" %}{% endblock %}

{% block content %}
{{ content }}
{% endblock %}
2 changes: 1 addition & 1 deletion oioioi/contests/templates/contests/nothing_to_submit.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Submit solution" %}{% endblock %}
{% block title %}{% trans "No problems available" %} - {% trans "Submit solution" %}{% endblock %}

{% block content %}
<h2>{% trans "Submit solution" %}</h2>
Expand Down
2 changes: 1 addition & 1 deletion oioioi/contests/templates/contests/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}
{% load check_perm %}

{% block title %}{% trans "Submission" %} {{ submission.id }}{% endblock %}
{% block title %}{% blocktrans with submission.id as id %}Submission {{ id }}{% endblocktrans %}{% endblock %}

{% block scripts %}
{{ block.super }}
Expand Down
6 changes: 5 additions & 1 deletion oioioi/contests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ def problem_statement_zip_index_view(request, contest_id, problem_instance,
statement_id):
response = problem_statement_zip_view(request, contest_id,
problem_instance, statement_id, 'index.html')

problem_statement = get_object_or_404(ProblemStatement, id=statement_id)

return TemplateResponse(request, 'contests/html_statement.html',
{'content': mark_safe(response.content)})
{'content': mark_safe(response.content),
'problem_name' : problem_statement.problem.name})


@enforce_condition(contest_exists & can_enter_contest)
Expand Down
3 changes: 3 additions & 0 deletions oioioi/dashboard/templates/dashboard/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block styles %}
{{ block.super }}
<link charset="utf-8" rel="stylesheet" type="text/css" href="{{ STATIC_URL }}dashboard/style.css">
{% endblock %}

{% block title %}{% trans "Contest dashboard" %}{% endblock %}

{% block content %}
{% for header in headers %}{{ header }}{% endfor %}
{% for fragment in fragments %}{{ fragment }}{% endfor %}
Expand Down
4 changes: 4 additions & 0 deletions oioioi/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
TEMPLATE_DEBUG = DEBUG
INTERNAL_IPS = ('127.0.0.1',)

# Site name displayed in the title
SITE_NAME = 'OIOIOI'

# Run uwsgi daemon. Shall be True, False or 'auto'.
# 'auto' means daemon will be run iff DEBUG is disabled.
UWSGI_ENABLED = 'auto'
Expand Down Expand Up @@ -88,6 +91,7 @@
'oioioi.su.processors.real_user',
'oioioi.base.processors.base_url',
'oioioi.base.processors.side_menus',
'oioioi.base.processors.site_name',
'oioioi.jotform.processors.jotform',
'oioioi.contests.processors.register_current_contest',
'oioioi.contests.processors.register_recent_contests',
Expand Down
3 changes: 3 additions & 0 deletions oioioi/deployment/settings.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ DEBUG = True

TEMPLATE_DEBUG = DEBUG

# Site name displayed in the title
SITE_NAME = 'OIOIOI'

# Email addresses to send error message reports.
ADMINS = (
('Your Name', '[email protected]'),
Expand Down
2 changes: 1 addition & 1 deletion oioioi/forum/templates/forum/confirm_delete.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "simple-centered-confirmation.html" %}
{% load i18n %}

{% block title %}{% trans "Confirmation" %}{% endblock %}
{% block title %}{% trans "Delete confirmation" %} - {% trans "Forum" %}{% endblock %}

{% block help_text %}
{% blocktrans with el=elem %}Are you sure, that you want to delete {{ elem }}?{% endblocktrans %}
Expand Down
2 changes: 1 addition & 1 deletion oioioi/forum/templates/forum/edit_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}
{% load check_perm %}

{% block title %}{% trans "Thread" %}: {{ thread.name }} - {% trans "Edit post" %}{% endblock %}
{% block title %}{% trans "Edit post" %} - {% trans "Thread" %}: {{ thread.name }}{% endblock %}

{% block content %}
{% check_perm 'contests.contest_admin' for contest as is_admin %}
Expand Down
2 changes: 1 addition & 1 deletion oioioi/forum/templates/forum/forum.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}
{% load check_perm %}

{% block title %}{% trans "Forum" %}: {{ forum }}{% endblock %}
{% block title %}{{ forum }} - {% trans "Forum" %}{% endblock %}

{% block content %}
{% check_perm 'contests.contest_admin' for contest as is_admin %}
Expand Down
4 changes: 2 additions & 2 deletions oioioi/forum/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ def test_remove_posts(self):
# user can remove p2 (last post, added by user)
response = self.try_to_remove_post(p2)
self.assertEqual(200, response.status_code)
self.assertIn('Confirmation', response.content)
self.assertIn('Delete confirmation', response.content)
p2.delete()

# user tries to remove post p1 (and he can!)
response = self.try_to_remove_post(p1)
self.assertEqual(200, response.status_code)
self.assertIn('Confirmation', response.content)
self.assertIn('Delete confirmation', response.content)
p1.delete()

# user tries to remove post p0 but cannot (added earlier than 15min ago)
Expand Down
2 changes: 1 addition & 1 deletion oioioi/oireports/templates/oireports/no_reports.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Report" %}{% endblock %}
{% block title %}{% trans "No reports available" %}{% endblock %}

{% block content %}
<h2>{% trans "Report" %}</h2>
Expand Down
2 changes: 2 additions & 0 deletions oioioi/participants/templates/participants/registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
{{ form.media.js }}
{% endblock %}

{% block title %}{% trans "Register to the contest" %}{% endblock %}

{% block content %}
<h2>{% trans "Register to the contest" %}</h2>

Expand Down
2 changes: 2 additions & 0 deletions oioioi/participants/templates/participants/unregister.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Confirm unregistration" %}{% endblock %}

{% block content %}
<div class="well span10 offset1 central-well">
<form action="" method="post" class="form-horizontal">{% csrf_token %}
Expand Down
2 changes: 1 addition & 1 deletion oioioi/printing/templates/printing/nothing_to_print.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Printing" %}{% endblock %}
{% block title %}{% trans "Nothing to print" %} - {% trans "Printing" %}{% endblock %}

{% block content %}
<h2>{% trans "Printing" %}</h2>
Expand Down
2 changes: 2 additions & 0 deletions oioioi/problems/templates/problems/add_or_update.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Add or update problem" %}{% endblock %}

{% block content %}
<h2>{% if existing_problem %}{% blocktrans with existing_problem as name %}Update problem {{ name }}{% endblocktrans %}{% else %}{% trans "Add problem" %}{% endif %}</h2>
{% if sources|length > 1 %}
Expand Down
2 changes: 2 additions & 0 deletions oioioi/programs/templates/programs/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
</style>
{% endblock %}

{% block title %}{% blocktrans %}Source code for submission {{ submission_id }}{% endblocktrans %}{% endblock %}

{% block content %}
{% if decode_error %}
{% include "programs/file_decoding_error.html" %}
Expand Down
2 changes: 2 additions & 0 deletions oioioi/programs/templates/programs/source_diff.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% blocktrans %}Source diff between submissions {{ submission1_id }} and {{ submission2_id }}{% endblocktrans %}{% endblock %}

{% block content %}
<a class="btn" href={{ reverse_diff_url }}><i class="icon-random"></i> {% trans "Swap sides" %}</a>
<table class="syntax-highlighttable diff-table"><tbody>
Expand Down
5 changes: 4 additions & 1 deletion oioioi/programs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def show_submission_source_view(request, contest_id, submission_id):
'css': formatted_source_css,
'is_source_safe': is_source_safe,
'download_url': download_url,
'decode_error': decode_error
'decode_error': decode_error,
'submission_id': submission_id
})


Expand Down Expand Up @@ -134,6 +135,8 @@ def numformat(num):
'download_url1': download_url1,
'source2': diff2, 'decode_error2': decode_error2,
'download_url2': download_url2,
'submission1_id': submission1_id,
'submission2_id': submission2_id,
'reverse_diff_url': reverse('source_diff', kwargs={
'contest_id': contest_id,
'submission1_id': submission2_id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Change message" %}{% endblock %}
{% block content %}
<h2>{% trans "Change message" %}</h2>
<form enctype="multipart/form-data" method="post" action="" class="form-horizontal">
Expand Down
4 changes: 2 additions & 2 deletions oioioi/questions/templates/questions/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{% load i18n %}
{% load check_perm %}

{% block title %}{% trans "Questions and announcements" %}{% endblock %}
{% block title %}{{ message.topic }} - {% trans "Questions and announcements" %}{% endblock %}

{% block content %}
{% check_perm 'contests.contest_admin' for contest as is_admin %}
<h3 class="message_topic">
{% if message.problem_instance %}{{ message.problem_instance.problem }}{% else %}{% trans "General" %}{% endif %}:
{% if message.problem_instance %}{{ message.problem_instance.problem }}{% else %}{% trans "General" %}{% endif %}:
{{ message.topic }}
</h3>
{% if is_admin %}
Expand Down
2 changes: 1 addition & 1 deletion oioioi/rankings/templates/rankings/no_rankings.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Ranking" %}{% endblock %}
{% block title %}{% trans "No rankings available" %} - {% trans "Ranking" %}{% endblock %}

{% block content %}
<h2>{% trans "Ranking" %}</h2>
Expand Down
2 changes: 1 addition & 1 deletion oioioi/testrun/templates/testrun/no_testrun_problems.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Test run" %}{% endblock %}
{% block title %}{% trans "No test run problems" %} - {% trans "Test run" %}{% endblock %}

{% block content %}
<h2>{% trans "Test run" %}</h2>
Expand Down
2 changes: 1 addition & 1 deletion oioioi/testrun/templates/testrun/submit.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base-with-menu.html" %}
{% load i18n %}

{% block title %}{% trans "Test run" %}{% endblock %}
{% block title %}{% trans "Submit solution" %} - {% trans "Test run" %}{% endblock %}

{% block content %}
<h2>{% trans "Test run" %}</h2>
Expand Down

0 comments on commit b24651c

Please sign in to comment.