Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar of the competition added #34

Closed
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 language/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"Instant_scoring": "Instant scoring",
"Multi_language": "Multi-language",
"Google_and_Facebook_logins":"Google and Facebook logins",
"calendar": "Calendar",

"number_of_routes": "Number of routes",
"address": "Address",
Expand Down
3 changes: 2 additions & 1 deletion language/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"Instant_scoring": "Calcul instantanné des scores",
"Multi_language": "Multi-langue",
"Google_and_Facebook_logins":"Login Google et Facebook",

"calendar": "Calendrier",

"number_of_routes": "Nombre de voies",
"address": "Adresse",
"link": "URL",
Expand Down
1 change: 1 addition & 0 deletions language/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"Instant_scoring": "Instant scoring",
"Multi_language": "Multi-language",
"Google_and_Facebook_logins":"Google and Facebook logins",
"calendar": "Calendar",
"competition_climber_list": "Competition climber list",

"number_of_routes": "Number of routes",
Expand Down
11 changes: 11 additions & 0 deletions main_app_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,17 @@ def privacy():
reference_data=competitionsEngine.reference_data
)

@app_ui.route('/calendar')
def calendar():
return render_template('calendar.html',
competitionName=None,
session=session,
user=competitionsEngine.get_user_by_email(session.get('email')),
reference_data=competitionsEngine.reference_data,
competitions=competitionsEngine.getCompetitions(),
langpack=languages['en_US'],
**session
)


@app_ui.route('/main')
Expand Down
71 changes: 71 additions & 0 deletions views/calendar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{% extends "skala3ma-layout.html" %}

{% block topcontent %}

{% endblock %}

{% block secondarycontent %}


<div name='bbb'>
<div class="text-center heading-section">
<br>
<h3>{{ reference_data['current_language'].calendar}}</h3>
{% if user is defined and user is not none and 'create_competition' in user['permissions']['general'] %}
<button type="button" class="btn btn-success btn-md"
onclick='location.href="/newCompetition"'>{{reference_data['current_language'].add}}</button>

{% endif %}
</div>
<div class="container">
<div id='calendar'></div>
</div>
</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
// themeSystem: 'bootstrap', // Bootstrap 4 or 5...
locale: 'fr', // TODO set the initial locale correctly
firstDay: 1,
// aspectRatio: 2, // for smaller months display
initialView: 'multiMonthFourMonth',
multiMonthMaxColumns: 2,
views: {
multiMonthFourMonth: {
type: 'multiMonth',
duration: { months: 4 },
buttonText: 'Grid' // TODO translate
},
listYear: {
buttonText: 'List' // TODO translate
}
},
headerToolbar: {
left: 'title',
center: 'listYear, multiMonthFourMonth'
},
events: [
// Loop through competitions and format them as events
{% for competitionId in competitions %}

{
title: "{{ competitions[competitionId]['name'] }}",
start: "{{ competitions[competitionId]['date'] }}",
url: '/competitionDetails/{{ competitionId }}',
backgroundColor: '#5cb85c', // copied from bootstap.css (don't know how to do better)
borderColor: '#449d44'
// other event properties
},

{% endfor %}
]
// other configuration options
});
calendar.render();

});
</script>

{% endblock %}
8 changes: 8 additions & 0 deletions views/skala3ma-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@

</script>


<!-- FullCalendar's Core JavaScript -->
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.10/index.global.min.js'></script>


</head>

Expand Down Expand Up @@ -227,6 +231,10 @@ <h1 id="fh5co-logo"><a href="/main"><img src="/public/images/favicon.png" height
</ul>
</li>

<li>
<a href="/calendar" class="fh5co-sub-ddown">{{ reference_data['current_language'].calendar}}</a>
</li>

<li>
<a href="/gyms" class="fh5co-sub-ddown">{{ reference_data['current_language'].gyms }}</a>
</li>
Expand Down