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
Wiki
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
Roman Karwacik
website
Commits
7567957d
Commit
7567957d
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Made announcements editable
parent
547ab2c5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server.py
+12
-1
12 additions, 1 deletion
server.py
templates/base.html
+15
-1
15 additions, 1 deletion
templates/base.html
with
27 additions
and
2 deletions
server.py
+
12
−
1
View file @
7567957d
...
@@ -238,7 +238,8 @@ def edit(prefix="", ignore=[]):
...
@@ -238,7 +238,8 @@ def edit(prefix="", ignore=[]):
'
lectures
'
:
(
'
lectures_data
'
,
'
id
'
,
[
'
visible
'
,
'
title
'
,
'
comment
'
,
'
lectures
'
:
(
'
lectures_data
'
,
'
id
'
,
[
'
visible
'
,
'
title
'
,
'
comment
'
,
'
internal
'
,
'
speaker
'
,
'
place
'
,
'
time
'
,
'
duration
'
,
'
jumplist
'
,
'
deleted
'
]),
'
internal
'
,
'
speaker
'
,
'
place
'
,
'
time
'
,
'
duration
'
,
'
jumplist
'
,
'
deleted
'
]),
'
videos
'
:
(
'
videos_data
'
,
'
id
'
,
[
'
visible
'
,
'
deleted
'
]),
'
videos
'
:
(
'
videos_data
'
,
'
id
'
,
[
'
visible
'
,
'
deleted
'
]),
'
chapters
'
:
(
'
chapters
'
,
'
id
'
,
[
'
time
'
,
'
text
'
,
'
visible
'
,
'
deleted
'
])
'
chapters
'
:
(
'
chapters
'
,
'
id
'
,
[
'
time
'
,
'
text
'
,
'
visible
'
,
'
deleted
'
]),
'
announcements
'
:
(
'
announcements
'
,
'
id
'
,
[
'
text
'
,
'
internal
'
,
'
level
'
,
'
visible
'
,
'
deleted
'
])
}
}
query
(
'
BEGIN
'
)
query
(
'
BEGIN
'
)
if
request
.
is_json
:
if
request
.
is_json
:
...
@@ -248,6 +249,7 @@ def edit(prefix="", ignore=[]):
...
@@ -248,6 +249,7 @@ def edit(prefix="", ignore=[]):
for
key
,
val
in
changes
:
for
key
,
val
in
changes
:
if
key
in
ignore
:
if
key
in
ignore
:
continue
continue
print
(
'
edit:
'
,
key
,
val
)
key
=
prefix
+
key
key
=
prefix
+
key
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
assert
table
in
tabs
assert
table
in
tabs
...
@@ -416,5 +418,14 @@ def suggest_chapter(lectureid):
...
@@ -416,5 +418,14 @@ def suggest_chapter(lectureid):
return
redirect
(
request
.
values
[
'
ref
'
])
return
redirect
(
request
.
values
[
'
ref
'
])
return
'
OK
'
,
200
return
'
OK
'
,
200
@app.route
(
'
/newpsa
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
@mod_required
def
new_announcement
():
id
=
query
(
'
INSERT INTO announcements (text, internal, time_created, time_updated, created_by) VALUES (
"
Neue Ankündigung
"
,
""
, ?, ?, ?)
'
,
datetime
.
now
(),
datetime
.
now
(),
session
.
get
(
'
user
'
,
{
'
dbid
'
:
None
})[
'
dbid
'
])
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
return
id
,
200
import
feeds
import
feeds
import
importer
import
importer
This diff is collapsed.
Click to expand it.
templates/base.html
+
15
−
1
View file @
7567957d
{% set page_border = page_border|default(1) %}
{% set page_border = page_border|default(1) %}
{% set min_announcement_level = min_announcement_level|default(1) %}
{% set min_announcement_level = min_announcement_level|default(1) %}
{% set announcement_levels = {0: 'info', 1: 'info', 2: 'warning', 3: 'danger'} %}
{% set announcement_levels = {0: 'info', 1: 'info', 2: 'warning', 3: 'danger'} %}
{% from 'macros.html' import valueeditor, valuecheckbox, valuedeletebtn %}
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
...
@@ -105,7 +106,20 @@
...
@@ -105,7 +106,20 @@
<div
class=
"alert alert-danger"
role=
"alert"
>
{{ msg }}
</div>
<div
class=
"alert alert-danger"
role=
"alert"
>
{{ msg }}
</div>
{% endfor %}
{% endfor %}
{% for msg in get_announcements(min_announcement_level) %}
{% for msg in get_announcements(min_announcement_level) %}
<div
class=
"alert alert-{{announcement_levels.get(msg.level, 'info')}}"
role=
"alert"
>
{{ msg.text|safe }}
</div>
<div
class=
"alert alert-{{announcement_levels.get(msg.level, 'info')}}"
role=
"alert"
>
{{ valueeditor(('announcements',msg.id,'text'), msg.text|safe) }}
{% if ismod() %}
<div
class=
"pull-right"
>
{{ valuecheckbox(('announcements',msg.id,'visible'),msg.visible) }}
{{ valuedeletebtn(('announcements',msg.id,'deleted')) }}
</div>
<br>
{{ valueeditor(('announcements',msg.id,'internal'), msg.internal) }}
<div
class=
"pull-right"
>
Level: {{ valueeditor(('announcements',msg.id,'level'), msg.level) }}
</div>
{% endif %}
</div>
{% endfor %}
{% endfor %}
{% block content %}
{% block content %}
<h1>
This is a Heading
</h1>
<h1>
This is a Heading
</h1>
...
...
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