Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csentry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
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
Anders Harrisson
csentry
Commits
e6635c63
Commit
e6635c63
authored
6 years ago
by
Benjamin Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Add checkbox to display all tasks (admin only)
parent
1332808d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/static/js/tasks.js
+7
-1
7 additions, 1 deletion
app/static/js/tasks.js
app/task/views.py
+4
-2
4 additions, 2 deletions
app/task/views.py
app/templates/task/tasks.html
+11
-0
11 additions, 0 deletions
app/templates/task/tasks.html
with
22 additions
and
3 deletions
app/static/js/tasks.js
+
7
−
1
View file @
e6635c63
$
(
document
).
ready
(
function
()
{
$
(
"
#allTasks
"
).
on
(
'
change
'
,
function
()
{
// reload the data from the Ajax source
tasks_table
.
ajax
.
reload
();
});
var
tasks_table
=
$
(
"
#tasks_table
"
).
DataTable
({
"
ajax
"
:
function
(
data
,
callback
,
settings
)
{
var
allTasks
=
$
(
'
#allTasks
'
).
prop
(
"
checked
"
);
$
.
getJSON
(
$SCRIPT_ROOT
+
"
/task/_retrieve_tasks
"
,
$SCRIPT_ROOT
+
"
/task/_retrieve_tasks
?all=
"
+
allTasks
,
function
(
json
)
{
callback
(
json
);
});
...
...
This diff is collapsed.
Click to expand it.
app/task/views.py
+
4
−
2
View file @
e6635c63
...
...
@@ -9,7 +9,8 @@ This module implements the task blueprint.
:license: BSD 2-Clause, see LICENSE for more details.
"""
from
flask
import
Blueprint
,
render_template
,
jsonify
from
flask
import
(
Blueprint
,
render_template
,
jsonify
,
request
)
from
flask_login
import
login_required
,
current_user
from
..
import
models
...
...
@@ -32,5 +33,6 @@ def view_task(id_):
@bp.route
(
'
/_retrieve_tasks
'
)
@login_required
def
retrieve_tasks
():
data
=
[
task
.
to_dict
()
for
task
in
current_user
.
get_tasks
()]
all
=
request
.
args
.
get
(
'
all
'
,
'
false
'
)
==
'
true
'
data
=
[
task
.
to_dict
()
for
task
in
current_user
.
get_tasks
(
all
=
all
)]
return
jsonify
(
data
=
data
)
This diff is collapsed.
Click to expand it.
app/templates/task/tasks.html
+
11
−
0
View file @
e6635c63
...
...
@@ -15,6 +15,17 @@
<br>
{% block tasks_main %}
{% if current_user.is_authenticated and current_user.is_admin %}
<div
class=
"form-check"
>
<input
class=
"form-check-input"
type=
"checkbox"
value=
""
id=
"allTasks"
>
<label
class=
"form-check-label"
for=
"allTasks"
>
Show all tasks (all users)
</label>
</div>
<hr
class=
"separator"
>
{%- endif %}
<table
id=
"tasks_table"
class=
"table table-bordered table-hover table-sm"
cellspacing=
"0"
width=
"100%"
>
<thead>
<tr>
...
...
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