Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
547ab2c5
Commit
547ab2c5
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Implemented public service announcements
parent
d8ec3c15
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
db_schema.sql
+12
-0
12 additions, 0 deletions
db_schema.sql
server.py
+4
-0
4 additions, 0 deletions
server.py
templates/base.html
+6
-1
6 additions, 1 deletion
templates/base.html
templates/index.html
+1
-0
1 addition, 0 deletions
templates/index.html
with
23 additions
and
1 deletion
db_schema.sql
+
12
−
0
View file @
547ab2c5
...
...
@@ -183,6 +183,18 @@ CREATE TABLE IF NOT EXISTS `videos_data` (
`video_format`
INTEGER
NOT
NULL
,
`hash`
varchar
(
32
)
NOT
NULL
);
CREATE
TABLE
IF
NOT
EXISTS
`announcements`
(
`id`
INTEGER
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
`text`
text
NOT
NULL
,
`internal`
text
NOT
NULL
,
`level`
INTEGER
NOT
NULL
DEFAULT
0
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`time_created`
datetime
NOT
NULL
,
`time_updated`
datetime
NOT
NULL
,
`created_by`
INTEGER
NOT
NULL
);
CREATE
VIEW
IF
NOT
EXISTS
`courses`
AS
select
*
from
`courses_data`
where
(
not
(
`courses_data`
.
`deleted`
));
CREATE
VIEW
IF
NOT
EXISTS
`lectures`
AS
select
*
from
`lectures_data`
where
(
not
(
`lectures_data`
.
`deleted`
));
CREATE
VIEW
IF
NOT
EXISTS
`videos`
AS
select
*
from
`videos_data`
where
(
not
(
`videos_data`
.
`deleted`
));
...
...
This diff is collapsed.
Click to expand it.
server.py
+
4
−
0
View file @
547ab2c5
...
...
@@ -115,6 +115,10 @@ def human_date(d):
def
rfc3339
(
d
):
return
d
.
strftime
(
'
%Y-%m-%dT%H:%M:%S+02:00
'
)
@app.template_global
()
def
get_announcements
(
minlevel
=
0
):
return
query
(
'
SELECT * FROM announcements WHERE NOT deleted AND (? OR visible) AND level >= ? ORDER BY level DESC
'
,
ismod
(),
minlevel
)
@app.route
(
'
/
'
)
@register_navbar
(
'
Home
'
,
icon
=
'
home
'
)
def
index
():
...
...
This diff is collapsed.
Click to expand it.
templates/base.html
+
6
−
1
View file @
547ab2c5
{% set page_border = page_border|default(1) -%}
{% set page_border = page_border|default(1) %}
{% set min_announcement_level = min_announcement_level|default(1) %}
{% set announcement_levels = {0: 'info', 1: 'info', 2: 'warning', 3: 'danger'} %}
<!DOCTYPE html>
<html>
...
...
@@ -102,6 +104,9 @@
{% for msg in get_flashed_messages() %}
<div
class=
"alert alert-danger"
role=
"alert"
>
{{ msg }}
</div>
{% endfor %}
{% for msg in get_announcements(min_announcement_level) %}
<div
class=
"alert alert-{{announcement_levels.get(msg.level, 'info')}}"
role=
"alert"
>
{{ msg.text|safe }}
</div>
{% endfor %}
{% block content %}
<h1>
This is a Heading
</h1>
<p>
This is a paragraph.
</p>
...
...
This diff is collapsed.
Click to expand it.
templates/index.html
+
1
−
0
View file @
547ab2c5
{% from 'macros.html' import preview %}
{% extends "base.html" %}
{% set page_border = 0 %}
{% set min_announcement_level = 0 %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-md-6 panel-group"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment