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

14 Lage forside, navbar og footer #23

Merged
merged 25 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c6c197e
make basic navbar
sindrelothe Mar 10, 2022
86e82f2
add logging
snorrekr Mar 1, 2022
21815bb
add snake case
snorrekr Mar 1, 2022
a5ec303
move import to top of file
snorrekr Mar 1, 2022
dd225bc
merge with main
sindrelothe Mar 10, 2022
ffb4386
add image grid for screens
sindrelothe Mar 10, 2022
058d33f
remove unnecessary comment
sindrelothe Mar 10, 2022
11e861e
add links
sindrelothe Mar 10, 2022
ca9fbc8
change grid to adjust automatically
sindrelothe Mar 22, 2022
03fcc1b
add possibility of seeing videos from home screen
sindrelothe Mar 22, 2022
3ab4052
fix indentation
sindrelothe Mar 22, 2022
e9c84bf
finish indentation fix
sindrelothe Mar 22, 2022
f98f5cf
Delete log
sindrelothe Mar 22, 2022
406dd0f
add info_screens.log to gitignore
sindrelothe Mar 22, 2022
2c620a7
remove old bootstrap version
sindrelothe Mar 22, 2022
44ce7f0
Revert "remove old bootstrap version"
sindrelothe Mar 22, 2022
38221f3
Use latest jQuery and bootstrap. Also update to new bootstrap
sindrelothe Mar 22, 2022
b8acdf2
Make screen component
sindrelothe Mar 22, 2022
110b987
Update bootstrap and update navbar and grid to new bootstrap
sindrelothe Mar 22, 2022
9bca6f3
Add navbar component
sindrelothe Mar 22, 2022
0ae2335
Include navbar and footer correctly
sindrelothe Mar 22, 2022
5f9485f
Use single quotes in infoscreen_tags.py
sindrelothe Mar 24, 2022
c0fcfde
Remove unnecessary a tag in footer
sindrelothe Mar 24, 2022
cc36d6e
Add jquery version 3.4.1
sindrelothe Mar 24, 2022
b7fe6a3
fix merge conflicts
sindrelothe Apr 21, 2022
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ db.sqlite3

__pycache__

info_screens.log

### VisualStudioCode ###
.vscode/**/*
!.vscode/extensions.json
Expand Down
441 changes: 277 additions & 164 deletions Pipfile.lock

Large diffs are not rendered by default.

Binary file added infoscreen/static/infoscreen/img/default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions infoscreen/static/infoscreen/img/default.jpg:Zone.Identifier
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://www.groupestate.gr/images/joomlart/demo/default.jpg
HostUrl=https://www.groupestate.gr/images/joomlart/demo/default.jpg
58 changes: 28 additions & 30 deletions infoscreen/templates/infoscreen/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,78 @@
{% load static %}
{% load compress %}


<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">


