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
Jannik Hellenkamp
website
Commits
8cbe0793
Commit
8cbe0793
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Added new panel button
parent
4370c3dc
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
db_schema.sql
+1
-1
1 addition, 1 deletion
db_schema.sql
server.py
+8
-4
8 additions, 4 deletions
server.py
templates/index.html
+9
-0
9 additions, 0 deletions
templates/index.html
with
18 additions
and
5 deletions
db_schema.sql
+
1
−
1
View file @
8cbe0793
...
...
@@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `featured` (
`internal`
text
NOT
NULL
DEFAULT
''
,
`type`
varchar
(
32
)
NOT
NULL
DEFAULT
''
,
`param`
text
NOT
NULL
DEFAULT
''
,
`order`
INTEGER
NOT
NULL
DEFAULT
0
,
`order`
INTEGER
UNIQUE
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`time_created`
datetime
NOT
NULL
,
...
...
This diff is collapsed.
Click to expand it.
server.py
+
8
−
4
View file @
8cbe0793
...
...
@@ -326,8 +326,12 @@ def index():
JOIN courses ON courses.id = lectures.course_id
WHERE streams.active AND (? OR (streams.visible AND courses.visible AND courses.listed AND lectures.visible))
'''
,
ismod
())
featured
=
query
(
'
SELECT * FROM featured WHERE NOT deleted AND (? OR visible) ORDER BY `order`
'
,
ismod
())
return
render_template
(
'
index.html
'
,
latestvideos
=
livestreams
+
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
)
featured
=
query
(
'
SELECT * FROM featured WHERE (? OR visible) ORDER BY `order`
'
,
ismod
())
newfeatured
=
0
if
featured
:
newfeatured
=
featured
[
-
1
][
'
order
'
]
+
1
featured
=
filter
(
lambda
x
:
not
x
[
'
deleted
'
],
featured
)
return
render_template
(
'
index.html
'
,
latestvideos
=
livestreams
+
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
,
newfeatured
=
newfeatured
)
@app.route
(
'
/course
'
)
@register_navbar
(
'
Videos
'
,
icon
=
'
film
'
)
...
...
@@ -523,7 +527,7 @@ def edit(prefix='', ignore=[]):
assert
column
in
tabs
[
table
][
2
]
modify
(
'
INSERT INTO changelog (`table`,id_value, id_key, field, value_new, value_old, `when`, who, executed) VALUES (?,?,?,?,?,(SELECT %s FROM %s WHERE %s = ?),?,?,1)
'
%
(
column
,
tabs
[
table
][
0
],
tabs
[
table
][
1
]),
table
,
id
,
tabs
[
table
][
1
],
column
,
val
,
id
,
datetime
.
now
(),
session
[
'
user
'
][
'
dbid
'
])
modify
(
'
UPDATE %s SET %s = ?, time_updated = ? WHERE %s = ?
'
%
(
tabs
[
table
][
0
],
column
,
tabs
[
table
][
1
]),
val
,
datetime
.
now
(),
id
)
modify
(
'
UPDATE %s SET %s = ?, time_updated = ? WHERE
`
%s
`
= ?
'
%
(
tabs
[
table
][
0
],
column
,
tabs
[
table
][
1
]),
val
,
datetime
.
now
(),
id
)
modify
(
'
COMMIT
'
)
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
...
...
@@ -549,7 +553,7 @@ def create(table):
continue
assert
column
in
tabs
[
table
][
2
]
+
tabs
[
table
][
3
]
assert
column
not
in
defaults
columns
.
append
(
column
)
columns
.
append
(
'
`
'
+
column
+
'
`
'
)
values
.
append
(
val
)
id
=
modify
(
'
INSERT INTO %s (%s) VALUES (%s)
'
%
(
tabs
[
table
][
0
],
'
,
'
.
join
(
columns
),
'
,
'
.
join
([
'
?
'
]
*
len
(
values
))),
*
values
)
...
...
This diff is collapsed.
Click to expand it.
templates/index.html
+
9
−
0
View file @
8cbe0793
...
...
@@ -53,6 +53,15 @@
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<ul
class=
"list-inline pull-right"
>
<li
style=
"padding-right: 0px;"
>
<div
class=
"btn-group"
>
<button
type=
"button"
class=
"btn btn-default dropdown-toggle"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
Neues Panel
<span
class=
"caret"
></span></button>
<ul
class=
"dropdown-menu"
>
<li><a
href=
"{{ url_for('create', table='featured', title='Neues Panel', type='plain', ref=request.url, order=newfeatured) }}"
>
Nur Text
</a></li>
<li><a
href=
"{{ url_for('create', table='featured', title='Neues Panel', type='image', ref=request.url, order=newfeatured) }}"
>
Text mit Bild
</a></li>
</ul>
</div>
</li>
<li
style=
"padding-right: 0px;"
>
<a
class=
"btn btn-default"
href=
"{{ url_for('create', table='announcements', text='Neue Ankündigung', time_publish=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), time_expire=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)+timedelta(days=7), ref=request.url) }}"
>
Neue Ankündigung
</a>
</li>
...
...
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