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
b5ebed8a
Commit
b5ebed8a
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Added ordering buttons for featured panels
parent
8cbe0793
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
+3
-5
3 additions, 5 deletions
server.py
templates/index.html
+8
-0
8 additions, 0 deletions
templates/index.html
with
12 additions
and
6 deletions
db_schema.sql
+
1
−
1
View file @
b5ebed8a
...
@@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `featured` (
...
@@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `featured` (
`internal`
text
NOT
NULL
DEFAULT
''
,
`internal`
text
NOT
NULL
DEFAULT
''
,
`type`
varchar
(
32
)
NOT
NULL
DEFAULT
''
,
`type`
varchar
(
32
)
NOT
NULL
DEFAULT
''
,
`param`
text
NOT
NULL
DEFAULT
''
,
`param`
text
NOT
NULL
DEFAULT
''
,
`order`
INTEGER
UNIQUE
,
`order`
INTEGER
NOT
NULL
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`visible`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`deleted`
INTEGER
NOT
NULL
DEFAULT
0
,
`time_created`
datetime
NOT
NULL
,
`time_created`
datetime
NOT
NULL
,
...
...
This diff is collapsed.
Click to expand it.
server.py
+
3
−
5
View file @
b5ebed8a
...
@@ -330,7 +330,7 @@ def index():
...
@@ -330,7 +330,7 @@ def index():
newfeatured
=
0
newfeatured
=
0
if
featured
:
if
featured
:
newfeatured
=
featured
[
-
1
][
'
order
'
]
+
1
newfeatured
=
featured
[
-
1
][
'
order
'
]
+
1
featured
=
filter
(
lambda
x
:
not
x
[
'
deleted
'
],
featured
)
featured
=
list
(
filter
(
lambda
x
:
not
x
[
'
deleted
'
],
featured
)
)
return
render_template
(
'
index.html
'
,
latestvideos
=
livestreams
+
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
,
newfeatured
=
newfeatured
)
return
render_template
(
'
index.html
'
,
latestvideos
=
livestreams
+
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
,
newfeatured
=
newfeatured
)
@app.route
(
'
/course
'
)
@app.route
(
'
/course
'
)
...
@@ -514,7 +514,6 @@ def edit(prefix='', ignore=[]):
...
@@ -514,7 +514,6 @@ def edit(prefix='', ignore=[]):
ignore
.
append
(
'
_csrf_token
'
)
ignore
.
append
(
'
_csrf_token
'
)
if
not
prefix
and
'
prefix
'
in
request
.
args
:
if
not
prefix
and
'
prefix
'
in
request
.
args
:
prefix
=
request
.
args
[
'
prefix
'
]
prefix
=
request
.
args
[
'
prefix
'
]
modify
(
'
BEGIN
'
)
changes
=
request
.
values
.
items
()
changes
=
request
.
values
.
items
()
if
(
request
.
method
==
'
POST
'
)
and
(
request
.
get_json
()):
if
(
request
.
method
==
'
POST
'
)
and
(
request
.
get_json
()):
changes
=
request
.
get_json
().
items
()
changes
=
request
.
get_json
().
items
()
...
@@ -525,10 +524,9 @@ def edit(prefix='', ignore=[]):
...
@@ -525,10 +524,9 @@ def edit(prefix='', ignore=[]):
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
assert
table
in
tabs
assert
table
in
tabs
assert
column
in
tabs
[
table
][
2
]
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
]),
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
'
])
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
:
if
'
ref
'
in
request
.
values
:
return
redirect
(
request
.
values
[
'
ref
'
])
return
redirect
(
request
.
values
[
'
ref
'
])
return
"
OK
"
,
200
return
"
OK
"
,
200
...
...
This diff is collapsed.
Click to expand it.
templates/index.html
+
8
−
0
View file @
b5ebed8a
...
@@ -76,9 +76,17 @@
...
@@ -76,9 +76,17 @@
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<h1
class=
"panel-title"
>
<h1
class=
"panel-title"
>
{{ moderator_editor(('featured',item.id,'title'), item.title) }} {{ moderator_checkbox(('featured',item.id,'visible'), item.visible) }}
{{ moderator_editor(('featured',item.id,'title'), item.title) }} {{ moderator_checkbox(('featured',item.id,'visible'), item.visible) }}
{% if ismod() %}
<ul
class=
"pull-right list-inline"
>
<ul
class=
"pull-right list-inline"
>
{% if not loop.first %}
<li><a
class=
"btn btn-default"
href=
"{{ url_for('edit', **{'featured.'+item.id|string+'.order': featured[loop.index0-1].order, 'featured.'+featured[loop.index0-1].id|string+'.order': item.order, 'ref': request.url})}}"
><span
class=
"glyphicon glyphicon-arrow-up"
></span></a></li>
{% endif %}
{% if not loop.last %}
<li><a
class=
"btn btn-default"
href=
"{{ url_for('edit', **{'featured.'+item.id|string+'.order': featured[loop.index0+1].order, 'featured.'+featured[loop.index0+1].id|string+'.order': item.order, 'ref': request.url})}}"
><span
class=
"glyphicon glyphicon-arrow-down"
></span></a></li>
{% endif %}
<li>
{{ moderator_delete(['featured',item.id,'deleted']) }}
</li>
<li>
{{ moderator_delete(['featured',item.id,'deleted']) }}
</li>
</ul>
</ul>
{% endif %}
</h1>
</h1>
</div>
</div>
{% if item.type == 'image' %}
{% if item.type == 'image' %}
...
...
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