<!-- JQuery first (3.5.0 breaks the site), then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
{# <script src="https://code.jquery.com/jquery-3.5.0.js" integrity="sha256-r/AaFHrszJtwpe+tHyNi/XCfMxYpbsRg2Uqn0x3s2zc=" crossorigin="anonymous"></script> #}
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm" crossorigin="anonymous"></script>
{# <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.4.0/cjs/popper.min.js" integrity="sha256-OH05DFHUWzr725HmuHo3pnuvUUn+TJuj8/Qz9xytFEw=" crossorigin="anonymous"></script> #}
{# <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> #}

<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
emilte marked this conversation as resolved.
Show resolved Hide resolved

<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

<!-- Icon library -->
<!-- Lineicons -->
<link href="https://cdn.lineicons.com/2.0/LineIcons.css" rel="stylesheet">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/19339791e2.js" crossorigin="anonymous"></script>

<!-- Pretty Checkbox -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-checkbox.min.css">

{# <link rel="shortcut icon" type="image/png" href="{% static 'root/img/favicon-32x32.png' %}"/> #}

<!-- flatpickr (requires .js file and init-script) -->
<!-- Plugin for calendar date-picker -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.3/flatpickr.css" integrity="sha256-7vIWE+OHz3pLhuONuFqSa/Oh/YUUHFIMooHMwN1Q2bk=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.3/themes/dark.css" integrity="sha256-K7VO/dYboZOIjm2us6WE3Z8P8lsfUKaUVSnYYtPg6eE=" crossorigin="anonymous" />

<!-- Other stylesheets -->
{% compress css %}
<link rel="stylesheet" type="text/x-scss" href="{% static "infoscreen/scss/base.scss" %}">
{% endcompress %}

<!-- Title -->
<title>{% block title %}Base{% endblock %}</title>

{% block head %}
<!-- head access for extended templates -->
{% endblock %}
</head>
<body>
{% block navbar %}

{% include "infoscreen/components/navbar.html" %}
{% endblock %}

<div class="body-outer container-fluid m-0 p-0">
{% block body %}
<!-- Body access for extended templates -->

{% endblock %}
</div>

{% block footer %}

{% include "infoscreen/components/footer.html" %}
{% endblock %}



<!-- Begin: scripts -->
<!-- NOTE: Scripts and plugins are imported last because of better user experience -->

<!-- flatpickr (requires: .css file) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.3/flatpickr.js" integrity="sha256-3soYYYidbbsrmHXTGgxeCdgMfgt6IqWjWPKfuDWduqM=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.3/l10n/no.js" integrity="sha256-q8KkXT0pTTRz4uxuUW+rWQbWyg1VTAygONGTJS/QUjE=" crossorigin="anonymous"></script>

<!-- select2 (requires: .css file) -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>

{% block scripts %}
<!-- Note: scripts access for extended templates -->
{% endblock scripts %}

<!-- Begin: base script -->
<script type="text/javascript">
/*
Expand All @@ -85,12 +83,12 @@
enhances user experience because visual confirmation is prioritized over functionality.
*/
$(document).ready(function() {

// Enable Bootstrap tooltips
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})

emilte marked this conversation as resolved.
Show resolved Hide resolved
let flatpickrConfig = {
default: {
locale: 'no',
Expand All @@ -110,7 +108,7 @@
noCalendar: true,
}
}

$(".flatpickr-init").each(function(i, element) {
$(element).flatpickr(flatpickrConfig.default);
});
Expand All @@ -120,7 +118,7 @@
$(".flatpickr-init--time").each(function(i, element) {
$(element).flatpickr(flatpickrConfig.time);
});

// e.g. button to clear an input-field
$('.clear-target').click(function() {
let inputId = $(this).attr('data-target');
Expand Down
5 changes: 5 additions & 0 deletions infoscreen/templates/infoscreen/components/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="container">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<p class="col-md-4 mb-0 text-muted">© Studentersamfundet i Trondhjem 2022</p>
</footer>
</div>
36 changes: 36 additions & 0 deletions infoscreen/templates/infoscreen/components/navbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link disabled">Disabled</a>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
13 changes: 11 additions & 2 deletions infoscreen/templates/infoscreen/components/screen.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{% load static %}

<div class="">
emilte marked this conversation as resolved.
Show resolved Hide resolved
<a href="{% url 'infoscreen:view_screen' screen.slug %}" class="{{ classes }}">
{{ screen.name }}
<h3>{{ screen.name }}</h3>
{% if screen.images.first %}
<img src= "{{ screen.images.first.url }}" class="img-fluid mb-2" width="90%"/>
{% elif screen.videos.first.youtube_code %}
<iframe src="//www.youtube.com/embed/{{ screen.videos.first.youtube_code }}" width="90%"></iframe>
{% else %}
<img class="img-fluid mb-2" src='{% static "infoscreen/img/default.jpg" %}' width="90%"/>
{% endif %}
</a>
</div>
</div>
9 changes: 6 additions & 3 deletions infoscreen/templates/infoscreen/screen_list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends "infoscreen/base.html" %}
{% load infoscreen_tags %}
{% load static %}


{% block title %}Screens{% endblock %}

Expand All @@ -10,13 +12,14 @@

{% block body %}
<div class="body-inner">

<div class="">
<div class="container">
<div class="row">
{% for screen in screens %}
<div class="col-6 col-md-4">
{% screen_component screen=screen %}
</div>
{% endfor %}
</div>

</div>
{% endblock %}

4 changes: 3 additions & 1 deletion infoscreen/templatetags/infoscreen_tags.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# imports
from django import template
from django.conf import settings

# End: imports -----------------------------------------------------------------

emilte marked this conversation as resolved.
Show resolved Hide resolved
sindrelothe marked this conversation as resolved.
Show resolved Hide resolved
register = template.Library()

# https://docs.djangoproject.com/en/3.0/howto/custom-template-tags/


@register.inclusion_tag('infoscreen/components/screen.html')
def screen_component(screen, *args, **kwargs):
default_classes = ''
return {
'screen': screen,
'classes': kwargs.get('classes', default_classes),
}
}
36 changes: 36 additions & 0 deletions root/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

from pathlib import Path
import logging.config

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
Expand Down Expand Up @@ -137,3 +138,38 @@
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

################## LOGGING ##################

LOGFILENAME = f"{BASE_DIR}/info_screens.log"

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'file': {
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
},
'handlers': {
'file': {
'level': 'INFO',
'class': 'logging.FileHandler',
'formatter': 'file',
'filename': LOGFILENAME,
},
},
'loggers': {
'root': {
'level': 'INFO',
'handlers': ['file'],
},
'django': {
'level': 'INFO',
'handlers': ['file'],
'propagate': True,
},
},
}

logging.config.dictConfig(LOGGING)