Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
protokollsystem
proto3
Commits
80b4f2f2
Commit
80b4f2f2
authored
8 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Enable renaming files
/close
#104
parent
7cd11f6e
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
server.py
+13
-1
13 additions, 1 deletion
server.py
templates/document-edit.html
+9
-0
9 additions, 0 deletions
templates/document-edit.html
views/forms.py
+4
-0
4 additions, 0 deletions
views/forms.py
views/tables.py
+2
-0
2 additions, 0 deletions
views/tables.py
with
28 additions
and
1 deletion
server.py
+
13
−
1
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
)
...
...
This diff is collapsed.
Click to expand it.
templates/document-edit.html
0 → 100644
+
9
−
0
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 %}
This diff is collapsed.
Click to expand it.
views/forms.py
+
4
−
0
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
"
)
...
...
This diff is collapsed.
Click to expand it.
views/tables.py
+
2
−
0
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
):
...
...
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