Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACIDES
Hiboo
Commits
304af3ea
Verified
Commit
304af3ea
authored
1 year ago
by
ornanovitch
Browse files
Options
Downloads
Patches
Plain Diff
enh: PoC
parent
fd3b7048
No related branches found
Branches containing commit
No related tags found
1 merge request
!72
Draft: Resolve "Améliorer le dialogue de confirmation"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hiboo/profile/forms.py
+4
-0
4 additions, 0 deletions
hiboo/profile/forms.py
hiboo/profile/views.py
+28
-19
28 additions, 19 deletions
hiboo/profile/views.py
hiboo/templates/confirm.html
+7
-1
7 additions, 1 deletion
hiboo/templates/confirm.html
with
39 additions
and
20 deletions
hiboo/profile/forms.py
+
4
−
0
View file @
304af3ea
...
...
@@ -28,3 +28,7 @@ class ClaimForm(flask_wtf.FlaskForm):
username
=
fields
.
StringField
(
_
(
'
Username
'
),
[
validators
.
DataRequired
()])
password
=
fields
.
PasswordField
(
_
(
'
Password
'
),
[
validators
.
DataRequired
()])
submit
=
fields
.
SubmitField
(
_
(
'
Claim profile
'
))
class
ConfirmationForm
(
flask_wtf
.
FlaskForm
):
submit
=
fields
.
SubmitField
(
_
(
'
Confirm
'
))
This diff is collapsed.
Click to expand it.
hiboo/profile/views.py
+
28
−
19
View file @
304af3ea
...
...
@@ -179,29 +179,38 @@ def action(profile_uuid, action):
@blueprint.route
(
"
/transition/<profile_uuid>/<transition_id>
"
,
methods
=
[
"
GET
"
,
"
POST
"
])
@security.confirmation_required
(
"
change the profile status
"
)
#
@security.confirmation_required("change the profile status")
def
start_transition
(
profile_uuid
,
transition_id
):
profile
=
models
.
Profile
.
query
.
get
(
profile_uuid
)
or
flask
.
abort
(
404
)
transition
=
profile
.
TRANSITIONS
.
get
(
transition_id
)
or
flask
.
abort
(
404
)
transition
.
authorized
(
profile
)
profile
.
transition
=
transition_id
profile
.
transition_step
=
models
.
Profile
.
INIT
profile
.
transition_time
=
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
seconds
=
transition
.
delay
)
models
.
log
(
category
=
models
.
History
.
TRANSITION
,
value
=
transition_id
,
user
=
profile
.
user
,
service
=
profile
.
service
,
profile
=
profile
,
actor
=
flask_login
.
current_user
,
public
=
True
action
=
"
change the profile status
"
context
=
transition_id
target
=
profile
.
username
form
=
forms
.
ConfirmationForm
()
if
form
.
validate_on_submit
():
transition
.
authorized
(
profile
)
profile
.
transition
=
transition_id
profile
.
transition_step
=
models
.
Profile
.
INIT
profile
.
transition_time
=
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
seconds
=
transition
.
delay
)
models
.
log
(
category
=
models
.
History
.
TRANSITION
,
value
=
transition_id
,
user
=
profile
.
user
,
service
=
profile
.
service
,
profile
=
profile
,
actor
=
flask_login
.
current_user
,
public
=
True
)
models
.
db
.
session
.
commit
()
flask
.
flash
(
_
(
"
Profile status change was requested
"
),
"
success
"
)
if
transition_id
==
"
delete
"
and
flask_login
.
current_user
.
is_admin
==
False
or
transition_id
==
"
purge
"
and
not
flask_login
.
current_user
.
is_admin
:
return
flask
.
redirect
(
flask
.
url_for
(
"
account.home
"
))
else
:
return
flask
.
redirect
(
flask
.
url_for
(
"
.details
"
,
profile_uuid
=
profile_uuid
))
return
flask
.
render_template
(
"
confirm.html
"
,
action
=
action
,
context
=
context
,
target
=
target
,
form
=
form
)
models
.
db
.
session
.
commit
()
flask
.
flash
(
_
(
"
Profile status change was requested
"
),
"
success
"
)
if
transition_id
==
"
delete
"
and
flask_login
.
current_user
.
is_admin
==
False
or
transition_id
==
"
purge
"
and
not
flask_login
.
current_user
.
is_admin
:
return
flask
.
redirect
(
flask
.
url_for
(
"
account.home
"
))
else
:
return
flask
.
redirect
(
flask
.
url_for
(
"
.details
"
,
profile_uuid
=
profile_uuid
))
@blueprint.route
(
"
/transition/<profile_uuid>/cancel
"
,
methods
=
[
"
GET
"
,
"
POST
"
])
...
...
This diff is collapsed.
Click to expand it.
hiboo/templates/confirm.html
+
7
−
1
View file @
304af3ea
...
...
@@ -5,7 +5,13 @@
{% block content %}
<p>
{% trans action %}Your are about to {{ action }}. Do you wish to confirm that action?{% endtrans %}
{% trans action %}Your are about to {{ action }}:{% endtrans %}
</p>
<pre>
{{ context }}: {{ target }}
</pre>
<p>
{% trans action %}Do you wish to confirm that action?{% endtrans %}
</p>
{{ macros.form(form) }}
{% endblock %}
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