Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Projects
Groups
Snippets
Sign up now
Login
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
80b4f2f2
Commit
80b4f2f2
authored
Apr 18, 2017
by
Robin Sonnabend
Browse files
Enable renaming files
/close
#104
parent
7cd11f6e
Changes
4
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
80b4f2f2
...
...
@@ -24,7 +24,7 @@ from shared import db, date_filter, datetime_filter, date_filter_long, date_filt
from
utils
import
is_past
,
mail_manager
,
url_manager
,
get_first_unused_int
,
set_etherpad_text
,
get_etherpad_text
,
split_terms
,
optional_int_arg
,
fancy_join
from
decorators
import
db_lookup
,
require_public_view_right
,
require_private_view_right
,
require_modify_right
,
require_admin_right
from
models.database
import
ProtocolType
,
Protocol
,
DefaultTOP
,
TOP
,
LocalTOP
,
Document
,
Todo
,
Decision
,
MeetingReminder
,
Error
,
TodoMail
,
DecisionDocument
,
TodoState
,
Meta
,
DefaultMeta
,
DecisionCategory
,
Like
from
views.forms
import
LoginForm
,
ProtocolTypeForm
,
DefaultTopForm
,
MeetingReminderForm
,
NewProtocolForm
,
DocumentUploadForm
,
KnownProtocolSourceUploadForm
,
NewProtocolSourceUploadForm
,
generate_protocol_form
,
TopForm
,
LocalTopForm
,
SearchForm
,
DecisionSearchForm
,
ProtocolSearchForm
,
TodoSearchForm
,
NewProtocolFileUploadForm
,
NewTodoForm
,
TodoForm
,
TodoMailForm
,
DefaultMetaForm
,
MetaForm
,
MergeTodosForm
,
DecisionCategoryForm
from
views.forms
import
LoginForm
,
ProtocolTypeForm
,
DefaultTopForm
,
MeetingReminderForm
,
NewProtocolForm
,
DocumentUploadForm
,
KnownProtocolSourceUploadForm
,
NewProtocolSourceUploadForm
,
generate_protocol_form
,
TopForm
,
LocalTopForm
,
SearchForm
,
DecisionSearchForm
,
ProtocolSearchForm
,
TodoSearchForm
,
NewProtocolFileUploadForm
,
NewTodoForm
,
TodoForm
,
TodoMailForm
,
DefaultMetaForm
,
MetaForm
,
MergeTodosForm
,
DecisionCategoryForm
,
DocumentEditForm
from
views.tables
import
ProtocolsTable
,
ProtocolTypesTable
,
ProtocolTypeTable
,
DefaultTOPsTable
,
MeetingRemindersTable
,
ErrorsTable
,
TodosTable
,
DocumentsTable
,
DecisionsTable
,
TodoTable
,
ErrorTable
,
TodoMailsTable
,
DefaultMetasTable
,
DecisionCategoriesTable
from
legacy
import
import_old_todos
,
import_old_protocols
,
import_old_todomails
...
...
@@ -1092,6 +1092,18 @@ def upload_document(protocol):
db
.
session
.
commit
()
return
redirect
(
request
.
args
.
get
(
"next"
)
or
url_for
(
"show_protocol"
,
protocol_id
=
protocol
.
id
))
@
app
.
route
(
"/document/edit/<int:document_id>"
,
methods
=
[
"GET"
,
"POST"
])
@
login_required
@
db_lookup
(
Document
)
@
require_modify_right
()
def
edit_document
(
document
):
form
=
DocumentEditForm
(
obj
=
document
)
if
form
.
validate_on_submit
():
form
.
populate_obj
(
document
)
db
.
session
.
commit
()
return
redirect
(
request
.
args
.
get
(
"next"
)
or
url_for
(
"show_protocol"
,
protocol_id
=
document
.
protocol
.
id
))
return
render_template
(
"document-edit.html"
,
document
=
document
,
form
=
form
)
@
app
.
route
(
"/document/delete/<int:document_id>"
)
@
login_required
@
group_required
(
config
.
ADMIN_GROUP
)
...
...
templates/document-edit.html
0 → 100644
View file @
80b4f2f2
{% extends "layout.html" %}
{% from "macros.html" import render_form %}
{% block title %}Dokument bearbeiten{% endblock %}
{% block content %}
<div
class=
"container"
>
{{render_form(form, action_url=url_for("edit_document", document_id=document.id, next=request.args.get("next") or url_for("show_protocol", protocol_id=document.protocol.id)), action_text="Ändern")}}
</div>
{% endblock %}
views/forms.py
View file @
80b4f2f2
...
...
@@ -153,6 +153,10 @@ class NewProtocolForm(FlaskForm):
super
().
__init__
(
**
kwargs
)
self
.
protocoltype_id
.
choices
=
get_protocoltype_choices
(
protocoltypes
,
add_all
=
False
)
class
DocumentEditForm
(
FlaskForm
):
name
=
StringField
(
"Dateiname"
)
is_private
=
BooleanField
(
"Intern"
)
class
DocumentUploadForm
(
FlaskForm
):
document
=
FileField
(
"Datei"
)
is_private
=
BooleanField
(
"Intern"
)
...
...
views/tables.py
View file @
80b4f2f2
...
...
@@ -439,6 +439,8 @@ class DocumentsTable(Table):
def
row
(
self
,
document
):
user
=
current_user
()
links
=
[]
if
document
.
protocol
.
has_modify_right
(
user
):
links
.
append
(
Table
.
link
(
url_for
(
"edit_document"
,
document_id
=
document
.
id
),
"Bearbeiten"
))
if
config
.
PRINTING_ACTIVE
and
document
.
protocol
.
has_modify_right
(
user
):
links
.
append
(
Table
.
link
(
url_for
(
"print_document"
,
document_id
=
document
.
id
),
"Drucken"
))
if
document
.
protocol
.
protocoltype
.
has_admin_right
(
user
):
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment