Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
redl
redeleitsystem
Commits
88eae95f
Commit
88eae95f
authored
Nov 07, 2015
by
Robin Sonnabend
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mostly changes to admin_topic_show
parent
ff9627d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
models/database.py
models/database.py
+5
-0
modules/admin.py
modules/admin.py
+9
-1
templates/admin_topic_show.html
templates/admin_topic_show.html
+8
-1
No files found.
models/database.py
View file @
88eae95f
...
...
@@ -148,3 +148,8 @@ class Statement(db.Model):
self
.
execution_time
=
datetime
.
now
()
return
True
def
undo
(
self
):
if
not
self
.
executed
:
return
False
self
.
executed
=
False
self
.
execution_time
=
datetime
(
1970
,
1
,
1
)
modules/admin.py
View file @
88eae95f
...
...
@@ -189,7 +189,7 @@ def topic_edit():
if
form
.
validate_on_submit
():
form
.
populate_obj
(
topic
)
db
.
session
.
commit
()
return
redirect
(
url_for
(
".
index"
))
return
redirect
(
url_for
(
".
topic_show"
,
id
=
topic
.
id
))
else
:
return
render_layout
(
"admin_topic_edit.html"
,
form
=
form
,
id
=
topic_id
)
else
:
...
...
@@ -256,3 +256,11 @@ def statement_delete():
return
redirect
(
url_for
(
".topic_show"
,
id
=
topic_id
))
return
redirect
(
url_for
(
".index"
))
@
admin
.
route
(
"/statement/undo"
)
@
login_required
@
admin_permission
.
require
()
def
statement_undo
():
statement
=
Statement
.
query
.
filter_by
(
executed
=
True
).
order_by
(
db
.
desc
(
Statement
.
execution_time
)).
first
()
statement
.
undo
()
db
.
session
.
commit
()
return
redirect
(
url_for
(
".topic_show"
,
id
=
statement
.
topic
.
id
))
templates/admin_topic_show.html
View file @
88eae95f
...
...
@@ -35,5 +35,12 @@
</tbody>
</table>
</div>
{{ render_form(form, action_url=url_for(".statement_new"), action_text="Add", title="Add Statement", class_="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--3-col mdl-cell-3-col-tablet mdl-cell--4-col-phone") }}
<div
class=
"mdl-cell mdl-cell--3-col mdl-cell--3-col-tablet mdl-cell--4-col-phone mdl-grid mdl-grid--no-spacing"
>
{{ render_form(form, action_url=url_for(".statement_new"), action_text="Add", title="Add Statement", class_="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone") }}
<div
class=
"mdl-cell mdl-card mdl-shadow--2dp mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone"
>
<ul
class=
"mdl-menu"
>
<li
class=
"mdl-menu__item"
><a
class=
"mdl-navigation__link"
href=
"{{ url_for("
.
statement_undo
")
}}"
><i
class=
"material-icons"
role=
"presentation"
>
undo
</i>
Undo
</a></li>
</ul>
</div>
</div>
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment